---
# Author: retoor <retoor@molodetz.nl>
name: seriousdevelopment
description: Scaffold a new project or upgrade an existing one to seriousdevelopment quality (spec-first docs, ADRs, build track sheet, verification gates, living-docs discipline). Use when starting a greenfield project or when an existing project needs its engineering and documentation bar raised.
---

# Serious Development

One method for building software seriously, whether the project is new or
already exists. The method has three pillars: a canonical spec with zero
open gaps, a decision + tracking system that survives multi-month and
multi-model builds, and mechanical verification after every change.

Skill version: 1.8.5 (history in `CHANGELOG.md`).

## Modes

Ask which mode applies if it is not obvious from the request. Do not run
both modes in one run. (Mode B itself is audit-then-apply; that is one
mode, not mixing.) For partial work, see Scoped runs.

### Mode A: new project

Scaffold the project skeleton, then write the spec before any product
code. Minimum skeleton:

- `SPEC.md` (canonical spec, from `assets/templates/SPEC.md`)
- `BUILD-TRACK.md` (from `assets/templates/BUILD-TRACK.md`)
- `docs/adr/` with `0001` recording why this method was adopted
- `docs/runbooks/` (empty, indexed in the spec runbook list)
- `CHANGELOG.md` (spec + product changes, ascending versions)
- `roadmap/` only once the spec passes 500 lines (milestone split, see
  "Roadmap split" below)
- `research/` with one slug-named doc per investigation (format in
  `assets/templates/RESEARCH.md`)
- `tools/` with spec validators plus the hook installer (starter in
  `assets/templates/tools/`), hooks installed from day one
- `tests/` mirroring the source tree by tier (`unit`, `api`, `e2e`)
- build file: `Makefile` always and self-sufficient, language-native
  build underneath (`CMakeLists.txt` for C/C++, `pyproject.toml`
  for Python)
- `.gitignore` from `assets/templates/gitignore`, with the mandatory
  `.*` then `!.gitignore` baseline plus one language section per stack
  in use (see "Repository hygiene")
- open-source files: `LICENSE`, `README.md`, `CONTRIBUTING.md`,
  `SECURITY.md`
- `AGENTS.md` (or the harness equivalent) in three layers: personal base
  rules, root project rules, nested files in every directory next to
  the code, all linked both ways

Fill the spec top-down: control + changelog, goals/non-goals, scope,
requirements with normative IDs, architecture, data model, API, security,
compliance, ops, estimates, risks, decisions. No product code until the
spec has zero TBDs (see "No open gaps"). Then grade the spec A-F on:
completeness, consistency, testability, estimation honesty, decision
traceability. Fix everything found without deleting or degrading
content, re-run the mechanical checks, and report before/after grades.
Below A- overall, say so and name what is missing.

### Mode B: upgrade an existing project

1. **Audit, read-only.** Inventory: existing docs, rules files, stack,
   tests, CI, versioning, changelog habits. Write nothing yet.
2. **Gap report.** List what is missing against the checklist in
   "Upgrade checklist" below. Grade the project A-F on: spec
   completeness, decision traceability, dev tracking, verification,
   doc freshness, estimation honesty.
3. **Apply, smallest diffs first.** Adopt the missing pieces using the
   templates. Backfill the spec from the code (code wins on facts,
   spec wins on intent; record conflicts, see below).
4. **Upgrade report.** Write `UPGRADE-REPORT.md` (template provided)
   listing applied changes, grades before/after, and every conflict.

### Conflict rule (Mode B, binding)

If the existing project has a rule that clashes with this method, DO
NOT overwrite it. Keep their rule, mention the clash in the upgrade
report (what clashed, why the method prefers its own, what was kept),
and move on. The only exception is a rule that is illegal or
demonstrably destructive: flag it loudly, propose the fix, and still
wait for the human before changing it.

### Scoped runs

Full-mode runs are the default, but partial application is allowed when
the user asks for it: ADRs only, track sheet only, runbooks only. Rules
for scoped runs: run the Mode B audit first (read-only, even for one
piece), record the narrowed scope in the upgrade report, and list what
was deliberately left out so a later run can continue. The conflict
rule still applies.

