This compatible patch reduces the token overhead the companion itself adds to agent sessions and makes the session label robust to host-side control-byte sanitization.
Changed
The
leancompanion profile now advertises only core MCP tools. Advertised tool schemas are re-sent to the model with every request, so underTOKENPAK_COMPANION_PROFILE=leanthe MCP server'stools/listresponse includes only the recall, compression, and journal tools (load_pak,prune_context,journal_read,journal_write,vault_search,vault_retrieve). Accounting and diagnostic tools (estimate_tokens,check_budget,session_info) and the deprecatedload_capsulealias remain fully callable — dispatch is not filtered — but their schemas no longer ride every request; hooks cover cost estimation and budget enforcement out-of-band in all profiles. Thebalanced(default) andverboseprofiles are unchanged. Two verbose tool descriptions were also shortened.Companion guidance no longer directs agents to spend model turns on accounting. Cost estimation and budget enforcement happen automatically in the pre-send hook, and session summaries in the stop hook, so the generated Codex
AGENTS.mdsection, the Claude launcher system-prompt fragment, and theestimate_tokens/check_budgetMCP tool descriptions now say to reserve explicit tool calls for genuine decisions instead of recommending them before reads and multi-step tasks. Each avoided call saves a full model round-trip that would re-send the whole conversation. The CodexAGENTS.mdmanaged section also shrinks to roughly a third of its former size while keeping the complete tool inventory and behavioral rules.estimate_tokensMCP results are compacted. The tool now returnstokens,chars, and a short estimator disclosure instead of echoing the full HTTP payload, because tool results persist in the conversation and are re-billed as input on every subsequent turn. The heuristic-fallback disclosure remains (aschars/4-approxplus a brief install hint), and the/tpk/v1/tokens/estimateHTTP response is unchanged.Release-workflow and leak-gate hardening. The delta leak gate consults the canonical pattern-register set, the private-path scan exempts only the exact documented vault-index default segment, and the release workflow quotes its step-output sink and guards its checksum globs.
Fixed
- The companion session label is plain text. The styled label embedded terminal escape bytes in a value rendered by the host CLI; a host update began sanitizing control bytes in that surface, displaying the sequences as literal text. A session name is data rendered by another program — styling now stays on the companion's own terminal streams.
Upgrade
python -m pip install --upgrade "tokenpak==1.18.3"
No data migration is required.
Rollback
python -m pip install --upgrade "tokenpak==1.18.2"
Compatibility
- No breaking change. The Python public-symbol set gains one additive
companion helper (
active_tools); no symbol is removed or changed. HTTP contracts, TIP wire formats, and storage schemas are unchanged. - Configurations not opting into the
leancompanion profile see no behavioral change.