trace subcommands operate on the run directories created by decide, act, and run-loop when --trace-dir is supplied. Each run directory holds the append-only decision event files from a single routing decision, plus the execution evidence accumulated by progress subcommands.
trace align is the primary verification step: it replays the decision trace against the current spec and checks structured execution evidence for every active obligation. trace compact rebuilds the summarized JSONL files from raw event files, which is useful after a run completes or when the run directory was written by multiple incremental commands.
Always use
--quiet when running trace align during normal agent execution. Without --quiet, the command emits a full transcript of every check result, which is expensive in context tokens and not needed for routine proof. Quiet mode still writes alignment.json and the proof digest to the run directory and still exits non-zero on failures.Run Directory Structure
Every trace run directory has the following layout:events/ directory is the source of truth. trace.jsonl and summary.json are derived artifacts rebuilt by trace compact. execution.jsonl is separate from the decision trace — it records what the agent actually did during execution.
trace align
Replays the decision trace against the current spec and checks the structured execution evidence in execution.jsonl for all active obligations. Produces alignment.json in the run directory and optionally a proof-digest.json that lists missing proof rows grouped by obligation kind.
Options
How alignment works
trace align runs two layers of checks:
- Decision replay — Re-runs the current spec on the captured input hash and compares the result (route selection, matched rules, forbids, elicitations, after-success) against what the trace recorded. A mismatch means spec drift or a trace/spec mismatch.
-
Execution proof — Derives active obligations from the selected route and matched rules (route fulfillment, route checks, forbid non-violations, elicitation answers, after-success completions), then checks
execution.jsonlfor structured evidence that each obligation was met.
pass— decision replay passed and all execution obligations have structured proof.unproven— decision replay passed or had no failures, but one or more obligations lack proof.fail— a deterministic decision check failed (spec drift) or execution evidence actively contradicts an obligation.
Examples
Quiet alignment during normal execution (recommended):Output (--json)
trace compact
Rebuilds trace.jsonl and summary.json from the append-only event files in <run-dir>/events/. Run this after a sequence of incremental trace writes, or when the compacted files are stale or missing.
Options
trace compact always emits JSON reporting the run id, file paths, and event count.
Example
Compact a run directory after a multi-step guided run:trace align automatically compacts the run directory before reading envelopes, so a manual trace compact call is not strictly required before alignment. It is useful for inspecting the run directory, sharing traces, or rebuilding after the events/ directory was populated by external tooling.