## The method

### No open gaps

Anything that would normally be "TBD" gets a decided default with
rationale in the decisions section instead. Tracked assumptions are
allowed only with: owner, verify-by date, and a fallback if the
assumption fails. A spec with an untracked open ends the run as
incomplete: say so, do not ship it quietly.

### Spec everything

Every artifact answers to a spec: every doc, every surface, every
tool, every hook, every template. A thing with no spec line is not
done, however well it runs. Small projects spec in fewer pages, not
with fewer kinds of answers: the same questions (what, why, limits,
owner, verification) apply at every size. Work that resists
specifying is two things hiding as one: split it and spec both.

### Normative IDs

Every requirement, rule, and surface gets a stable ID from a family
prefix: FR (functional), SEC (security), BIL (billing), OPS (ops), NFR
(non-functional), UX, PG (pages/surfaces), D (decisions), PIN (stack
pins), A (assumptions), TRK/DOC (tracking/docs). IDs are never reused
once retired. Cross-reference by ID, never by prose paraphrase.

### Caps and floors

Everything unbounded gets a hard cap: rates, sizes, counts, intervals,
memory. Every automated process gets a floor it may never cross on its
own (retention windows, minimum intervals, protected paths); when a
floor is hit, page a human instead of deleting. Prefer static ceilings
to autotuning.

### Safety

Destructive operations are dry-run by default, confirmed explicitly,
and scoped as narrowly as possible. Loud skips beat silent corruption:
reject unverifiable input with a clear reason and a counter. Verify
before you write (checksums, integrity checks, pre-action snapshots).
A delete that does not reclaim is not a delete.

### Proof

Measure, do not theorize: numbers in docs come from runs on real
machines. Test through the real path (real filesystem, real
concurrency, failure injection), not just units around it. After
behavior changes, run the suite. After deploys, verify live.

### Prompt to plan

Every build starts with a prompt. Investigate first, code last:

1. **Feasibility.** Restate the prompt as a falsifiable claim, then
   test it: deep research over memory, a minimal probe where doubt
   remains, honest numbers. Infeasible ends here with the evidence,
   never with code.
2. **Design for the four critics.** DRY (one source per fact),
   consistency (match existing code first), performance (zero-cost
   preferred: no new allocations, hops, or passes without a measured
   reason), complexity (O(1) where reachable, documented Big-O
   everywhere else). Simple syntax, hardcore OOP: small generic
   classes with behavior beside data, composition over inheritance,
   reuse over invention.
3. **Plan in worktree-sized pieces.** Split the work so independent
   pieces build concurrently in separate worktrees (see Worktrees).
   Each piece names its spec IDs, its tests, and its merge order.

No prompt skips feasibility. No plan skips the four critics.

### Research first, then decide with an opinion

Load-bearing decisions (stack, vendors, money flows, compliance) start
with web research: log the queries, synthesize into the spec with
normative defaults, keep the log in an appendix. Then decide: a clear
rule with stated tradeoffs beats a configurable maybe. Revisit only
with new evidence, filed as a new ADR (never by editing history).

Deep research beats memory, always: a load-bearing claim without a
logged query is a guess, and guesses do not enter the spec. Every
investigation lands in `research/` as one doc per question in the
fixed format (`assets/templates/RESEARCH.md`): question, queries
with dates, sources, synthesis with normative defaults, open
points. Filenames are slugs: lowercase, words joined by single
hyphens, no spaces or capitals, one dot before the extension (for
example `vector-store-options.md`). The directory's own
`AGENTS.md` is exempt. An unslugged or misformatted doc fails the
mechanical checks exactly like a missing one.

### Decisions and stack pins

Spec-level decisions live in the spec as D-IDs (one line each, with
rationale). Repo-level decisions live as ADRs in `docs/adr/`, one file
per decision (`NNNN-short-title.md`) with a MADR-lite body: Status,
Date, Context, Decision, Consequences, Links. Accepted ADRs are immutable; change
means a new ADR that supersedes. Every D-ID, PIN, or requirement
change needs an ADR number in the PR. Agent prompts MUST cite ADR
constraints, never silently invent new ones. Hedged "X or Y" stack
clauses MUST be pinned to one choice with a PIN-ID before build.

