docs(ai): ai.md becomes a router; invariants move to AGENTS.md; budgets gated

ai.md 228 → 64 lines. It now carries only: what the product is, the build
commands, the architecture table, a "where the truth lives" table, and a
pointer to HANDOFF. No narrative, no status, no duplicated invariants.

AGENTS.md (195 lines) is now the single always-read file:
- the 20 invariants that break output, wipe user data, or ship a legal/trust
  breach — one line each, pointing at the doc that explains it (they replace
  110 lines of invariant stubs that duplicated docs/ai/*.md verbatim)
- Response style + No-Fluff Mode moved in from ai.md (rules belong in the rules file)
- onboarding is now: HANDOFF → ai.md router → the ONE docs/ai file → dir index;
  TASKS.md is read when the question is "what's next", not to write code
- memory rides with the change but is no longer a unit of its own; HANDOFF is
  ≤40 lines and overwritten, never appended

Anti-rebloat gate: scripts/verify.sh gains step 1/4, a doc-budget check
(AGENTS ≤210, ai ≤100; HANDOFF/TASKS caps land with the queue trim). A commit
that pads a capped file instead of moving detail fails the gate.

schema.md and docs/index.md corrected for the new roles and reading order.
Docs-only unit: scope-check run, no build.
This commit is contained in:
2026-10-29 11:08:07 -07:00
parent a311c8feb1
commit c9ac348976
6 changed files with 187 additions and 279 deletions
+15 -16
View File
@@ -16,15 +16,15 @@ that every other memory file follows. Read `ai.md` first; this file explains
| File | Role | Entry point? |
|------|------|--------------|
| `AGENTS.md` | Auto-read on-ramp for AI sessions — points to the map and the working rules | **always read first** |
| `AGENTS.md` | Auto-read on-ramp: working rules, **the invariants that break the product**, response style | **always read first** |
| `ai.md` | **Router** — what the product is, the architecture table, a "where the truth lives" table. No narrative, no status (≤100 lines, gated) | yes — the map |
| `README.md` | Human-facing intro: what the app is, how to run it, roadmap | no |
| `ai.md` | **AI guide + session handoff** — architecture, patterns, decisions, the cognitive map home | **yes — start here** |
| `TASKS.md` | **Catalog/index** for the task queue. The actual task files live in [`TASKS/`](TASKS/) (one file per task); `TASKS.md` carries the status table, open items, and research facts pointer. Read this for queue state; open task files for full detail. | yes — for status |
| `HANDOFF.md` | Current operational state: what's in flight, landmines, next step, secret/DB/port locations | yes — trust it as current state |
| `MyMistakes.md` | Per-task failure log **+ RECIPES REGISTRY** (derived-solution rule): one-off solutions / how-tos get recorded here the same session, then grepp'd before ever re-deriving them (see `AGENTS.md` 🔬) | grep first on any "did this before?" wall |
| `TASKS.md` | The active queue. Full task detail and research live in [`TASKS/`](TASKS/); done work in `TASKS/archive.md` | when the task is "what's next" |
| `HANDOFF.md` | Current operational state: branch, in flight, next action, landmines (≤40 lines, overwritten never appended) | yes — trust it as current state |
| `MyMistakes.md` | Failure log **+ RECIPES REGISTRY**: one-off solutions / how-tos get recorded here the same session, then grepp'd before ever re-deriving them | grep first on any "did this before?" wall |
| `schema.md` | This file: the conventions below | when in doubt |
| `<dir>/index.md` | Per-directory map (progressive disclosure): what lives there + links | when diving into code |
| `docs/ai/*.md` | **Split-out subsystems** of `ai.md` — verbatim moves (from 2026-10-26); `ai.md` keeps a short invariant stub + link, and [`docs/ai/index.md`](docs/ai/index.md) routes | when the task touches a moved subsystem |
| `docs/ai/*.md` | **Subsystem truth** — one file per subsystem (capture, frame pipeline, output, overlays, youtube-api, ui-surface, product, environment). `ai.md` routes; [`docs/ai/index.md`](docs/ai/index.md) lists them with a "read when" | when the task touches that subsystem |
| `Views/` | Reserved for Views; currently empty | — |
## Conventions
@@ -46,16 +46,15 @@ that every other memory file follows. Read `ai.md` first; this file explains
## Reading order
1. `AGENTS.md` — auto-read on-ramp; it points you here.
2. `ai.md` — what this app is, how it's built, current state, open decisions.
3. `TASKS.md` — what's done, what's next, and the YouTube API constraints.
4. `<dir>/index.md` — to understand a directory before reading its files.
5. The source files themselves — always the authority over any memory file.
1. `AGENTS.md` — auto-read on-ramp: rules + invariants; it points you here.
2. `HANDOFF.md` — current state. Trust it; don't re-derive it.
3. `ai.md` — the router: architecture and where truth lives.
4. The one `docs/ai/*.md` file that matches the task.
5. `<dir>/index.md` — before reading that directory's files.
6. The source files themselves — always the authority over any memory file.
## Integration rule
Every feature change ships with its memory update **in the same commit**:
`ai.md` for architecture / patterns, `TASKS.md` for status, index files when
the layout changes. No code commit without its docs — a follow-up "docs
backfill" commit is a broken rule, not a style. That is what keeps the map
accurate enough to trust next session.
Every feature change ships with what it **falsifies** corrected in the same commit — a path, an
invariant, a status line. Broader restatement may be batched at a milestone. The point is that
the map never stays wrong; it is not a tax on every commit.