{"_id":"@8monkey/pi-context-history","_rev":"5-a38ec91edf92bb83f47d671997d9fa9a","name":"@8monkey/pi-context-history","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@8monkey/pi-context-history","version":"0.1.0","keywords":["pi","pi-extension","context","history","summary","tool-calls"],"license":"MIT","_id":"@8monkey/pi-context-history@0.1.0","maintainers":[{"name":"heiwen","email":"h@8monkey.ai"},{"name":"turisanapo","email":"selvaggiodavide@hotmail.it"}],"homepage":"https://github.com/8monkey-ai/pi-context-history#readme","bugs":{"url":"https://github.com/8monkey-ai/pi-context-history/issues"},"pi":{"extensions":["./src/index.ts"]},"dist":{"shasum":"fe9ec81813347ddf8fd42dc0e0f0ecb67491c6c6","tarball":"https://registry.npmjs.org/@8monkey/pi-context-history/-/pi-context-history-0.1.0.tgz","fileCount":11,"integrity":"sha512-27Lcs50rLVc45ZlsjduzmHbR9iGTHBkAT+n7Gyfs/JVC7d6e1jwS+nLo3WrKGANFWL8iXntTVVBBbPLu+qOWwQ==","signatures":[{"sig":"MEUCICddCHnIddW2urXuIt/GZsxy4VDu331XOQs2AXl6P9qyAiEA4wkv68kBn5symeG5rbQokPn+RHeH51TNr1vBRBSDW6o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15776},"type":"module","gitHead":"798ad26eae3274a63f1804d87c5172379b35c2b6","scripts":{"test":"node --test","typecheck":"tsc --noEmit"},"_npmUser":{"name":"turisanapo","email":"selvaggiodavide@hotmail.it"},"repository":{"url":"git+https://github.com/8monkey-ai/pi-context-history.git","type":"git"},"_npmVersion":"11.6.0","description":"Pi extension that manages conversation context: trims old history, strips stale tool calls, and keeps a rolling summary fed back into the system prompt. Each feature toggles independently.","directories":{},"_nodeVersion":"24.9.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^22","@earendil-works/pi-coding-agent":"*"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-context-history_0.1.0_1782830936030_0.4216837373684603","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@8monkey/pi-context-history","version":"0.2.0","keywords":["pi","pi-extension","context","history","summary","tool-calls"],"license":"MIT","_id":"@8monkey/pi-context-history@0.2.0","maintainers":[{"name":"heiwen","email":"h@8monkey.ai"},{"name":"turisanapo","email":"selvaggiodavide@hotmail.it"}],"homepage":"https://github.com/8monkey-ai/pi-context-history#readme","bugs":{"url":"https://github.com/8monkey-ai/pi-context-history/issues"},"pi":{"extensions":["./src/index.ts"]},"dist":{"shasum":"f10a79b7f9d7f374efa6414ff963660232c260e8","tarball":"https://registry.npmjs.org/@8monkey/pi-context-history/-/pi-context-history-0.2.0.tgz","fileCount":11,"integrity":"sha512-OCxtvH2GDHOZrFcqkF+DOxqiK+LVOYYxTVQ3jZAUXvt4uThr9LuEikJnqUOJnw+tp0xS0mu9opav7HSKu95VWQ==","signatures":[{"sig":"MEQCIEdZloHX8yiP+kkZw/qre1+OBV6Zt9tLTO7HmqwqO5SEAiBdWzkJ1pvyZmxgfjCvQ5MxxujgFCJ9qKfTEsj8nVxLeg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18588},"type":"module","gitHead":"5bc2e781b42b80519a9c53d0f25c5d79ac8741ea","scripts":{"test":"node --test","typecheck":"tsc --noEmit"},"_npmUser":{"name":"turisanapo","email":"selvaggiodavide@hotmail.it"},"repository":{"url":"git+https://github.com/8monkey-ai/pi-context-history.git","type":"git"},"_npmVersion":"11.6.0","description":"Pi extension that manages conversation context: trims old history, strips stale tool calls, and keeps a rolling summary fed back into the system prompt. Each feature toggles independently.","directories":{},"_nodeVersion":"24.9.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^22","@earendil-works/pi-coding-agent":"*"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-context-history_0.2.0_1782834901369_0.18680609024029704","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@8monkey/pi-context-history","version":"0.2.1","keywords":["pi","pi-extension","context","history","summary","tool-calls"],"license":"MIT","_id":"@8monkey/pi-context-history@0.2.1","maintainers":[{"name":"heiwen","email":"h@8monkey.ai"},{"name":"turisanapo","email":"selvaggiodavide@hotmail.it"}],"homepage":"https://github.com/8monkey-ai/pi-context-history#readme","bugs":{"url":"https://github.com/8monkey-ai/pi-context-history/issues"},"pi":{"extensions":["./src/index.ts"]},"dist":{"shasum":"265f28bfacfdc746dce2db8b62f24a2829dd8751","tarball":"https://registry.npmjs.org/@8monkey/pi-context-history/-/pi-context-history-0.2.1.tgz","fileCount":11,"integrity":"sha512-zVu768DkmD1wNwxQGxV0GNmxRal9rTrqMmGeYKTGyk45z9RKom0XN1HioIzN8Hw86T6fgu/OJh5IMr8WD9bvqg==","signatures":[{"sig":"MEUCIBPNp/TlD0wOkXao5ECOjYIVIHrM5PQdWrQs4v3c4w6oAiEApZkYHSPi75YkocM7fGnAyJH13p5vfiEjtlKb9HLlSIc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15894},"type":"module","gitHead":"38519ed734605e399d8a43846294d650d2abbdf7","scripts":{"test":"node --test","typecheck":"tsc --noEmit"},"_npmUser":{"name":"turisanapo","email":"selvaggiodavide@hotmail.it"},"repository":{"url":"git+https://github.com/8monkey-ai/pi-context-history.git","type":"git"},"_npmVersion":"11.6.0","description":"Pi extension that manages conversation context: trims old history, strips stale tool calls, and keeps a rolling summary fed back into the system prompt. Each feature toggles independently.","directories":{},"_nodeVersion":"24.9.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^22","@earendil-works/pi-coding-agent":"*"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-context-history_0.2.1_1782897981297_0.9682681179102706","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@8monkey/pi-context-history","version":"0.2.2","keywords":["pi-package","pi","context","history","summary","tool-calls"],"license":"MIT","_id":"@8monkey/pi-context-history@0.2.2","maintainers":[{"name":"heiwen","email":"h@8monkey.ai"},{"name":"turisanapo","email":"selvaggiodavide@hotmail.it"}],"homepage":"https://github.com/8monkey-ai/pi-context-history#readme","bugs":{"url":"https://github.com/8monkey-ai/pi-context-history/issues"},"pi":{"extensions":["./src/index.ts"]},"dist":{"shasum":"44e7f51f8f74414859f6afc28428781499164fd7","tarball":"https://registry.npmjs.org/@8monkey/pi-context-history/-/pi-context-history-0.2.2.tgz","fileCount":11,"integrity":"sha512-2JqFVAAfmR0aI92wv8MC5ea0m1Ur9HMhgrkoG7076QNFuyyAkNPaU//Yq4FEmjkY9Ghhpci9ULCyxbRcyriBMw==","signatures":[{"sig":"MEUCIQC6eZFa7yy6xYYW3+jCgLaJuY1YCd83bItKye4TfZYW9wIgB5DXG+Nv7X7/DR6MWRfsRUS4NFIOnNmhgEWDkio7I4c=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15892},"type":"module","gitHead":"5b2213ac9e8207eae2dd62fb7a13938df549b66b","scripts":{"test":"node --test","typecheck":"tsc --noEmit"},"_npmUser":{"name":"turisanapo","email":"selvaggiodavide@hotmail.it"},"repository":{"url":"git+https://github.com/8monkey-ai/pi-context-history.git","type":"git"},"_npmVersion":"11.6.0","description":"Pi extension that manages conversation context: trims old history, strips stale tool calls, and keeps a rolling summary fed back into the system prompt. Each feature toggles independently.","directories":{},"_nodeVersion":"24.9.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^22","@earendil-works/pi-coding-agent":"*"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-context-history_0.2.2_1783512981960_0.0722576203474754","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@8monkey/pi-context-history","version":"0.3.0","description":"Pi extension that manages conversation context: trims old history, strips stale tool calls, and keeps a rolling summary fed back into the system prompt. Each feature toggles independently.","license":"MIT","type":"module","repository":{"type":"git","url":"git+https://github.com/8monkey-ai/pi-context-history.git"},"homepage":"https://github.com/8monkey-ai/pi-context-history#readme","bugs":{"url":"https://github.com/8monkey-ai/pi-context-history/issues"},"pi":{"extensions":["./src/index.ts"]},"publishConfig":{"access":"public"},"scripts":{"test":"node --test","typecheck":"tsc --noEmit"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"devDependencies":{"@earendil-works/pi-coding-agent":"*","@types/node":"^22","typescript":"^5"},"keywords":["pi-package","pi","context","history","summary","tool-calls"],"_id":"@8monkey/pi-context-history@0.3.0","gitHead":"d4f43568637e0f625fabb7b0cc0fbc70048320f8","_nodeVersion":"24.9.0","_npmVersion":"11.6.0","dist":{"integrity":"sha512-xDhtjn4vNsQ/Ix+P+R5NCboSOWR2MiQ93hsTkleGvRpO7iW1MdUvL99H1FJKXEoVEArmoHr5jYRwjrxY8EbwkA==","shasum":"a2a562af37734b717bac92c90c148e39a107324f","tarball":"https://registry.npmjs.org/@8monkey/pi-context-history/-/pi-context-history-0.3.0.tgz","fileCount":11,"unpackedSize":16695,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDSz48Cf3+wbH44QUGT6JEV+rQkt9/xnKwNAuNk6aUZ6QIhAInExP4yjgiZ7fbaSt26mC7QVKb+FwBvFszmPo6EmlpE"}]},"_npmUser":{"name":"turisanapo","email":"selvaggiodavide@hotmail.it"},"directories":{},"maintainers":[{"name":"heiwen","email":"h@8monkey.ai"},{"name":"turisanapo","email":"selvaggiodavide@hotmail.it"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-context-history_0.3.0_1783607295367_0.24269087651742538"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-30T14:48:55.837Z","modified":"2026-07-09T14:28:15.689Z","0.1.0":"2026-06-30T14:48:56.185Z","0.2.0":"2026-06-30T15:55:01.538Z","0.2.1":"2026-07-01T09:26:21.433Z","0.2.2":"2026-07-08T12:16:22.098Z","0.3.0":"2026-07-09T14:28:15.519Z"},"bugs":{"url":"https://github.com/8monkey-ai/pi-context-history/issues"},"license":"MIT","homepage":"https://github.com/8monkey-ai/pi-context-history#readme","keywords":["pi-package","pi","context","history","summary","tool-calls"],"repository":{"type":"git","url":"git+https://github.com/8monkey-ai/pi-context-history.git"},"description":"Pi extension that manages conversation context: trims old history, strips stale tool calls, and keeps a rolling summary fed back into the system prompt. Each feature toggles independently.","maintainers":[{"name":"heiwen","email":"h@8monkey.ai"},{"name":"turisanapo","email":"selvaggiodavide@hotmail.it"}],"readme":"# pi-context-history\n\nA [Pi](https://github.com/earendil-works/pi-coding-agent) extension that keeps long-running conversations lean and focused.\n\nIn long sessions, the context window fills with old messages and tool output the model no longer needs. This extension removes what's stale and keeps a rolling summary so earlier context isn't lost.\n\nEverything is on by default and works once installed. Each feature can be disabled independently.\n\n## Install\n\n```bash\npi install npm:@8monkey/pi-context-history\n```\n\n## Features\n\n- **Trim history.** Drops messages older than `PI_HISTORY_DAYS` (60 by default) on each context rebuild.\n- **Strip tool history.** Removes tool calls and results from turns before the current one, leaving the in-progress turn untouched.\n- **Compact.** Keeps a rolling summary of each session in `~/.pi/agent/compact/<session-id>.md` and folds it into that session's system prompt, so the model continues with prior context. The summary regenerates during session start when you resume a session after it has gone stale. Run `/compact-session` to regenerate on demand.\n- **Append message.** Adds a user or assistant message to the end of the history with `/add-user-message` and `/add-assistant-message`.\n\n## Commands\n\n| Command | What it does |\n|---|---|\n| `/compact-session` | Write a fresh summary of the current session now, ignoring the staleness window. |\n| `/add-user-message <text>` | Add a message to the conversation as if you had typed it. |\n| `/add-assistant-message <text>` | Add a message as if the assistant had said it. Requires a selected model. |\n\nAppended messages are persisted immediately but only enter the live context on the next rebuild (resume or branch).\n\n## Configuration\n\nAll configuration is via environment variables, and all of it is optional.\n\n### Feature toggles\n\nEach feature is on by default. Set its variable to `false` to disable it.\n\n| Variable | Feature |\n|---|---|\n| `PI_TRIM_HISTORY` | Trim history |\n| `PI_STRIP_TOOL_HISTORY` | Strip tool history |\n| `PI_COMPACT` | Compact (generation and injection) |\n| `PI_APPEND_MESSAGE` | The append-message commands |\n\n### Settings\n\n| Variable | Default | Description |\n|---|---|---|\n| `PI_HISTORY_DAYS` | `60` | Maximum age, in days, of messages kept in context. |\n| `PI_COMPACT_STALENESS_DAYS` | `3` | How old the summary may get before it's regenerated on resume. |\n\n### Compact prompt\n\nOverride the built-in prompt with a file at `prompts/compact.md`, read from the project `.pi/` first, then `~/.pi/`. It must contain the `{conversation_history}` placeholder.\n\n## Development\n\nNo runtime dependencies. Pi loads the TypeScript directly, so there's no build step, and it runs under Node or Bun.\n\n```bash\nnode --test        # run tests\nnpm run typecheck\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}