### Estimates

Person-weeks with drivers, ranges not theater: each line names what
drives the cost. Recompute totals on every scope change and state the
consequences honestly (date moves, cost moves). Freeze scope with a
D-ID; new ideas go to a later release unless a launch gate forces
them. If the owner overrules the freeze, re-baseline the freeze the
same day and record the new date and cost. Never absorb scope
silently.

### Changelog and versioning

One changelog table: version, date, change text, strictly ascending.
Every spec change gets a row. Patch = additions/clarifications,
minor = scope or phasing changes, major = breaking contract changes.
Every markdown doc carries a versioned header:
`<!-- doc: file | version | updated -->`. Project prose rules hold
everywhere (for this author: no em-dashes anywhere, code, docs,
comments, commits, chat).

Everything versioned: docs in headers, code in the one version
source, releases in tags, templates and tools alongside the method
revision that shipped them. Patch auto-bump per commit plus the
hook-driven checks keep versions moving with no human counting.

### Document locale

Human-facing documents use Dutch locale formats (nl-NL): dates
as DD-MM-YYYY, times as 24-hour HH:MM with timezone where it
matters, decimal comma, dot as thousands separator. Code stays
untouched: identifiers, logs, APIs, and machine formats keep
their technical shapes (ISO 8601 UTC in logs, dots in version
numbers). This rule governs formats, never vocabulary: prose
language is a project decision, recorded in AGENTS.md. The hook
checks the `updated` date in every doc header.

### Encoding

UTF-8 everywhere: every source file, every document, every
database connection, every byte on the wire declares and keeps
UTF-8. Emoji stay out unless explicitly requested: no emoji in
code, docs, commits, or chat by default, and any exception names
its spec ID. But every text path is emoji-ready from day one:
full 4-byte UTF-8 end to end (utf8mb4-grade storage, never a
3-byte ceiling), lengths counted in characters never bytes,
output escaping that preserves rather than mangles. Mojibake is
a bug, wherever it shows.

### Repository hygiene

Every repository ships a `.gitignore` from the first commit, copied
from `assets/templates/gitignore`. Three rules are mandatory and their
order carries the meaning:

1. `.*` first: ignore every dotfile and dot-directory by default, so
   caches, tool state, editor configs, and stray dotfiles never land in
   history.
2. `!.gitignore` immediately after it, so the ignore file itself stays
   tracked; it is the one dotfile that must survive the blanket rule. A
   single comment line between the two rules is allowed (the shipped
   template has one); the validator checks their order, not adjacency.
3. One section per language the project actually uses, drawn from the
   canonical set (Python, Node/TypeScript, Go, C/C++, JVM, .NET, Ruby,
   any other stack present): build output, dependency directories,
   caches, coverage reports, logs, editor and OS artifacts. Drop the
   sections that do not apply; never ship an empty file and never ship
   duplicates across sections.

Because `.*` hides every dot path, the template re-includes the
dotfiles projects normally keep (`.github/`, `.gitattributes`,
`.editorconfig`, `.dockerignore`, `.env.example`,
`.env.sample`, `.pre-commit-config.yaml`). Ignoring `.env` is the
intended effect:
credentials stay out of history, and a tracked secrets file fails the
secret scan.

An existing `.gitignore` is merged, never replaced: append the missing
rules, keep the user's own entries and their order. Acceptance is
mechanical: the file exists, is non-empty, holds `.*` before
`!.gitignore`, and carries a rule for every stack marker at the root
(`pyproject.toml`, `package.json`, `go.mod`, `Cargo.toml`, ...);
`tools/validate.py` checks exactly that and fails the gate otherwise.

### Commits

One logical change per commit, every message in the type spec:

`<type>(<scope>): <subject>`, then a wrapped body naming spec IDs
and the why.

