@adamjen/pi-compact-fast
Compress Pi sessions with a fast local model to save tokens.
Install & Use
Copy this prompt and send it to your AI assistant (Claude / Cursor / TRAE / Codex / WorkBuddy etc.) to auto-install:
Help me install this AI Skill: @adamjen/pi-compact-fast. It is used for: Compress Pi sessions with a fast local model to save tokens. Full Skill content: https://321skill.com/skills/adamjen-pi-compact-fast/raw/index.md Read that page and install it.
The prompt includes a link to the full Skill content. You can also view the full content.
This Skill addresses the issues of high token consumption and slow speed when Pi users rely on expensive primary models for session compression. In practical development, developers frequently need to compress long conversations to free up context windows, but the cost of using primary models (e.g., GPT-4) for compression is high, and the speed is limited by model inference efficiency.
Usage is simple: just enter the /compact-fast command in Pi. It will automatically locate the configured qwen-35b-moe model (or another custom model), generate a session summary via an independent API call, and return the structured summary to Pi's built-in compression system. You can also switch the model used by modifying the COMPACT_MODEL_ID in extensions/index.ts.
It is ideal for Pi users who frequently manage long conversations, especially developers using high-cost models (e.g., GPT-4, Claude 3 Opus). Agent developers and backend engineers who accumulate substantial context during coding and need regular compression to maintain session continuity will see significant token savings and efficiency gains.
It is recommended to use this tool consistently after configuring a fast model (like qwen-35b-moe) in models.json. Note that it depends on the Pi platform and the @mariozechner/pi-ai library, and the compression model must be available in the local or remote configuration. If the fast model fails to respond, the command will exit gracefully without affecting the current session.
Key Features
Unlike Pi's built-in `/compact` command, `/compact-fast` uses an independent API call to a fast local model (e.g., qwen-35b-moe) instead of the primary conversation model for compression, saving up to 80% in token consumption while increasing compression speed by several times.
Limitations
Requires the Pi platform and the `@mariozechner/pi-ai` library, and the compression model must be pre-configured in `~/.pi/agent/models.json`; it defaults to `qwen-35b-moe`, and manual code modification is needed if this model is not configured.
FAQ
How do I change the model used for compression?
Edit the `COMPACT_MODEL_ID` variable in `extensions/index.ts` and set it to your model ID (which must be defined in `models.json`).
Does compressing a session lose the conversation content?
No. Pi's compression system retains structured information such as the summary, the first retained message ID, and token count; the full conversation history remains accessible.
Installation guide for AI assistants
If your AI coding assistant (Claude Code, Cursor, TRAE etc.) can see this page, send it this message to auto-install:
Visit https://321skill.com/skills/adamjen-pi-compact-fast/raw/index.md to read the original Skill definition (Markdown format) for @adamjen/pi-compact-fast, and install it according to the instructions.
Raw Markdown URL for AI: /skills/adamjen-pi-compact-fast/raw/index.md