[Feature] ACP mode should report context usage (usage_update) #1356
Replies: 1 comment
|
@sethkarten flagging this one to you as well, as the author of ACP mode. Where this comes from: I run Prime Agent through ACP rather than the TUI, and the context bar is the one thing I genuinely miss. Over ACP there is no signal at all that a session is filling up until compaction happens, which is a strange gap given that the number already exists and ACP has a standard field for it. Captured from a real ( The patch is #1351. It reads the same If you would rather this rode in |
Uh oh!
There was an error while loading. Please reload this page.
Affected area
Coding agent and CLI (ACP mode)
What is the problem?
ACP mode reports no usage information at all, so an ACP client cannot show how much of the context window a session has consumed. The number exists — the TUI renders it as the context bar — but nothing in
src/modes/acp/references usage or the context window, so over ACP it is invisible.That matters most in exactly the setting ACP is for: a long driven session where the user cannot see the TUI and has no signal that compaction is approaching.
Proposed solution
Emit ACP's standard
usage_updatesession update:{ "sessionUpdate": "usage_update", "used": 20846, "size": 1000000 }used/sizecome fromAgentConnectionState.contextUsage, the sameContextUsagethe TUI bar renders, so the two cannot disagree.getState()round trip per delta.tokensisnull— rather than reporting zero.usage_updateis a first-classSessionUpdatevariant in@agentclientprotocol/sdk, so nothing goes into_metaand a vanilla client gets this for free.Alternatives considered
Putting the number in the Prime Agent
_metaenvelope: rejected, since only a Prime-Agent-aware client would read it, and ACP already has the standard field.Polling usage on every session event: rejected, since it costs a round trip per streamed delta to report an unchanged number.
Additional context
A patch is up as #1351, with a test in
test/suite/acp-mode.test.tsthat drives a real ACP client over an in-memory duplex and asserts0 < used < size(reverting the source change fails it);npm run checkpasses, and it is verified against a liveprime-agent --mode acpprocess.Opening this Discussion because the new contribution process routes intake here — this one has no Issue behind it, so treat the PR as a proposal rather than as accepted work.
All reactions