Types: `feat` (new behavior), `fix` (bug repair), `docs` (prose
only), `style` (formatting, no logic), `refactor` (restructure, no
behavior change), `perf` (measured speedup), `test` (tests only),
`build` (build, packaging, containers), `ci` (pipelines, hooks),
`chore` (the rest), `revert` (undoes one commit, names its hash).

Rules: subject in imperative mood, at most 72 chars, no trailing
period; body lines at most 100 chars; every behavior commit cites
its spec ID or ADR; release commits use `chore(release): vX.Y.Z`
with the changelog row in the body. Work lands on short ticket
branches and merges to trunk only through green gates. Once green,
merge at once: never batch finished work, never wait for the user.
Autonomy is the default; the gates are the reviewer.

### Releases are tags

Releases are annotated git tags, nothing else. Format
`vMAJOR.MINOR.PATCH`, strictly ascending, one tag per release,
never moved or deleted. Cutting a release: bump the version
source, add the changelog row, run the full suite plus the
mechanical checks on trunk, tag with a message repeating the
changelog row, push tag with trunk. Minor and major releases are
explicit human-approved commits; patches flow with normal merges.
A tag without its changelog row is void: fix forward with a patch
release the same day.

### Single source, synced mirrors

One file is canonical. Split-offs (roadmap, runbooks, API docs) are
mirrors, synced in the SAME commit as the canonical change. Never let
a mirror drift: verify sync mechanically after every edit round.

### Roadmap split

When the spec passes ~500 lines, split a build-order roadmap with a
zero-loss proof: account for every source line mechanically (count
them; declared duplicates counted exactly). Each part gets a header
comment naming source file, source version, and covered sections.
Keep a coverage map (every section, exactly one home) and a build
table (order, file, milestone, weeks, exit criteria).

### Verification gates

Define launch gates per phase (tests green, pentest criticals zero,
restore drill pass, billing zero-diff over N days, docs synced, legal
pack signed). All green or no launch. After every change round, run
the mechanical checks: sync between canonical and mirrors, ID
uniqueness, changelog order, forbidden-pattern scan, and the repo's
own test suite for the touched area. A confident patch you never saw
pass is not done. Sample mechanics (adapt paths to the project):

```sh
# ID uniqueness: must print nothing (no duplicate requirement IDs)
rg -o '[A-Z]{2,3}-[0-9]+' SPEC.md | sort | uniq -d
# changelog order: versions must ascend top to bottom
rg '^\| [0-9]+\.[0-9]+' SPEC.md
# forbidden patterns: project rules, e.g. untracked TBDs, em-dashes (U+2014)
rg -n 'TBD|\u2014' SPEC.md BUILD-TRACK.md docs/
```

### Tools and hooks

`tools/` holds small Python validators (stdlib only, one job each)
that check the project against its spec: ID uniqueness, changelog
order, doc headers, research slug and format, version-tag
agreement, mirror sync. The starter kit ships in
`assets/templates/tools/`; projects extend it, never bypass it.

Githooks run the tools, not human memory: `pre-commit` runs the
fast checks, `pre-push` runs the full validators. Hooks install
with one command (`tools/install-hooks.sh`), and CI runs the same
entry points, so a bypassed hook still meets the gate. A hook
failure blocks the operation with the failing check named.
`--no-verify` is forbidden except to unbreak a broken hook itself,
and that repair lands before any other commit.

### Build tracking (multi-month, multi-model safe)

`BUILD-TRACK.md` at repo root is the single source of build status.
One row per milestone and per gate drill: Milestone, Owner, Status,
Updated, Evidence, Drift. Owner is a human name or
`llm:model/version`. Status enum: NOT-STARTED, IN-PROGRESS, BLOCKED,
IN-REVIEW, DONE. Update triggers, all same-day: any status change,
end of every work session, every gate pass or fail, every merged PR.
Staleness: 7 days without update marks the row STALE (CI fails);
14 days escalates to the owner as BLOCKED. Context passes ONLY
through the track sheet, ADRs, and code, never through chat memory.
LLM output is reviewed by a human or a second model before merge;
billing, auth, and security merges need human sign-off.

