@neikyun/ciel 6.10.1 → 6.11.1

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 (40) hide show
  1. package/assets/.claude/hooks/memory-engine.py +256 -0
  2. package/assets/commands/ciel-audit.md +42 -0
  3. package/assets/commands/ciel-create-skill.md +2 -2
  4. package/assets/commands/ciel-status.md +1 -1
  5. package/assets/platforms/opencode/.opencode/agents/ciel-improver.md +2 -2
  6. package/assets/platforms/opencode/.opencode/commands/ciel-create-skill.md +2 -2
  7. package/assets/platforms/opencode/.opencode/commands/ciel-memory-bootstrap.md +195 -0
  8. package/assets/skills/ciel/SKILL.md +2 -1
  9. package/assets/skills/workflow/adr-auto/SKILL.md +88 -0
  10. package/assets/skills/workflow/ai-failure-modes-detector/SKILL.md +180 -0
  11. package/assets/skills/workflow/ask-window/SKILL.md +119 -0
  12. package/assets/skills/workflow/avec-quoi-versioner/SKILL.md +111 -0
  13. package/assets/skills/workflow/ci-watcher/SKILL.md +194 -0
  14. package/assets/skills/workflow/critiquer-auditor/SKILL.md +135 -0
  15. package/assets/skills/workflow/critiquer-auditor/reference.md +134 -0
  16. package/assets/skills/workflow/debug-reasoning-rca/SKILL.md +174 -0
  17. package/assets/skills/workflow/depth-classifier/SKILL.md +118 -0
  18. package/assets/skills/workflow/diverge/SKILL.md +91 -0
  19. package/assets/skills/workflow/doc-validator-official/SKILL.md +196 -0
  20. package/assets/skills/workflow/evaluer-sizer/SKILL.md +112 -0
  21. package/assets/skills/workflow/faire-gatekeeper/SKILL.md +99 -0
  22. package/assets/skills/workflow/flux-narrator/SKILL.md +93 -0
  23. package/assets/skills/workflow/memoire/SKILL.md +198 -0
  24. package/assets/skills/workflow/memoire-consolidator/SKILL.md +91 -0
  25. package/assets/skills/workflow/meta-critiquer/SKILL.md +112 -0
  26. package/assets/skills/workflow/modern-patterns-checker/SKILL.md +166 -0
  27. package/assets/skills/workflow/pattern-fitness-check/SKILL.md +108 -0
  28. package/assets/skills/workflow/playwright-visual-critic/SKILL.md +98 -0
  29. package/assets/skills/workflow/pr-review-responder/SKILL.md +214 -0
  30. package/assets/skills/workflow/prouver-verifier/SKILL.md +184 -0
  31. package/assets/skills/workflow/prouver-verifier/reference.md +152 -0
  32. package/assets/skills/workflow/quoi-framer/SKILL.md +91 -0
  33. package/assets/skills/workflow/relire-critic/SKILL.md +99 -0
  34. package/assets/skills/workflow/security-regression-check/SKILL.md +86 -0
  35. package/assets/skills/workflow/self-consistency-verifier/SKILL.md +85 -0
  36. package/assets/skills/workflow/spike-mode/SKILL.md +101 -0
  37. package/assets/skills/workflow/stride-analyzer/SKILL.md +96 -0
  38. package/assets/skills/workflow/stride-analyzer/reference.md +144 -0
  39. package/assets/skills/workflow/test-strategy-vitest-playwright/SKILL.md +119 -0
  40. package/package.json +1 -1
