Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rule Index

Who this is for — the reader with five minutes, and the agent that needs the whole book compressed into a checklist.

Read this if — you want every normative rule in this book on one page.
Skip this if — you want the reasoning; each rule links to the chapter that argues it.

Takeaways

  1. Every rule in this book appears here exactly once, with exactly one home chapter.
  2. Rules with a command in the last column are enforced by machine; the rest are enforced by attention.
  3. If a rule is not here, it is not a rule — it is an opinion in a paragraph.

Last updated: 2026-08-09.


Principles

#RuleHomeEnforced by
P1Never ask an agent for feature code that has no automated way to be checked.Manifestojudgement
P2Write the harness, canary, or test suite before the feature.Manifestojudgement
P3The repository is the only source of truth; if it is not in a file, it does not exist.Manifestojudgement
P4Keep the harness lightweight and transparent; the human triggers steps and stays accountable.Manifestojudgement
P5Prefer strict, self-contained tools and static binaries over resident daemon architectures.Manifestojudgement
P6Every line you do not write is a line no agent can misunderstand — keep it minimal.Manifestojudgement

The Loop

#RuleHomeEnforced by
L1When a check is green but the result is wrong, add the missing check before fixing the bug.Golden Pathjudgement
L2A commit carries code, tests, and spec together, in conventional-commit form.Golden Pathreview
L3Record which model helped in a Co-Authored-By: trailer, not in prose.Golden Pathgit log
L4Run the preflight gate before ending a turn or handing over.Agentic Dev Patternsmake preflight
L5Before a context compaction or session end, write state, warnings, and next steps into issues/.Agentic Dev Patternsjudgement

Canaries

#RuleHomeEnforced by
C1If you cannot verify a mechanism with a fake, write a canary before writing the feature.Canary-Firstjudgement
C2A canary isolates one external mechanism — no application logic, no abstractions.Canary-Firstreview
C3Run the canary against the real environment and inspect its output directly.Canary-Firstmake canary
C4Document what the canary found; the finding is the design input for the feature.Canary-Firstreview
C5Never delete a canary — keep it as the cheapest regression check you own.Canary-Firstmake canary

Specs & Configuration

