Skip to content

feat(compaction): L2 history snip — drop stale tool scaffolding (M4.2… - #27

Merged
wusijian007 merged 1 commit into
mainfrom
feat/m4.2-l2-history-snip
Jun 19, 2026
Merged

wusijian007 merged 1 commit into
mainfrom
feat/m4.2-l2-history-snip

Conversation

@wusijian007

Copy link
Copy Markdown
Owner

… / v4)

Layer 2 of the v4 pipeline: a deterministic stage that drops stale tool SCAFFOLDING. In the stale zone (outside the root task and the recent window) it snips oversized tool_result content to a tiny marker — the dominant token cost of old tool turns — while leaving tool_use blocks (tiny), prose/reasoning text, and user turns alone. Pairing is always safe (blocks are snipped in place, never removed) and the artifactPath is preserved so the full output stays restorable.

The layer separation is the point: L2 reclaims only the cheap, low-value tool apparatus; prose/reasoning is intentionally untouched because that is L5's job (semantic recap). The cascade is now [spill, snip, reclaim].

Because L1 spill and L2 snip both target tool scaffolding, a fixture whose whale is a stale tool_result would get reclaimed before the semantic layer runs — so the semantic-compaction eval task and the M3.2c query integration test now seed an assistant PROSE whale instead, which L1/L2 skip and only L5 can condense. That is the correct layer separation and keeps the eval fingerprint unchanged (prose replaces tool_result; scripted usage is the same).

  • core: snipStaleToolScaffolding + SnipScaffoldingOptions (context.ts); query loop inserts the snip stage between spill and reclaim.
  • tests: 2 new L2 unit tests (snips stale tool_result, leaves prose/tool_use/ root/recent; preserves artifactPath in the marker); two compaction fixtures retargeted to prose whales.
  • docs: CLAUDE.md query-loop step 7 lists L2; v4 roadmap M4.2 delivered.

232 tests pass (+2); all 10 eval tasks green, fingerprint unchanged.

… / v4)

Layer 2 of the v4 pipeline: a deterministic stage that drops stale tool
SCAFFOLDING. In the stale zone (outside the root task and the recent window) it
snips oversized tool_result content to a tiny marker — the dominant token cost
of old tool turns — while leaving tool_use blocks (tiny), prose/reasoning text,
and user turns alone. Pairing is always safe (blocks are snipped in place, never
removed) and the artifactPath is preserved so the full output stays restorable.

The layer separation is the point: L2 reclaims only the cheap, low-value tool
apparatus; prose/reasoning is intentionally untouched because that is L5's job
(semantic recap). The cascade is now [spill, snip, reclaim].

Because L1 spill and L2 snip both target tool scaffolding, a fixture whose whale
is a stale tool_result would get reclaimed before the semantic layer runs — so
the semantic-compaction eval task and the M3.2c query integration test now seed
an assistant PROSE whale instead, which L1/L2 skip and only L5 can condense.
That is the correct layer separation and keeps the eval fingerprint unchanged
(prose replaces tool_result; scripted usage is the same).

- core: snipStaleToolScaffolding + SnipScaffoldingOptions (context.ts); query
  loop inserts the snip stage between spill and reclaim.
- tests: 2 new L2 unit tests (snips stale tool_result, leaves prose/tool_use/
  root/recent; preserves artifactPath in the marker); two compaction fixtures
  retargeted to prose whales.
- docs: CLAUDE.md query-loop step 7 lists L2; v4 roadmap M4.2 delivered.

232 tests pass (+2); all 10 eval tasks green, fingerprint unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wusijian007
wusijian007 merged commit 50b9765 into main Jun 19, 2026
3 checks passed
@wusijian007
wusijian007 deleted the feat/m4.2-l2-history-snip branch June 19, 2026 21:36
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