Skip to content

feat(session): cooperative context feed for interactive claude via statusline hooks - #110

Merged
arcaven merged 1 commit into
mainfrom
feat/context-feed-statusline
Aug 5, 2026
Merged

feat(session): cooperative context feed for interactive claude via statusline hooks#110
arcaven merged 1 commit into
mainfrom
feat/context-feed-statusline

Conversation

@arcaven

@arcaven arcaven commented Aug 5, 2026

Copy link
Copy Markdown
Member

Interactive sessions were the CTX% blind spot: no stream, so the usage accountant has nothing to read and the column renders "-" exactly where a long-lived human-in-the-loop supervisor most needs metering (aae-orc-dc1j). This wires the statusline side-channel probed in finding-011 into a working feed, and it is live-verified: an interactive claude session under examples/context-feed.toml shows CTX% 13% in marvel get sessions after one model turn, with the pane statusline reading "Fable 5 · CTX 13% · $1.47".

Manifest surface: runtime.context_feed = "statusline" (validated; empty means off, typos rejected at parse).

Projection contract, preserved: policy content is never modified. The feed only ADDS statusLine/subagentStatusLine keys where the policy does not define them; a policy carrying its own statusLine wins verbatim (regression-tested). Roles with a feed but no policy now also get a projected settings file.

Forwarder: hidden marvel ctx-forward reads the payload on stdin, prints a compact human-facing status ("Fable 5 · CTX 13% · $1.47"), and forwards used_percentage to the existing heartbeat RPC using the MARVEL_* env the adapter already injects. Never exits nonzero and never prints errors: a broken feed is a silent CTX% gap, not red text inside an agent's terminal. Subagent payloads render a summary row and send nothing (no daemon surface for per-subagent context yet; tracked in aae-orc-7hzb).

Idle-session guard: the injected statusLine carries refreshInterval: 15, so the feed keeps beating between prompts instead of starving a heartbeat healthcheck.

Additive only: roles without context_feed behave exactly as before. Tests: renderForward table tests, projection feed-injection + policy-wins tests; full suite passes.

Refs: aae-orc-7hzb, aae-orc-dc1j, finding-011

…atusline hooks

Interactive (TUI) sessions emit no parseable stream, so the usage
accountant cannot meter them and CTX% renders "-". This closes the gap
using the harness's own statusline side-channel (finding-011):

- runtime.context_feed = "statusline" (manifest, validated) opts a role
  into the feed
- the projection layer merges marvel-owned statusLine and
  subagentStatusLine hooks into the projected settings; policy content
  is never modified and policy keys always win
- the injected statusLine carries refreshInterval 15 so an idle session
  keeps beating instead of starving a heartbeat healthcheck
- new hidden command `marvel ctx-forward` reads the statusline payload
  on stdin, prints a compact status for the human attached to the pane,
  and forwards used_percentage to the heartbeat RPC using the
  MARVEL_SOCKET/WORKSPACE/SESSION env the adapter already injects;
  subagent payloads render a summary and send nothing (no daemon
  surface for per-subagent context yet)

Live-verified end to end: interactive claude session under
examples/context-feed.toml shows CTX% 13% in `marvel get sessions`
after one model turn, with the pane statusline reading
"Fable 5 · CTX 13% · $1.47".

Refs: aae-orc-7hzb, aae-orc-dc1j
@arcaven
arcaven merged commit 9fbb6fe into main Aug 5, 2026
9 checks passed
@arcaven
arcaven deleted the feat/context-feed-statusline branch August 5, 2026 18:53
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