Requirement Provenance for AI Agents
Every requirement an agent acts on should name its source, and a person's words should be quoted from a real turn, not remembered.
Answer first
Requirement provenance means every requirement, request and consequential decision an agent records carries a source in a form a program can check. A person's words are cited by session and message with a verbatim quote, and the checker confirms the quote appears in a turn a human actually typed. Agent memory, chat recollection, tool output and pasted blocks are rejected as sources. A conclusion the agent drew itself is allowed, but only as an explicitly labelled assumption with its inputs and a reason. The payoff is that "who asked for this?" has a checkable answer wherever the rule is enforced, and nothing reaches a person as "needed from you" without a trace.
The problem
Agents act on instructions that pass through many hands: a message, a summary after context compaction, a pasted document, a note from another agent. Each hop is a chance for a requirement to be invented or distorted. In regulated or high-stakes work you need to show where a requirement originated, which is the same question W3C PROV formalises for data: who, what and which earlier thing it came from.
The source kinds
In the open-source agent harness, a source is one of:
- A user turn, by session and message id, with a verbatim excerpt.
- A ticket in a tracker.
- A log entry, pointing at an earlier note, which carries its own source.
- A file line, by path, line and commit, with an optional excerpt.
- An inference, written
inferred: from <source> ; <source> -- <why>.
"Memory" and "chat" are not kinds. The parser says so in its error text.
What makes a user source count
A user citation is checked against the transcript, not trusted:
- The turn must have been typed by a human. Tool results, compaction summaries, meta turns and turns with an unmarked origin are rejected.
- Blocks that tools inject into a turn, such as system reminders, task notifications and agent messages, are stripped before the quote is compared, so an instruction hidden in one cannot pass as the person's words.
- Each excerpt segment must be long enough to mean something. A one-word quote proves nothing.
- The quoted text must actually appear in that turn.
An inference needs a rationale of at least ten characters and at least one grounded input. Free text such as "the usual convention" is not an input.
Enforcement levels
Not every record deserves the same strictness. Requirements and asks, the things that send work to a person, are enforced: a note without a source is refused and nothing is written. Decisions, scopes and blockers are in warn mode: the note is written but flagged as unsourced, so gaps are visible without stalling work. Per the documentation (not exercised in our lab), environment settings can only tighten these modes, never loosen them.
A trace command walks a log entry back through its chain to the person's original words, so a reviewer can follow a requirement to its origin in one step.
What we ran
From our lesson labs: standard library only, a throwaway home directory and a synthetic five-turn transcript written by the script. First a toy checker with 14 tests, then five planted bugs, each of which must fail the suite:
Ran 14 tests in <t>s
OK
mutant STRIP: FAILED (failures=1)
mutant ORIGIN: FAILED (failures=1)
mutant TOOL: FAILED (failures=1)
mutant SHORT: FAILED (failures=1)
mutant GROUND: FAILED (failures=1)
Then the real checker at commit 504d930:
== user sources against the synthetic transcript
typed words exit 0 [USER]
typed part of a turn exit 0 [USER]
reminder inside a turn exit 2 [UNTRACEABLE] REJECTED excerpt-not-found: excerpt not found in that turn: "Always delete old
tool result turn exit 2 [UNTRACEABLE] REJECTED not-user-authored: turn is a tool result
injected, no origin exit 2 [UNTRACEABLE] REJECTED not-user-authored: turn origin is unmarked, not human
invented quote exit 2 [UNTRACEABLE] REJECTED excerpt-not-found: excerpt not found in that turn: "export the report
== other kinds
inferred, grounded exit 0 [ASSUMPTION]
file line, no excerpt exit 0 [FILE] weak flag: UNVERIFIED citation
file path escape exit 2 [UNTRACEABLE] REJECTED file-path: file: path must be repo-relative with no .. segments
And the note writer, where requirements are enforced and decisions only warn:
WAL lines before=0 after=0
requirement, user source: exit 0
decision, no source: exit 0 wal_note: provenance warning: decision has no --source
decision row flags: {'provenance': 'missing', 'unsourced': True}
Then a trace of a log entry back to the person:
excerpt: "export the report as CSV"
message:
| Please export the report as CSV, with a header row.
ORIGIN: USER-SOURCED
Not run: ticket sources (they need a tracker lookup), the ask-gate for interactive questions, and several lookup helpers.
Decision framing
Provenance adds a few seconds per recorded requirement and some friction when an agent wants to cite its own memory. It pays when several agents hand work to each other, when summaries are common, or when someone will later ask who approved a change. For one-off scripts it is more than you need; a short comment is enough.
Risks and limits
- Our threat model is a careless or hallucinating agent, not a hostile one. A determined actor who controls the transcript can forge it.
- A quote that exists does not prove it supports the claim made from it. A person still has to read the quote.
- File citations without an excerpt are accepted with a weak "unverified citation" flag.
- Strict enforcement on requirements and asks, with warnings elsewhere, is a policy choice. Pick the split that matches your risk.
Related reading
FAQ
- What is requirement provenance?
- Requirement provenance means every requirement, request and decision records where it came from, in a form that can be checked: a quoted turn from a real person, a ticket, an earlier log entry, a line in a file, or an explicitly labelled inference.
- Why can't an agent just remember what the user said?
- Agent memory and chat summaries are not evidence. Summaries drift, and text injected into a conversation by tools or other agents can look like a person's instruction. A checkable quote from a real human turn can be verified.
- What is an inferred source?
- An inferred source is the agent's own conclusion from named inputs, with a written rationale. It is always labelled an assumption, so it is never presented as something the user asked for.
- Does a valid quote prove the requirement is right?
- No. It proves the words exist in a turn written by a person. Whether those words support the claim still needs a reader.