Skip to content

Day 22 — Trace, Replay, and Memory

Today Forge becomes debuggable across time.

Terminal window
cd rust/rust-ai-engineering
cargo run -p forge-cli -- replay --trace target/forge-valid.jsonl
cargo run -q -p mosaic-harness --example strict_and_forked_replay
cargo run -q -p mosaic-harness --example verified_memory_write_lab

A causal trace records ordered typed events: run started, model requested, tool proposed, policy decided, effect dispatched, receipt observed, verification failed, repair requested, and terminal reached.

Each event binds run ID, sequence number, relevant release identities, safe payload references, and resource deltas. Redact secrets before persistence; a trace is not permission to store everything.

Strict replay reproduces the recorded decision path without new inference. Forked replay changes one allowed input or release and creates a new lineage branch. Never overwrite history and call it replay.

A model suggestion is not a memory. A write proposal needs scope, evidence, subject consent where required, conflict policy, expiry, and a receipt. Retrieval must respect tenant and purpose scope.

Test stale facts, conflicting values, revoked consent, missing evidence, expired records, and concurrent writes. “The user prefers X” can be harmful when it was inferred from one task and applied globally.

For one run, reconstruct the terminal state, tool count, repair count, and final artifact identity from the trace alone. For one memory, show source evidence, grant, scope, expiry, conflict outcome, and write receipt.

Deep references: Trace design and causal debugging, Strict and forked replay, and Memory write verification.

Next: Day 23 — Evals and Release →.