You land on a fifteen-year-old monolith. The docs/ folder describes an application that no longer exists, and the only faithful document is the code. The next day, you start a product from scratch: not a single line of code, and the whole truth is whatever you are about to write. In both cases you ask an assistant to code. In both cases it must know what to trust. And it is not the same thing.

This article asks a simple question: when you work with agents, which one is the truth, the specification or the code? It shows why common approaches answer one of the two cases well, then how AI-KIDO tries to tell them apart by looking, at every request, at where you are starting from and what you want to do.

Four situations, four truths

Before talking about tools, let us separate what you actually live through on a project.

  • New project (greenfield)Nothing exists yet. The specification is the only trace of intent: it is the one that must be the truth.
  • Transforming an existing systemYou modernise or move a system that works. The old behaviour and the target both matter: two truths at once.
  • Maintaining legacy codeYou fix, extend, understand. The code in production is reality; the documentation may well have aged.
  • Mixed casesA new feature in an old system, an external API to plug in: the source that leads changes with the request.

Keep this idea, it carries everything else: the same source is sometimes the truth and sometimes noise, depending on what you are doing. A README is precious when designing a new module, and misleading when you try to understand a production bug.

When the specification is the truth

Spec-driven development (SDD) reverses the usual order: you first write what the software must do, then the agent produces the code. GitHub presents Spec Kit this way: the spec is a contract for how the code should behave, and it becomes the source of truth that tools and agents use to generate, test and validate the code.

The work moves through phases with checkpoints. You first describe the what and the why (Specify), then you give the technical stack, the architecture and the constraints (Plan). GitHub adds that this planning phase is where you mention a legacy integration or a compliance requirement.

Kiro, the AWS editor, also organises work in three phases: requirements (requirements.md), design (design.md) and tasks (tasks.md). Its documentation also covers bugfix specs, which describe the current behaviour, the expected behaviour and what must not change.

The Thoughtworks Technology Radar sums up the movement: an emerging approach to AI-assisted coding, still being defined, that starts from a structured functional specification before breaking it into solutions and tasks. The Radar cites Kiro and Spec Kit, whose constitution sets immutable principles, then places Tessl on the more radical side: there, the spec takes over from the code.

Three levels of rigor

These tools do not all ask for the same commitment to the spec. Birgitta Böckeler (Thoughtworks), in a series published on Martin Fowler’s site, distinguishes three levels.

Three levels of spec rigorSpec-firstWritten before the task, used for that taskSpec-anchoredKept afterwards to evolve and maintain thefeatureSpec-as-sourceOnly the spec is edited by people, never thecode
The three levels of rigor described by Birgitta Böckeler: the life of the spec grows at each step.

Böckeler notes that all the approaches she looked at are spec-first, but that not all of them try to keep the spec alive, nor to make it the only source.

An arXiv preprint by Deepak Babu Piskala describes the same three levels and offers a framework to decide when SDD brings value and when a simpler approach is enough. It is a preprint, not yet a peer-reviewed study.

For a new product, this model is natural. You start from zero, no code contradicts the spec, and every decision can be written before it is coded. The spec is the truth, and the code is its outcome.

When the code is the truth

On an old system the exercise is the opposite. The original specifications have been edited by twenty hands, the documentation has aged, and what runs in production is the only exact description of the behaviour. The principle that the code is the source of truth is nothing new: it has long guided people who work on existing systems. What AI changes is how fast you can read it.

The Thoughtworks authors make this point in an article published on Martin Fowler’s site in September 2024: most uses of generative AI in development aim at producing code, while there is as much value, if not more, in understanding existing code, especially in long-lived, large and complex systems.

Their tool, CodeConcise, combines a language model with a knowledge graph built from the abstract syntax trees of a codebase. They report good results in drawing out low-level requirements and in building a high-level explanation of a system. In other words, you start from the code, and it feeds the documentation.

The large cloud players offer products in this direction. AWS Transform presents itself as an agentic service that aims to accelerate and de-risk each stage of modernisation: infrastructure, applications such as mainframe or Windows, and continuous fixing of technical debt.

Microsoft describes GitHub Copilot modernization as an end-to-end agentic solution that analyses and upgrades Java, .NET and C++ applications, and helps migrate some of them to Azure. In both cases the starting point is the application as it exists today.

Two axes: where you start, what you trustGreenfieldExisting codeThe spec is the truthSpec-drivenSpec first, thenplan, tasks, codeRarely coveredA spec to write for asystem that alreadyexistsThe code is the truthRarely neededNo code yet, sonothing to documentfromCode as truthRead the code,document from it,modernise step bystepAI-KIDO: the request decidesThe truth evaluator picks the leading sourcefor each scenario
Two axes to place the approaches: where you start (new project or existing code) and what you hold as true (the spec or the code). AI-KIDO aims at the whole grid.

Habits that have proven themselves

These tools build on practices that are much older. In Working Effectively with Legacy Code, Michael Feathers offers strategies for working with large codebases that have no tests.

Martin Fowler recalls that a seam is a place where you can change the behaviour of the system without editing its source code. You use it to break dependencies, to test more simply, to insert observability probes or to redirect the flow to new modules; he credits Michael Feathers with the term.

The same author describes the Strangler Fig, a term now often used for a gradual approach to legacy modernisation: the old system is replaced bit by bit rather than all at once.

On the documentation side, Cyrille Martraire argues in Living Documentation that you do not have to choose between working software and thorough documentation: a living documentation can help at every stage of a project.

2 familiesof approaches, each expert in a single point of view: the spec for the new, the code for the existing

Why each family sees only one side

There is no flaw here, only specialisation. A spec-driven approach assumes a well-thought spec comes before the code; on a new project, that holds. A code-centred approach assumes the real behaviour is the reference; on an old system, that holds too. The problem appears when the ground mixes both. You add a feature to an old system: should you write a full spec, as for a new product, or rather read the code around it? You fix a bug in a recent module next to an inherited one: is the new module’s spec enough?

In the sources I read, each of these families is described by its own starting point. I did not find a tool presented as a referee that, for each request, chooses between the spec and the code. That is the gap AI-KIDO tries to fill, without claiming to be exhaustive about the market: I only read the sources cited here.

AI-KIDO: let the request decide

AI-KIDO does not pick a side. Its agent-aikido-truth-evaluator agent has a mission worded like this in its definition: determine what represents “truth” based on the development scenario. For spec-driven work (a new feature), the specs are the truth. For maintenance (existing code), the implementation is the truth. In case of conflict, context decides. Its role is that of a referee: it tells you which source to trust, it does not decide what to do next.

What the truth evaluator does1. Classify the scenarioFrom the words of your request2. Discover and score sourcesSpecs, code, docs, config, tests3. Detect conflictsWhere two sources contradict each other4. Ranking and recommendationWith a confidence level
How an evaluation unfolds: classify, score, compare, then recommend.

Eight scenarios, one leading source for each

The evaluator files your request under one of the eight scenarios of its matrix, based on the words you use. Here is what that matrix says, on the leading source:

The spec or the target leads

  • New feature (“implement”, “add”): the specs in gen/ and hard_points/.
  • Starting from scratch (“initialize”, “bootstrap”): the project specs.
  • Configuration: the configuration specs in the hard points.
  • API integration: the official documentation of the external API.

The code leads

  • Bug fix (“fix”, “bug”): the current code, with tests in support.
  • Documentation (“document”, “README”): the current code, that is, reality.
  • Investigation (“understand”, “how does”): the implementation, with tests and Git history.
  • Refactoring: both the goals and the current code, two truths.

Look at the “Documentation” scenario: the code leads, and the specs only come as a reference for intent. This is exactly the “code as truth” idea applied to writing documentation. At the other end, for a new feature the specs lead and existing code is not to be followed unless it is cited. The two families of the industry therefore live in one table, and your request selects the row.

The hierarchy of locations

Above these scenarios, AI-KIDO sets an order between the places where knowledge lives: hard_points/ (immutable truths, absolute priority), then gen/ (the project truth tables, which evolve), then code, documentation and configuration. The spec/ folder, your personal space, is never a source of truth: it is ignored unless you activate it explicitly.

Which source winshard_points/immutable,absoluteprioritygen/the project truth tablesspec/personal, ignored unless activated
The location sets the base priority; the scenario then decides what leads for your request.

Conflicts, a signal rather than an incident

When two sources contradict each other, the evaluator does not settle it silently. If gen/ and the code have diverged, it flags a high-priority conflict and recommends realigning them. If every source is outdated, it flags technical debt and recommends investigating first. If the situation goes in circles, it hands the decision to the human together with its analysis. Each source gets a score that accounts for the scenario, the location, recency and the presence of tests (bonuses), as well as a deprecation mark or a contradiction with another source (penalties).

