← The seriesyingzhiva.github.io
Field Notes · No. 02 · Single Source of Truth

Say It Once

The same fact copied into three places isn't redundancy, it's a future contradiction. A note on giving every fact exactly one home: in the code, the prompt, or the knowledge file, and never more than one.

Field note·~6 min read·Details generalized
The same value in three homes. Edit one and the others go stale, until the copies collapse into a single source the rest just point to.

In the last note I said a tested function was "one place you can read, test, and fix." That sentence was hiding a whole discipline of its own. Building this system, information could live in three kinds of places: in the code, in the agent's prompt, or in a knowledge file the agent reads. The single most durable habit I formed was not letting the same fact live in more than one of them.


01 · The failure mode

Two copies of a fact are a contradiction waiting to happen

Duplication feels harmless when you write it. You're just being helpful, restating a rule where it's convenient. The rot shows up later, on the day someone edits one copy and not the other. Now the system quietly disagrees with itself, and nothing complains: both versions are individually valid, so no schema catches it and no test fails. It's the same slow divergence a drift eval exists to catch, except self-inflicted.

Duplicated facts don't stay redundant. They wait for one edit and become a contradiction.

And even before anything goes stale, every duplicate costs you twice more. It bloats the context. The agent spends attention re-reading what it already knew, and signal drowns in the repetition. And it bloats the bill: you ship those redundant tokens into the model on every single run, forever, for nothing.

02 · The rule

One home per fact; everything else points to it

The discipline is simple to state and constant to uphold: choose the single right home for each fact, and make every other place that needs it reference that home rather than restate it. The interesting part is that deciding which home forces you to understand what kind of fact you're holding.

Which home a piece of information belongs in, and the one question that tells you.
HomeWhat belongs thereThe edit test
codeDeterministic logic, formulas, constants, i.e., anything computed.If it's calculated, it lives with the calculation.
promptHow the agent must behave: workflows, rules, output conventions.A behavior the agent follows.
knowledge fileDomain facts and reference data the agent looks things up in.A fact the agent consults.

The test that settles almost every case: if this changed, what's the one file I'd open to change it? That file is its home. If the honest answer is "three files," you've found a duplication to collapse.

For every fact, there should be exactly one file you'd open to change it.
03 · Why it's worth the discipline

Change-proof, lean, and clearer to think about

Single-sourcing buys three things at once. It's change-proof: one edit, and nothing anywhere else silently contradicts it. It's lean: the agent reads less, so it attends better and each run costs less. And, here is the quiet benefit, it makes you think more clearly, because you can't file a fact until you've decided what kind of fact it is: logic, instruction, or knowledge.

It's the same instinct as the harness note, widened. There, the point was that the math should live in exactly one place. Here it's every fact. Contracts keep two components from disagreeing about the shape of what they pass; single-sourcing keeps the whole system from disagreeing with itself about the facts. Both are just the refusal to leave the same thing said in two voices.

Carry-forward · The transferable part

What I'd keep single-sourced

  1. Every fact gets exactly one home

    Code, prompt, or knowledge file. The same fact in two places is a latent contradiction, not a convenience.

  2. Reference, don't restate

    Where a fact is needed elsewhere, point at the source instead of copying it. A copy is a promise to keep two things in sync forever, and you won't.

  3. Use the edit test to find the home

    Ask "if this changed, what's the one file I'd open?" That file is the home. If the answer is several, you've found duplication to collapse.

  4. Match the fact to the kind of home

    Computed things live in code; behaviors live in the prompt; looked-up facts live in the knowledge file. Filing it forces you to know what it is.

  5. Duplicated context is paid for every run

    Every redundant line is attention the agent spends re-reading and tokens you buy again on each invocation.

  6. Single-sourcing is the sibling of contracts

    Contracts stop components disagreeing about shape; single-sourcing stops the system disagreeing with itself about facts. Same refusal, different axis.