Skip to content

Commit 9108503

Browse files
committed
chore: changeset for context compaction
1 parent 9f35408 commit 9108503

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

.changeset/context-compaction.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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`).

0 commit comments

Comments
 (0)