What you do, what you see

Back to the monolith. You have to fix a bug in an old authentication module. Before letting the agent change anything, you ask it to run the evaluator:

  1. You
    I need to fix a login bug in the authentication module. Run the truth evaluator: which sources should I trust?
  2. Assistant
    Truth Evaluation: bug fix
    🥇 Primary source: the current code of the module (high confidence).
    🥈 Supporting: the tests, which state the expected behaviour.
    🥉 Reference: the specs in gen/, for intent.
    ⚠️ Conflict: the truth table describes a flow the code no longer applies.
    ❌ Ignore: anything under spec/.

What you read looks like a ranking. This example is illustrative: the real content depends on your project, but the shape is the one the agent defines, with the primary source, supporting sources, conflicts, what to ignore, then a recommendation and a confidence level. You then decide: the code is right, the truth table needs updating, or the other way round.

Now the other day: you start the new product and ask “implement login by email”. The same evaluator now files the request as a new feature. The specs lead, the architecture supports, and existing code is not a source to follow unless it is cited. You changed nothing in how you ask: the wording of the request steered the ranking.

Keeping sources in agreement: check-truth

The evaluator answers one request. The /check-truth command takes care of the whole: it verifies the consistency between the Memory Bank documentation and the project code, detects obsolescence and conflicts, and proposes automatic remediation. You can run it on the whole project, or narrow it with options.

bash
/check-truth
/check-truth --file /prompts/gen/concepts/oauth.md
/check-truth --domain concepts
/check-truth --code-path ./src/auth/
/check-truth --dry-run
A few usages of the command, taken from its definition. The --force-check, --search and --verbose options exist too.

To go fast, the command relies on each document’s header: if it carries a last-check date, an up-to-date status and unchanged sources, the check is skipped. The agent file gives this example header.

text
Truth Source: Code
Last Check: 2025-01-10
Check Status: ✅ Up-to-date
Source Refs: src/auth/oauth.ts:45-120
Example header taken from the evaluator definition. A check is only redone if a source changed since, or if the last one is more than 90 days old.

In the end you get a readable report: the coherent files, the minor drifts, the major conflicts, then recommended actions. Automatic correction only happens if you choose it.

A diagram to keep in mind

Which source leads for your requestYour requestIs there code already?No: starting from scratchThe specs leadYes: what do you want to do?Add a featureThe specs leadFix a bug, or understandThe code leads, tests supportRefactor or migrateTwo truths: current code and targetAlways firstThe immutable hard points
The question that comes back with every request: is there code already, and what do you want to do with it?

What this approach brings is mostly flexibility. It does not ask you to pick a creed once and for all. It accepts that, in the same week, the spec is the truth on Monday and the code on Wednesday, and it helps you not to mix them up.

Try it

  1. Pick a real request in progress, for example a bug or a new feature.
  2. Ask your assistant to run the truth evaluator before changing anything, using the key word of your request (“fix”, “implement”, “understand”).
  3. Read the ranking, follow the primary source first, then handle the flagged conflicts by updating the Memory Bank or the code.

References

  1. GitHub Spec-driven development with AI: Get started with a new open source toolkit
  2. Kiro (AWS) Specs – Kiro docs
  3. Thoughtworks Technology Radar Spec-driven development
  4. martinfowler.com Understanding Spec-Driven-Development: Kiro, spec-kit, and Tessl Birgitta Böckeler, 15 October 2025
  5. Tessl Tessl – Software factory
  6. arXiv Spec-Driven Development: From Code to Contract in the Age of AI Coding Assistants Deepak Babu Piskala, 30 January 2026, preprint
  7. Amazon Web Services AWS Transform
  8. Microsoft Learn Analyze Applications and Migrate to Azure by Using GitHub Copilot Modernization
  9. martinfowler.com Legacy Modernization meets GenAI Alessio Ferri, Tom Coggrave, Shodhan Sheth, 24 September 2024
  10. martinfowler.com Strangler Fig Martin Fowler, 22 August 2024
  11. martinfowler.com Legacy Seam Martin Fowler, 4 January 2024
  12. InformIT (Pearson) Working Effectively with Legacy Code Michael Feathers, 2004
  13. Leanpub Living Documentation by design, with… (Cyrille Martraire)