Skip to content

docs(v4): compaction-pipeline roadmap — five-layer cascade anchor - #24

Merged
wusijian007 merged 1 commit into
mainfrom
docs/v4-compaction-pipeline
Jun 19, 2026
Merged

wusijian007 merged 1 commit into
mainfrom
docs/v4-compaction-pipeline

Conversation

@wusijian007

Copy link
Copy Markdown
Owner

Open a new iteration track: rebuild context compaction from today's single-box compactMessagesTiered + chars/4 trigger into a Claude Code-style five-layer pipeline that runs before every model call, cheapest-first, short-circuiting as soon as it is under budget, with semantic auto-compact as the guarded last resort.

The doc is the spec of record for the track. It locks:

  • the five layers + usage anchor (Budget / Snip / Microcompact / Context collapse / Auto-compact; budget judged against last API usage, not chars/4),
  • an audit of what myagent already has (L1 spill is non-destructive — keep it) vs the real gaps (heuristic trigger, middle three layers mashed into one in-place rewrite, no guardrails on the semantic layer),
  • the load-bearing constraint: the gateway does not expose Anthropic cache_edits, so L3's hot path is a native cache-preserving adaptation (defer rewrite / append after the breakpoint; warmth approximated by elapsed time since last call via an injectable clock), not server-side reference deletion,
  • five cross-cutting invariants (v3's three + per-layer freed-token short-circuit
    • reversible-before-irreversible),
  • the build order (foundation-first: M4.0 cascade spine + usage anchor, then L1..L5 cheapest-first, one PR each) and per-milestone design + decisions,
  • honest fidelity trade-offs adapted from CC (cache_edits, real TTL, plan state, the view-overlay architecture change).

No code yet — M4.0 (cascade spine + usage anchor) follows in its own PR and references this file.

Open a new iteration track: rebuild context compaction from today's single-box
compactMessagesTiered + chars/4 trigger into a Claude Code-style five-layer
pipeline that runs before every model call, cheapest-first, short-circuiting as
soon as it is under budget, with semantic auto-compact as the guarded last
resort.

The doc is the spec of record for the track. It locks:
- the five layers + usage anchor (Budget / Snip / Microcompact / Context
  collapse / Auto-compact; budget judged against last API usage, not chars/4),
- an audit of what myagent already has (L1 spill is non-destructive — keep it)
  vs the real gaps (heuristic trigger, middle three layers mashed into one
  in-place rewrite, no guardrails on the semantic layer),
- the load-bearing constraint: the gateway does not expose Anthropic
  cache_edits, so L3's hot path is a native cache-preserving adaptation (defer
  rewrite / append after the breakpoint; warmth approximated by elapsed time
  since last call via an injectable clock), not server-side reference deletion,
- five cross-cutting invariants (v3's three + per-layer freed-token short-circuit
  + reversible-before-irreversible),
- the build order (foundation-first: M4.0 cascade spine + usage anchor, then
  L1..L5 cheapest-first, one PR each) and per-milestone design + decisions,
- honest fidelity trade-offs adapted from CC (cache_edits, real TTL, plan state,
  the view-overlay architecture change).

No code yet — M4.0 (cascade spine + usage anchor) follows in its own PR and
references this file.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wusijian007
wusijian007 merged commit f9812a3 into main Jun 19, 2026
3 checks passed
@wusijian007
wusijian007 deleted the docs/v4-compaction-pipeline branch June 19, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant