@xhulz/nina 0.78.0 → 0.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/package.json +1 -1
  2. package/releases/0.79.0/core/GAPS.md +125 -0
  3. package/releases/0.79.0/core/answered.json +113 -0
  4. package/releases/0.79.0/core/defaults/tree/.claude/agents/architect.md +1 -0
  5. package/releases/0.79.0/core/defaults/tree/.claude/agents/dba.md +3 -0
  6. package/releases/0.79.0/core/defaults/tree/.claude/agents/devops.md +1 -0
  7. package/releases/0.79.0/core/defaults/tree/.claude/agents/implementer.md +1 -0
  8. package/releases/0.79.0/core/defaults/tree/.claude/agents/integration-tester.md +3 -0
  9. package/releases/0.79.0/core/defaults/tree/.claude/agents/qa.md +7 -0
  10. package/releases/0.79.0/core/defaults/tree/.claude/agents/reviewer.md +3 -0
  11. package/releases/0.79.0/core/defaults/tree/.claude/agents/secops.md +3 -0
  12. package/releases/0.79.0/core/defaults/tree/.claude/agents/solidity-auditor.md +3 -0
  13. package/releases/0.79.0/core/defaults/tree/.claude/agents/solidity-dev.md +3 -0
  14. package/releases/0.79.0/core/tree/.claude/agents/architect.md +140 -0
  15. package/releases/0.79.0/core/tree/.claude/agents/dba.md +123 -0
  16. package/releases/0.79.0/core/tree/.claude/agents/design-reviewer.md +82 -0
  17. package/releases/0.79.0/core/tree/.claude/agents/devops.md +122 -0
  18. package/releases/0.79.0/core/tree/.claude/agents/implementer.md +198 -0
  19. package/releases/0.79.0/core/tree/.claude/agents/integration-tester.md +174 -0
  20. package/releases/0.79.0/core/tree/.claude/agents/planner.md +132 -0
  21. package/releases/0.79.0/core/tree/.claude/agents/qa.md +154 -0
  22. package/releases/0.79.0/core/tree/.claude/agents/reviewer.md +191 -0
  23. package/releases/0.79.0/core/tree/.claude/agents/secops.md +124 -0
  24. package/releases/0.79.0/core/tree/.claude/agents/solidity-auditor.md +130 -0
  25. package/releases/0.79.0/core/tree/.claude/agents/solidity-dev.md +127 -0
  26. package/releases/0.79.0/core/tree/.claude/agents-overview.md +65 -0
  27. package/releases/0.79.0/core/tree/.claude/frontend.md +10 -0
  28. package/releases/0.79.0/core/tree/.claude/graph.md +79 -0
  29. package/releases/0.79.0/core/tree/.claude/patterns.md +256 -0
  30. package/releases/0.79.0/core/tree/.claude/pills/README.md +150 -0
  31. package/releases/0.79.0/core/tree/.claude/pipeline.md +101 -0
  32. package/releases/0.79.0/core/tree/.claude/retrieval.md +103 -0
  33. package/releases/0.79.0/core/tree/.claude/router.md +224 -0
  34. package/releases/0.79.0/core/tree/.claude/templates/integration.md +48 -0
  35. package/releases/0.79.0/core/tree/CLAUDE.md +167 -0
  36. package/releases/0.79.0/core/tree/scripts/cost-watch.mjs +27 -0
  37. package/releases/0.79.0/core/tree/scripts/edit-guard.mjs +24 -0
  38. package/releases/0.79.0/core/tree/scripts/harness-check.mjs +84 -0
  39. package/releases/0.79.0/core/tree/scripts/loop-gate.mjs +19 -0
  40. package/releases/0.79.0/core/vocabulary.json +15 -0
  41. package/releases/0.79.0/surfaces/blockchain/tree/.claude/agents/architect.md +5 -0
  42. package/releases/0.79.0/surfaces/blockchain/tree/.claude/agents/devops.md +5 -0
  43. package/releases/0.79.0/surfaces/blockchain/tree/.claude/agents/reviewer.md +5 -0
  44. package/releases/0.79.0/surfaces/blockchain/tree/.claude/agents/solidity-auditor.md +18 -0
  45. package/releases/0.79.0/surfaces/blockchain/tree/.claude/agents/solidity-dev.md +16 -0
  46. package/releases/0.79.0/surfaces/blockchain/tree/.claude/agents-overview.md +6 -0
  47. package/releases/0.79.0/surfaces/blockchain/tree/.claude/graph.md +11 -0
  48. package/releases/0.79.0/surfaces/blockchain/tree/.claude/router.md +6 -0
  49. package/releases/0.79.0/surfaces/blockchain/tree/CLAUDE.md +12 -0
  50. package/releases/0.79.0/surfaces/d1/tree/.claude/agents/dba.md +15 -0
  51. package/releases/0.79.0/surfaces/d1/tree/.claude/agents/devops.md +2 -0
  52. package/releases/0.79.0/surfaces/d1/tree/.claude/agents/implementer.md +2 -0
  53. package/releases/0.79.0/surfaces/d1/tree/.claude/patterns.md +8 -0
  54. package/releases/0.79.0/surfaces/d1/tree/CLAUDE.md +2 -0
  55. package/releases/0.79.0/surfaces/db/tree/.claude/agents/architect.md +5 -0
  56. package/releases/0.79.0/surfaces/db/tree/.claude/agents/dba.md +54 -0
  57. package/releases/0.79.0/surfaces/db/tree/.claude/agents/devops.md +5 -0
  58. package/releases/0.79.0/surfaces/db/tree/.claude/agents/implementer.md +2 -0
  59. package/releases/0.79.0/surfaces/db/tree/.claude/agents/integration-tester.md +10 -0
  60. package/releases/0.79.0/surfaces/db/tree/.claude/agents/planner.md +2 -0
  61. package/releases/0.79.0/surfaces/db/tree/.claude/agents/reviewer.md +22 -0
  62. package/releases/0.79.0/surfaces/db/tree/.claude/agents/secops.md +2 -0
  63. package/releases/0.79.0/surfaces/db/tree/.claude/agents-overview.md +5 -0
  64. package/releases/0.79.0/surfaces/db/tree/.claude/graph.md +8 -0
  65. package/releases/0.79.0/surfaces/db/tree/.claude/patterns.md +22 -0
  66. package/releases/0.79.0/surfaces/db/tree/.claude/pipeline.md +13 -0
  67. package/releases/0.79.0/surfaces/db/tree/.claude/retrieval.md +5 -0
  68. package/releases/0.79.0/surfaces/db/tree/.claude/router.md +4 -0
  69. package/releases/0.79.0/surfaces/db/tree/CLAUDE.md +17 -0
  70. package/releases/0.79.0/surfaces/drizzle/tree/.claude/agents/dba.md +9 -0
  71. package/releases/0.79.0/surfaces/drizzle/tree/.claude/agents/devops.md +5 -0
  72. package/releases/0.79.0/surfaces/drizzle/tree/.claude/agents/implementer.md +2 -0
  73. package/releases/0.79.0/surfaces/drizzle/tree/.claude/patterns.md +7 -0
  74. package/releases/0.79.0/surfaces/edge-cf/tree/.claude/agents/architect.md +14 -0
  75. package/releases/0.79.0/surfaces/edge-cf/tree/.claude/agents/dba.md +2 -0
  76. package/releases/0.79.0/surfaces/edge-cf/tree/.claude/agents/devops.md +29 -0
  77. package/releases/0.79.0/surfaces/edge-cf/tree/.claude/agents/implementer.md +14 -0
  78. package/releases/0.79.0/surfaces/edge-cf/tree/.claude/agents/integration-tester.md +11 -0
  79. package/releases/0.79.0/surfaces/edge-cf/tree/.claude/agents/qa.md +3 -0
  80. package/releases/0.79.0/surfaces/edge-cf/tree/.claude/agents/reviewer.md +8 -0
  81. package/releases/0.79.0/surfaces/edge-cf/tree/.claude/agents/secops.md +8 -0
  82. package/releases/0.79.0/surfaces/edge-cf/tree/.claude/patterns.md +17 -0
  83. package/releases/0.79.0/surfaces/edge-cf/tree/.claude/retrieval.md +8 -0
  84. package/releases/0.79.0/surfaces/edge-cf/tree/CLAUDE.md +29 -0
  85. package/releases/0.79.0/surfaces/frontend/tree/.claude/agents/architect.md +20 -0
  86. package/releases/0.79.0/surfaces/frontend/tree/.claude/agents/devops.md +28 -0
  87. package/releases/0.79.0/surfaces/frontend/tree/.claude/agents/implementer.md +25 -0
  88. package/releases/0.79.0/surfaces/frontend/tree/.claude/agents/qa.md +17 -0
  89. package/releases/0.79.0/surfaces/frontend/tree/.claude/agents/reviewer.md +56 -0
  90. package/releases/0.79.0/surfaces/frontend/tree/.claude/patterns.md +8 -0
  91. package/releases/0.79.0/surfaces/frontend/tree/.claude/retrieval.md +2 -0
  92. package/releases/0.79.0/surfaces/frontend/tree/.claude/router.md +14 -0
  93. package/releases/0.79.0/surfaces/frontend/tree/CLAUDE.md +5 -0
  94. package/releases/0.79.0/surfaces/integrations/tree/.claude/agents/architect.md +16 -0
  95. package/releases/0.79.0/surfaces/integrations/tree/.claude/agents/implementer.md +12 -0
  96. package/releases/0.79.0/surfaces/integrations/tree/.claude/agents/integration-tester.md +20 -0
  97. package/releases/0.79.0/surfaces/integrations/tree/.claude/agents/planner.md +2 -0
  98. package/releases/0.79.0/surfaces/integrations/tree/.claude/agents/reviewer.md +21 -0
  99. package/releases/0.79.0/surfaces/integrations/tree/.claude/agents/secops.md +2 -0
  100. package/releases/0.79.0/surfaces/integrations/tree/.claude/agents-overview.md +8 -0
  101. package/releases/0.79.0/surfaces/integrations/tree/.claude/graph.md +10 -0
  102. package/releases/0.79.0/surfaces/integrations/tree/.claude/patterns.md +38 -0
  103. package/releases/0.79.0/surfaces/integrations/tree/.claude/pipeline.md +16 -0
  104. package/releases/0.79.0/surfaces/integrations/tree/.claude/retrieval.md +16 -0
  105. package/releases/0.79.0/surfaces/integrations/tree/.claude/router.md +6 -0
  106. package/releases/0.79.0/surfaces/integrations/tree/CLAUDE.md +17 -0
  107. package/releases/0.79.0/surfaces/money/tree/.claude/agents/architect.md +12 -0
  108. package/releases/0.79.0/surfaces/money/tree/.claude/agents/dba.md +14 -0
  109. package/releases/0.79.0/surfaces/money/tree/.claude/agents/implementer.md +11 -0
  110. package/releases/0.79.0/surfaces/money/tree/.claude/agents/integration-tester.md +3 -0
  111. package/releases/0.79.0/surfaces/money/tree/.claude/agents/reviewer.md +23 -0
  112. package/releases/0.79.0/surfaces/money/tree/.claude/agents/secops.md +5 -0
  113. package/releases/0.79.0/surfaces/money/tree/.claude/agents/solidity-auditor.md +4 -0
  114. package/releases/0.79.0/surfaces/money/tree/.claude/agents/solidity-dev.md +4 -0
  115. package/releases/0.79.0/surfaces/money/tree/.claude/graph.md +2 -0
  116. package/releases/0.79.0/surfaces/money/tree/.claude/patterns.md +49 -0
  117. package/releases/0.79.0/surfaces/money/tree/.claude/pipeline.md +2 -0
  118. package/releases/0.79.0/surfaces/money/tree/.claude/retrieval.md +2 -0
  119. package/releases/0.79.0/surfaces/money/tree/CLAUDE.md +11 -0
  120. package/releases/0.79.0/surfaces/pii/tree/.claude/agents/dba.md +2 -0
  121. package/releases/0.79.0/surfaces/pii/tree/.claude/agents/devops.md +8 -0
  122. package/releases/0.79.0/surfaces/pii/tree/.claude/agents/reviewer.md +8 -0
  123. package/releases/0.79.0/surfaces/pii/tree/.claude/agents/secops.md +2 -0
  124. package/releases/0.79.0/surfaces/pii/tree/.claude/agents/solidity-auditor.md +5 -0
  125. package/releases/0.79.0/surfaces/pii/tree/CLAUDE.md +5 -0
  126. package/releases/0.79.0/surfaces/prisma/tree/.claude/agents/architect.md +2 -0
  127. package/releases/0.79.0/surfaces/prisma/tree/.claude/agents/dba.md +42 -0
  128. package/releases/0.79.0/surfaces/prisma/tree/.claude/agents/devops.md +11 -0
  129. package/releases/0.79.0/surfaces/prisma/tree/.claude/agents/implementer.md +2 -0
  130. package/releases/0.79.0/surfaces/prisma/tree/.claude/agents/integration-tester.md +2 -0
  131. package/releases/0.79.0/surfaces/prisma/tree/.claude/agents/reviewer.md +2 -0
  132. package/releases/0.79.0/surfaces/prisma/tree/.claude/patterns.md +15 -0
  133. package/releases/0.79.0/surfaces/prisma/tree/CLAUDE.md +5 -0
  134. package/src/wiring.mjs +6 -0
