File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' @electric-ax/agents-runtime ' : minor
3+ ' @electric-ax/agents-server-ui ' : patch
4+ ---
5+
6+ Context compaction for the agents runtime. Modelled on OpenAI Codex's
7+ summarization but adapted to the event-sourced timeline (a ` context_inserted `
8+ checkpoint placed at a stored watermark, so reconstruction folds older messages
9+ into a summary):
10+
11+ - A context-window usage gauge (cache-inclusive ` context_input_tokens ` +
12+ ` context_window ` persisted per step) and ` <token_budget> ` notices injected at
13+ 25 / 50 / 75% usage.
14+ - Oversized tool-output truncation, and a synchronous mid-turn compaction floor
15+ at the 90% hard ceiling (runs before every model step via the adapter's
16+ ` transformContext ` hook).
17+ - Non-blocking background (turn-end) compaction that starts at 85%: a detached
18+ summarize whose checkpoint is applied at the next turn's start, or immediately
19+ if it finishes while idle. Each generation uses a watermark-unique checkpoint
20+ id so a new run can't supersede a prior completed one. Summarize calls are
21+ bounded by a hard timeout.
22+ - UI: a "Compacting…" indicator (blocking vs. background) and a collapsible
23+ "Context compacted" entry in the conversation timeline.
24+
25+ Thresholds are env-tunable (` ELECTRIC_AGENTS_COMPACT_CEILING ` ,
26+ ` ELECTRIC_AGENTS_COMPACT_BG_CEILING ` , ` ELECTRIC_AGENTS_COMPACT_MIN_TOKENS ` ).
You can’t perform that action at this time.
0 commit comments