Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add dimetron/pi-go --skill tool-compactiongit clone --depth 1 https://github.com/dimetron/pi-goWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/dimetron/pi-go/tool-compaction)<a href="https://agentmods.dev/skills/dimetron/pi-go/tool-compaction"><img src="https://agentmods.dev/badge/skills/dimetron/pi-go/tool-compaction/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/dimetron/pi-go/tool-compaction"><img src="https://agentmods.dev/badge/skills/dimetron/pi-go/tool-compaction.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00061 | $0.01718 |
| Opus 5.5 | $0.00024 | $0.00687 |
| Sonnet 5.5 | $0.00012 | $0.00344 |
| Haiku 4.5 | $0.00006 | $0.00172 |
Grade A, and why
tool-compaction scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 120 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Tool-output compaction, the after-tool chain, and dedup
Every rule here exists because its violation was silent: nothing crashed, the pipeline simply did nothing.
Tool-output compaction: one route per tool, and write what you read
internal/tools/compactor*.go shrinks tool results before they reach the model.
Seven of its nine pipelines were no-ops in production for a long time, and every
cause was a silent mismatch rather than a crash. The invariants below exist so
that cannot recur.
- Route on the registered name.
compactorPipelinesis keyed by the name a tool actually registers — hyphens for the git tools (git-file-diff), andripgrepfor the search tool, which self-names viagrepToolNameand is built once byCoreTools. The tool registersgreponly on a host withoutrg. Aswitchon underscore spellings is what made three git pipelines unreachable. - A pipeline may only write the field it read.
CompactResultcarriesCompactWrite{Key, Value}pairs. Do not add a probe order that guesses a target field: the previousstdout → content → output → diff → result → dataorder wrote to the wrong key, and no tool emitsoutputat all. - Keep the value's type. ADK round-trips every result through
json.Marshal/json.Unmarshal(internal/typeutil/convert.go), so a[]GrepMatcharrives as[]anyofmap[string]any— never a typed slice. Cap the array; do not re-render it to a string. The TUI result summaries read the same keys (internal/tui/tool_display.go) as[]any. - Preserve the true total. A cap sets
truncatedand leavestotal_matches/total_files/total_entries/total_hunksas the pre-cap count, so a partial list is never read as the whole answer.truncatedcarriesomitempty, so it is absent from a complete result —applyCompactionwrites named keys unconditionally for exactly this reason. - Decline when there is nothing to gain. Return
nilwhen the result would not shrink (the rtknever_worseguard). Do not cap lists that mislead when truncated:git-overviewcapsrecent_commitsbut leaves the staged/unstaged/untracked lists whole, because hiding a dirty file is a correctness problem, not a saving. - Test against real structs. Build test payloads by marshalling the tool's
actual output struct (
buildProdResult), never a hand-written map. Synthetic maps carrying anoutputkey are what kept the dead pipelines green.TestCompactor_EveryToolCompactsandTestCompactorRouting_EveryRegisteredToolare the guards; both fail if a route or field drifts.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 12d ago First seen · 120 lines · 61 tokens per session scan A 1e5b81ea3787
tool-compaction is a skill published in the GitHub repository dimetron/pi-go (232 stars, last pushed 7d ago), licensed MIT. It adds 61 tokens to every session and 1,718 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-18.
tool-compaction compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| tool-compactiondimetron/pi-go | Skill | 232 | 7d ago | MIT | A | 61 | Claude Code, Codex |
| test-fixpatriceckhart/zot | Skill | 372 | yesterday | MIT | A | 17 | Claude Code |
| find-tracesaxiomhq/cli | Skill | 60 | 7d ago | MIT | A | 37 | Claude Code |
| explore-datasetaxiomhq/cli | Skill | 60 | 7d ago | MIT | A | 40 | Claude Code |
| promptkitty-assemblebaldaworks/promptkitty | Skill | 5 | 5d ago | MIT | A | 78 | Claude Code, Codex |
| troubleshoot-tervaterva-sh/terva | Skill | 5 | yesterday | MIT | A | 83 | Claude Code, Codex |
| golang-lintalexastrum/skl | Skill | 11 | 6d ago | MIT | A | 100 | Claude Code |