@@ -0,0 +1,196 @@
1
+ ---
2
+ name: doc-validator-official
3
+ description: Before generating code that calls an external library, framework, or API, fetches the OFFICIAL documentation for the exact version in use and validates that each proposed API call (function name, signature, parameters, return type) exists as cited. Rejects reliance on Stack Overflow/blog posts when official docs exist. Forces citations for every non-trivial API use. The primary anti-hallucination gate for the RECHERCHE step.
4
+ allowed-tools: Read, Grep, Glob, Bash, WebFetch, WebSearch
5
+ ---
6
+
7
+ # doc-validator-official — Official docs first, blogs never
8
+
9
+ LLM hallucination of APIs is the #1 coding failure mode (ISSTA 2025). Functions that don't exist, wrong version signatures, parameters invented, return types fabricated. Advanced RAG against official docs eliminates this class of bug.
10
+
11
+ ---
12
+
13
+ ## Inputs (infer before asking — see orchestrator's Autonomy protocol)
14
+
15
+ ```
16
+ TARGET_STACK: [language + framework + version — e.g., "TypeScript 5.5 + React 19"]
17
+ PROPOSED_APIS: [list of function/class/method calls the implementation will use]
18
+ PACKAGE_SOURCES: [paths to package.json / go.mod / requirements.txt / Cargo.toml]
19
+ ```
20
+
21
+ ### Auto-inference sources (exhaust BEFORE asking the user)
22
+
23
+ - **PACKAGE_SOURCES** → `find . -maxdepth 3 -name 'package.json' -o -name 'go.mod' -o -name 'requirements.txt' -o -name 'pyproject.toml' -o -name 'Cargo.toml' -o -name 'Gemfile'` — pick up every manifest without asking.
24
+ - **TARGET_STACK** → derive from PACKAGE_SOURCES (read the files, extract versions of the key libs). Cross-check with `ciel-overlay.md`.
25
+ - **PROPOSED_APIS** → parse from the user's task description + any referenced code diff. If user said "use stripe to refund X", APIs = `stripe.refunds.create`, `stripe.paymentIntents.retrieve`, etc.
26
+
27
+ Only BLOCK if no manifest file exists at all (greenfield project with no deps yet) — then ask once "Which package.json / go.mod should I validate against?".
28
+
29
+ ---
30
+
31
+ ## Phase 1 — Extract exact versions
32
+
33
+ Read package manifests. For each lib in PROPOSED_APIS extract the pinned version:
34
+
35
+ ```bash
36
+ # npm/yarn/pnpm
37
+ jq -r '.dependencies + .devDependencies | to_entries[] | "\(.key) \(.value)"' package.json
38
+
39
+ # go
40
+ grep -E '^\s*<lib>' go.mod
41
+
42
+ # python
43
+ grep -E '^<lib>' requirements.txt pyproject.toml
44
+ ```
45
+
46
+ Record as `{lib_name, pinned_version, source_file:line}`.
47
+
48
+ If version is a range (`^1.2.0`) → resolve the actual installed version from lockfile (`package-lock.json`, `yarn.lock`, `uv.lock`, `Cargo.lock`). Never validate against a range.
49
+
50
+ ---
51
+
52
+ ## Phase 2 — Locate official docs
53
+
54
+ For each lib, find the CANONICAL doc URL for the exact version. Priority order:
55
+
56
+ 1. **Versioned docs site** — `https://reactjs.org/docs/v19.0.0/` or `https://fastapi.tiangolo.com/release-notes/`
57
+ 2. **Repo `/docs/` at the tag** — `https://github.com/org/repo/tree/v1.2.0/docs`
58
+ 3. **README at the tag** — `https://github.com/org/repo/blob/v1.2.0/README.md`
59
+ 4. **Context7 MCP** (if available) — provides up-to-date official docs for thousands of libs
60
+
61
+ ### Reject these sources
62
+
63
+ - Stack Overflow answers (even highly upvoted — often stale)
64
+ - Medium/dev.to blog posts (version drift, author may have been wrong)
65
+ - AI-generated tutorials (recursion hazard)
66
+ - Forum posts without corroboration by official docs
67
+
68
+ These may GUIDE investigation but never JUSTIFY an API claim.
69
+
70
+ ---
71
+
72
+ ## Phase 3 — Validate each proposed API
73
+
74
+ For each item in PROPOSED_APIS:
75
+
76
+ 1. **Fetch the official doc page** for that function/class.
77
+ 2. **Verify the signature matches** — function exists, parameter names and types match, return type matches.
78
+ 3. **Verify version availability** — "Added in vX.Y" metadata. If the pinned version < X.Y, the API doesn't exist in this project yet.
79
+ 4. **Capture citation** — URL + section header + (if possible) quoted signature.
80
+
81
+ Output per API:
82
+ ```
83
+ [VALID] lib.funcName(a: T1, b: T2): T3
84
+ Source: <URL>#section
85
+ Cited: "funcName(a, b) → T3 — Added in 1.4.0"
86
+ Pinned: 1.5.2 ✓
87
+ ```
88
+
89
+ or:
90
+ ```
91
+ [INVALID] lib.funcName — NOT FOUND in v1.5.2 docs
92
+ Similar: lib.otherFunc (did you mean this?)
93
+ Action: rename or choose a different lib
94
+ ```
95
+
96
+ or:
97
+ ```
98
+ [AMBIGUOUS] lib.funcName exists but signature differs
99
+ Doc says: funcName(a: string, opts?: Opts) → Promise<T>
100
+ Proposed: funcName(a, b) — missing opts wrapping
101
+ Action: rewrite call site to match doc signature
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Phase 4 — Citation enforcement
107
+
108
+ Every non-trivial API use in the final implementation MUST have a citation comment OR be documented in the PR description. Trivial = stdlib builtin (`Array.map`, `str.split`). Non-trivial = third-party lib, framework-specific, version-sensitive stdlib (e.g., `Intl.Segmenter`).
109
+
110
+ Citation format in code (optional, acceptable if 3+ APIs would clutter):
111
+ ```typescript
112
+ // Per react.dev/reference/react/useTransition (v19)
113
+ const [isPending, startTransition] = useTransition();
114
+ ```
115
+
116
+ Citation format in PR description (mandatory for Critical tasks):
117
+ ```
118
+ ## External APIs used
119
+ - `react.useTransition` — react.dev/reference/react/useTransition (v19)
120
+ - `drizzle-orm.select().from()` — orm.drizzle.team/docs/select (v0.33)
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Phase 5 — Training-cutoff awareness
126
+
127
+ If a lib in PROPOSED_APIS was released or had a major version AFTER your knowledge cutoff (January 2026), explicitly flag:
128
+
129
+ ```
130
+ [CUTOFF-WARNING] lib <name> vX.Y (released 2026-MM-DD)
131
+ Your training data does not reliably cover this version.
132
+ MANDATORY: fetch live docs, do not rely on pattern-matching from memory.
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Output format
138
+
139
+ ```
140
+ ## DOC VALIDATION
141
+
142
+ ### Versions resolved
143
+ - react 19.0.2 (from package-lock.json:1234)
144
+ - drizzle-orm 0.33.1 (from package-lock.json:5678)
145
+
146
+ ### API validation
147
+ [VALID] react.useTransition — react.dev/.../useTransition (v19)
148
+ [VALID] drizzle-orm.select — orm.drizzle.team/docs/select (v0.33)
149
+ [INVALID] drizzle-orm.raw — not in v0.33, renamed to sql.raw in v0.30+
150
+ [AMBIGUOUS] react.use — signature changed in v19, proposed call uses v18 shape
151
+
152
+ ### Cutoff warnings
153
+ - drizzle-orm 0.33 (released 2026-02) — post-cutoff, relied on live fetch
154
+
155
+ ### Verdict
156
+ BLOCKING: 1 INVALID, 1 AMBIGUOUS — cannot proceed until resolved
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Guardrails
162
+
163
+ - **Never infer an API from "it should exist"** — if you can't cite the doc page, the API doesn't exist for your purposes.
164
+ - **Exact version, never range** — validating against a range produces false positives.
165
+ - **Reject blog/SO as primary source** — they may CONFIRM, never ESTABLISH.
166
+ - **Cutoff-flag everything post-January 2026** — your memory is wrong often enough to require external validation.
167
+ - **If docs don't exist** (tiny lib, no website, just README) → read the source directly at the tag. No README + no source available → replace the lib.
168
+ - **Budget**: 5 APIs × 2 min lookups = 10 min max. Beyond 10 APIs, batch via a single doc-site crawl or ask user to narrow.
169
+
170
+ ---
171
+
172
+ ## How to verify
173
+
174
+ - [ ] Exact versions extracted from lock files?
175
+ - [ ] Official docs located for each API call?
176
+ - [ ] Each proposed API validated (function name, signature, params, return type)?
177
+ - [ ] Citations enforced (file:line or URL for every API)?
178
+ - [ ] Training-cutoff awareness applied (if lib updated after cutoff)?
179
+ - [ ] VERDICT issued (VALID / INVALID / UNCERTAIN)?
180
+
181
+ ## When triggered
182
+
183
+ - RECHERCHE step for Standard/Critical tasks using external libs
184
+ - Before any code using a lib published/updated after your knowledge cutoff
185
+ - When `@ciel-researcher` is dispatched for API design
186
+ - When user says "use library X" and you have no strong prior
187
+ - After `ai-failure-modes-detector` flags an invented-API risk
188
+
189
+ ---
190
+
191
+ ## References
192
+
193
+ - ISSTA 2025 — "LLM Hallucinations in Practical Code Generation: Phenomena, Mechanism, and Mitigation"
194
+ - arxiv 2404.00971 — "Beyond Functional Correctness: Exploring Hallucinations in LLM-Generated Code"
195
+ - Mintlify — AI hallucination prevention via accurate docs
196
+ - Context7 MCP — `@upstash/context7-mcp` for live official-doc retrieval
@@ -0,0 +1,112 @@
1
+ ---
2
+ name: evaluer-sizer
3
+ description: How to size and assess risk before coding — back-of-envelope sizing, pre-mortem (2 failure modes), recent-churn check, diverged alternatives (v5), and counterfactual ("what if we do nothing?"). For Ciel v5 pipeline step 9 (EVALUER). Use after DIVERGE and RECHERCHE, before ASK2.
4
+ ---
5
+
6
+ # Pre-Implementation Sizing — 5 Cheap Gates (Ciel v5)
7
+
8
+ ## What this covers
9
+
10
+ How to sanity-check an approach before committing to it. In v5, this step follows DIVERGE (etape 5) which explored 2-3 approaches. Here we evaluate the selected approach. These 5 gates take 2 minutes and prevent hours of wasted work.
11
+
12
+ ## Core principle
13
+
14
+ **Quantify before coding.** "Small memory footprint" is not sizing. "~2 MB × 10k entries = 20 MB" is.
15
+
16
+ ## Gate 1: Back-of-envelope sizing
17
+
18
+ Compute rough estimates:
19
+ - Memory: bytes per row × row count
20
+ - Connections: concurrent users × connections per user
21
+ - Throughput: req/s × processing time per req
22
+ - Storage: items × avg size × retention
23
+
24
+ Does the solution fit in the budget? If caching requires 10 GB and the server has 2 GB -> wrong solution, don't start.
25
+
26
+ ## Gate 2: Pre-mortem
27
+
28
+ State explicitly: "In production, this could fail in these 2 ways:"
29
+ 1. <failure mode 1>
30
+ 2. <failure mode 2>
31
+
32
+ Can't imagine 2 failure modes -> don't understand the system well enough.
33
+
34
+ ## Gate 3: Recent churn
35
+
36
+ ```bash
37
+ git log --oneline --since="7 days" -- <impacted files>
38
+ ```
39
+
40
+ If 2+ commits in the last week touched the same module:
41
+ - Read those commits BEFORE proposing your fix
42
+ - Someone already fixed this area twice this week -> incomplete mental model
43
+ - Your "fix" might be the 3rd attempt at the same bug
44
+
45
+ ## Gate 4: Diverged approach comparison (v5)
46
+
47
+ Compare the approaches explored during DIVERGE (etape 5):
48
+ - Approach A (from DIVERGE): <summary>
49
+ - Approach B (from DIVERGE): <summary>
50
+ - Selected: <A or B> because <reason>
51
+ - Why NOT the other: <specific limitation, not "it's worse">
52
+
53
+ If only 1 approach was explored -> DIVERGE was incomplete.
54
+
55
+ ## Gate 5: Counterfactual
56
+
57
+ **Counterfactual**: "What if we do NOTHING?" If doing nothing solves 80% of the problem with 0 risk -> reconsider scope.
58
+
59
+ ## Output format
60
+
61
+ ```
62
+ ## EVALUER
63
+
64
+ ### Sizing
65
+ - Memory: <estimate>
66
+ - Connections: <estimate>
67
+ - Throughput: <estimate>
68
+ - Fit: <yes -- within budget | no -- what breaks>
69
+
70
+ ### Pre-mortem (2 ways this could fail)
71
+ 1. <failure mode>
72
+ 2. <failure mode>
73
+
74
+ ### Recent churn
75
+ - Commits in last 7 days: <N>
76
+ - Relevant: <list>
77
+ - Read them? <yes -- findings>
78
+
79
+ ### Diverged approach comparison (v5)
80
+ - A: <summary>
81
+ - B: <summary>
82
+ - Selected: <A/B> because <reason>
83
+
84
+ ### Counterfactual
85
+ - What if nothing? <consequence>
86
+ - 80% solve with 0 risk? <yes -> reconsider | no -> proceed>
87
+ ```
88
+
89
+ ## How to verify
90
+
91
+ - [ ] Sizing has concrete numbers (request rate, data volume, latency budget)?
92
+ - [ ] Pre-mortem identifies >= 2 specific failure modes?
93
+ - [ ] Recent churn checked (git log for affected files)?
94
+ - [ ] >= 2 approaches compared from DIVERGE?
95
+ - [ ] Counterfactual stated ("what if we don't do this")?
96
+ - [ ] Selected approach justified with specific reason?
97
+
98
+ ## Common rationalizations
99
+
100
+ | Rationalization | Reality |
101
+ |---|---|
102
+ | "I'll size it as I go" | Sizing after coding is guessing. Sizing before prevents committing to the wrong approach. |
103
+ | "I can't estimate without coding" | Back-of-envelope takes 2 minutes. 2 minutes of thinking saves 2 hours of coding the wrong thing. |
104
+ | "Pre-mortem is pessimistic" | Pre-mortem is the cheapest bug fix you'll ever write. Imagining failure costs nothing. Production failure costs everything. |
105
+ | "Diverging is a waste of time, the first approach is fine" | The first approach is rarely the best. It's just the first. Generating 2-3 approaches takes 5 minutes. Committing to the wrong one takes days. |
106
+
107
+ ## Common mistakes
108
+
109
+ - **Hand-waving sizing**: "small footprint" without numbers
110
+ - **Pre-mortem = tests**: "might have bugs" is useless. "Query times out at > 10k notifications" is useful.
111
+ - **Fake alternatives**: "React over Assembly" is not real. "Page vs cursor pagination because API is public" is real.
112
+ - **Single-approach bias (v5)**: if DIVERGE was skipped, EVALUER cannot compare alternatives. Go back to DIVERGE.
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: faire-gatekeeper
3
+ description: How to implement code safely — 6 quality gates for Ciel v5 (test-first, alternatives, idiomatic, quality, removal, boy-scout). SPIKE mode relaxes gates. A checklist for implementation discipline during FAIRE (etape 11).
4
+ ---
5
+
6
+ # Implementation Safety — 6 Quality Gates (Ciel v5)
7
+
8
+ ## What this covers
9
+
10
+ How to implement code with discipline during Ciel v5 FAIRE phase (etape 11). These gates run during coding and are enforced by the plugin or hooks. SPIKE mode relaxes some gates.
11
+
12
+ ## Core principle
13
+
14
+ **Check gates per-file, not per-task.** Each write/edit gets its own gate check. In SPIKE mode, gates 1 and 6 are optional but the code must be marked FIXME/TODO.
15
+
16
+ ## The 6 gates (v5)
17
+
18
+ ### Gate 1: Test-first (RED)
19
+
20
+ Do not write source code before the test exists. If no `*.test.*` file exists:
21
+ - OpenCode: plugin blocks via tool.execute.before
22
+ - Claude Code: hook blocks via exit 2
23
+
24
+ **SPIKE mode**: relaxed. Exploration code may be written without tests, but must be marked FIXME/TODO.
25
+
26
+ ### Gate 2: Alternatives
27
+
28
+ "I chose X over Y because [reason]." No Y named -> research alternatives first.
29
+
30
+ ### Gate 3: Idiomatic
31
+
32
+ Common bypass signals that need justification:
33
+ - `window.*` / `document.*` in React -> why not hook/ref/router?
34
+ - `for` + raw SQL -> why not batch/ORM?
35
+ - `catch(e) { return null }` -> why not Result/sealed class?
36
+ - `as X` without type guard -> why not `is X`?
37
+ - Copying a block for the 3rd+ time -> why not extract a helper?
38
+
39
+ ### Gate 4: Quality
40
+
41
+ - Complexity: < 15 (cyclomatic)
42
+ - Nesting: < 4 levels
43
+ - Function length: < 50 lines
44
+ - File length: < 400 lines
45
+
46
+ **SPIKE mode**: relaxed. Exploration code may be longer or complex, but must be marked FIXME/TODO.
47
+
48
+ ### Gate 5: Removal safety
49
+
50
+ If you are DELETING code:
51
+ - Who uses it? (grep for imports/references)
52
+ - What replaces it?
53
+ - What degrades if not replaced?
54
+ - Is there a migration path?
55
+
56
+ ### Gate 6: Boy-scout (v5)
57
+
58
+ After the change: is the code better than before?
59
+ - Minor improvements count: better naming, removed dead code, added missing test
60
+ - If the file was already touched, leaving it better is cheap
61
+ - If nothing to improve, note "status quo" explicitly
62
+
63
+ ## Output format
64
+
65
+ ```
66
+ ## FAIRE gates
67
+
68
+ Gate 1 (test-first): <PASS | BLOCKED | SPIKE>
69
+ Gate 2 (alternatives): <X > Y because ...>
70
+ Gate 3 (idiomatic): <PASS | bypass justified: ...>
71
+ Gate 4 (quality): <complexity N, nesting N, length N | PASS>
72
+ Gate 5 (removal): <no removal | safe: ...>
73
+ Gate 6 (boy-scout): <improved: ... | status quo>
74
+ ```
75
+
76
+ ## How to verify
77
+
78
+ - [ ] Test exists (or spike mode active)?
79
+ - [ ] Alternative considered and documented?
80
+ - [ ] No unjustified framework bypass?
81
+ - [ ] Complexity < 15, nesting < 4, function < 50 lines?
82
+ - [ ] Removals checked for dependents?
83
+ - [ ] Code better than before?
84
+
85
+ ## SPIKE mode behavior
86
+
87
+ When `.ciel/exploration.active` exists:
88
+ - Gate 1 (test-first): relaxed
89
+ - Gate 4 (quality): relaxed
90
+ - Gates 2, 3, 5: always active
91
+ - Gate 6 (boy-scout): recommended but not blocking
92
+ - Exploration code MUST be marked FIXME or TODO
93
+
94
+ ## Key rules
95
+
96
+ - **Gates are non-negotiable in Standard/Critical mode**: plugin/hooks enforce them
97
+ - **SPIKE mode is for exploration only**: gates are relaxed, but code must be refactored properly after
98
+ - **Gate 5 matters most**: deleting code without checking dependents is the fastest way to break production
99
+ - **Boy-scout is the cheapest improvement**: if you already read the file, clean it up
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: flux-narrator
3
+ description: How to trace data flow through a system — trigger → handler → service → state → output, with boundaries, assumptions, and break points called out. Essential before implementation or test writing.
4
+ allowed-tools: Read, Grep
5
+ ---
6
+
7
+ # Data Flow Tracing — Narrate Before You Code
8
+
9
+ ## What this covers
10
+
11
+ How to trace and narrate data flow through a system. If you can't narrate the flow, you don't understand the system — read more code before implementing.
12
+
13
+ ## Core narration
14
+
15
+ Format: `"When [trigger] → [handler fires] → [function calls] → [data flows] → [output]"`
16
+
17
+ Example:
18
+ ```
19
+ When user clicks "Save" on ProfileForm →
20
+ → ProfileForm.tsx:handleSubmit (component boundary)
21
+ → useUpdateProfile hook fires (state boundary)
22
+ → fetch('/api/users/:id/profile', {method: 'PATCH'}) (network boundary)
23
+ → Ktor Route at routes/UserRoute.kt:PATCH /:id/profile
24
+ → UserService.updateProfile (service layer)
25
+ → UserRepository.save (DB layer)
26
+ → return HTTP 200 with updated user
27
+ → UI optimistically updates via React Query
28
+ → Toast notification: "Profile saved"
29
+ ```
30
+
31
+ ## 3 cross-cutting dimensions
32
+
33
+ ### BOUNDARIES
34
+ Where does control pass between layers? Each boundary is a place where contracts can break.
35
+
36
+ ### ASSUMPTIONS
37
+ What must be true for this flow to work? E.g. "assumes user is authenticated", "assumes DB connection is not exhausted".
38
+
39
+ ### BREAK POINTS
40
+ Where can the flow fail WITHOUT visible error? E.g. silent swallowed exceptions, network retries that mask failures, caching that hides stale data.
41
+
42
+ **Break points ≠ assumptions**: an assumption is "must be true"; a break point is "how it fails silently even when all assumptions hold".
43
+
44
+ ## Test-specific items (when writing tests)
45
+
46
+ When the task involves writing tests, also determine:
47
+
48
+ - **Test level**: unit / integration / E2E — justify the choice
49
+ - **URL routing**: request `host:port` vs handler `host:port` — match or mismatch? (CI often differs from local)
50
+ - **Mock lifecycle**: fires at module load? function call? render cycle?
51
+ - **Timing**: expected delay in ms / CI runner capabilities (fake timers? timeout?)
52
+
53
+ ## Output format
54
+
55
+ ```
56
+ ## FLUX
57
+
58
+ When <trigger>
59
+ → <layer 1: component/handler — file:function>
60
+ → <layer 2: service/function — file:function>
61
+ → <layer 3: DB/API/store>
62
+ → <output: state change / HTTP response / side effect>
63
+
64
+ ### Boundaries
65
+ - <list: where control crosses layers>
66
+
67
+ ### Assumptions
68
+ - <list: what must be true>
69
+
70
+ ### Break points (silent failures)
71
+ - <list: how the flow fails without visible error>
72
+
73
+ [If writing tests:]
74
+ ### Test-specific
75
+ - Test level: <unit | integration | E2E> — <justification>
76
+ - URL routing: MATCH ✓ | MISMATCH ⚠️
77
+ - Mock lifecycle: <module load | function call | render>
78
+ - Timing: <X ms>, CI: <capable | insufficient ⚠️>
79
+ ```
80
+
81
+ ## How to verify
82
+
83
+ - [ ] ≥ 3 layers in the flow (trigger → middle → output)?
84
+ - [ ] BOUNDARIES identified?
85
+ - [ ] ASSUMPTIONS listed (what must be true)?
86
+ - [ ] BREAK POINTS identified (silent failures)?
87
+ - [ ] Narration based on grep (not memory)?
88
+
89
+ ## Key rules
90
+
91
+ - **Minimum 3 layers**: trigger → middle → output. Only 2 = don't understand the flow.
92
+ - **Don't narrate from memory**: grep the actual call graph. Pattern-matching produces plausible but wrong narrations.
93
+ - **Test items mandatory when writing tests**: skipping any one risks CI/local mismatch or flaky tests.