Design docs as source is a pattern in which the durable artifact is a set of natural-language design docs, and code is regenerated when a doc changes.1 Humans edit the docs, and the code is treated as disposable when the implementation will be invalidated often.1
Overview
Worked examples in the spec give the generator a demonstration, not only a wish.1 Regenerated code is checked against a hand-audited reference.1
Mechanism
- The repository is kept as a directed graph of design docs.1
- Every human change is an edit to a doc.1
- The docs are written around step-by-step worked examples.1
- Regeneration is anchored on a small fixed spine that the agents do not invent.2
- The regenerated artifact is checked against a reference.1
Applications
The pattern applies when patching an implementation costs more than regenerating it from a spec.
Limitations
The pattern concerns implementation code. A compiled wiki is not discarded and regenerated from scratch on each ingest, and an empty code branch is not a rule for every repository.
Worked example
In the library described in the source paper, design docs form a graph, agents regenerate the code doc by doc, tests and reference models check the build, and the orchestrator logs where the prose was unclear.1
- The main branch holds almost no code: it is a folder of self-contained design docs that form a dependency graph.
- Read-only agents infer the dependency edges between docs. An orchestrating agent then walks the graph in dependency order and gives each doc to its own coding agent.
- Each doc is written around step-by-step worked examples, and every doc that carries numbers ends with a small preset whose expected outputs are stated exactly and checked by generated tests.
- The regenerated build must reconcile against hand-audited reference models before it replaces the previous build.
- The orchestrator logs where agents struggled with the prose, so humans know which docs to clarify. Humans only ever edit the docs.
See also
- Thin harness, fat skills – the thin harness
- Skillify authoring – skills as folders, not as regenerated code
- Autoresearch loop – keep-or-discard of experiments, a different loop