# Auditing architecture docs before code: nine contradictions

> Before writing the AI layer, I audited the team’s architecture docs and found nine places where they contradicted the founder. Why that audit is the cheapest code you will write.

The [AI layer for a fintech platform](/work/ai-layer/) started as a documentation job. The team had a core scope, a high-level architecture, a document working through the design decisions, a description of the agent logic for the MVP, requirements for the calendar, a note on model choice and the founder’s feedback on all of it. Before writing code I read them against each other, and the decisions document disagreed with the founder’s feedback in nine places. The feedback was the later word, so it won.

This matters more than it used to. When AI coding agents implement your specifications, a contradiction in the documents doesn’t wait for a code review to surface. It becomes two implementations, both tested, both green, at the speed the agents type.

## The nine

Each pair is what the decisions document said, then what the founder’s feedback required:

1. **No agent harness in the MVP** → a single harness as the first priority.
2. **No work between agents** → delegation, one lead agent, one combined answer.
3. **Work lives only in a conversation** → the unit of execution is a run, and system agents have runs without a conversation.
4. **A sequential worker; drop the table of step dependencies** → a dependency graph of steps; the graph sets the order, not a list.
5. **Five final statuses from the old vocabulary** → a new vocabulary for the outcome of a decision, the status of a request and the result of a step.
6. **An expired request is closed and the question asked again** → an ‘expired’ status, and resuming from it.
7. **The model has no tools** → the harness describes tools and permissions, read-only by default.
8. **Privacy is part of the requirements** → privacy as its own first-priority requirement: minimisation, retention and deletion, logs without personal data, isolation, a full audit trail.
9. **Evidence is a link to a chunk or a rule** → a contract for evidence: the source, the excerpt, the jurisdiction, the period of validity, the document version, the date it was retrieved, and the link from each claim to its evidence.

Read as a list, they aren’t nine small fixes. Items 1 to 4 and 6 describe a different execution model: durable runs with a graph of steps and delegation, instead of a worker walking a list inside a chat. Item 7 changes the security model and item 9 changes the data model. If the code had followed the decisions document, most of it would have been rewritten within weeks.

## The tenth: confidence as a gate

One more disagreement sat between other sources. Part of the material proposed a 90% confidence threshold and a score – validation × 0.6 + critic × 0.4 – deciding whether an answer goes out. The founder’s position was that rules decide the outcome.

I sided with the rules, and not only because of who said it. A confidence a model reports about itself isn’t calibrated against anything, and weights like 0.6 and 0.4 are a guess with two decimal places. Neither tells you why an answer is final. In the shipped system code sets the outcome from the rules and the presence of evidence – final, needs information, preliminary – and model scores are never shown to the client. When an answer is wrong, you can point at the rule or the missing evidence. You can’t point at a 0.87.

## An order of sources, written down

Resolving the nine was the easy part. The durable part was a written order of precedence for every later question:

1. The founder’s feedback.
2. The core scope and the high-level architecture.
3. The backend code and its documentation.
4. The decisions document, except in the nine places above.
5. The description of the agent logic.
6. The calendar requirements.
7. The note on model choice.
8. Audits – which are findings, not decisions.

Behaviour the client sees has its own rule: it follows only the requirements document for the agents and the QA report.

Putting the backend code third was deliberate. In an existing system the code is a source of truth about what is, and a specification that ignores it is a migration nobody planned.

## How it stays true

A precedence list helps only if work is checked against it. Four rules made it stick:

- **No specification and no task for an agent without a source.** Every point names the document and the section it comes from.
- **Silence or contradiction is a question, not a decision.** It goes to the owner of the requirements; the curator doesn’t settle it. The owner’s answer in chat is a source in its own right, with its date.
- **Review checks conformance to the source.** A deviation is a defect, even if the code is good.
- **Old vocabulary is banned in code.** Synonyms of the old status names aren’t allowed, so the replaced model can’t creep back in through naming.

The second rule is the one I would defend hardest. A curator who quietly resolves ambiguity is making product decisions without the authority to make them, and with AI agents those decisions are implemented before anyone notices they were made.

## What it cost

A slower start. The first days went on reconciling documents rather than writing code, and some specifications waited for answers before they could be written. On a two-week project that is a visible cost. It was still the cheapest code I wrote: every contradiction found on paper was a rewrite that never happened.

The thing I would change is where the audit lived. I kept the table of contradictions in my own notes and shared conclusions. It should have gone into a shared team document on the first day, so the team could see the reasoning and argue with it, not just receive the result.

The same idea – a claim needs a source, and a check needs an owner – carries into the rest of the project, from [the design of the pipeline](/blog/designing-a-multi-agent-pipeline/) to [testing LLM integrations](/blog/testing-llm-structured-outputs/).