@@ -0,0 +1,256 @@
1
+ # Patterns & Conventions
2
+
3
+ Read this before writing code. Architects cite it in specs; implementers follow it; reviewers enforce it.
4
+
5
+ ---
6
+
7
+ ## Language & tooling
8
+
9
+ - **TypeScript strict mode** everywhere. No `any` without a justifying comment.
10
+ - **pnpm workspaces + Turborepo**. Never `npm` or `yarn`. Use `turbo run <task>` for orchestrated work.
11
+ - **Biome** for format + lint. No ESLint / Prettier.
12
+ - **Vitest** for unit tests.
13
+ <!-- nina:slot edge-cf.3 -->
14
+ - **Zod** for runtime validation at all trust boundaries (API ingress, env loading, queue payload, an RPC between services, webhook body, integration responses).
15
+
16
+ ### Relative imports carry a `.js` extension — this is intentional, do NOT "fix" it
17
+
18
+ Relative imports in `.ts`/`.tsx` source MUST use the `.js` extension (e.g. `import { x } from './client.js'`, never `'./client'` or `'./client.ts'`). This looks wrong but is correct ESM-TypeScript and is load-bearing:
19
+
20
+ - The repo is ESM (`"type": "module"`, `module: ESNext`, `moduleResolution: Bundler`, `verbatimModuleSyntax: true` in `packages/tsconfig/base.json`). **TypeScript never rewrites import specifiers** — what you write is what lands in the emitted `.js`.
21
+ - Emitting packages ({{EMITTING_PKGS}}) compile with `tsc` to real `.js` in `dist/` and are consumed via their `exports` map (`./dist/*.js`). At runtime the file IS `client.js`; a source `'./client.ts'` would emit a dead `'./client.ts'` reference → broken import. The `.js` form is the only one that works for these.
22
+ - Bundled apps (`{{API_DIR}}` and `{{APP_DIR}}`, each via its bundler) resolve `'./x.js'` back to `./x.ts` source transparently, so the same convention works everywhere.
23
+ - Switching to `.ts` extensions would require `allowImportingTsExtensions`, which only works with `noEmit` — it would break every emitting package. Do not propose it.
24
+
25
+ This is the official TypeScript guidance for ESM. A reviewer/AI that "corrects" `.js` → `.ts` (or strips the extension) is introducing a bug, not a cleanup.
26
+
27
+ ---
28
+
29
+ ## Folder structure within a TS package
30
+
31
+ ```
32
+ package/
33
+ ├── src/
34
+ │ ├── index.ts # public exports only — this is the package API
35
+ │ ├── internal/ # not re-exported; no deep imports allowed from outside
36
+ │ └── types.ts # shared types
37
+ ├── test/ # *.test.ts mirroring src/ structure
38
+ └── package.json
39
+ ```
40
+
41
+ - External code imports from `{{PKG_SCOPE}}/<name>` (barrel `index.ts`), never `{{PKG_SCOPE}}/<name>/src/internal/...`.
42
+
43
+ ---
44
+
45
+ ## `export` only what crosses a module boundary
46
+
47
+ **`export` is a claim that something outside this file needs the symbol.** If nothing does, drop the
48
+ keyword — the declaration stays, it just stops pretending to be API.
49
+
50
+ This is not cosmetic. An unused export is invisible to every tool we have: TypeScript's
51
+ `noUnusedLocals` and Biome's `noUnusedVariables` both stop at the file boundary, so an exported dead
52
+ symbol is the one kind of dead code nothing flags. It also makes the symbol look load-bearing to the
53
+ next reader, which is how a second implementation gets written next to the first.
54
+
55
+ - A React component's `Props` type used only by that component is **not** exported. Export it only
56
+ when another module actually imports it.
57
+ - The same goes for a service's internal result/input shapes, an error code union that never leaves
58
+ its module, and a constant only its own file reads.
59
+ <!-- nina:slot project.1 library-packages -->
60
+ - The standing report is `.claude/code-map.generated.md` § *Rot signals*. The
61
+ reviewer checks it for symbols the current diff introduced: **a new export nothing consumes is
62
+ dead on arrival.**
63
+
64
+ ---
65
+
66
+ ## Naming
67
+
68
+ - **Files:** `kebab-case.ts` for modules, `PascalCase.tsx` for React components.
69
+ - **Types / interfaces:** `PascalCase`. No `I` prefix.
70
+ - **Functions / vars:** `camelCase`.
71
+ - **Constants:** `SCREAMING_SNAKE_CASE` only for true compile-time constants.
72
+ - **Env vars:** `SCREAMING_SNAKE_CASE`, loaded through a typed `env.ts` with Zod validation.
73
+ <!-- nina:slot prisma.1 -->
74
+ <!-- nina:slot money.1 -->
75
+ <!-- nina:slot money.2 -->
76
+ <!-- nina:slot money.3 -->
77
+
78
+ ---
79
+
80
+ ## Readable code — *Clean Code* as a reference
81
+
82
+ Robert C. Martin's *Clean Code* is the reference for writing code the next reader understands without
83
+ running it. It is a reference, not a rulebook: when two ways of writing the same thing both meet the
84
+ spec, choose the one the book would choose. Where the book and this document disagree, this document
85
+ wins: the book treats comments as a failure, and here every declaration still carries TSDoc
86
+ (§ *TSDoc*). The reviewer does not reject a diff on this section alone.
87
+
88
+ - **A name says what the thing is or does.** A function is a verb (`loadProfile`), a boolean reads as a
89
+ question (`isExpired`, `canRetry`), a collection is plural. No abbreviation a newcomer has to decode,
90
+ no bare `data`, `info`, `tmp` or `manager`, and one word per concept: not `fetch` in one module and
91
+ `get` in the next for the same operation.
92
+ - **A function does one thing, at one level of abstraction.** A function that calls three steps does
93
+ not also parse a string inline. When a block needs a comment to say what it does, it is a function
94
+ with that comment as its name.
95
+ - **Guard clauses over nesting.** Leave early on the case you cannot handle — with a named failure, not
96
+ a silent default — so the main path reads at one indentation level.
97
+ - **Few parameters, no flag parameters.** Past three, pass one object with named fields. A boolean that
98
+ switches what a function does (`render(true)`) is two functions.
99
+ - **No magic values.** A number or string whose meaning is not obvious where it is used gets a named
100
+ constant.
101
+ - **A side effect shows in the name.** `getX` does not write. A function either answers a question or
102
+ changes something, not both, where splitting costs nothing.
103
+ - **Extract what is the same rule, not what has the same shape.** Two blocks that look alike but would
104
+ change for different reasons stay apart.
105
+
106
+ **Where it stops.** Readability works inside the scope you were given. Extracting a private function or
107
+ naming a constant in a file you are already writing is in scope; a new shared helper, module, class
108
+ hierarchy or interface the spec did not name is a new abstraction, and goes back to the architect. Code
109
+ you read but are not changing is not rewritten to read better. And indirection is not the goal: a
110
+ function, an interface with one implementation or a pattern earns its place by making the caller
111
+ clearer, not by making the function smaller.
112
+
113
+ ---
114
+
115
+ ## API conventions
116
+
117
+ ### Layering: Route → Service → Data Objects
118
+
119
+ Every request (and queue/webhook invocation) traverses three layers in order. **No layer may skip the next.** Full diagram in `.claude/architecture.md`.
120
+
121
+ - **Route** (`{{API_DIR}}/src/routes/<resource>.ts`): Zod validation, auth + role extraction, envelope shaping, privacy-safe log, deps construction. Nothing else.
122
+ <!-- nina:slot integrations.1 -->
123
+ - **Service** (`{{API_DIR}}/src/services/<resource>.ts`): business orchestration, owner scoping (every read and write filtered by who owns the data), Date→ISO mapping, named-error taxonomy. HTTP-agnostic.
124
+ - **Data Objects:** the database client, the platform bindings, and each integration's boundary module.
125
+
126
+ **Hard rules (reviewer enforces):**
127
+
128
+ <!-- nina:slot db.2 -->
129
+ - Routes must NOT call `.toISOString()` on service results — services do that.
130
+ - Services must NOT import the HTTP framework's request context, shape a response, or reference status codes.
131
+ <!-- nina:slot prisma.2 -->
132
+ <!-- nina:slot db.4 -->
133
+ <!-- nina:slot money.4 -->
134
+ <!-- nina:slot money.5 -->
135
+ <!-- nina:slot integrations.2 -->
136
+
137
+ ### Other API rules
138
+
139
+ - **Zod validation at the request boundary.** No ad-hoc `if (!body.foo) return 400`.
140
+ - Response shape is always `{ok: true, data: T} | {ok: false, error: {code, message}}`. No bare throws leaking to clients.
141
+ - Custom errors: `class AppError extends Error { code: string; status: number }`. Each route maps known classes to HTTP codes.
142
+ <!-- nina:slot money.6 -->
143
+ <!-- nina:slot db.5 -->
144
+ <!-- nina:slot db.7 -->
145
+ <!-- nina:slot prisma.3 -->
146
+ <!-- nina:slot drizzle.1 -->
147
+ <!-- nina:slot d1.1 -->
148
+ <!-- nina:slot integrations.3 -->
149
+ <!-- nina:slot project.2 integration-error-types -->
150
+
151
+ ---
152
+
153
+ ## SDK / shared package conventions
154
+
155
+ - **Tree-shakeable:** barrel `index.ts` only re-exports. No side effects at module top level.
156
+ - Works in: modern browsers, Node 20+, and every runtime the project deploys to.
157
+ - No `console.log` in production paths. Use a `debug(msg)` helper that's a no-op in prod, and never log PII.
158
+ <!-- nina:slot frontend.1 -->
159
+
160
+ ---
161
+
162
+ ## Tests
163
+
164
+ ### Unit tests
165
+ - Test **pure functions** directly. No mocks of our own code.
166
+ <!-- nina:slot money.7 -->
167
+ - Don't test implementation details. Test behavior at the module boundary.
168
+
169
+ ### Integration tests
170
+ <!-- nina:slot edge-cf.4 -->
171
+ <!-- nina:slot db.6 -->
172
+ <!-- nina:slot integrations.4 -->
173
+
174
+ ### Fixtures
175
+ <!-- nina:slot project.3 test-fixtures -->
176
+
177
+ ### Test files MUST be inside the typecheck program
178
+
179
+ A package whose `tsconfig.json` has `include: ["src"]` **does not typecheck its own tests.** That is
180
+ a false green, and an expensive one: the test still imports the symbol you deleted and still passes
181
+ a fixture whose shape drifted, and you find out at vitest time — or never, if nobody runs that
182
+ suite. It is the mechanism behind the pill *test-files-not-typechecked-on-symbol-removal*.
183
+ <!-- nina:slot project.4 typecheck-current-state -->
184
+
185
+ A package that emits (`build: tsc`, with `rootDir: "src"`) cannot simply add `test` to its build
186
+ config. Give it a second config instead and point the script at it:
187
+
188
+ ```jsonc
189
+ // tsconfig.typecheck.json
190
+ {
191
+ "extends": "./tsconfig.json",
192
+ "compilerOptions": { "rootDir": ".", "noEmit": true },
193
+ "include": ["src", "test"]
194
+ }
195
+ ```
196
+ ```jsonc
197
+ // package.json — build keeps using tsconfig.json, typecheck does not
198
+ "typecheck": "tsc --noEmit -p tsconfig.typecheck.json"
199
+ ```
200
+ <!-- nina:slot project.5 typecheck-coverage -->
201
+
202
+ ---
203
+
204
+ ## Correcting a document
205
+
206
+ When you correct a document, **delete what you are correcting.** A document that contradicts itself
207
+ is worse than one that is merely wrong: every reader picks the half that suits what they are already
208
+ writing, so two readers reach opposite conclusions from the same file and both believe they followed
209
+ it. The correction and the text it replaces cannot coexist "for history" — that is what the commit
210
+ log is for.
211
+
212
+ ---
213
+
214
+ ## TSDoc — required on all TS declarations
215
+
216
+ Every named declaration gets a TSDoc block (`/** ... */`) — exported or not: functions, classes + members, interfaces + members, type aliases, enums + members, and top-level constants whose name doesn't convey intent.
217
+
218
+ ### Structure
219
+ - **First line:** a concise one-sentence summary.
220
+ - **`@param`** when the purpose isn't fully encoded in name and type.
221
+ - **`@returns`** when the return carries information the type alone doesn't convey.
222
+ - **`@throws`** whenever the function can throw — name the error type and condition.
223
+ - **`@example`** for non-trivially composed APIs.
224
+ - **`@remarks`** for invariants, perf trade-offs, caveats.
225
+
226
+ ### What TSDoc is NOT
227
+ - Not a restatement of the signature. Not a changelog. Not a crutch for bad naming.
228
+ - Not a statement about code that is not built yet. A block that names what another function, service or step does
229
+ states it only once that exists in the tree; until then it is a contract with its owner named — "Contract for the
230
+ caller: the rule service (R4) must refuse …", "Selected for site 2, which R6 builds" — never the present tense: a later
231
+ stage checking whether a guard exists reads "X guarantees Y" beside the code that relies on it as proof that it does.
232
+
233
+ ### Enforcement
234
+ Reviewer verifies coverage. **Missing TSDoc on any declaration or member the diff adds or changes — test files
235
+ included, as Hard Rule #9 counts them — = `REJECTED`.**
236
+
237
+ ---
238
+
239
+ ## Inline comments — default: none
240
+
241
+ Separate from TSDoc. Regular `//` comments stay rare:
242
+ - **Only** for non-obvious **WHY**: an invariant, a subtle perf trade-off, a workaround.
243
+ - **Never** for WHAT — if code doesn't read clearly, fix the code.
244
+ - **Never** reference callers, tickets, or PR history.
245
+ <!-- nina:slot edge-cf.1 -->
246
+ <!-- nina:slot project.7 required-secrets -->
247
+ <!-- nina:slot edge-cf.2 -->
248
+
249
+ ---
250
+
251
+ ## Commit / PR conventions
252
+
253
+ - One logical change per PR. Multi-concern PRs get split by reviewer.
254
+ - Conventional Commits (`feat:`, `fix:`, `chore:`, `refactor:`, `docs:`).
255
+ - PR description answers **why**, not **what**.
256
+ - Reviewer verifies: typecheck clean, Biome clean, every gate the diff triggered approved (`.claude/graph.md`), no secret leaked, no PII in logs or tests.
@@ -0,0 +1,150 @@
1
+ # Pills of Knowledge
2
+
3
+ Hard-won, per-agent **behavioral corrections** — lessons learned the expensive way (a loop-back,
4
+ a rejected diff, a blocked milestone, a user correction). Each agent reads its own pills **before
5
+ acting** so it does not repeat a past mistake.
6
+
7
+ This is a knowledge surface, not a convention doc. Keep the niche clean:
8
+
9
+ | Surface | Holds | Example |
10
+ |---|---|---|
11
+ | `CLAUDE.md` / `.claude/patterns.md` | **Codebase law / conventions** | "relative imports carry a `.js` extension" |
12
+ | `.claude/integrations/<slug>.md` | **External premises**, with evidence | "the client's `signOut()` never rejects" |
13
+ | **`.claude/pills/<role>/` (here)** | **Agent behavioral corrections** | "implementer: `waitFor()` hangs under fake timers" |
14
+
15
+ If a lesson is really a code convention or an external premise, it belongs in those files — not here.
16
+
17
+ ## Layout
18
+
19
+ ```
20
+ .claude/pills/
21
+ ├── README.md # this file
22
+ ├── shared/ # pills that apply to MORE THAN ONE role
23
+ └── <role>/ # one directory per role, named exactly as its spec in .claude/agents/
24
+ ```
25
+
26
+ A role directory is created on demand, when its first pill is written. One **lesson per file**,
27
+ `kebab-case.md`. An agent reads `pills/<its-role>/*.md` **and** the `pills/shared/*.md` whose
28
+ `applies_to` includes it.
29
+
30
+ Placement is not decoration — it is delivery. A pill sitting in `architect/` that declares
31
+ `applies_to: [architect, implementer]` is never read by the implementer, because the implementer
32
+ only globs its own directory and `shared/`. So the rule is mechanical, and `nina pills` enforces it:
33
+
34
+ - **one role in `applies_to`** → the pill lives in that role's directory
35
+ - **more than one** → the pill lives in `shared/`
36
+
37
+ A pill loose at the top level of `pills/` is read by nobody.
38
+
39
+ ## Pill format
40
+
41
+ Frontmatter is mandatory. A pill without it still reads like prose to a human, but it is invisible
42
+ to every filter the agents and the tooling run — `status`, `trigger` and `applies_to` all stop
43
+ working, so the pill is either ignored or applied where it does not belong.
44
+
45
+ ```markdown
46
+ ---
47
+ id: <role-dir>-<file-slug> # derived from the path, so it cannot drift
48
+ applies_to: [implementer] # one or more roles; drives who reads it, and where it lives
49
+ severity: low | medium | high
50
+ status: active | retired # retired = graduated into a rule, kept for history
51
+ date: YYYY-MM-DD # when learned; this is what lets staleness be spotted
52
+ occurrences: 1 # bump when the SAME lesson is learned again — see Graduation
53
+ last_seen: YYYY-MM-DD # set with every bump; how the harness knows the lesson is current
54
+ trigger: <when this pill is relevant — the agent applies it only if the task matches>
55
+ citations: [path/to/file.ts:42] # the code this pill is a claim about, when there is any
56
+ ---
57
+ **What went wrong:** <the concrete mistake, with where it happened>
58
+ **Rule:** <the imperative — what to do / not do next time>
59
+ **Why:** <the mechanism, so the rule is understood and not merely obeyed>
60
+ **How to apply:** <the concrete check or step the agent runs>
61
+ source: <the run / commit / conversation that produced the lesson>
62
+ ```
63
+
64
+ The `id` is the pill's directory and filename joined. When the filename already opens with the
65
+ role — `reviewer/reviewer-never-write-to-repo-files.md` — the role is not repeated.
66
+
67
+ **Every pill carries evidence: `citations`, or `source`, or both.** A pill is a claim about how
68
+ this system behaves, and a claim with nothing behind it is the thing this harness exists to remove.
69
+ The two are not interchangeable, and that is why they sit in different places:
70
+
71
+ - `citations` point at code in this repository, so a machine can later ask whether the cited line
72
+ still exists. Use them whenever the lesson is about code. They are a **frontmatter field**
73
+ because tooling reads them back.
74
+ - `source` points at the episode — a run, a commit, a conversation. Use it when the lesson is about
75
+ a tool or a process and there is no line to cite. Only a person ever reads it, so it closes the
76
+ body rather than crowding the header.
77
+
78
+ ## The four guardrails (so this stays an asset, not noise)
79
+
80
+ 1. **Bounded growth + graduation.** "Read all my pills" only works while the set is small. See
81
+ *Graduation* below.
82
+ 2. **Staleness.** A pill that cites code rots like any note. `date` flags age and `citations` make
83
+ the rot findable; **verify before trusting**, and prune or update when you next touch the topic.
84
+ 3. **Defined authoring trigger.** Every loop-back (qa → implementer, a reviewer rejection, a mandatory
85
+ gate blocking) **and every user correction** is looked at for a lesson, and a pill is written when the
86
+ mistake would happen again — `.claude/router.md` § *Look at every loop-back for a lesson*. The lesson
87
+ belongs to the stage whose work was sent back. If it already has a pill, do not write a second one:
88
+ increment that pill's `occurrences` and set `last_seen`.
89
+ 4. **Trigger-targeted, not blanket.** The agent reads its pills but **applies only those whose
90
+ `trigger` matches the current task**. This is what lets the corpus grow without drowning the agent.
91
+
92
+ ## Graduation
93
+
94
+ `occurrences` is the counter that decides when a correction has stopped being an anecdote. A pill
95
+ learned once is a note. The same pill learned a third time is evidence that the surrounding rules do
96
+ not cover the case, and the fix belongs where nobody has to remember it:
97
+
98
+ - a convention of this codebase → this project's `.claude/patterns.md`, `CLAUDE.md` or the agent's own
99
+ spec, each written through its copy under `.nina/project/tree/` (`nina where <file>` lists the slots),
100
+ then `nina compose`
101
+ - a premise about a dependency → `.claude/integrations/<slug>.md`
102
+ - a correction that would apply to **any** project of this shape → back into the harness itself, as
103
+ a rule in the core or in the surface that implies it
104
+
105
+ Which of these it is, is this project's call, and only the last leaves it. When a pill reaches three
106
+ occurrences, `harness:check` asks for the call every turn until it is made:
107
+
108
+ - **A rule here:** write it, then `nina learn --graduate <pill> --here <file>`. That retires the pill —
109
+ `status: retired`, moved to `.claude/pills/retired/<the directory it was in>/` — and keeps a record under
110
+ `.nina/requests/`, so the lesson is still watched: if it comes back three more times, the rule did not
111
+ hold, and `harness:check` sends it to the harness. A retired pill is history, not instruction, and there
112
+ no agent opens it to find out. Deleting it would lose the reason the rule exists.
113
+ - **A rule for every project:** the core and the surfaces live in another repository, and this project
114
+ composes a frozen version of them, so this graduation is a request. `nina learn --graduate <pill>` writes
115
+ one under `.nina/requests/`, carrying the pinned version, the layer the rule belongs in and the lesson in
116
+ this project's words. **Commit it with the pill.** The harness maintainer answers it in a release — with
117
+ the rule, or with the reason it stays here — and the `nina upgrade` that installs that release closes the
118
+ request: a rule retires the pill; a decline leaves it active, and `harness:check` asks for it as a rule
119
+ here. Until then the pill stays active; retiring it earlier drops the lesson in the gap.
120
+
121
+ Either can be done before three. `nina pills` names every active pill that has reached three
122
+ occurrences and, for the harness, proposes where it should go: the core when its roles are composed by
123
+ every project, or the surface that its roles exist for. That is a proposal, not a verdict — a reviewer
124
+ lesson can still be about one surface, and only a person can tell. It is reported as a note, never a
125
+ failure: a recurring lesson is work to do, not a defect.
126
+
127
+ ## Reading contract (referenced from each agent spec)
128
+
129
+ > Before acting, read `.claude/pills/<your-role>/*.md` and the `pills/shared/*.md` whose
130
+ > `applies_to` includes your role. Treat `status: active` pills as binding for any task matching
131
+ > their `trigger`. Skip `retired` pills. If a pill cites code that no longer exists, prefer the
132
+ > current code and flag the pill as stale.
133
+
134
+ ## Checking
135
+
136
+ ```bash
137
+ nina pills --project .
138
+ ```
139
+
140
+ Reports malformed frontmatter, pills filed where their audience will not read them, roles this
141
+ project does not compose, and pills carrying no evidence.
142
+
143
+ It also resolves every `citations` entry against the repository. A path that no longer exists, or a
144
+ line past the end of the file it names, is a failure: the pill is telling an agent to look at
145
+ something that is not there. A citation that still resolves in a file which **changed after the
146
+ pill's `date`** is only a note — the line survived, but the code on it may have moved on, and no
147
+ machine can settle that. Verify it before trusting it, then update the pill or retire it.
148
+
149
+ This is what `citations` buys, and it is the reason the format asks for them. A pill with only a
150
+ `source` cannot be checked this way at all.
@@ -0,0 +1,101 @@
1
+ # Pipeline
2
+
3
+ <!-- nina:slot project.1 track-summary -->
4
+
5
+ <!-- nina:slot project.2 pipeline-diagram -->
6
+
7
+ The `reviewer` and every gate the diff triggers are read-only, so **dispatch them together in one
8
+ message** after the implementer rather than in sequence. The reviewer names the gates the diff
9
+ triggers; `qa` goes out once the reviewer and each of them approved, and runs vitest once, on its own. On a diff over ~200 lines, fan the reviewer out by dimension. Full rules:
10
+ `.claude/router.md` § *Parallelization*.
11
+
12
+ ---
13
+
14
+ ## Stage contracts
15
+
16
+ Each stage has: **Input** → what arrives, **Output** → the artifact handed on, **Tools** → what it may use, **Exit criteria** → what must be true before handing off.
17
+
18
+ ---
19
+
20
+ ### Planner
21
+
22
+ - **Input:** user request, often ambiguous or multi-step.
23
+ - **Output:** ordered list of subtasks, each tagged with a 1-line goal + scope (S/M/L) + retrieval list + parallelization tag (`SEQUENTIAL` / `PARALLEL-SAFE`).
24
+ - **Tools:** what its spec's `tools:` grants. **No edits except planning artifacts.**
25
+ - **Exit criteria:** each subtask is small enough for an architect to design in a single pass.
26
+ - **Skip if:** task is already small, single-concern, and concrete.
27
+
28
+ ### Architect
29
+
30
+ - **Input:** one subtask from planner, or a well-scoped direct request.
31
+ - **Output:** technical spec — files to touch, function signatures, data flow, edge cases, tests to add, patterns to follow. Marks which gates in `.claude/graph.md` the change will trigger — the database gate if the schema or a query will be touched, the integration gate if an integration boundary will be — AND, for the latter, includes an **Integration premises** section: every behavior the implementation depends on, each carrying the evidence its kind requires — a `<package dir>/node_modules/<lib>/<file>:<line>` citation with its version, a contract-test case, an observed response, or a `P<n>` reference into `.claude/integrations/<slug>.md`. No premise without a citation.
32
+ - **Tools:** what its spec's `tools:` grants. **No edits except spec files + `.claude/integrations/**`.**
33
+ - **Exit criteria:** implementer can code without re-planning AND the integration gate, where `.claude/graph.md` has one, can verify each premise / contract case without re-deriving it.
34
+
35
+ ### Implementer
36
+
37
+ - **Input:** architect's spec.
38
+ - **Output:** working TS code + tests. `{{TYPECHECK_CMD}}`, `{{LINT_CMD}}`, and (when frontend) `{{BUILD_CMD}}` clean for the affected packages. Diff scoped to the spec. **Does NOT run vitest.**
39
+ - **Tools:** what its spec's `tools:` grants.
40
+ - **Exit criteria:** typecheck/lint/build pass; no scope creep; if the database was touched, says so on first line; if an external service surface touched, says so.
41
+ <!-- nina:slot db.1 -->
42
+ <!-- nina:slot integrations.1 -->
43
+
44
+ ### Reviewer (gate before qa)
45
+
46
+ - **Input:** implementer's diff + all upstream artifacts.
47
+ - **Output:** `APPROVED`, or `REJECTED` with `path:line` references.
48
+ - **Tools:** what its spec's `tools:` grants. **No edits. No vitest.**
49
+ - **Exit criteria:**
50
+ - `{{TYPECHECK_CMD}}`, `{{LINT_CMD}}` pass; `{{BUILD_CMD}}` when frontend touched.
51
+ - Diff matches spec (reject scope creep).
52
+ - `.claude/patterns.md` conventions followed (TSDoc, layering, naming, owner scoping).
53
+ <!-- nina:slot db.2 -->
54
+ <!-- nina:slot integrations.2 -->
55
+ - No security / privacy regression (no PII in logs, no leaked secret, no query missing its owner scope).
56
+ <!-- nina:slot money.1 -->
57
+ - **Preview-first deploy invariant:** a spec that culminates in prod deploy names a preview URL where smoke runs FIRST.
58
+
59
+ ### QA (test execution)
60
+
61
+ - **Input:** `APPROVED` from the reviewer and every gate the diff triggered + the implementer's touched-package list.
62
+ - **Output:** PASS (ready for deploy) or FAIL (loops back to implementer/architect).
63
+ - **Tools:** what its spec's `tools:` grants.
64
+ - Runs vitest **once**, per affected package, **sequentially** (configs enforce single-fork). Kills stray test processes at start and end. See `.claude/agents/qa.md`.
65
+
66
+ ### Devops (deploy)
67
+
68
+ - **Trigger:** qa PASS on a step that changes a deployed surface. Not for test-only, docs-only or harness-only steps, nor while the project has no preview target yet.
69
+ - **Input:** qa PASS + the touched-package list + the architect spec's preview-deploy plan.
70
+ - **Output:** `DEPLOYED` (targets, migrations, the smoke it actually ran, the rollback) or `BLOCKED` (what stopped it, which stage owns the fix).
71
+ - **Tools:** what its spec's `tools:` grants. **No edits to code, tests or config.**
72
+ - **Checks:** clean rebuild of emitting packages; both targets when the API surface changed; every variable the bundle reads present at build time; migrations applied in order against the intended database; secret parity; smoke against preview exercising the changed path; a named rollback.
73
+ - **Production:** never on its own initiative — an explicit go from {{OWNER}}, for that change.
74
+
75
+ ---
76
+
77
+ ## Handoff discipline
78
+
79
+ Each stage produces a **written artifact** — spec, diff, review comments. The next stage consumes the artifact, **not** the original user message. If the implementer finds itself re-reading the original user message, something is wrong with the spec.
80
+
81
+ ---
82
+
83
+ ## Examples
84
+ <!-- nina:slot project.3 worked-example-a -->
85
+ <!-- nina:slot project.4 worked-example-b -->
86
+
87
+ ### Example C — Trivial fix
88
+
89
+ User: "Fix the typo in the dashboard page title."
90
+
91
+ No stage: a trivial edit goes through no chain (`CLAUDE.md`, the task table). Edit it directly, run the typecheck, and commit.
92
+
93
+ ---
94
+
95
+ ## When the pipeline breaks
96
+
97
+ Where each failing verdict sends the work, and how many rounds it gets, is in `.claude/graph.md` —
98
+ the one place it is stated, composed for this project.<!-- nina:why --> This section used to restate it, and had
99
+ already drifted from it: it sent an architect back to the planner along an edge the graph did not
100
+ have.<!-- /nina:why --> One thing the graph cannot express, so it stays here: a stage that hits something no spec
101
+ anticipated stops and says so. It does not guess.
@@ -0,0 +1,103 @@
1
+ # Retrieval Map (RAG for workflow)
2
+
3
+ Which documents to pull into context for a given task type. Goal: **avoid loading all docs on every task** — that wastes tokens and crowds out the actual work.
4
+
5
+ This is the closest thing the harness has to RAG for development. Treat it as authoritative.
6
+
7
+ ---
8
+
9
+ ## Always loaded (by Claude Code itself)
10
+ - `CLAUDE.md` — loads automatically. Don't re-read.
11
+
12
+ ## Pills (per-agent behavioral corrections — loaded by the agent itself)
13
+
14
+ `.claude/pills/<role>/*.md` + `.claude/pills/shared/*.md` hold hard-won corrections from past mistakes (a loop-back, a rejected diff, a blocked milestone, a user correction). **Each subagent reads its own pills before acting** (the instruction is in every `.claude/agents/<role>.md`). Distinct from the surfaces above: pills capture *agent behavior* ("the implementer did X wrong"), not codebase conventions (→ `patterns.md`) or library premises (→ `integrations/`). The orchestrator looks at every loop-back and user correction for a lesson, and writes a pill when it would happen again. Graduation: a lesson learned three times goes to the harness as a request, and the upgrade to the release that answers it retires the pill. Format + guardrails: `.claude/pills/README.md`.
15
+ <!-- nina:slot integrations.1 -->
16
+ <!-- nina:slot project.1 integration-doc-list -->
17
+ <!-- nina:slot integrations.2 -->
18
+
19
+ ## Code map (load first for file-location tasks)
20
+
21
+ **Rule:** Before grepping the repo to find which files participate in a domain, load `.claude/code-map.md`. Two layers:
22
+
23
+ - **`.claude/code-map.md`** — hand-curated. Purpose, invariants, the critical paths, what to reuse. **Read this one.**
24
+ - **`.claude/code-map.generated.md`** — the exhaustive mechanical inventory (every module, its exports, its test) plus the dead-export and untested-module reports, built by a script of the project's own: the harness ships none. Go here when you need the full list. A project with no such script yet defers this file in its profile, and `.claude/code-map.md` is then the whole map — every instruction that points here falls back to it.
25
+
26
+ Where the project checks the curated map against the tree, its `harness:check` runs that check every turn. **A "does this helper already exist?" question is answered here, not by writing a second one.**
27
+
28
+ ## Load on demand
29
+
30
+ ### Task types
31
+
32
+ | Task type | Load these docs | Dispatch |
33
+ |---|---|---|
34
+ | New API endpoint | `.claude/architecture.md` § *API*, § *Layering*, `.claude/patterns.md` § *API conventions* | architect → implementer → reviewer → qa |
35
+ <!-- nina:slot db.1 -->
36
+ <!-- nina:slot db.2 -->
37
+ <!-- nina:slot edge-cf.1 -->
38
+ <!-- nina:slot integrations.3 -->
39
+ <!-- nina:slot edge-cf.2 -->
40
+ <!-- nina:slot money.1 -->
41
+ <!-- nina:slot frontend.1 -->
42
+ <!-- nina:slot edge-cf.3 -->
43
+ | Performance investigation | `.claude/architecture.md` § *Performance targets*, relevant source | architect → implementer |
44
+
45
+ ### Meta tasks
46
+
47
+ **Before changing anything under `.claude/` or `CLAUDE.md`, settle where it goes.** Most of those
48
+ files are composed and cannot be changed from this project; the rest are yours outright, and the
49
+ first question is mechanical rather than a judgement call: **does the file carry `nina:generated`?**
50
+ `nina where <path>` answers that and the rest for any path — including a path that does not exist
51
+ yet, which is the case no file's own header can answer — and it prints the same sentence that file's
52
+ header carries rather than a second wording of it. Inside a generated file the second question is
53
+ the judgement one, and it is only about that case: is the wrong text **this project's fact**, which
54
+ belongs in a `project.N` slot, or **a rule for every project**, which cannot be changed from here?
55
+
56
+ | Task type | Load these docs | Dispatch |
57
+ |---|---|---|
58
+ | A rule an agent follows is wrong | `nina where <the composed file>` — it is a **request against the pinned core**, quoting file and line. It cannot be edited here | report it; it arrives back through `nina upgrade` |
59
+ | A number, path, command or provider in a composed file is wrong | `nina where <the composed file>` — it is **this project's fact**, so it belongs in the slot it names under `.nina/project/tree/` | whoever found it, now |
60
+ | A spec the harness should compose is not on disk | `nina where <the path>` — a file gated on a surface this project does not declare is **not missing**, it is switched off. Declaring the surface is a decision about the project, not a fix | whoever is asking why it is absent |
61
+ | A mistake just happened and should not happen twice | `.claude/pills/README.md` — a **pill** under `.claude/pills/<role>/`, written directly. Never an edit to the agent's spec | the orchestrator, on the loop-back |
62
+ | What a library actually does, proven at runtime | `.claude/integrations/<slug>.md` — yours to write, and the slug belongs in `.nina/profile.json` or nothing knows the doc exists | the integration gate, or whoever proved it |
63
+ | A plan for work in progress | `.claude/plans/**` — yours, and nothing composes it, ever | whoever is planning |
64
+ | Anything that is not one of the above | `nina where <the path>` — it will say "not harness", which is an answer: the file is ordinary project code and the harness has no opinion about it | whoever is editing it |
65
+ | New subagent role | `.claude/pipeline.md`, `.claude/router.md`, existing `.claude/agents/*.md` | human decision |
66
+ | Package / route / service / RPC method added or removed | `.claude/code-map.md` — update the curated map, and its check where the project has one | whoever shipped the change, at the close of the step |
67
+ | Update this map | the project's slot in it — `nina where .claude/retrieval.md` names it; a row every project needs is a request against the pinned core | architect (light) → reviewer |
68
+
69
+ ---
70
+
71
+ ## How to scope loads
72
+
73
+ - **Load a section, not a full doc, when possible.** Architecture and patterns docs have headings; jump to the relevant one.
74
+ - **Don't preload.** Only read a doc when the task actually requires it.
75
+ - **Re-read existing code before editing it**, even if read this session — it may have changed.
76
+
77
+ ---
78
+
79
+ ## Anti-patterns
80
+
81
+ - ❌ Loading `.claude/architecture.md` in full for a 3-line bug fix.
82
+ - ❌ Loading `.claude/patterns.md` when the task is a pure design discussion (no code yet).
83
+ - ❌ Loading every subagent spec manually — they load automatically when dispatched via Agent.
84
+ - ❌ Re-reading `CLAUDE.md` after Claude Code has loaded it.
85
+ - ❌ Skipping the retrieval map and loading "everything just in case."
86
+
87
+ ---
88
+
89
+ ## When unsure
90
+
91
+ 1. Read the **first 50 lines** of `.claude/architecture.md` (table of contents).
92
+ 2. Identify the relevant section.
93
+ 3. Read that section only.
94
+ 4. If still unclear, escalate to the user — don't guess with more tokens.
95
+
96
+ ---
97
+
98
+ ## Updating this map
99
+
100
+ When a new kind of task appears that isn't in the table:
101
+ 1. Add a row here first.
102
+ 2. Commit the update alongside the change it describes.
103
+ 3. Don't let the map rot — a stale retrieval map is worse than no map.