-
-
Notifications
You must be signed in to change notification settings - Fork 0
Request Compiler and Context Compaction
Tool-result compression is only half the problem. Agent runtimes can still assemble a provider request containing repeated evidence, old large tool results, and redundant completed turns. Token Terminator therefore performs a final provider-bound pass.
The compiler operates on a deep copy. It can:
- identify repeated large artifacts;
- replace later exposures with bounded receipts;
- collapse same-request duplicates;
- optionally inject bounded working state;
- record request metrics without storing prompt content.
The caller-owned request remains untouched.
The compiler does not accept a local improvement merely because one field got smaller. It measures the complete final provider payload after receipts, metadata, optional working state, and context compaction.
If the final serialized payload is not smaller, Token Terminator passes through the original request.
When an exact tokenizer is configured, measured token count is a second veto gate.
Old large tool results can be vaulted and replaced with receipts. Completed old turns may be folded into deterministic compact summaries for the provider-bound copy.
The configured recent-turn invariant matters:
collapse_after_turns == 0
OR
collapse_after_turns >= inline_recent_turns
The default is six turns before collapse, with the five most recent turns guaranteed fully inline.
This does not delete the host's persisted transcript. It changes only the provider-bound copied request.
TOKEN_TERMINATOR_WORKING_GRAPH_CHARS defaults to 0. When enabled, the bounded selector is optional context, not a second memory system. If injecting it would erase the end-to-end reduction, it is removed.
v0.5.1 makes exposure/lease accounting track the request actually accepted. A candidate rejected by the final character/token gate should not consume a provider exposure as though it had been delivered.
Token Terminator v0.6.0 · Repository · Releases · crates.io · MIT
Documentation is source-controlled from the repository wiki/ directory.
Token Terminator
Core mechanics
- Vault & Exact Recovery
- Temporal Delta Compression
- Request Compiler & Context Compaction
- Async & Adapter Integration
Operations
Development