dispatch-envelope schema (v0.4)
The .contextbrew/dispatches/<id>/envelope.json file is validated by the normative JSON Schema published at its canonical URL:
- $id: https://contextbrew.dev/schemas/dispatch-envelope/v0.4/schema.json
- Format version:
0.4.0 - Schema dialect: draft-07
- Validate with:
ctx schema dispatch-envelopeor any JSON Schema validator (ajv, VS Code, …)
Root object: DispatchEnvelope
Section titled “Root object: DispatchEnvelope”The canonical transcript artifact — ONE agent session’s captured stream in an agent-agnostic envelope. This is the schema root for schemas/dispatch-envelope/.
| Property | Type | Required | Description |
|---|---|---|---|
kind | "ctxbrew.dispatch.envelope" | yes | |
schemaVersion | string | yes | |
dispatchId | string | yes | |
agent | DispatchAgentType | yes | |
model | string | no | Agent-reported model id, when the stream provides one. |
sessionId | string | no | Agent-native session id — enables resume to continue the session. |
resumedFromSessionId | string | no | Set when this dispatch resumed an earlier session. |
source | DispatchSourceRef | yes | |
prompt | string | yes | What we asked (scrubbed before persistence). |
cwd | string | no | Directory the agent ran in (project root or its isolated worktree). |
pourVintage | string | no | Pour 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. |
canonHash | string | no | Hash of the canon (requirements/models state) the pour was cut from. |
planCoverage | PlanCoverage | no | Plan-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. |
steered | boolean | no | O14 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). |
startedAt | string | yes | |
finishedAt | string | no | |
exitCode | number | no | |
verdict | DispatchVerdict | yes | |
metrics | DispatchMetrics | yes | |
messages | TranscriptMessage[] | yes | |
unparsed | | no | Non-JSON stream lines the parser could not attribute (bounded count). Fidelity valve: nothing silently dropped without a trace. |
generator | object | no |
Definitions
Section titled “Definitions”DispatchAgentType
Section titled “DispatchAgentType”Agents that can be dispatched to. Mirrors recipes’ AgentType.
Type: "claude-code" | "codex" | "generic"
DispatchMetrics
Section titled “DispatchMetrics”| Property | Type | Required | Description |
|---|---|---|---|
durationMs | number | yes | |
inputTokens | number | no | |
outputTokens | number | no | |
costUsd | number | no | |
turns | number | no |
DispatchSourceKind
Section titled “DispatchSourceKind”Where the dispatched prompt came from — never a new “intent” concept.
Type: "prompt" | "raw-prompt" | "cbrl" | "recipe" | "chat" | "orchestration-task"
DispatchSourceRef
Section titled “DispatchSourceRef”| Property | Type | Required | Description |
|---|---|---|---|
kind | DispatchSourceKind | yes | |
id | string | no | Identifier of the source object when kind ≠ "prompt": CBRL requirement id, recipe id, raw_prompts id, chat message id, orchestration task id. |
title | string | no | Human title / subject line for history rendering. |
DispatchVerdict
Section titled “DispatchVerdict”Outcome of a dispatch, derived from the agent stream — never guessed.
Type: "passed" | "partial" | "failed" | "aborted"
PlanCoverage
Section titled “PlanCoverage”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.
| Property | Type | Required | Description |
|---|---|---|---|
requirementIds | | yes | CBRL requirement ids the plan claims to satisfy (e.g. ["REQ-104"]). |
claimedSlices | | yes | Slice labels the plan claims to have produced (receipt material). |
TranscriptMessage
Section titled “TranscriptMessage”One transcript event: prose, a tool call, or a tool result.
| Property | Type | Required | Description |
|---|---|---|---|
index | number | yes | Monotonic within the transcript, 0-based, assigned by the capture pipeline. |
timestamp | string | yes | |
role | "user" | "assistant" | "system" | "tool" | yes | |
content | string | no | Prose content (assistant text, user prompt echo, summaries). |
tool | TranscriptToolCall | no | Present when role is "tool" (or an assistant message carries a call). |
eventId | string | no | Capture-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. |
TranscriptToolCall
Section titled “TranscriptToolCall”One tool invocation inside a transcript, scrubbed and size-capped.
| Property | Type | Required | Description |
|---|---|---|---|
id | string | no | Agent-native tool-call id, when the stream provides one. |
name | string | yes | |
args | Record<string, unknown> | no | |
result | string | no | Scrubbed 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.
