Back to Everything Claude Code

HUD Status And Session Control Contract

docs/architecture/hud-status-session-control.md

2.0.04.2 KB
Original Source

HUD Status And Session Control Contract

This contract defines the portable status payload ECC uses for local operator surfaces, handoffs, and future HUDs. It is intentionally harness-neutral: a Claude Code statusline, Codex pane, dmux session, OpenCode run, or terminal-only workflow can emit partial data without changing field names.

The canonical example lives at examples/hud-status-contract.json.

Payload Shape

Every status payload uses schema_version: "ecc.hud-status.v1" and keeps these top-level sections stable:

FieldPurposePrimary Source
contextModel, harness, repo, branch, worktree, session id, and context-window pressurestatusline stdin, git, session adapters
toolCallsRecent tool counts, pending calls, stale calls, and last tool eventloop-status, tool-usage.jsonl, hook bridge
activeAgentsCurrent workers/subagents, runtime state, branch, worktree, objective, and handoff pathsdmux/orchestration snapshots
todosCurrent in-progress task and todo countsClaude todos, local task files, plan metadata
checksLocal and remote validation status with command/check URLs when availableCI, local commands, release gates
costSession spend, token counts, budget, and trendcost tracker, metrics bridge
riskAttention state, conflict pressure, stale calls, dirty worktree, and manual-review flagsreadiness gates, git, queue state
queueStateGitHub PR/issue/discussion counts, conflict queue, merge queue, and stale-salvage queueGitHub sync, work items
sessionControlsSupported operator actions for the current targetECC CLI, dmux, git/GitHub
syncLinear, GitHub, and handoff publication statestatus updates, work items, handoff writer

Fields can be null, empty arrays, or "unknown" when a harness cannot expose the signal. Producers should not invent incompatible names. Consumers should render missing sections as unavailable, not as green.

Session Controls

The minimum session-control vocabulary is:

ControlMeaning
createStart a new isolated run, worktree, or orchestration plan
resumeReattach to an existing session or historical target
statusEmit the current payload without mutating state
stopRequest a graceful stop or mark the session completed
diffShow current working-tree or worker diff
prOpen or inspect the linked pull request
mergeQueueShow merge-ready, blocked, and waiting-check items
conflictQueueShow dirty/conflicting PRs or worktrees needing integration

sessionControls.supported lists the controls available for the current harness. sessionControls.blocked explains unavailable controls, for example a missing GitHub token, no tmux session, or a read-only adapter.

Sync Contract

The sync section separates durable trackers:

  • Linear records project status update id, health, and whether issue creation is blocked by workspace capacity.
  • GitHub records the current repo, PR/issue/discussion queue counts, and the latest merged or open PR tied to the session.
  • handoff records the durable Markdown handoff path and whether it has been written after the latest batch.

This makes real-time progress tracking explicit without requiring every run to create Linear issues or GitHub comments. When Linear issue capacity is blocked, the status payload can still prove progress through project updates and repo handoffs.

Current Implementations

  • ecc status --json exposes readiness, active sessions, skill runs, install health, governance, and linked work items from the SQLite state store.
  • ecc loop-status --json --write-dir <dir> writes live transcript snapshots and attention signals for long-running loops.
  • ecc session-inspect <target> --write <path> emits canonical session snapshots from dmux and Claude-history adapters.
  • scripts/hooks/ecc-statusline.js renders compact model, task, cost, tool, file, duration, directory, and context pressure signals inside Claude Code.

The ecc.hud-status.v1 payload is the common outer contract these surfaces can project into before ECC grows a dedicated full-screen HUD.