Add usage_update session notification support to ACP adapter

Author: Radiant303Created Aug 23, 2026Updated Oct 1, 2026
Labelspydanty:is-working

Capability Name

AcpUsageUpdate

Description

This capability allows ACP clients (like Zed editor) to display context window usage percentage.

Currently, the ACP adapter doesn't send usage_update session notifications, so editors cannot show information like "Context 8% · 21k / 262k".

The implementation would:

  • Send schema.UsageUpdate after each turn completes
  • Use existing resolve_context_window() function to get model's max context size
  • Report current total_tokens from RunUsage

The SessionUpdate type alias already includes schema.UsageUpdate, and the project has resolve_context_window() function in compaction/_context_window.py that can be reused.

Use Case

When building an agent that needs to manage context window limits, developers using ACP-compatible editors (like Zed) want to see real-time context usage feedback.

For example:

  • A developer sees "Context 8% · 21k / 262k" in their editor
  • They know they have 240k tokens remaining before hitting the limit
  • They can plan their prompts accordingly and avoid unexpected context overflow

This is especially useful for:

  • Long-running agent sessions
  • Complex multi-turn conversations
  • Debugging context management issues

Hooks / Integration Points

No response

Prior Art / References

No response