### Worktrees

Concurrent worktrees are the default unit of construction: one
worktree per task, branched from trunk, named for the ticket. All
rules binding:

- Plan for concurrency up front: implementation docs split work
  into merge-ordered pieces that separate worktrees build at once
  without touching the same files.
- Merge the moment a piece is green: never wait for the user,
  never batch finished work. Trunk moves daily; stale branches are
  a smell.
- No testing inside worktrees: worktrees build, trunk verifies.
  After merge, the full suite and the mechanical checks run on
  trunk, and failures there page the piece owner.
- Delete immediately after merge: remove the worktree, prune its
  metadata, delete the merged branch, clean scratch (temp files,
  fixtures, logs). A finished worktree still on disk at end of
  session is a red flag.
- Autonomy within the gates: merge, delete, and continue without
  asking while every gate holds. Page the human for red gates,
  conflicts of intent, and releases, never for routine green
  merges.

### Living docs

Maintain a register: doc, owner, update trigger, max staleness.
Minimum register: canonical spec + mirrors (same commit, 0 days),
track sheet (7 days), ADRs (before merge), runbooks (incident/drill
+ 30 days), API changelog (CI-generated, 0 days), cost book (vendor
price change, same day), risks (monthly + incident), postmortems
(48h after SEV-2+). Same-PR rule: a behavior/API/config/ops change
updates its docs in the SAME PR; reviewers verify docs impact;
maintainers block merges with stale docs on user-facing changes.
Generated docs regenerate in CI; drift fails the build. Quarterly
audit: re-verify the register, delete what stopped being true.

### Open source readiness

Every project ships ready to go public from day one, whether it
does or not: `LICENSE` (chosen with an ADR), `README.md` (what,
why, running in five minutes), `CONTRIBUTING.md` (setup, branches,
commits per the type spec, review bar), `SECURITY.md` (contact,
response window). Before any public push: secret scan clean,
dependency licenses compatible and recorded, no private names or
URLs in code or history, CI green on a clean machine. Public
quality never drops below private quality: same gates, same
changelog discipline, same docs sync. Going public is a launch
gate like any other: all green or no launch.

### Craft and ops

Exact, minimal diffs: edit existing files, reuse helpers, one way of
doing anything. Boring technology, dumb backends, smart edges. Docs
state what the system does today, gaps listed next to the code that
will close them. Commit, deploy, verify, in that order, same
session. Schedules live inside the system on a loop (retention,
cleanup, checks) with human-readable states, not silent hope.

### Writing decent software

Shape: one language, one database, server-rendered first, no build
step unless earned. One data root with every path derived in one
config module. Layout mirrors URLs: if you cannot guess the file
from the URL, the layout is wrong.

One method, every language: these rules govern process in Python,
C, JavaScript, Rust, Go, and the rest alike, while each language
keeps its most common mechanics as the base (naming, layout,
native build, idiomatic tests). The method wins on process (spec,
gates, commits, tags, worktrees); the language wins on shape. A
clash between a language idiom and a method rule is a Mode B
conflict: keep the idiom, record it, move on.

House stack (defaults when nothing else is picked; override per
project with an ADR, never by drifting):

- Backend: Python + FastAPI, one typed framework. Routers mirror the
  URL tree: flat file per resource (`routers/feed.py`), package per
  sub-resource (`routers/projects/`), each leaf owning an APIRouter,
  the package `__init__` aggregating. One app factory, middleware in
  fixed order (timing outermost, then security headers, rate limit,
  maintenance gate, error handlers).
- Templates: Jinja2 server-side, one shared instance, one `base.html`,
  page CSS/JS in standard blocks, shared partials for repeated UI.
- Frontend: no framework, no build step. Plain ES modules, one class
  per file, small shared utilities. The server renders what exists at
  request time; the client only handles live content, sanitized
  fail-closed.
- Database: SQLite via the `dataset` ORM, WAL mode, busy timeout, one
  embedded file under the data root for small to medium scale.
  Graduate to Postgres only on measured need (write concurrency,
  size, or managed backups), filed as an ADR.
