Proving what the factory did
When an agent changes code, the question isn't just 'what changed?' — it's 'who decided this, and why?' Decision provenance is the most painful thing to retrofit. Design it in from day one.
A diff tells you what changed. It doesn’t tell you who decided it, or why. For a factory — where some decisions were made by a human and some by an agent — that gap is a problem. If you can’t reconstruct the reasoning behind a change, you can’t really trust the output, review it well, or defend it later.
What you need is decision provenance: a record of every decision, whether a human or the AI made it, and which spec, ticket, or requirement drove it. Not a log of actions — a log of decisions.
The ticket is the spine
Don’t build a separate audit system. The ticket is already the object that flows through the whole factory — make it the spine of the provenance record. Every decision links to the ticket; the ticket accumulates the trail.
ticket #4821
│
┌────────────┬───────┼─────────────┬──────────────┐
▼ ▼ ▼ ▼ ▼
decision-1 decision-2 decision-3 decision-4 decision-5
human: agent: human: agent: human:
"approve "use "revise "implement "merge
design" approach B" approach" approach B" PR"
│ │ │ │ │
└────────────┴───────────┴───────────┴────────────┘
the updated ticket = the trail
The “updated ticket” that’s the definition of done isn’t just a status note; it’s the provenance record. That’s the payoff of making the ticket the single source of truth: the audit trail falls out for free.
Why it’s a first-class artifact, not an afterthought
Trust. A reviewer can see which parts were human-judged and which were machine-generated, and weight their review accordingly. “A human signed off on the design; the agent did the implementation” is a very different posture than “the agent did all of it.”
Debugging. When something’s wrong, you trace back to the decision and the input that caused it — not just the diff. Provenance turns “why is this here?” from an archaeology project into a lookup.
Compliance. In regulated environments — and increasingly under AI-governance rules — you have to be able to show why an autonomous system did what it did. In some contexts this is a hard requirement, not a nice-to-have. If you’re building for a team that answers to a compliance function, provenance is on the critical path, not the backlog.
The decision-event schema
This is the most painful thing to retrofit, because retrofitting means reconstructing intent from logs that weren’t designed to capture it — and you’ll always be missing something. So define the schema early, even if the UI is bare. A minimal structured record per decision:
{
"decision_id": "d-3",
"ticket": "4821",
"actor": { "kind": "human", "ref": "reviewer-1" }, // or { "kind": "agent", "ref": "dev-worker" }
"decision": "revise approach",
"rationale": "approach A can't satisfy the offline requirement",
"source": { "type": "ticket", "ref": "4821", "section": "constraints" },
"timestamp": "…"
}
The actor field is the one that matters most. A decision chain that’s all-agent is a different trust and compliance posture than one with human sign-offs at the seams — and the record has to make that distinction explicit, not implied. Every gate resolution is exactly one of these events with actor.kind = "human", so the two features share a record shape.
The trade-off, stated plainly
Provenance is a completeness-versus-overhead bet. Capture every decision and you add friction to every step — the agent has to articulate a rationale for things that felt obvious, and humans have to record sign-offs they’d otherwise skip. Capture too little and you’ve built a system you can’t defend when the hard question arrives.
The honest line is: record the decisions that change what you’d do, not every keystroke. A decision that a human would reverse-engineer differently is worth an event; a mechanical step is noise. The risk is that “which decisions matter” is a judgment call you make under time pressure, in the moment, and getting that line wrong is how you find out — after the fact — that the one decision you didn’t record is the one the auditor asked about.
Open questions
- How granular is “a decision”? A merge is one. But is “the agent chose approach B over C” one decision or three (consider A, reject A, pick B)? Too fine and the record is noise; too coarse and you lose the reasoning. I don’t have a clean rule.
- How much do you trust agent-reported rationale? The
rationalefield is written by the agent about itself. It’s better than nothing, but it’s self-reported — a compliance posture that leans on it has to say so explicitly. - Retention and scope. The ticket accumulates the trail, but tickets have lifecycles. How long do decision events live, and are they queryable across tickets? That determines whether provenance is per-task or actually a system you can audit.
Get the schema right first and the dashboard can come later. Get it wrong and you’ll be guessing.
This is part of the Software Factory series.