feat(session): cooperative context feed for interactive claude via statusline hooks - #110
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tomlshows CTX% 13% inmarvel get sessionsafter 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/subagentStatusLinekeys 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-forwardreads the payload on stdin, prints a compact human-facing status ("Fable 5 · CTX 13% · $1.47"), and forwardsused_percentageto 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_feedbehave 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