@ssweens/pi-compaxxt
Enhanced compaction for pi — session context and LLM-ranked important files
Package details
Install @ssweens/pi-compaxxt from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@ssweens/pi-compaxxt- Package
@ssweens/pi-compaxxt- Version
1.1.0- Published
- Mar 30, 2026
- Downloads
- 39/mo · 9/wk
- Author
- ssweens
- License
- MIT
- Types
- extension, skill
- Size
- 23.1 KB
- Dependencies
- 0 dependencies · 4 peers
Pi manifest JSON
{
"extensions": [
"extensions"
],
"skills": [
"skills"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-compaxxt
pi install @ssweens/pi-compaxxt
Enhanced compaction for pi. Two improvements to every compaction, zero extra LLM calls.

Features
Session Context
Every compaction summary is prepended with the current session file path and thread ID:
## Session Context
**Session:** `/Users/you/.pi/agent/sessions/abc123/session.jsonl`
**Thread ID:** `e7f2a3c1-...`
Use the `session_query` tool to retrieve specific context from messages that were summarized away.
---
## Goal
...
After compaction, the LLM knows exactly where to look if it needs older context that was summarized away. The bundled session_query tool makes this retrieval cheap — it doesn't load the full session, just answers a targeted question from it.
LLM-Judged Important Files
The compaction prompt is augmented to ask the LLM to identify the most goal-relevant files as part of generating the summary. The file sections are restructured:
<important-files>
src/core/compaction.ts
extensions/handoff.ts
</important-files>
<modified-files>
src/core/compaction.ts
extensions/handoff.ts
src/utils.ts
</modified-files>
<other-read-files>
package.json
docs/api.md
</other-read-files>
Files are selected using these criteria:
- Directly related to accomplishing the goal
- Contain reference code or patterns to follow
- Will need to be read, edited, or created
- Provide important context or constraints
<modified-files> is left untouched (intentional overlap with important-files is fine). <read-files> becomes <other-read-files> with the important ones pruned out.
If the LLM doesn't output a parseable ## Most Important Files section, the extension falls back to the default <read-files>/<modified-files> format silently.
Components
| Component | Type | Description |
|---|---|---|
| compaction.ts | Extension | session_before_compact hook — session context + file restructuring |
| session-query.ts | Extension | session_query tool for querying session history |
| pi-session-query/ | Skill | Instructions for using session_query |
Notes
- If you also have
@ssweens/pi-handoffinstalled, both packages register thesession_querytool. Pi will warn about the duplicate — it's harmless, one will shadow the other. - Works with
/compact [instructions]— user instructions are preserved and the file importance prompt is appended after them. - On any compaction error, falls back to pi's default compaction silently (with a warning notification).
License
MIT