Nerudo

Nerudo's architecture, written down where agents read it and checked in the gate

nerudo/nerudo now has an architecture map, decision records and a proposed direction that agents load before they work, and the landing gate checks the map, the decisions and the required runtime suites.

Scripted demonstration

Agents write most of nerudo/nerudo and land it through a gate that checks tests, lints and policy. Until T-384, nothing in the repository said what the components are, how they may depend on each other, or which design decisions are settled, so each agent rediscovered the structure from the code. T-384 writes it down where agents load it and adds two checks to the gate. Product behaviour is unchanged; the repository's guidance and CI changed, and anyone can read them in the public repository.

The first two figures are signed-out captures of production at the deployed commit 4aaf543. The last two are scripted local runs of the new gate scripts in a clean terminal session, on a scratch copy of the files those scripts read, taken from the same commit; in a full checkout, both print the same lines.

The map

The root AGENTS.md now sends an agent that adds a component, a dependency or binding between components, a route another Worker calls or a public contract to ARCHITECTURE.md. That file names each component and what it owns, and draws how they connect while running: the service bindings between nerudo-web, the MCP server and the forge, the forge's calls to the type-check and signature Workers, and the Durable Objects each side reads. It lists eight rules that must hold and says where new code goes. Its machine-readable form, .nerudo/architecture.json, lists 29 components with their allowed dependencies, Worker bindings and decisions, plus three known exceptions to its rules.

ARCHITECTURE.md at commit 4aaf543 in the public nerudo/nerudo repository on nerudo.dev, with its introduction, bird's-eye view and runtime diagram of the Workers and their bindings
Signed-out headless capture of production nerudo.dev at the deployed commit 4aaf543.

The first figure is a signed-out capture of ARCHITECTURE.md on nerudo.dev, with its rendered runtime diagram.

Decisions and direction

Each settled decision is now one MADR file in docs/engineering/adr, with front matter for status, date, decision-makers, tasks and the paths it governs. Of the six, only the two the maintainer already made elsewhere are accepted: laying out the repository by role, and keeping Anthropic API code review out of the forge's gate. Each names the maintainer and says where they decided. The other four stay proposed until a maintainer accepts one by sealing a change that does only that. docs/engineering/DIRECTION.md holds three candidate outcomes, also proposed; the maintainer has put trustworthy automation first and left the order of the other two open.

The architecture decisions index at commit 4aaf543: decisions 0002 and 0003 accepted, 0001, 0004, 0005 and 0006 proposed
Signed-out headless capture of production nerudo.dev at the deployed commit 4aaf543.

The second figure is a signed-out capture of the decision index, with each decision's status.

The checks in the gate

A new qa step runs .nerudo/scripts/check-guidance.mjs. It fails on a malformed map, a component or decision the map names that does not exist, a decision record with bad front matter or missing from the index, an accepted decision without a maintainer from nerudo.toml or without evidence, and a link or anchor in the guidance documents that does not resolve. Where the code and the map disagree (Cargo path dependencies, wrangler service bindings, directories the map lacks, stale exceptions, or a structural change with no decision record) it reports without failing.

The runtime-suite guard moved to .nerudo/scripts/suites-wired.mjs as its own qa step. Ten authorization and account-lifecycle suites sit in a REQUIRED list inside that script, and a web-job step has the script run them itself, so no unsealed file decides whether they run. Everything under .nerudo already needed the governance seal; nerudo.toml now adds ARCHITECTURE.md, the decision records and DIRECTION.md, so changing any of them waits for a maintainer.

Terminal: check-guidance passes with 29 components, 6 decisions and 2 advisories, suites-wired counts 10 required and 11 other suites, and nerudo.toml lists the new governance entries
Terminal capture of a scripted local run in a clean session, on a scratch copy of the files the two scripts read at 4aaf543. Not CI.

The third figure runs both scripts on the unchanged copy. The guidance check passes with 29 components and 6 decisions, the suite guard counts 10 required and 11 other suites, and nerudo.toml shows the new governance entries. One advisory is the CLI's embedded test fixtures, which no decision covers yet; the other is that Cargo is not installed in the capture environment. The landed commit's message records one advisory for the same check.

Terminal: a printed script applies five faults, check-guidance reports 5 errors and an advisory and exits 1, and suites-wired fails because a required suite is missing
Terminal capture of a scripted local run in a clean session, on the same scratch copy after five deliberate faults. Not CI.

The fourth figure prints a script of five deliberate faults, applies it, and runs both scripts again. Marking decision 0004 accepted produces three errors: no maintainer, no evidence, and an index that still lists it as proposed. The unknown decision 0042 and the broken link add one error each, the new apps/notes directory is only an advisory, and the check exits with status 1. With a required suite deleted, the suite guard stops with "required suite apps/forge/tests/voided-approvals.mjs is missing." and exits with status 1 too.

In production, the public Pipelines page for batch #438, which landed 4aaf543, shows the qa job passing with the steps "architecture guidance" and "forge runtime suites are wired into the gate", whose log shows the same suite count as the third figure. That page is not reproduced here because it names the runner machine.

Limits

Disagreements between the code and the map are advisory, and the check does not see TypeScript imports, routes or contracts. The structural-change report compares the whole batch with main, so a decision record in another pull request of the same batch hides it; the scratch copy had no Git history, so the figures do not show that report. The suites' own code is not sealed: a change that weakens a suite shows only in its diff. Most decisions and the direction are proposals, not accepted policy. Nothing makes an agent read ARCHITECTURE.md; AGENTS.md points to it, and the gate checks only what these two scripts check.

Walkthrough details

Two figures are signed-out headless captures of production nerudo.dev at the deployed commit 4aaf543. Two are scripted local runs of the commit's .nerudo/scripts/check-guidance.mjs and .nerudo/scripts/suites-wired.mjs in a clean terminal session with a scratch home and no profile, on a scratch copy of the files those scripts read, taken from 4aaf543; a run in a full checkout printed the same lines. Nothing signed in; no Git history in the copy.

  1. Open ARCHITECTURE.md at 4aaf543 on nerudo.dev signed out and read the map and its runtime diagram.
  2. Open docs/engineering/adr/README.md at 4aaf543 signed out and read each decision's status.
  3. Read the public Pipelines page for batch #438's qa job and its two new steps (not reproduced: it names the runner machine).
  4. Copy from 4aaf543 the files the two scripts read into a scratch directory and confirm both print the same lines as in a full checkout.
  5. Run check-guidance.mjs and suites-wired.mjs on the unchanged copy, and show nerudo.toml's new governance entries.
  6. Apply five printed faults (decision 0004 accepted, unknown decision 0042, a broken link, an unmapped directory, a deleted required suite) and run both scripts again.

Captured · Product view · Verification source