{"_id":"@adamjen/pi-compact-fast","_rev":"4-f7f1c57dedb17c488faf1a185ef222cf","name":"@adamjen/pi-compact-fast","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"@adamjen/pi-compact-fast","version":"1.0.0","keywords":["pi-package"],"author":{"name":"adamjen"},"license":"MIT","_id":"@adamjen/pi-compact-fast@1.0.0","maintainers":[{"name":"adamjen","email":"adamjentv@gmail.com"}],"homepage":"https://github.com/adamjen/pi-compact-fast#readme","bugs":{"url":"https://github.com/adamjen/pi-compact-fast/issues"},"pi":{"extensions":["./extensions/index.ts"]},"dist":{"shasum":"721ef87ba6125939a27870a50650fb11017932ab","tarball":"https://registry.npmjs.org/@adamjen/pi-compact-fast/-/pi-compact-fast-1.0.0.tgz","fileCount":4,"integrity":"sha512-VSJohUH9qgieNc1I6OVItEBY2ULArc5CKFoFOw93NFvvI0oRIzRQ8PGcws/ktq+qpuPthxg2iI6QxXta3bexNg==","signatures":[{"sig":"MEUCIQCwhgocwUZnowbINog8m2eMLVQagsAytr6L6SsL1g8zywIgXmIPzDr83r0lq8WqAXtJRlCrWlnKg7xRzJxO9vZEJPc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9604},"gitHead":"a55e2c735c964dbf78ebc20ff825b9387688199b","_npmUser":{"name":"adamjen","email":"adamjentv@gmail.com"},"repository":{"url":"git+https://github.com/adamjen/pi-compact-fast.git","type":"git"},"_npmVersion":"10.9.7","description":"/compact-fast command for Pi — compacts sessions with a fast local model instead of your main conversation model.","directories":{},"_nodeVersion":"22.22.2","_hasShrinkwrap":false,"peerDependencies":{"@mariozechner/pi-ai":"","@mariozechner/pi-coding-agent":""},"_npmOperationalInternal":{"tmp":"tmp/pi-compact-fast_1.0.0_1778141649680_0.7262717275805357","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@adamjen/pi-compact-fast","version":"1.0.1","keywords":["pi-package"],"author":{"name":"adamjen"},"license":"MIT","_id":"@adamjen/pi-compact-fast@1.0.1","maintainers":[{"name":"adamjen","email":"adamjentv@gmail.com"}],"homepage":"https://github.com/adamjen/pi-compact-fast#readme","bugs":{"url":"https://github.com/adamjen/pi-compact-fast/issues"},"pi":{"extensions":["./extensions/index.ts"]},"dist":{"shasum":"463ba7c4f455eea48cdc4b4b4d21da27257c07cd","tarball":"https://registry.npmjs.org/@adamjen/pi-compact-fast/-/pi-compact-fast-1.0.1.tgz","fileCount":4,"integrity":"sha512-t5DlDI8r6VuFA0uTya9jJzQW0+u34JH31l711lBGRKM4LGmsYb90YLGSehzPfzMNkXlW6dKo7BWiD0Sth0R+Lg==","signatures":[{"sig":"MEQCIAucN+iYuCfDGtjaLQwBtaJebUZlov5HNkH44qp3CZEWAiBVROg58DVZ+stehX6m0vEh7QqWkzeKFQpqu7opiJjiGQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9602},"gitHead":"c944aedbab6437f4bbbbffb16c2961a249ebc8d6","_npmUser":{"name":"adamjen","email":"adamjentv@gmail.com"},"repository":{"url":"git+https://github.com/adamjen/pi-compact-fast.git","type":"git"},"_npmVersion":"10.9.7","description":"/compact-fast command for Pi — compacts sessions with a fast local model instead of your main conversation model.","directories":{},"_nodeVersion":"22.22.2","_hasShrinkwrap":false,"peerDependencies":{"@mariozechner/pi-ai":"","@mariozechner/pi-coding-agent":""},"_npmOperationalInternal":{"tmp":"tmp/pi-compact-fast_1.0.1_1778141755056_0.2774125098768956","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@adamjen/pi-compact-fast","version":"1.0.2","keywords":["pi-package"],"author":{"name":"adamjen"},"license":"MIT","_id":"@adamjen/pi-compact-fast@1.0.2","maintainers":[{"name":"adamjen","email":"adamjentv@gmail.com"}],"homepage":"https://github.com/adamjen/pi-compact-fast#readme","bugs":{"url":"https://github.com/adamjen/pi-compact-fast/issues"},"pi":{"extensions":["./extensions/index.ts"]},"dist":{"shasum":"a29aea089a1ea6c10bbcec951f1f246edf5cc226","tarball":"https://registry.npmjs.org/@adamjen/pi-compact-fast/-/pi-compact-fast-1.0.2.tgz","fileCount":4,"integrity":"sha512-WYXAM9hdQDgjxfPv6P+Oh8viCkzokwtN5CIkn/K2e39++a8q2SRAYA2Juk7Tljfh+iERF68zABVfvwLRCev6AA==","signatures":[{"sig":"MEUCIQDcY7eol2qK9ls+0JeOVSlFeiWggqjWd5BM0vwSiBx7LwIgCjA5/XE2VWy2Lwpa4U3G3PkvTfwTE66Gp0cD1KkWq38=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9601},"gitHead":"613416ccd4be23a958f68b09f82be3ef1a0a3e51","_npmUser":{"name":"adamjen","email":"adamjentv@gmail.com"},"repository":{"url":"git+https://github.com/adamjen/pi-compact-fast.git","type":"git"},"_npmVersion":"10.9.7","description":"/compact-fast command for Pi — compacts sessions with a fast local model instead of your main conversation model.","directories":{},"_nodeVersion":"22.22.2","_hasShrinkwrap":false,"peerDependencies":{"@mariozechner/pi-ai":"","@mariozechner/pi-coding-agent":""},"_npmOperationalInternal":{"tmp":"tmp/pi-compact-fast_1.0.2_1778141851118_0.2634499099474752","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@adamjen/pi-compact-fast","version":"2.0.0","description":"/compact-fast command for Pi — compacts sessions with a fast local model instead of your main conversation model.","license":"MIT","author":{"name":"adamjen"},"keywords":["pi-package"],"repository":{"type":"git","url":"git+https://github.com/adamjen/pi-compact-fast.git"},"homepage":"https://github.com/adamjen/pi-compact-fast#readme","peerDependencies":{"@mariozechner/pi-coding-agent":"","@mariozechner/pi-ai":""},"pi":{"extensions":["./extensions/index.ts"]},"_id":"@adamjen/pi-compact-fast@2.0.0","gitHead":"88ffc8bcd31e6bf85a0fb2604ab87d74861c0892","bugs":{"url":"https://github.com/adamjen/pi-compact-fast/issues"},"_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-mFR7R3KHHSmRmLwMu/sOjmGWkkkDTSB85Vsj2iicEDyu7hVJ9CuYoqgmu/5n4UnAyKWgLI7lFLE3ZGrvrieEjw==","shasum":"c4f4108ab19cb9ab18af6ee6fefb291a085e224c","tarball":"https://registry.npmjs.org/@adamjen/pi-compact-fast/-/pi-compact-fast-2.0.0.tgz","fileCount":4,"unpackedSize":17477,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICbW9lvTleNzT4uQ5Dwtx1b4RqgUl4GXPJPgu3hpUXyPAiEA4swmjhHVrrTAX7MKyLUmdf2r+4D7YJcBzbsC0dkJWd4="}]},"_npmUser":{"name":"adamjen","email":"adamjentv@gmail.com"},"directories":{},"maintainers":[{"name":"adamjen","email":"adamjentv@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-compact-fast_2.0.0_1778149928772_0.2480573303837763"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-07T08:14:09.621Z","modified":"2026-05-07T10:32:09.032Z","1.0.0":"2026-05-07T08:14:09.825Z","1.0.1":"2026-05-07T08:15:55.197Z","1.0.2":"2026-05-07T08:17:31.261Z","2.0.0":"2026-05-07T10:32:08.906Z"},"bugs":{"url":"https://github.com/adamjen/pi-compact-fast/issues"},"author":{"name":"adamjen"},"license":"MIT","homepage":"https://github.com/adamjen/pi-compact-fast#readme","keywords":["pi-package"],"repository":{"type":"git","url":"git+https://github.com/adamjen/pi-compact-fast.git"},"description":"/compact-fast command for Pi — compacts sessions with a fast local model instead of your main conversation model.","maintainers":[{"name":"adamjen","email":"adamjentv@gmail.com"}],"readme":"# @adamjen/pi-compact-fast\n\n**`/compact-fast` command for Pi** — compact your session using a fast local model instead of your main conversation model.\n\n## What it does\n\nPi normally uses your current conversation model for compaction (summarizing the session). This extension adds `/compact-fast` which:\n\n1. Looks up `qwen-35b-moe` from your configured models (`models.json`)\n2. Uses that model directly via a separate API call to generate the summary\n3. Returns the structured summary to Pi's built-in compaction system\n\nThis saves tokens on expensive models and speeds up compaction when using a smaller/faster local model.\n\n## Install\n\n```bash\npi install npm:@adamjen/pi-compact-fast@latest\n```\n\nOr try without installing:\n\n```bash\npi -e npm:@adamjen/pi-compact-fast\n```\n\n## Usage\n\n```\n/compact-fast\n```\n\nThat's it — Pi will compact the session using `qwen-35b-moe` instead of your current model.\n\n## Configure a different model\n\nEdit `extensions/index.ts` and change line 24:\n\n```ts\nconst COMPACT_MODEL_ID = \"your-model-id\";\n```\n\nThe model must be defined in your `~/.pi/agent/models.json` or provider config.\n\n## How it works\n\n1. Intercepts `session_before_compact` event\n2. Makes a direct API call to the target model via `completeSimple()` from `@mariozechner/pi-ai`\n3. Returns `{ compaction: { summary, firstKeptEntryId, tokensBefore, details } }` which Pi uses for compaction\n\n### Prompt structure (mirrors pi's native compaction)\n\n- **System prompt** tells model to ONLY summarize, not continue conversation\n- **Conversation comes BEFORE instructions** — the model follows the last pattern\n- **Previous summary** in `<previous-summary>` tags between conversation and instructions (for incremental updates)\n- **Split turns** generate two summaries merged with separator (mirrors pi's native behavior)\n- **File operations** tracked in both summary text AND `details` object\n\n## Changelog\n\n### 2.0.0 — Major rewrite\n\n- ✅ Guard against empty content — aborts cleanly instead of writing garbage \"empty conversation\" summary\n- ✅ File operations tracking — `<read-files>` and `<modified-files>` tags appended to summary, plus `details` object for pi's internal tracking\n- ✅ Split turn handling — parallel dual summaries with proper merge separator when a single turn exceeds `keepRecentTokens`\n- ✅ Correct token budgets — dynamic from `settings.reserveTokens * 0.8` / `* 0.5` instead of hardcoded 8192\n- ✅ Added `TURN_PREFIX_SUMMARIZATION_PROMPT` for split-turn prefix summaries (different format: \"Original Request\", \"Early Progress\")\n- ✅ Switched from `complete()` to `completeSimple()` — matches pi's internal API usage\n- ✅ Added `stopReason === \"error\"` check — handles API failures gracefully instead of producing empty strings\n- ✅ Removed debug logging (`console.error`)\n- ⚠️ Default model changed from `qwen3.6-35b` to `qwen-35b-moe` (configure your own in models.json)\n\n### 1.x — Initial release\n\n- Basic compaction using a fast local model via direct API call\n\n## License\n\nMIT\n","readmeFilename":"README.md"}