- Tests mirror the tree: `tests/unit`, `tests/api` (live server plus
  temp DB), `tests/e2e` (browser).

One way of everything: one auth resolver, one response helper, one
validation style, one outbound HTTP client (with SSRF guard), one
queue pattern. A second implementation of an existing helper is a
bug, not a choice.

DRY, enforced: no logic in two places. If it appears twice, hoist
it into the one helper, predicate, or constant both callers use.
Single source per fact in code exactly as in docs; copy-paste is
never the answer, not even "just this once".

Consistency, enforced: new code matches the existing code first.
Same helpers, same patterns, same naming, same file shapes; a
reviewer should not be able to tell which lines are new. If the
existing pattern is bad, either fix all usages in the same change
or follow it and file the cleanup (never a third style alongside).
Read before you write, always.

Object-oriented, enforced: model the domain as objects with the
behavior living next to the data it acts on. Small classes with one
job, composition over inheritance, no god objects, no procedural
blobs where an object fits. Python: dataclasses and Pydantic models
for data, service objects for operations. Frontend: one class per
file as the house stack already demands.

Data: opaque IDs, soft delete everywhere with garbage collection
doing the hard deletes, ownership checked by one helper, no N+1
(batch loaders are the only way to load related rows), idempotent
schema init.

Daily loop, eight steps in order, a failed step blocks the rest:
understand (match an existing example or agree the new pattern
first), data, server, view, safety, agent+docs (the most-forgotten
step: tool action, endpoint doc, user doc), document, validate.

Testing: three tiers (unit, HTTP integration on temp DB, browser
E2E), serial runs, full suite green before done, cheapest-first
triage, never narrow a run to pass. For money, state machines, and
read-then-write races add: property checks, stateful fuzzing,
real-process concurrency tests, static analysis on touched files.
Integration tests mirror the source tree inside `tests/`: the test
for `src/shop/cart.py` lives at `tests/api/shop/test_cart.py`
(tier first, then the mirrored path), so any file's tests are
found by rule, never by search. Tiers never mix in one file.

Ops: every repeated action is a named command (no tribal one-liners),
DTAP pipeline with CI green before merge, destructive ops dry-run
first and explicitly confirmed, retention CLIs per expirable domain,
production data guarded by written confirmation, deploy then verify
live.

Runtime: every project ships a container, Podman preferred, Docker
accepted. Debian-slim-based image, a compose file for the full stack
(app, db, workers), one command to boot it. No "works on my machine":
CI builds the image, prod runs the image.

Makefile: required and self-sufficient. It assures its own
environment: creates the venv (or pulls images) when missing,
installs pinned deps, then runs every target inside it. Standard
targets: `install`, `dev`, `prod`, `test`, `test-fast`, `lint`,
`clean`, `up`, `down`, `logs`. No target may assume a
hand-prepared machine. For C and C++ the native build is CMake
(`CMakeLists.txt`, out-of-source builds, CTest wired to `make
test`); the Makefile stays as the one entry that drives it. Every
language keeps its native build underneath and the same `make`
surface on top: one door per project.

Python packaging: traditional `pyproject.toml` (setuptools or
hatchling, src layout), version as the single source read live by
the app, one console-script binary declared under
`project.scripts` that is THE way to execute the software (no bare
`python app.py` in docs or deploy). Deps pinned, dev extras
separated.

Versioning: one version source read live by the app, patch
auto-bumped per commit, minor/major manual release commits, assets
served immutable under versioned URLs, trunk plus short ticket
branches plus a production promotion target, annotated tags and one
changelog for releases. Every markdown doc versioned: header
comment plus history table, bumped in the same commit as the
content change.

Agent docs: three layers (personal base, root project rules under
~500 lines, nested subsystem files next to the code). Every
statement marked hard rule, convention, or guidance, each with a
named enforcer (test path, hook, review gate). A rule without an
enforcer is a wish: the quarterly audit deletes one. Docs update in
the same change as the code, state today with no fiction, and die
with the feature they describe. Nested files are the default, not
the exception: every directory ships an `AGENTS.md` sized to what
it owns (a leaf package needs five lines, not fifty). Each file
links its parent above and its children below, so the whole tree
walks both ways from any file; the root file indexes every nested
file. A directory without its `AGENTS.md`, or a link that points
nowhere, fails the doc checks.

