fullstack-agentic-flow 2.0.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 (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +348 -0
  3. package/dist/src/cli/args.js +74 -0
  4. package/dist/src/cli/commands/doctor.js +133 -0
  5. package/dist/src/cli/commands/init.js +103 -0
  6. package/dist/src/cli/commands/shared.js +20 -0
  7. package/dist/src/cli/commands/tools.js +21 -0
  8. package/dist/src/cli/commands/update.js +21 -0
  9. package/dist/src/cli/main.js +6 -0
  10. package/dist/src/cli/output.js +11 -0
  11. package/dist/src/cli/prompter.js +13 -0
  12. package/dist/src/cli/report.js +13 -0
  13. package/dist/src/cli/run.js +48 -0
  14. package/dist/src/domain/canon-mapping.js +26 -0
  15. package/dist/src/domain/claude-md-mode.js +17 -0
  16. package/dist/src/domain/enum-parse.js +9 -0
  17. package/dist/src/domain/errors.js +13 -0
  18. package/dist/src/domain/pipeline-config.js +58 -0
  19. package/dist/src/domain/runtime.js +19 -0
  20. package/dist/src/domain/tool.js +129 -0
  21. package/dist/src/domain/topology.js +39 -0
  22. package/dist/src/install/adapters.js +39 -0
  23. package/dist/src/install/applier.js +150 -0
  24. package/dist/src/install/detect.js +70 -0
  25. package/dist/src/install/managed-section.js +35 -0
  26. package/dist/src/install/manifest.js +63 -0
  27. package/dist/src/install/planned-file.js +77 -0
  28. package/dist/src/install/planner.js +139 -0
  29. package/dist/src/install/rules-preset.js +37 -0
  30. package/dist/src/install/setup-guide.js +60 -0
  31. package/dist/src/io/fs.js +39 -0
  32. package/dist/src/io/paths.js +6 -0
  33. package/dist/src/io/shell.js +25 -0
  34. package/dist/src/registry/commands.js +52 -0
  35. package/dist/src/registry/subagents.js +52 -0
  36. package/dist/src/registry/tools.js +99 -0
  37. package/package.json +53 -0
  38. package/payload/ai-agents/agents/00-bootstrap.md +473 -0
  39. package/payload/ai-agents/agents/00a-scaffold.md +295 -0
  40. package/payload/ai-agents/agents/00b-module-scaffold.md +108 -0
  41. package/payload/ai-agents/agents/01-intake.md +308 -0
  42. package/payload/ai-agents/agents/01b-impact-analysis.md +274 -0
  43. package/payload/ai-agents/agents/02a-dependency-map.md +247 -0
  44. package/payload/ai-agents/agents/02b-backend-contract.md +434 -0
  45. package/payload/ai-agents/agents/02c-ui-contract.md +367 -0
  46. package/payload/ai-agents/agents/02d-interface-seam.md +373 -0
  47. package/payload/ai-agents/agents/03a-backend-sequence.md +233 -0
  48. package/payload/ai-agents/agents/03b-ui-sequence.md +230 -0
  49. package/payload/ai-agents/agents/04a-backend-implementer.md +290 -0
  50. package/payload/ai-agents/agents/04b-ui-implementer.md +302 -0
  51. package/payload/ai-agents/agents/05-ci-validator.md +125 -0
  52. package/payload/ai-agents/agents/06-qa-spec.md +249 -0
  53. package/payload/ai-agents/agents/07-security.md +228 -0
  54. package/payload/ai-agents/agents/08-performance.md +208 -0
  55. package/payload/ai-agents/agents/09a-feature-notes.md +156 -0
  56. package/payload/ai-agents/agents/09b-release.md +111 -0
  57. package/payload/ai-agents/architecture-context.template.md +554 -0
  58. package/payload/ai-agents/archive/README.md +22 -0
  59. package/payload/ai-agents/canon/backend-canon.md +295 -0
  60. package/payload/ai-agents/canon/frontend-canon.md +47 -0
  61. package/payload/ai-agents/canon/typed-data.md +158 -0
  62. package/payload/ai-agents/observations/README.md +11 -0
  63. package/payload/ai-agents/scripts/check-test-with-change.mjs +103 -0
  64. package/payload/ai-agents/scripts/check-typed-boundaries.mjs +329 -0
  65. package/payload/ai-agents/scripts/lib/config.mjs +63 -0
  66. package/payload/ai-agents/scripts/lib/glob.mjs +40 -0
  67. package/payload/ai-agents/state/README.md +108 -0
  68. package/payload/ai-agents/state/current-stage.md +10 -0
  69. package/payload/ai-agents/templates/README.md +22 -0
  70. package/payload/ai-agents/templates/ci/github-actions.rules.yml +35 -0
  71. package/payload/ai-agents/templates/ci/gitlab-ci.rules.yml +30 -0
  72. package/payload/ai-agents/toolchain.md +214 -0
  73. package/payload/commands/bootstrap.md +17 -0
  74. package/payload/commands/contract.md +64 -0
  75. package/payload/commands/finalize.md +26 -0
  76. package/payload/commands/impact.md +25 -0
  77. package/payload/commands/implement.md +58 -0
  78. package/payload/commands/intake.md +16 -0
  79. package/payload/commands/perf.md +20 -0
  80. package/payload/commands/qa.md +15 -0
  81. package/payload/commands/release.md +22 -0
  82. package/payload/commands/resume.md +52 -0
  83. package/payload/commands/scaffold-module.md +20 -0
  84. package/payload/commands/scaffold.md +35 -0
  85. package/payload/commands/seam.md +28 -0
  86. package/payload/commands/security.md +16 -0
  87. package/payload/commands/sequence.md +22 -0
  88. package/payload/commands/status.md +37 -0
  89. package/payload/legacy/v1-checksums.json +197 -0
  90. package/payload/root/contracts-README.md +19 -0
  91. package/payload/root/pipeline-section.md +33 -0
@@ -0,0 +1,554 @@
1
+ # Architecture Context — {PROJECT NAME}
2
+
3
+ > **This file is generated per repository by `/bootstrap` (agent 00), then
4
+ > corrected by a human. It is the single source of truth every other agent
5
+ > reads before doing anything.**
6
+ >
7
+ > There is no global version of this file and there never will be. Two repos
8
+ > that both "use React and Postgres" still disagree about where files go, what
9
+ > a service is allowed to do, and what a button looks like — and those
10
+ > disagreements are exactly what makes generated code feel foreign. This file
11
+ > is where a repo states its own answers.
12
+ >
13
+ > **Agents must not modify this file.** Only `/bootstrap` writes it, and only
14
+ > when you re-run it deliberately. If an agent discovers a pattern that
15
+ > contradicts this file, it raises that as a finding — it does not silently
16
+ > adapt.
17
+ >
18
+ > Delete every `{PLACEHOLDER}` and every instruction block like this one before
19
+ > committing. A section that does not apply should say **"N/A — {why}"**, not be
20
+ > left as template text. Agents treat leftover template text as an unfilled gap
21
+ > and will stop to ask.
22
+
23
+ **Generated**: {ISO timestamp}
24
+ **Last verified against codebase**: {ISO timestamp}
25
+ **Bootstrap confidence**: {high | medium | low — set by agent 00}
26
+
27
+ ---
28
+
29
+ ## 1. What this system is
30
+
31
+ {Two or three sentences, plain language. What the software does and who uses
32
+ it. Agents use this to judge whether a proposed feature belongs here at all.}
33
+
34
+ **Primary users**: {roles}
35
+ **Deployment shape**: {monolith | modular monolith | service in a mesh | ...}
36
+ **Scale posture**: {rows/requests/users the design should assume today, and the
37
+ horizon it should not over-engineer for}
38
+ **Large table threshold**: {row count above which a table counts as "large" —
39
+ agent 01b scores data and performance risk against it}
40
+ **Hot paths**: {the endpoints/screens/jobs that carry most traffic — 01b D6}
41
+
42
+ ### 1.1 Topology
43
+
44
+ **Topology**: {mvc | unified-api | split-backend | split-frontend}
45
+ **Secondary surface**: {none | e.g. "JSON API under /api/v1 for the mobile app"}
46
+ **API style**: {N/A — mvc | REST | GraphQL | RPC/tRPC | gRPC | mixed: which where}
47
+ **Schema source of truth**: {N/A | generated from code annotations by {tool} | SDL file at {path} | router types | hand-written spec at {path}}
48
+ **Counterpart repositories**: {N/A | repo — role — how contracts travel (path/URL)}
49
+ **Seam mode(s)** (agent 02d): {page-contract | http-api | graphql | export | import}
50
+
51
+ ---
52
+
53
+ ## 2. Stack inventory
54
+
55
+ | Concern | Choice | Version | Notes |
56
+ |---------|--------|---------|-------|
57
+ | Language | {} | {} | |
58
+ | Backend framework | {} | {} | |
59
+ | Datastore(s) | {} | {} | |
60
+ | Cache / queue | {} | {} | |
61
+ | UI framework | {} | {} | |
62
+ | Styling | {} | {} | |
63
+ | Build tooling | {} | {} | |
64
+ | Test runner(s) | {} | {} | |
65
+ | Package manager(s) | {} | {} | |
66
+
67
+ **Deliberate exclusions** — libraries the team has decided NOT to use, and why.
68
+ This prevents agents from helpfully introducing them:
69
+
70
+ - {library} — {why not}
71
+
72
+ ---
73
+
74
+ ## 3. Commands
75
+
76
+ Agents run these verbatim. If a command does not exist, write `N/A` rather than
77
+ inventing a plausible one.
78
+
79
+ | Purpose | Command |
80
+ |---------|---------|
81
+ | Install dependencies | `{}` |
82
+ | Run dev server | `{}` |
83
+ | Run full test suite | `{}` |
84
+ | Run one test file | `{}` |
85
+ | Lint | `{}` |
86
+ | Lint with autofix | `{}` |
87
+ | Type check | `{}` |
88
+ | Static analysis | `{}` |
89
+ | Apply schema migrations | `{}` |
90
+ | Generate a migration | `{}` |
91
+ | Build for production | `{}` |
92
+ | Secret scan | `{}` |
93
+
94
+ ---
95
+
96
+ ## 4. Repository map
97
+
98
+ Where things live. Agents use this to place new files and to know where to look
99
+ before claiming something does not exist.
100
+
101
+ ```
102
+ {paste the actual annotated tree — two or three levels deep, with a comment on
103
+ each significant directory. Not the output of `tree`; a curated map.}
104
+ ```
105
+
106
+ **Where a new feature's files go**: {describe the rule — by module, by layer, by
107
+ domain. Give one concrete worked path.}
108
+
109
+ ---
110
+
111
+ # BACKEND
112
+
113
+ ## 5. Backend architecture
114
+
115
+ ### 5.0 Canon mapping
116
+
117
+ How this repository maps the pipeline's backend canon
118
+ (`.ai-agents/canon/backend-canon.md`). Agent 00b generates new modules from this
119
+ table; 00 bootstrap re-verifies it on every run.
120
+
121
+ **Canon mapping**: {laravel | nestjs | express | django | fastapi | spring | go | custom}
122
+ **Strictness**: {strict | pragmatic}
123
+ **Modules root**: `{path}`
124
+ **Use-case entry method**: {execute | handle} **Output suffix**: {Result | View}
125
+ **Data-class mechanism**: {Spatie Data | readonly classes | class + mapper | dataclasses | pydantic | records}
126
+ **Conformance**: {conforms | different vocabulary | partial — see §11 | does not conform — see §11}
127
+
128
+ | Canon layer | Path in this repo | Contains here |
129
+ |-------------|-------------------|---------------|
130
+ | Module registration | `{}` | {} |
131
+ | Domain | `{}` | {} |
132
+ | Application | `{}` | {} |
133
+ | Infrastructure | `{}` | {} |
134
+ | Interface | `{}` | {} |
135
+ | Tests — unit / integration / feature | `{}` | {} |
136
+ | Fakes | `{}` | {} |
137
+
138
+ **Newest conforming module** (00b reads it for texture): `{path}`
139
+
140
+ ### 5.1 Layers and boundaries
141
+
142
+ {Name the layers in dependency order and state, for each, what it may and may
143
+ not do. Be specific about the illegal moves — those are what agents get wrong.}
144
+
145
+ | Layer | Responsibility | May call | Must never |
146
+ |-------|----------------|----------|------------|
147
+ | {} | {} | {} | {} |
148
+
149
+ **The rule that matters most here**: {e.g. "handlers never touch the ORM
150
+ directly", "domain services never construct HTTP responses"}
151
+
152
+ ### 5.2 Request lifecycle
153
+
154
+ {Trace one request end to end, naming the actual classes/functions it passes
155
+ through. This single trace teaches an agent more than a paragraph of
156
+ description.}
157
+
158
+ ```
159
+ {HTTP entry} → {routing} → {middleware} → {handler} → {input contract}
160
+ → {domain service} → {data access} → {datastore}
161
+ → {response shape} → {serialization}
162
+ ```
163
+
164
+ ### 5.3 Data access
165
+
166
+ - **Pattern**: {repository | active record | query builder | DAO | ...}
167
+ - **Where queries live**: {}
168
+ - **Naming conventions for read methods**: {list the exact required names — this
169
+ is high-value, agents invent synonyms otherwise}
170
+ - **Pagination**: {approach, default page size, response shape}
171
+ - **Filtering / search**: {how filters arrive and how they are applied}
172
+ - **Eager loading / N+1 policy**: {}
173
+ - **Raw query policy**: {when raw SQL is permitted, and how parameters bind}
174
+
175
+ ### 5.4 Input contracts and validation
176
+
177
+ - **Mechanism**: {DTO class | schema object | decorator | framework request}
178
+ - **Where validation lives**: {}
179
+ - **Create vs update differences**: {especially uniqueness handling}
180
+ - **Error message conventions**: {tone, casing, whether defaults are overridden}
181
+ - **What is validated where**: {client, edge, domain — and what is duplicated on
182
+ purpose}
183
+
184
+ ### 5.5 Business logic
185
+
186
+ - **Where it lives**: {}
187
+ - **Transaction boundaries**: {who opens them, what must be inside one}
188
+ - **Domain errors**: {exception types, how they map to responses}
189
+ - **Side effects** (email, events, webhooks): {dispatched where, sync or async}
190
+
191
+ ### 5.6 Authentication and authorization
192
+
193
+ - **Auth mechanism**: {session | token | JWT | mTLS}
194
+ - **Where authorization is enforced**: {middleware | policy | guard | handler}
195
+ - **Role/permission model**: {}
196
+ - **Default posture**: {deny-by-default or allow-by-default — state it plainly}
197
+ - **Multi-tenancy**: {N/A, or how tenant scoping is applied and enforced}
198
+
199
+ ### 5.7 Background work
200
+
201
+ - **Queue/worker system**: {N/A or name}
202
+ - **What must be async**: {the threshold rule}
203
+ - **Job conventions**: {base classes, naming, retry/timeout defaults, idempotency}
204
+ - **Scheduling**: {}
205
+
206
+ ### 5.8 Backend exemplar — copy this shape
207
+
208
+ {Paste a real, complete, currently-committed file that exemplifies a handler and
209
+ its dependencies. Verbatim, not idealized. This is the highest-signal part of
210
+ the entire document — the implementer agent matches it structurally. Pick your
211
+ cleanest recent example, not your oldest.}
212
+
213
+ ```{language}
214
+ {paste}
215
+ ```
216
+
217
+ **Non-negotiable in the above**: {call out the 3–5 specific things that must be
218
+ reproduced — return types, constructor injection style, naming, ordering}
219
+
220
+ ---
221
+
222
+ ## 6. Persistence conventions
223
+
224
+ - **Naming**: {tables, columns, keys, indexes, constraints}
225
+ - **Primary keys**: {type and generation strategy}
226
+ - **Foreign keys**: {constrained? on-delete behaviour?}
227
+ - **Timestamps**: {which, what type, timezone policy}
228
+ - **Soft deletes**: {used? on which tables? how queries account for them}
229
+ - **Audit columns**: {which, populated where}
230
+ - **Money and precision**: {exact types — this is where projects lose real data}
231
+ - **Enums / status columns**: {native enum, string with constraint, lookup table}
232
+ - **JSON columns**: {permitted? which type? indexed how?}
233
+ - **Migration rules**: {idempotency, reversibility, whether they may contain data
234
+ changes, how destructive changes are staged}
235
+
236
+ ### 6.1 Migration exemplar
237
+
238
+ ```{language}
239
+ {paste a real migration}
240
+ ```
241
+
242
+ ### 6.2 Indexing policy
243
+
244
+ {When an index is required rather than optional. Which columns always get one.
245
+ How composite index column order is chosen. Any partial-index conventions.}
246
+
247
+ ---
248
+
249
+ ## 7. Interface surface conventions
250
+
251
+ The frontend is built against this. Agent 02d freezes the per-feature seam, but
252
+ these are the standing rules it must conform to. Fill the subsections the
253
+ topology in §1.1 uses; mark the others `N/A — topology is {x}`.
254
+
255
+ ### 7A. HTTP API
256
+
257
+ - **Style**: {REST | RPC | mixed — and where each is used}
258
+ - **Route naming**: {pattern, with two examples}
259
+ - **Versioning**: {}
260
+ - **Success response envelope**:
261
+
262
+ ```json
263
+ {}
264
+ ```
265
+
266
+ - **Error response envelope**:
267
+
268
+ ```json
269
+ {}
270
+ ```
271
+
272
+ - **Validation error shape** (the frontend renders this field-by-field):
273
+
274
+ ```json
275
+ {}
276
+ ```
277
+
278
+ - **Status codes**: {which codes are used for what — especially for validation
279
+ failure, authorization failure, and async acceptance}
280
+ - **Pagination shape**: {}
281
+ - **Empty collection**: {`[]` vs `null` — state it, agents guess otherwise}
282
+ - **Dates over the wire**: {format and timezone}
283
+ - **Money over the wire**: {string or number, and precision}
284
+ - **Async operations**: {how a queued job reports acceptance and completion}
285
+
286
+ ### 7B. GraphQL
287
+
288
+ - **Schema approach**: {SDL-first | code-first — with which library}
289
+ - **Naming**: {types, inputs, enums, mutations — e.g. `createBrand(input: CreateBrandInput!): CreateBrandPayload!`}
290
+ - **Nullability policy**: {}
291
+ - **Error model**: {typed union results | errors with extension codes — which for what}
292
+ - **Pagination**: {connections | offset}
293
+ - **Batching / N+1**: {dataloader or equivalent, where it lives}
294
+ - **Authorization**: {per resolver | per field | directive}
295
+
296
+ ### 7C. Page contracts (MVC)
297
+
298
+ - **Rendering call**: {e.g. `Inertia::render('Masters/Brands/Index', BrandIndexViewModel::from(...))`}
299
+ - **View model convention**: {one Data class per screen, in `{path}`, named `{Screen}ViewModel`}
300
+ - **Shared props**: {what every page receives, and where it is defined}
301
+ - **Validation error bag**: {shape, and how the UI reads it}
302
+ - **Flash messages**: {keys, tone, where rendered}
303
+ - **Redirect after write**: {convention}
304
+ - **Lazy / partial props**: {N/A or the mechanism}
305
+
306
+ ### 7D. Cross-repository contracts (split topologies)
307
+
308
+ - **Contracts directory**: `contracts/{slug}/` — `seam.md`, schema fragment, `VERSION`
309
+ - **Transport between repos**: {git submodule | copied by `/seam import` from a path | fetched from a URL | package}
310
+ - **Versioning**: semver per `agents/02d-interface-seam.md`; consumers pin the version they built against
311
+
312
+ ---
313
+
314
+ # FRONTEND
315
+
316
+ ## 8. UI architecture
317
+
318
+ ### 8.0 Frontend canon mapping
319
+
320
+ How this repo maps `.ai-agents/canon/frontend-canon.md`.
321
+
322
+ | Canon area | Path here |
323
+ |------------|-----------|
324
+ | Routes / pages | `{}` |
325
+ | Feature folders | `{}` |
326
+ | Shared UI (the inventory) | `{}` |
327
+ | API client | `{}` |
328
+ | Tokens | `{}` — or `DESIGN.md` |
329
+
330
+ **Product and design context**: {`PRODUCT.md` + `DESIGN.md` (impeccable) | N/A}
331
+
332
+ ### 8.1 Composition model
333
+
334
+ - **Rendering approach**: {SPA | SSR | islands | server-rendered templates}
335
+ - **Routing**: {file-based | config | server-driven}
336
+ - **How a page receives data**: {props from server | fetch on mount | loader |
337
+ server component — be specific, this drives every page the agent writes}
338
+ - **State management**: {local | store library | server-state cache}
339
+ - **What may hold state**: {which layer owns what — page vs component vs store}
340
+
341
+ ### 8.2 Screen anatomy
342
+
343
+ {Describe the standard skeleton every screen conforms to. Layout wrapper,
344
+ header, content container, action placement.}
345
+
346
+ ```
347
+ {Layout}
348
+ └── {Page header: title, breadcrumb, primary action}
349
+ └── {Content container}
350
+ └── {feature content}
351
+ ```
352
+
353
+ **Standard screen types and their required shape**:
354
+
355
+ | Screen type | Required elements | Notes |
356
+ |-------------|-------------------|-------|
357
+ | List / index | {} | |
358
+ | Create / edit form | {} | |
359
+ | Detail / show | {} | |
360
+ | Dashboard | {} | |
361
+
362
+ ### 8.3 Component inventory — the approved list
363
+
364
+ Agents compose UI **only** from these. Inventing a component is a contract-level
365
+ decision that must be raised at Gate 1, never made silently during
366
+ implementation, because every ad-hoc component permanently widens the surface
367
+ the team maintains.
368
+
369
+ | Component | Import path | Use for | Do not use for |
370
+ |-----------|-------------|---------|----------------|
371
+ | {} | {} | {} | {} |
372
+
373
+ **If a feature appears to need something not on this list**, the UI contract
374
+ agent records it under "Architectural decisions needed" with a proposed API and
375
+ a justification. A human approves it before it exists.
376
+
377
+ ### 8.4 Design tokens
378
+
379
+ Agents must reference tokens, never literal values. A hex code in a diff is a
380
+ review failure.
381
+
382
+ **If `DESIGN.md` exists, it is the visual source of truth.** This section then
383
+ records only where the tokens live in code and anything `DESIGN.md` omits. When
384
+ the two disagree, bootstrap raises it; agents do not pick.
385
+
386
+ | Token group | Values / source of truth |
387
+ |-------------|--------------------------|
388
+ | Color — semantic (primary, danger, success, warning, muted) | {} |
389
+ | Color — surface / background / border | {} |
390
+ | Typography scale | {} |
391
+ | Font families | {} |
392
+ | Spacing scale | {} |
393
+ | Border radius | {} |
394
+ | Elevation / shadow | {} |
395
+ | Breakpoints | {} |
396
+ | Z-index layers | {} |
397
+ | Motion — duration and easing | {} |
398
+
399
+ **Dark mode**: {supported? how it is implemented? what agents must do to keep a
400
+ component correct in both themes}
401
+
402
+ ### 8.5 Required states
403
+
404
+ Every data-bound surface must handle all of these. A UI task is not done if any
405
+ is missing, and the QA agent tests each one explicitly.
406
+
407
+ | State | Required treatment |
408
+ |-------|--------------------|
409
+ | Loading — initial | {skeleton? spinner? which component?} |
410
+ | Loading — refetch / background | {} |
411
+ | Empty — no data yet | {illustration? copy tone? call to action?} |
412
+ | Empty — no results for filter | {must differ from "no data yet"} |
413
+ | Error — recoverable | {inline? retry affordance?} |
414
+ | Error — fatal | {} |
415
+ | Partial / degraded | {} |
416
+ | Success feedback | {toast? inline? duration?} |
417
+ | Destructive confirmation | {dialog pattern, wording convention} |
418
+
419
+ ### 8.6 Forms
420
+
421
+ - **Form state library / pattern**: {}
422
+ - **Where validation errors come from**: {server shape from §7, client rules, or
423
+ both — and which wins}
424
+ - **Error display**: {position, styling, timing — on blur, on submit, live}
425
+ - **Submit behaviour**: {disabled while pending? optimistic? redirect after?}
426
+ - **Unsaved-changes handling**: {}
427
+ - **Field-level conventions**: {labels, required markers, help text, placeholders}
428
+ - **Multi-step forms**: {N/A or the pattern}
429
+
430
+ ### 8.7 Interaction and feedback
431
+
432
+ - **Primary action placement**: {}
433
+ - **Keyboard support expected**: {which interactions must work without a mouse}
434
+ - **Focus management**: {after navigation, after modal open/close, after submit}
435
+ - **Optimistic updates**: {where permitted}
436
+ - **Debounce/throttle conventions**: {search input, autosave}
437
+
438
+ ### 8.8 Responsive behaviour
439
+
440
+ - **Breakpoints**: {from tokens}
441
+ - **Approach**: {mobile-first or desktop-first — state it}
442
+ - **How tables degrade on narrow viewports**: {}
443
+ - **Navigation on narrow viewports**: {}
444
+ - **Touch target minimum**: {}
445
+
446
+ ### 8.9 Accessibility baseline
447
+
448
+ Non-negotiable minimums. The QA agent tests these.
449
+
450
+ - **Target standard**: {e.g. WCAG 2.2 AA}
451
+ - **Contrast**: {minimum ratio, and which token pairs are pre-verified}
452
+ - **Semantic markup**: {landmark and heading requirements}
453
+ - **Labels**: {every input labelled how}
454
+ - **Focus visibility**: {}
455
+ - **Announcements**: {live regions for async results}
456
+ - **Motion**: {reduced-motion handling}
457
+
458
+ ### 8.10 UI exemplar — copy this shape
459
+
460
+ {Paste one real, complete, currently-committed component or page that
461
+ exemplifies the conventions above. Same reasoning as §5.8: structural imitation
462
+ beats description.}
463
+
464
+ ```{language}
465
+ {paste}
466
+ ```
467
+
468
+ **Non-negotiable in the above**: {the 3–5 things that must be reproduced}
469
+
470
+ ---
471
+
472
+ # CROSS-CUTTING
473
+
474
+ ## 9. Testing conventions
475
+
476
+ | Level | Framework | Location | What must be covered |
477
+ |-------|-----------|----------|----------------------|
478
+ | Unit | {} | {} | {} |
479
+ | Integration | {} | {} | {} |
480
+ | End-to-end | {} | {} | {} |
481
+ | Visual / component | {} | {} | {} |
482
+
483
+ - **TDD mechanics** (rule TDD-1):
484
+ - Run one test: `{}`
485
+ - Pending/skip marker for acceptance specs: `{e.g. ->todo() | test.todo | xfail(strict=True)}`
486
+ - Mirrored or co-located tests: {}
487
+ - In-memory fakes location: `{}`
488
+ - **Test data strategy**: {factories, fixtures, builders — returning named types, not arrays}
489
+ - **Database in tests**: {}
490
+ - **What is NOT tested by policy**: {so agents stop writing tests nobody wants}
491
+ - **Coverage expectation**: {number, or "no gate — judgment"}
492
+
493
+ ---
494
+
495
+ ## 10. Non-negotiable rules
496
+
497
+ The specific mistakes that are always wrong in this repository. Each becomes a
498
+ CI check where mechanically checkable, and a review item where not.
499
+
500
+ ### 10.0 Pipeline-wide rules
501
+
502
+ Installed with the pipeline. Copied verbatim by bootstrap; never deleted or
503
+ softened. A scoped exception is written directly beneath the rule it relaxes,
504
+ naming the exact path and the reason, and must have been approved at a gate.
505
+
506
+ | # | Rule | Applies to | Checked by |
507
+ |---|------|-----------|------------|
508
+ | T1 | No untyped array, map, `mixed`, or `any` in a signature that crosses a layer, module, process, or network boundary. Named Data classes instead. | both | `scripts/check-typed-boundaries.mjs` + static analysis |
509
+ | T2 | Collections are typed collections of named types. A bare array is never a return type. | both | static analysis |
510
+ | T3 | Fixed value sets are enums, not strings. | both | review |
511
+ | T4 | Optional is explicit (nullable or a variant), never "key may be missing". | both | type checker |
512
+ | T5 | Untyped data only at the parse edge, converted to a named type on the next line. No casts on response bodies. | both | review |
513
+ | T6 | Money, quantities, identifiers, and dates with rules are value objects or branded types. | both | review |
514
+ | TDD-1 | Tests are written first. A commit that changes source without a test change needs `[no-test: reason]` in its message. | both | `scripts/check-test-with-change.mjs` + `tdd-log.md` at Gate 2 |
515
+ | TDD-2 | Acceptance tests from the frozen seam are un-skipped, never edited, by implementers. | both | review |
516
+ | CANON-1 | Dependencies point Interface → Application → Domain; Infrastructure implements ports. Domain imports no framework code in `strict` mode. | backend | review; graph check where installed |
517
+ | CANON-2 | A controller/resolver action calls exactly one use case and never a repository or the ORM. | backend | review |
518
+ | CANON-3 | Canonical names only — use cases `VerbNoun`, repository methods per canon §4, no synonyms. | backend | review |
519
+
520
+ ### 10.1 Repository rules
521
+
522
+ Write these as your team would say them out loud. Vague rules produce vague
523
+ enforcement.
524
+
525
+ | # | Rule | Applies to | Mechanically checkable? |
526
+ |---|------|-----------|-------------------------|
527
+ | 1 | {} | {backend/frontend/both} | {yes — regex / no — review} |
528
+
529
+ **Rationale for the non-obvious ones**: {a sentence each. Agents apply a rule
530
+ correctly to novel situations only when they understand what it protects
531
+ against.}
532
+
533
+ ---
534
+
535
+ ## 11. Known debt and no-go zones
536
+
537
+ Places the codebase is knowingly wrong, or where change is disproportionately
538
+ risky. Agents must not "fix" these opportunistically and must flag when a
539
+ feature forces them into one.
540
+
541
+ | Area | What is wrong | Why it is still there | Rule for agents |
542
+ |------|---------------|----------------------|-----------------|
543
+ | {} | {} | {} | {} |
544
+
545
+ ---
546
+
547
+ ## 12. Glossary
548
+
549
+ Domain terms that mean something specific here. Include the ones with an
550
+ everyday meaning that differs from the local one — those cause the worst bugs.
551
+
552
+ | Term | Means | Does NOT mean |
553
+ |------|-------|---------------|
554
+ | {} | {} | {} |
@@ -0,0 +1,22 @@
1
+ # Archive
2
+
3
+ Finished features land here, one directory per slug, written by agent 09a when
4
+ `/finalize` runs — on the branch, before the merge, so the record arrives with
5
+ the code rather than after it.
6
+
7
+ ```
8
+ {slug}/
9
+ ├── feature.md what was asked for
10
+ ├── contract-backend.md how the backend was designed
11
+ ├── contract-ui.md how the interface was designed
12
+ ├── contract-seam.md the frozen seam both tracks built against
13
+ ├── plan.md dependency map and the task sequences
14
+ ├── impact.md predicted and actual impact, with the risk class
15
+ ├── decisions.md judgment calls made during implementation
16
+ ├── tdd-log.md the red → green record
17
+ └── stage.md final state, including any accepted findings
18
+ ```
19
+
20
+ Keep these. When someone asks in a year why a field behaves the way it does,
21
+ `decisions.md` and the contracts are the only record — the diff shows what
22
+ changed, never why.