| 1 | # House rules |
| 2 | |
| 3 | These rules apply across every project. Each project's `AGENTS.md` keeps only what is specific to |
| 4 | it. |
| 5 | |
| 6 | ## Writing |
| 7 | |
| 8 | - **Code comments** say what a reader cannot infer from the code: purpose, reasons, constraints, and |
| 9 | non-obvious consequences. Leave out what the code shows. |
| 10 | - **User-facing docs** (READMEs, guides) tell a clear, simple, concise story of the typical, |
| 11 | well-trodden user journeys. They show how simple the platform is and how easy it is to use. |
| 12 | Detailed configuration, options, and corner cases belong in reference docs. Concision matters |
| 13 | most. |
| 14 | - **Reference docs** hold the complete, precise detail. |
| 15 | |
| 16 | All three share these rules: |
| 17 | |
| 18 | - one voice, describing the system as it is; |
| 19 | - no dates, change or knot IDs, quotes attributed to people, "previously", or "no longer"; |
| 20 | - reasons for a change go in its commit message; |
| 21 | - when behaviour changes, rewrite the affected text as if it had been designed that way; |
| 22 | - prefer merging and deleting to adding. |
| 23 | |
| 24 | Guidance for agents gives instructions, not lessons: name the command to run and the outcome to |
| 25 | expect, and leave how the machinery works to the tools and their reference docs. Write "list the |
| 26 | checks your change requires with `valley checks --names origin/main HEAD`", not an account of which |
| 27 | policy layer requires which check. |
| 28 | |
| 29 | ## Tests |
| 30 | |
| 31 | Tests let the author verify that a module behaves correctly, without mirroring its implementation or |
| 32 | chasing coverage. Give each user-visible behaviour one end-to-end path at the outermost layer that |
| 33 | shows it, and inner layers focused tests of their own logic. Tests across component boundaries are |
| 34 | the most valuable, and the code they run requires them. Assert outcomes, not wording, and wait on |
| 35 | events rather than fixed windows. Do not re-prove upstream software; check rendered configuration at |
| 36 | evaluation time rather than booting a machine. A test's run time is part of the change's cost. |
| 37 | |
| 38 | ## Design |
| 39 | |
| 40 | - Name the missing capability before choosing a mechanism. A fix that only makes a symptom stop is a |
| 41 | workaround. |
| 42 | - A setting lives with the thing whose behaviour it changes: the tool's behaviour in the tool, a |
| 43 | project's choices in the project, a machine's facts in the machine's configuration. |
| 44 | - One concept, one meaning. When an existing state or setting would start to carry a second meaning, |
| 45 | add an explicit command or setting instead. |
| 46 | - When the right place is harder to change than a nearby one, say so and ask. Don't let the easier |
| 47 | place decide. |
| 48 | - State the alternative you rejected and why. |
| 49 | |
| 50 | ## Carrying cost |
| 51 | |
| 52 | Code and tests are carried for the project's lifetime. When a change's cost in code, tests, check |
| 53 | time, or new concepts outweighs what it delivers, stop instead of pushing through and report what |
| 54 | the implementation revealed about the problem or platform; that counts as success. Do not add a |
| 55 | recurring job for a problem that happened once; fix it by hand and note how. Keep migrations light, |
| 56 | adding cutover steps only to prevent lockout, data loss, or a bad state. |
| 57 | |
| 58 | ## Language |
| 59 | |
| 60 | Write logic — commands, controllers, deployment, and verification — in Go or declarative Nix, where |
| 61 | behaviour can be tested and errors are explicit. Keep Bash to thin glue that sets up an environment |
| 62 | and runs a program, and add no logic to existing scripts. |
| 63 | |
| 64 | ## Events, not timers |
| 65 | |
| 66 | Wake on changes to the files and refs you read, not on a clock. Reread durable state on wakeup so a |
| 67 | missed event loses no correctness, and retry failures when a relevant input changes rather than |
| 68 | after a fixed delay. Calendar work belongs on a timer; any other poll, interval, or sleep must state |
| 69 | why no event serves. |