Skip to content

Week 4 Day 5: add token-aware context compaction - #170

Draft
skyzh wants to merge 1 commit into
skyzh/week4-day4-sessionsfrom
skyzh/week4-day5-compaction
Draft

Week 4 Day 5: add token-aware context compaction#170
skyzh wants to merge 1 commit into
skyzh/week4-day4-sessionsfrom
skyzh/week4-day5-compaction

Conversation

@skyzh

@skyzh skyzh commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Day 4 sessions preserve the full transcript, but an unbounded replay eventually exceeds the model context and can feed oversized observations back into generation.

This checkpoint adds exact rendered-token admission, tool-specific observation bounds, immutable structured summaries, durable compaction markers, and safe cache reconciliation. Summary generation uses a separate cache, has one schema-checked attempt, and falls back deterministically without rewriting source events. Replayed markers are validated for chronology, complete-turn coverage, and structured provenance before they can hide history.

The CLI also rejects generation budgets that exceed its reserved context and records context/cache metrics without treating model completion as task correctness.

AI-assisted: Codex.

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