Skip to content

dispatch-envelope schema (v0.4)

The .contextbrew/dispatches/<id>/envelope.json file is validated by the normative JSON Schema published at its canonical URL:

The canonical transcript artifact — ONE agent session’s captured stream in an agent-agnostic envelope. This is the schema root for schemas/dispatch-envelope/.

PropertyTypeRequiredDescription
kind"ctxbrew.dispatch.envelope"yes
schemaVersionstringyes
dispatchIdstringyes
agentDispatchAgentTypeyes
modelstringnoAgent-reported model id, when the stream provides one.
sessionIdstringnoAgent-native session id — enables resume to continue the session.
resumedFromSessionIdstringnoSet when this dispatch resumed an earlier session.
sourceDispatchSourceRefyes
promptstringyesWhat we asked (scrubbed before persistence).
cwdstringnoDirectory the agent ran in (project root or its isolated worktree).
pourVintagestringnoPour vintage at dispatch time (O3 — orchestration-surfaces v1 §4.3, 2026-10-16): identifies the context pour the agent ran against (pour timestamp/id as produced by the pour pipeline). Optional so pre-O3 envelopes (schema 0.1.x) stay valid; M3 turns the invariant into enforcement — dispatch refuses to run without a vintage at least as fresh as canonHash (--allow-stale is the deliberate escape hatch). Asserting it here makes vintage a dispatch-side contract instead of the ingest-side inference the Cockpit performs today.
canonHashstringnoHash of the canon (requirements/models state) the pour was cut from.
planCoveragePlanCoveragenoPlan-gate coverage declaration (O5 — orchestration-surfaces v1 §3, schema 0.3.0): present when this dispatch's source is a generated plan that CLAIMS to satisfy the named CBRL requirements. The plan gate (ctxbrew gate plan) renders its coverage counters from this, and veto/approve ledger events snapshot it — coverage is a DISPLAYED INPUT, never a verdict (spec §9 risk 4; proof stays with the gate sweep at done-time). Optional so pre-O5 envelopes (schema ≤0.2.x) stay valid.
steeredbooleannoO14 terminals (schema 0.4.0): true when a human steered this dispatch's agent through its worktree terminal — typed input into the PTY is steering, and this flag is what makes the intervention visible to the judge and receipts (a steered lane never presents as unattended; sticky once set). Optional so pre-O14 envelopes (schema ≤0.3.x) stay valid; written by the terminal capture path, never by the capture pipeline itself (which never steers).
startedAtstringyes
finishedAtstringno
exitCodenumberno
verdictDispatchVerdictyes
metricsDispatchMetricsyes
messagesTranscriptMessage[]yes
unparsedstring[]noNon-JSON stream lines the parser could not attribute (bounded count). Fidelity valve: nothing silently dropped without a trace.
generatorobjectno

Agents that can be dispatched to. Mirrors recipes’ AgentType.

Type: "claude-code" | "codex" | "generic"

PropertyTypeRequiredDescription
durationMsnumberyes
inputTokensnumberno
outputTokensnumberno
costUsdnumberno
turnsnumberno

Where the dispatched prompt came from — never a new “intent” concept.

Type: "prompt" | "raw-prompt" | "cbrl" | "recipe" | "chat" | "orchestration-task"

PropertyTypeRequiredDescription
kindDispatchSourceKindyes
idstringnoIdentifier of the source object when kind ≠ "prompt": CBRL requirement id, recipe id, raw_prompts id, chat message id, orchestration task id.
titlestringnoHuman title / subject line for history rendering.

Outcome of a dispatch, derived from the agent stream — never guessed.

Type: "passed" | "partial" | "failed" | "aborted"

The coverage declaration a generated plan carries on its dispatch envelope (schema 0.3.0 planCoverage): which CBRL requirements the plan CLAIMS to satisfy, and the slices it claims to have produced. Claimed, never proven — the counters render what the plan says.

PropertyTypeRequiredDescription
requirementIdsstring[]yesCBRL requirement ids the plan claims to satisfy (e.g. ["REQ-104"]).
claimedSlicesstring[]yesSlice labels the plan claims to have produced (receipt material).

One transcript event: prose, a tool call, or a tool result.

PropertyTypeRequiredDescription
indexnumberyesMonotonic within the transcript, 0-based, assigned by the capture pipeline.
timestampstringyes
role"user" | "assistant" | "system" | "tool"yes
contentstringnoProse content (assistant text, user prompt echo, summaries).
toolTranscriptToolCallnoPresent when role is "tool" (or an assistant message carries a call).
eventIdstringnoCapture-batch dedupe identity (R2 §2.2, wave 3a — additive). The terminal-capture route stamps the client outbox's eventId on every message of a batch; a lost-ack retry with the same id replays the first outcome instead of appending again. Absent on all older writers and read paths.

One tool invocation inside a transcript, scrubbed and size-capped.

PropertyTypeRequiredDescription
idstringnoAgent-native tool-call id, when the stream provides one.
namestringyes
argsRecord<string, unknown>no
resultstringnoScrubbed textual result, truncated to TOOL_RESULT_MAX_CHARS.
status"ok" | "error"no

See the schemas overview for the versioning policy and how these files are generated and kept in sync.