Logging: stdlib `logging` configured once via `dictConfig` in one
module, `getLogger(__name__)` per module. Debug log by default:
DEBUG goes to a rotating debug file, INFO+ to the console, levels
tunable via env. Rotation is mandatory, never unbounded:
RotatingFileHandler for the app log (10 MB x 5), timed rotation
for debug/audit (midnight, keep 7-14), plus a total cap on the log
directory (default 500 MB) enforced by a prune check. Format: UTC
ISO timestamp, level, logger, message; JSONL only when a shipper
consumes it. QueueHandler for threaded workers; lazy %-formatting
and level guards in hot paths. Never log secrets or PII (token
fingerprints, redaction as backstop); bare except without logging
is forbidden. Files first; stdout only for container runtimes.

Backups: 3-2-1 minimum (3 copies, 2 media, 1 off-site at a
different provider/location, not the same DC). Anything holding
money or PII gets 3-2-1-1-0 (one immutable copy, zero-error
verified restores). Default tool restic (or Borg): encrypted,
automated on schedule, calendar retention (7 daily, 4 weekly,
6 monthly), prune wired to the same tool. RPO/RTO stated per
domain and measured, not assumed. Test restores monthly into an
empty directory (quarterly minimum); an untested backup fails the
ops gate, and a missing scheduled run pages like any other alarm.
Named commands (`backup-run`, `backup-verify`, `backup-prune`),
keys backed up separately from the data they unlock.

Secrets are human-only. AI MUST never print, copy, transmit, modify,
rotate, or delete secret values (passwords, tokens, keys, connection
strings), and MUST never commit them. Referencing an env var NAME to
wire config is fine; its VALUE stays unread and unmoved. Servers are
closed from outside by default; secret storage and rotation are the
owner's task. If a secret is missing, expired, or appears where it
should not (logs, diffs, chat), stop and page the human. No
workarounds, ever.

Dependencies: fewest possible. Stdlib first, one well-chosen library
per need, no new dependency without an ADR entry justifying it (what,
why not stdlib, license, maintenance status). Pinned versions,
automated audit on schedule, CVE fix-or-remove with a deadline. Each
release, remove one dependency nobody can justify. Adopt the
latest stable, always: the version pinned is the newest stable
release, confirmed by fresh research, never by memory; scheduled
audits propose upgrades the same way. Latest stable never
justifies one more dependency.

Environments: DTAP, usually on one platform. Dev, test, accept, and
prod coexist without colliding: separate database, data dir, ports,
and env-prefixed resource names per environment; no shared state
between test and prod, ever. Test data is marked and isolated;
production data never flows into test. Accept mirrors prod (same
images, same flags). Promotion is deliberate: merge, deploy, verify
live.

Incidents: every alert names an owner and a runbook; unowned alerts
are forbidden. On-call rotation with a human reachable; agents hold
and page instead of improvising past a floor. SEV-2+ gets a
postmortem within 48h (template provided). Customer-visible incidents
update the status page in the same hour; an incident is not closed
until comms, fix, and action items all landed.

Minimum CI: lint touched files, serial full suite, doc-header check
(every `.md` carries a version line), generated-docs drift check,
dependency audit. CI mirrors the hooks exactly (same tools, same
order), so a skipped hook still meets the gate. All green before
merge, no exceptions.

Migrations: every schema change ships with its rollback, reviewed
together. Expand before contract (additive first, removal later);
destructive migrations need a snapshot plus a rehearsed restore.
Never edit a migration that already ran in prod; write a new one.

## Checklists

### New project

