Method · Agent tooling

Dead reckoning: a coding agent’s known position.

The single artifact that let one AI agent build and keep shipping a full iOS app — a compiled, code-is-ground-truth document that keeps it oriented across a large, constantly-moving codebase.


The problem

An agent dropped into a mature codebase is lost.

Ask a coding agent to change one screen in a hundred-file app and it faces a quiet, expensive problem: it doesn’t know where it is. What is this app? Which of these files are load-bearing? What was already decided, and why? Was that bug fixed last week or is it still open?

Left to its own devices, it re-derives all of that from scratch, every session — grepping around, reading files, inferring architecture from fragments. That’s slow, it burns tokens on rediscovery instead of work, and it’s unreliable: the agent guesses, contradicts a decision made a week ago, or “fixes” something that was deliberate. The bigger and older the codebase, the worse the drift. Documentation is supposed to solve this — but hand-written docs rot into confident fiction the moment the code moves past them.


The model

Borrowed from a robot with no GPS.

The fix came from somewhere unexpected — autonomous robots. In a research lab at UIUC I worked with dead reckoning: how a robot holds its course with no constant external signal, by tracking its position from a known origin and heading and correcting against periodic fixes.

Agentic coding is the same navigation problem. Give the agent a known position and a heading (a tight spec for the task at hand), and let it dead-reckon through the work — course-correcting at real checkpoints (tests, verification) rather than being steered keystroke by keystroke. The heading changes with every task. The known position is the constant — and it needs to be a single, trustworthy thing the agent reads before it does anything.

The known position is one compiled document: the “State of the App.”

Read at the start of every session. It is the origin fix from which the next mile of work is dead-reckoned.


The artifact

What the State of the App holds.

Not a wiki and not a README. A compiled snapshot of the whole system — nine sections, each answering a question an agent would otherwise waste a session re-answering:

  1. Index & summary. What the product is, and the one load-bearing thing to internalize before touching anything.
  2. Architecture & structure. The stack, the patterns, the folder map, where the seams are.
  3. Feature inventory & status. Every feature, tagged shipped / code-done-but-unverified / partial — so nothing is assumed done.
  4. Product & design decisions. What was chosen and why, each cited to a file or migration — so decisions aren’t re-litigated.
  5. Known issues & tech debt. The open problems, ranked — so the agent doesn’t rediscover them as surprises.
  6. Contradictions & drift. Where the docs disagree with the code. The rule is printed right here: the code wins.
  7. Polish readiness. How close each surface is to done, dimension by dimension.
  8. Guardrails. What is load-bearing (change only with sign-off) versus safe to refine freely.
  9. Provenance. What was scanned, the exact counts, what was and wasn’t verified, and how to recompile.

Above the sections sits machine-readable frontmatter — the load-bearing metadata that turns a document into an instrument:

compiled-commit · the exact SHA it reflects working-tree · clean / dirty & why confidence counts · migrations · interface methods · tests sources · what was scanned

The one rule that makes it trustworthy

Code is ground truth. Compile, never hand-edit.

A document only works as a “known position” if the agent can trust it. Hand-maintained docs fail that test — they drift the instant someone forgets to update them. So this one is never written by hand. It is compiled from the code by a command, and recompiled — not patched — when things change. When the page and the code disagree, the code wins, every time, and the page is regenerated to match.

Hand-written docs

Drift silently. Age into fiction. The reader can’t tell fresh from stale. Trust erodes, so nobody reads them — and the agent re-derives anyway.

A compiled snapshot

Stamped with the commit it reflects, so drift is measurable: any session can diff the code against compiled-commit and know exactly how far things have moved. Regenerated, not maintained — it can’t rot into a lie.

There is exactly one hand-written exception — a small “Human notes” block, preserved verbatim across every recompile, for the handful of things a human knows that the code can’t confess. Everything else is a function of the source.


Compiling it

One command, three modes.

Refreshing the known position is a single instruction — /state-of-app — that scans the real sources (the app, the shared package, the database migrations, the test suites, the specs, the dated decision log) and regenerates the page from them. It runs in three modes:

  1. diff — the default. Diff against compiled-commit and rewrite only the sections that actually changed, plus the counts and the “read this first” banner. Cheap enough to run after any meaningful merge.
  2. full — re-scan everything and regenerate all nine sections from scratch.
  3. <section> — recompile just one section when only one thing moved.

It counts things directly rather than trusting prose — migrations, interface methods, tests — cites evidence as file:line, and is deliberately honest in the provenance section about what it did and didn’t verify this pass. A snapshot that lies about its own freshness is worse than none.


Why it works

The agent starts oriented, and stays that way.

With a known position loaded, every session begins already located. Tokens go to the work, not to rediscovery — which is most of why the build ran on aggressive prompt caching at roughly 98% cache reads: the same trustworthy context, re-read cheaply, session after session. Decisions don’t get re-argued, because they’re written down with their reasons. Drift is visible instead of surprising. The load-bearing pieces are fenced off by the guardrails, so the agent refines freely where it’s safe and asks before touching what isn’t.

And because the position is known rather than watched, the human isn’t in the loop keystroke by keystroke. Hand off the map and a heading; let it dead-reckon; check the fixes at the checkpoints that matter. That is what turns one person into something that moves like a team.


Lineage

Standing on prior art.

The “known position” is a small idea with good ancestry. It leans directly on Andrej Karpathy’s LLM Wiki — the pattern of an LLM that incrementally builds and maintains a persistent, structured wiki rather than re-deriving everything from raw sources on every query. The State of the App is that idea aimed at a codebase.

And it was built with two open tools in the same lineage: claude-obsidian by AgriciDaniel — a self-organizing Claude + Obsidian second brain that files any source into one connected knowledge graph — and obsidian-second-brain by eugeniughelbur — the vault structure that holds the specs, the decisions, and the compiled snapshot itself.

“The document isn’t documentation. It’s a navigation instrument — a known origin, so the next mile can be dead-reckoned with confidence.”
Read the case study   See the product