#RuleHomeEnforced by
S1No layout constants, UI labels, key bindings, or colors inside application code.Agentic Dev Patternsreview
S2Declare them in spec/ files and embed them at compile time (//go:embed, @embedFile).Agentic Dev Patternsreview
S3Generate every derivative format from the master spec; never hand-maintain a copy.Agentic Dev Patternsreview
S4One component, one language — never maintain the same logic twice in two languages.Agentic Dev Patternsreview
S5Prefer self-contained binaries that exit and clean up over background daemons.Agentic Dev Patternsreview

Golden Files

#RuleHomeEnforced by
G1Shrink the repro to the smallest failing input, and find a control that does not fail.Golden-Change Playbookjudgement
G2Prove the root cause with numbers, not screenshots; state it as a formula.Golden-Change Playbookjudgement
G3Run the real production code in diagnostic scripts; never reimplement it.Golden-Change Playbookreview
G4Write down which goldens will change before editing code.Golden-Change Playbookjudgement
G5If the actual diff set differs from the prediction, revert and re-diagnose.Golden-Change Playbooktest diff
G6Fix the layer where the wrong value originates, and delete downstream band-aids.Golden-Change Playbookreview
G7Assert the underlying invariant in a unit test, not just the output string.Golden-Change Playbooktest suite
G8Regenerate goldens deliberately, revert unpredicted changes, and inspect the new values.Golden-Change Playbookgit diff
G9Never use the update flag to make a red suite green.Golden-Change Playbookreview
G10Commit tests, code, docs, and issue references together.Golden-Change Playbookreview

Terminal & Teardown

#RuleHomeEnforced by
T1Every exit path — selection, cancel, SIGINT/SIGTERM, panic — runs the full teardown sequence, in order.TUI RestorationPTY harness
T2Disable mouse tracking first, then drain in-flight input with a CPR (\x1b[6n) handshake.TUI RestorationPTY harness
T3Restore termios before erasing anything.TUI RestorationPTY harness
T4Erase only the rows the TUI occupied (\x1b[2K); never \x1b[J or \x1b[2J.TUI RestorationPTY harness
T5Park the cursor at the recorded start row and emit nothing after it.TUI Restorationvisual check
T6Emit ?1049l only if you emitted ?1049h; keep separate inline and alt-screen restore sequences.TUI Restorationvisual check
T7Keep the ? in DEC private modes, and disable auto-wrap (\x1b[?7l) during inline renders.TUI Restorationreview
T8Parse mouse input with a ≥512-byte buffer, a multi-event loop, and a carry buffer for split events.TUI RestorationPTY harness
T9On full-width rows, skip trailing \x1b[K — pending wrap makes it erase the last drawn cell.TUI Restorationgolden ANSI
T10Verify teardown visually on a VTE terminal, on Foot, and under tmux.TUI Restorationmanual protocol
T11Parse CPR responses with a character-by-character state machine so user keystrokes are never eaten.TUI RestorationPTY harness
T12Distribute grid remainder cells across the first R columns so widths sum exactly to W.TUI Restorationunit test
T13Write sandboxed tool output under the user’s home, never to the system /tmp.TUI Restorationmake canary
T14Set PDEATHSIG immediately after spawning a subprocess so no child outlives its parent.TUI Restorationreview

Verification You Can Trust

#RuleHomeEnforced by
V1Before marking version-gated behavior Resolved, confirm its regression test actually ran — a test that can silently skip is not a check.The Canary That Skipped ItselfAGENTS.md
V2Never infer an external tool’s version threshold from one installed copy — probe the binary that will actually run.The Canary That Skipped Itselfreview
V3Shared process state a test forces (a sync.Once, a package-level flag) must be reset on cleanup, or later tests silently inherit it.The Canary That Skipped Itselftest suite
V4When a bug’s only symptom is inside a GUI the agent cannot observe, ask a human to check one change at a time.The Canary That Skipped Itselfmanual protocol

Inheritance & First-Shot Code

#RuleHomeEnforced by
I1Review generated code’s success paths first — a fallback that reports success is more dangerous than a crash.The Single-Prompt Miraclereview
I2When a fix makes an operation fail closed, verify the operation is still reachable on a stock install.The Single-Prompt Miraclemanual protocol
I3Write the issue spec — Summary, Motivation, Proposed Solution, Alternatives Considered — before handing a fix to an unfamiliar agent or harness.The Single-Prompt Miraclereview
I4Audit the documentation a template brought with it in the same session, or file it as an issue.The Single-Prompt Miraclereview

House Rules — Go

#RuleHomeEnforced by
GO1Default to the standard library; get approval before adding a dependency.Goreview
GO2No ORMs, no logging frameworks, no DI containers; cobra is the one permitted CLI library.Goreview
GO3No package-level mutable state — pass state explicitly via arguments or a state struct.Goreview
GO4init() only for static, side-effect-free registration.Goreview
GO5Wrap errors with fmt.Errorf("module: %w", err) and let them bubble to main().Goreview
GO6Never panic() outside unrecoverable boot-time configuration.Goreview
GO7Functions return values; only explicit printer helpers write to stdout.Goreview
GO8Table-driven tests with t.Run, standard testing only, in the same package.Gomake test
GO9Go sources stay gofmt-clean.House Rulesmake preflight

House Rules — Zig

#RuleHomeEnforced by
Z1Never hide allocations; pass an Allocator explicitly.Zigreview
Z2Hot paths get a zero-allocation core (stack buffers, prefetched data).Zigbenchmark
Z3Build utility binaries with -O ReleaseSmall; keep them under 1 MB and 5 MB RSS.Zigbuild check
Z4Split helpers into dedicated files and run them via std.testing.refAllDecls(@This()).Zigzig test
Z5Treat pinned 0.16.0 API shapes as dated notes — re-verify against the current release.Zigcompiler

House Rules — Bash

#RuleHomeEnforced by
B1Every script starts with #!/usr/bin/env bash and set -euo pipefail.Bashreview
B2Use if test …; never [ … ] or [[ … ]].Bashreview
B3Put then/else/do on their own lines and avoid semicolons.Bashreview
B4Double-quote every expansion, and fail loudly on missing arguments ("${1:?usage}").Bashreview
B5Declare local first, assign second, so command substitution exit codes survive.Bashreview
B6Use alignment continuation for long pipelines and conditions instead of fixed indents.Bashreview
B7Use printf over echo for variables, and route pass/fail messages through helper functions.Bashreview
B8Stay mawk-portable: no 3-argument match(), no strtonum(), no gensub().Bashreview

House Rules — Make

#RuleHomeEnforced by
M1help is the first target; bare make prints usage.Makemake
M2Mark targets phony with the ⚙️ sentinel dependency instead of per-target .PHONY lists.Makereview
M3Every user-facing target carries a #/## description and is scraped into make help.Makemake help
M4Use := for immediate values, ?= for overridable ones, and align the assignments.Makereview
M5Express build order as target dependencies, not as a script of steps.Makereview
M6Always invoke the locally built binary (./$(BINARY)), never one from $PATH.Makereview

Rules with no command in the last column are the ones an organization has to staff. That gap is not an oversight; it is the honest boundary of this approach, and it is the subject of The Solo Fleet, Reviewed.