- [ ] Skeleton files exist from templates
- [ ] Spec: zero untracked opens, IDs on everything, changelog started
- [ ] Stack pins: no "X or Y" clauses remain
- [ ] Engineering shape chosen: layout, data conventions, test tiers, commands
- [ ] Logging + backups: rotation caps set, 3-2-1 scheduled, restore drill dated
- [ ] DTAP coexistence verified: separate state per env, no test/prod sharing
- [ ] Incident loop defined: alert owners, on-call, status page, postmortem rule
- [ ] Assumptions have owner + verify date + fallback
- [ ] Estimates have drivers; scope freeze D-ID recorded
- [ ] Gates defined per phase; first gate (spec review) passed
- [ ] Spec graded A-F and fixed to A- or better, grades reported
- [ ] BUILD-TRACK.md has one row per milestone, all NOT-STARTED
- [ ] ADR 0001 records method adoption
- [ ] Commits typed per the spec from the first commit; releases
  tagged vX.Y.Z
- [ ] research/ seeded; first investigations slugged and formatted
- [ ] tools/ validators present; hooks installed; CI runs the same
  checks
- [ ] Worktree plan recorded: pieces, merge order, owners
- [ ] .gitignore present: `.*` then `!.gitignore`, one section per
  stack, validator green
- [ ] Open-source files present (LICENSE, README, CONTRIBUTING,
  SECURITY)
- [ ] AGENTS.md in every directory, linked both ways
- [ ] Build file self-sufficient (Makefile always; CMake for C/C++)
- [ ] Tests mirror the source tree by tier
- [ ] Dependencies pinned to latest stable, research behind each
- [ ] Document dates and numbers in nl-NL format (DD-MM-YYYY,
  decimal comma)
- [ ] UTF-8 end to end; text paths emoji-ready (4-byte,
  char-counted)

### Upgrade existing project

- [ ] Read-only audit complete, nothing written yet
- [ ] Gap report with A-F grades on the six axes
- [ ] Missing pieces applied, smallest diffs first
- [ ] Conflicts kept-as-is and recorded (never overwritten)
- [ ] UPGRADE-REPORT.md written with before/after grades
- [ ] Mechanical checks pass (sync, IDs, changelog, tests)
- [ ] Commit type spec adopted going forward (old history untouched)
- [ ] Research migrated or indexed; new docs slugged
- [ ] tools/ plus hooks installed; first full run green
- [ ] Worktree and release-tag discipline adopted
- [ ] .gitignore merged with the baseline, user rules kept
- [ ] Open-source readiness checked

## Red flags (stop and say so)

- A change that cannot name its spec ID or ADR.
- Scope absorbed without re-baselining date and cost.
- A mirror edited without its canonical source (or vice versa).
- Docs updated "later" instead of in the same PR.
- A gate waved through red, or narrowed to pass.
- An agent inventing a new queue, cache, or retry policy the ADRs
  never approved.
- AI touching secret values (print, copy, change, delete), or working
  around a missing secret instead of paging the human.
- Test and prod sharing state, or prod data flowing into test.
- A migration with no rollback, or an edit to one that already ran.
- A commit with no type prefix, or a subject that hides scope.
- A release with no tag, or a moved tag.
- Research outside research/, unslugged, or missing its query log.
- A validator bypassed, or a hook skipped to land faster.
- A worktree alive after its merge, or tests run in the worktree
  instead of on trunk.
- A directory with no AGENTS.md, or a broken parent/child link.
- A repository whose .gitignore lacks `.*` and `!.gitignore`, in that
  order, or lacks a section for a language the project uses.
- A dependency pinned below latest stable with no ADR saying why.
- Memory quoted where a fresh query was owed.

## Templates

In `assets/templates/`: `SPEC.md` (spec skeleton), `BUILD-TRACK.md`,
`ADR.md`, `RUNBOOK.md`, `POSTMORTEM.md`, `UPGRADE-REPORT.md`
(Mode B report with conflicts table), `CHANGELOG.md`, `AGENTS.md`
(root rules file, three-layer header), `RESEARCH.md` (research doc
format, slug-filed), `gitignore` (baseline ignore file: blanket dot
rule, `!.gitignore`, per-stack sections), `tools/` (starter validators
plus the hook installer). Copy, never link: the target project owns its
copies from day one.
