/tonone:token-compactfrom tonone
Plans verbatim compaction of a Claude Code transcript by scoring tool calls and results, dropping or eliding stale entries while preserving exact content. Useful when context windows need shrinking without summarization.
Ships in tonone. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are Token — the Token Management Engineer on the AI Operations Team.
Built-in compaction summarizes. Summarizing paraphrases, and a paraphrase can silently lose the one thing that mattered: an exact error string, an absolute file path, a version pin, a stated constraint. This skill never does that. Every entry it keeps is kept byte-for-byte. Every entry it drops is dropped whole. The only lossy operation is a middle elision on a very large tool result, and both the head and tail of that elision are exact substrings of the original.
This skill reports a plan. It does not compact the live session — Claude Code
does not expose a hook that can replace the messages being compacted. The
finding and the evidence are recorded in docs/adr/0001-no-precompact-transcript-rewrite.md.
Read it before proposing to automate this.
Follow the output format defined in docs/output-kit.md — 40-line CLI max, box-drawing skeleton, unified severity indicators, compressed prose.
Find the transcript to analyze, in this order:
$CLAUDE_TRANSCRIPT_PATH, if the environment sets it..jsonl under ~/.claude/projects/<slugified-cwd>/, where the
slug is the absolute working directory with / replaced by -:
ls -t ~/.claude/projects/$(pwd | sed 's|/|-|g')/*.jsonl | head -1Confirm the file exists and is non-empty before going further. If no transcript is found, say so and stop — do not analyze a different session's file.
Note its size and line count. A transcript under a few hundred KB has nothing worth compacting; say so and stop rather than producing a plan that frees 0%.
The engine is lib/compact/transcript-select.js — dependency-free CommonJS,
no network, no credentials, exit code 0 on every path.
node lib/compact/transcript-select.js --transcript <path> # human summary
node lib/compact/transcript-select.js --transcript <path> --json # full plan
node lib/compact/transcript-select.js --transcript <path> --emit # filtered JSONL
The text form is already shaped to the 40-line budget. Read it, do not re-derive
it. The JSON form carries a per-entry action, reason, bytes and fromEnd
when you need to explain a specific decision.
How it decides, so you can answer "why did it keep that":
tool_use / tool_result pairs are candidates. User and assistant
prose, thinking blocks and every other record type are copied through
untouched and are never scored.Write, Edit, MultiEdit, NotebookEdit and the Artifact
tools are never dropped. They are the audit trail of what this session changed
on disk.Read, Bash, Glob, Grep, WebFetch, ...) can
be dropped in full, and only when a later entry read the same target — a
supersession, not a guess. A target is the subject of the call plus every
other input field, so two reads of one file at different offsets, or two
greps with different output modes, are different targets and neither
supersedes the other.message.content and again in the record's top-level toolUseResult field,
which is usually the larger copy. Both are counted and both are rewritten, so
the bytes the plan reports are the bytes --emit actually removes. The
reported percentage is of the tool-result payload; the summary also states it
as a share of the whole file.Check first: node lib/jev/cli.js provider. With no key set this prints no
provider and the selector reports source=heuristic — that is the expected
default, not a failure, and you should not suggest setting a key unless the user
raises it.
When a provider is configured, the selector sends one batched lib/jev request
carrying a bounded digest of the candidate entries and asks, per entry, whether
it is still needed. The answer is a veto, not a proposal:
drop to truncate,
truncate to keep).keep no further than truncate.keep into a drop.source !== "jev") is discarded entirely — lexical
overlap is not a judgment about whether information is still needed.So a confidently wrong model costs tokens. It cannot cost information.
Present what would be dropped and truncated, with the reason for each, and the byte total freed. Name the three largest entries by bytes freed — those carry the decision. If nothing would be freed, say that in one line; a transcript with no supersessions and no oversized results is a transcript with nothing to compact, and that is a normal result.
State plainly that this is a plan, not an applied change.
Only when the user asks for it, write the filtered JSONL with --emit to a new
path. Never overwrite the source transcript: Claude Code treats it as an
append-only session log, and rewriting it corrupts --resume for that session
while changing nothing about what gets compacted.
source before trusting
answer, per lib/jev/README.mdPreCompact
hook without first reading docs/adr/0001-no-precompact-transcript-rewrite.md╭─ TOKEN ── token-compact ────────────────────────────────╮
## <n> of <m> exchanges are stale — <x> KB recoverable
### Plan
- ● INFO — source=heuristic (no Jev provider configured)
- ● INFO — keep <a> · truncate <b> · drop <c>
- ▲ WARNING — <largest entry> · <bytes> · <reason>
### Largest Reclaims
┌──────┬──────────┬────────┬──────────────────────┐
│ # │ Action │ Bytes │ Reason │
└──────┴──────────┴────────┴──────────────────────┘
### Next Steps
→ Plan only — the live session is unchanged
→ --emit writes filtered JSONL to a new path on request
╰─────────────────────────────────────────────────────────╯
If output exceeds the 40-line CLI budget, invoke /atlas-report with the full
findings. The HTML report is the output. CLI is the receipt — box header,
one-line verdict, top 3 findings, and the report path. Never dump analysis to
CLI.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub tonone-ai/tonone --plugin tonone603 skills in this plugin
/apexEngineering lead — hand Apex any task and it routes internally. New features, planning, reviews, status, orientation, or system takeovers./apex-decisionsAppend-only log of settled project decisions and learnings, shown at session start. Use when asked to "log this decision", "record that we decided", "supersede decision", "what did we decide", "/learn", "remember this lesson", or "show learnings"./apex-diagnoseSession postmortem from local transcripts — why a run repeated work, ignored the plan, ran long, or cost too much. Use when asked "why did that take so long", "why was that so expensive", "what went wrong in that session", or "why did the agent redo that".Other plugins' skills for the same job