@curdx/flow 3.0.0 → 3.1.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 (219) hide show
  1. package/CHANGELOG.md +21 -87
  2. package/LICENSE +1 -1
  3. package/README.md +28 -129
  4. package/dist/index.mjs +995 -0
  5. package/package.json +33 -44
  6. package/.claude-plugin/marketplace.json +0 -48
  7. package/.claude-plugin/plugin.json +0 -52
  8. package/agent-preamble/preamble.md +0 -314
  9. package/agents/flow-adversary.md +0 -203
  10. package/agents/flow-architect.md +0 -198
  11. package/agents/flow-brownfield-analyst.md +0 -143
  12. package/agents/flow-debugger.md +0 -321
  13. package/agents/flow-edge-hunter.md +0 -289
  14. package/agents/flow-executor.md +0 -269
  15. package/agents/flow-orchestrator.md +0 -145
  16. package/agents/flow-planner.md +0 -247
  17. package/agents/flow-product-designer.md +0 -159
  18. package/agents/flow-qa-engineer.md +0 -282
  19. package/agents/flow-researcher.md +0 -166
  20. package/agents/flow-reviewer.md +0 -304
  21. package/agents/flow-security-auditor.md +0 -401
  22. package/agents/flow-triage-analyst.md +0 -272
  23. package/agents/flow-ui-researcher.md +0 -230
  24. package/agents/flow-ux-designer.md +0 -221
  25. package/agents/flow-verifier.md +0 -350
  26. package/bin/curdx-flow +0 -5
  27. package/bin/curdx-flow-state +0 -104
  28. package/bin/curdx-flow.js +0 -54
  29. package/cli/README.md +0 -104
  30. package/cli/doctor-workflow.js +0 -483
  31. package/cli/doctor.js +0 -73
  32. package/cli/help.js +0 -59
  33. package/cli/install-bundled-mcps.js +0 -37
  34. package/cli/install-companions.js +0 -19
  35. package/cli/install-context7-config.js +0 -80
  36. package/cli/install-curdx-plugin.js +0 -96
  37. package/cli/install-language.js +0 -35
  38. package/cli/install-next-steps.js +0 -29
  39. package/cli/install-options.js +0 -9
  40. package/cli/install-paths.js +0 -52
  41. package/cli/install-recommended-plugins.js +0 -104
  42. package/cli/install-required-plugins.js +0 -57
  43. package/cli/install-self-update.js +0 -62
  44. package/cli/install-workflow.js +0 -209
  45. package/cli/install.js +0 -101
  46. package/cli/lib/claude-commands.js +0 -41
  47. package/cli/lib/claude-ops.js +0 -47
  48. package/cli/lib/claude.js +0 -183
  49. package/cli/lib/config.js +0 -24
  50. package/cli/lib/doctor-claude-settings.js +0 -1186
  51. package/cli/lib/doctor-report.js +0 -978
  52. package/cli/lib/doctor-runtime-environment.js +0 -196
  53. package/cli/lib/frontmatter.js +0 -44
  54. package/cli/lib/json-schema.js +0 -57
  55. package/cli/lib/logging.js +0 -25
  56. package/cli/lib/process.js +0 -60
  57. package/cli/lib/prompts.js +0 -135
  58. package/cli/lib/runtime.js +0 -107
  59. package/cli/lib/semver.js +0 -109
  60. package/cli/lib/version.js +0 -12
  61. package/cli/protocols-body.md +0 -22
  62. package/cli/protocols.js +0 -162
  63. package/cli/registry.js +0 -123
  64. package/cli/router.js +0 -49
  65. package/cli/uninstall-actions.js +0 -360
  66. package/cli/uninstall-workflow.js +0 -146
  67. package/cli/uninstall.js +0 -42
  68. package/cli/upgrade-workflow.js +0 -80
  69. package/cli/upgrade.js +0 -91
  70. package/cli/utils.js +0 -40
  71. package/gates/adversarial-review-gate.md +0 -219
  72. package/gates/coverage-audit-gate.md +0 -182
  73. package/gates/devex-gate.md +0 -254
  74. package/gates/edge-case-gate.md +0 -194
  75. package/gates/karpathy-gate.md +0 -130
  76. package/gates/security-gate.md +0 -218
  77. package/gates/tdd-gate.md +0 -182
  78. package/gates/test-quality-gate.md +0 -59
  79. package/gates/verification-gate.md +0 -179
  80. package/hooks/hooks.json +0 -130
  81. package/hooks/scripts/common.sh +0 -237
  82. package/hooks/scripts/config-change-guard.sh +0 -94
  83. package/hooks/scripts/flow-context-watch.sh +0 -94
  84. package/hooks/scripts/inject-karpathy.sh +0 -53
  85. package/hooks/scripts/quick-mode-guard.sh +0 -69
  86. package/hooks/scripts/session-start.sh +0 -94
  87. package/hooks/scripts/session-title.sh +0 -87
  88. package/hooks/scripts/stop-watcher.sh +0 -231
  89. package/hooks/scripts/subagent-artifact-guard.sh +0 -92
  90. package/hooks/scripts/subagent-statusline.sh +0 -111
  91. package/hooks/scripts/task-lifecycle-guard.sh +0 -106
  92. package/hooks/scripts/teammate-idle-guard.sh +0 -83
  93. package/knowledge/artifact-output-discipline.md +0 -24
  94. package/knowledge/artifact-summary-contracts.md +0 -50
  95. package/knowledge/atomic-commits.md +0 -262
  96. package/knowledge/claude-code-runtime-contracts.md +0 -240
  97. package/knowledge/epic-decomposition.md +0 -307
  98. package/knowledge/execution-strategies.md +0 -303
  99. package/knowledge/karpathy-guidelines.md +0 -219
  100. package/knowledge/planning-reviews.md +0 -211
  101. package/knowledge/poc-first-workflow.md +0 -223
  102. package/knowledge/review-feedback-intake.md +0 -57
  103. package/knowledge/spec-driven-development.md +0 -180
  104. package/knowledge/systematic-debugging.md +0 -378
  105. package/knowledge/two-stage-review.md +0 -249
  106. package/knowledge/wave-execution.md +0 -403
  107. package/monitors/monitors.json +0 -8
  108. package/monitors/scripts/flow-state-monitor.sh +0 -102
  109. package/output-styles/curdx-evidence-first.md +0 -34
  110. package/output-styles/curdx-fast-mode.md +0 -42
  111. package/output-styles/curdx-spec-mode.md +0 -46
  112. package/schemas/agent-frontmatter.schema.json +0 -66
  113. package/schemas/config.schema.json +0 -134
  114. package/schemas/gate-frontmatter.schema.json +0 -30
  115. package/schemas/hooks.schema.json +0 -115
  116. package/schemas/output-style-frontmatter.schema.json +0 -22
  117. package/schemas/plugin-manifest.schema.json +0 -436
  118. package/schemas/plugin-settings.schema.json +0 -29
  119. package/schemas/skill-frontmatter.schema.json +0 -177
  120. package/schemas/spec-frontmatter.schema.json +0 -42
  121. package/schemas/spec-state.schema.json +0 -165
  122. package/settings.json +0 -8
  123. package/skills/brownfield-index/SKILL.md +0 -53
  124. package/skills/brownfield-index/references/applicability.md +0 -12
  125. package/skills/brownfield-index/references/handoff.md +0 -8
  126. package/skills/brownfield-index/references/index-contract.md +0 -10
  127. package/skills/browser-qa/SKILL.md +0 -39
  128. package/skills/browser-qa/references/handoff.md +0 -6
  129. package/skills/browser-qa/references/prerequisites.md +0 -10
  130. package/skills/browser-qa/references/qa-contract.md +0 -20
  131. package/skills/cancel/SKILL.md +0 -41
  132. package/skills/cancel/references/destructive-mode.md +0 -17
  133. package/skills/cancel/references/reporting.md +0 -18
  134. package/skills/cancel/references/state-recovery.md +0 -30
  135. package/skills/cancel/references/target-resolution.md +0 -7
  136. package/skills/debug/SKILL.md +0 -45
  137. package/skills/debug/references/context-gathering.md +0 -11
  138. package/skills/debug/references/failure-guard.md +0 -25
  139. package/skills/debug/references/intake.md +0 -12
  140. package/skills/debug/references/phase-workflow.md +0 -34
  141. package/skills/debug/references/reporting.md +0 -20
  142. package/skills/epic/SKILL.md +0 -39
  143. package/skills/epic/references/epic-artifacts.md +0 -20
  144. package/skills/epic/references/epic-intake.md +0 -9
  145. package/skills/epic/references/slice-handoff.md +0 -16
  146. package/skills/fast/SKILL.md +0 -62
  147. package/skills/fast/references/applicability.md +0 -25
  148. package/skills/fast/references/clarification.md +0 -20
  149. package/skills/fast/references/execution-contract.md +0 -56
  150. package/skills/help/SKILL.md +0 -55
  151. package/skills/help/references/dispatch.md +0 -20
  152. package/skills/help/references/overview.md +0 -39
  153. package/skills/help/references/troubleshoot.md +0 -47
  154. package/skills/help/references/workflow.md +0 -37
  155. package/skills/implement/SKILL.md +0 -104
  156. package/skills/implement/references/error-recovery.md +0 -36
  157. package/skills/implement/references/linear-execution.md +0 -43
  158. package/skills/implement/references/native-task-sync.md +0 -107
  159. package/skills/implement/references/preflight.md +0 -43
  160. package/skills/implement/references/progress-contract.md +0 -36
  161. package/skills/implement/references/state-init.md +0 -36
  162. package/skills/implement/references/stop-hook-execution.md +0 -50
  163. package/skills/implement/references/strategy-router.md +0 -38
  164. package/skills/implement/references/subagent-execution.md +0 -57
  165. package/skills/implement/references/wave-execution.md +0 -180
  166. package/skills/init/SKILL.md +0 -49
  167. package/skills/init/references/gitignore-and-health.md +0 -26
  168. package/skills/init/references/next-steps.md +0 -22
  169. package/skills/init/references/preflight.md +0 -15
  170. package/skills/init/references/scaffold-contract.md +0 -27
  171. package/skills/review/SKILL.md +0 -82
  172. package/skills/review/references/optional-passes.md +0 -48
  173. package/skills/review/references/preflight.md +0 -38
  174. package/skills/review/references/report-contract.md +0 -49
  175. package/skills/review/references/reporting.md +0 -20
  176. package/skills/review/references/stage-execution.md +0 -32
  177. package/skills/security-audit/SKILL.md +0 -47
  178. package/skills/security-audit/references/audit-contract.md +0 -21
  179. package/skills/security-audit/references/gate-handoff.md +0 -8
  180. package/skills/security-audit/references/scope-and-depth.md +0 -9
  181. package/skills/spec/SKILL.md +0 -100
  182. package/skills/spec/references/artifact-landing.md +0 -31
  183. package/skills/spec/references/phase-execution.md +0 -50
  184. package/skills/spec/references/planning-review.md +0 -31
  185. package/skills/spec/references/preflight-and-routing.md +0 -46
  186. package/skills/spec/references/reporting.md +0 -21
  187. package/skills/start/SKILL.md +0 -84
  188. package/skills/start/references/branch-routing.md +0 -51
  189. package/skills/start/references/mode-semantics.md +0 -12
  190. package/skills/start/references/preflight.md +0 -13
  191. package/skills/start/references/reporting.md +0 -20
  192. package/skills/start/references/state-seeding.md +0 -44
  193. package/skills/start/references/workflow-handoff.md +0 -26
  194. package/skills/status/SKILL.md +0 -41
  195. package/skills/status/references/gather-contract.md +0 -30
  196. package/skills/status/references/health-rules.md +0 -27
  197. package/skills/status/references/output-contract.md +0 -25
  198. package/skills/status/references/preflight.md +0 -10
  199. package/skills/status/references/recovery-hints.md +0 -18
  200. package/skills/ui-sketch/SKILL.md +0 -39
  201. package/skills/ui-sketch/references/brief-intake.md +0 -10
  202. package/skills/ui-sketch/references/iteration-handoff.md +0 -5
  203. package/skills/ui-sketch/references/variant-contract.md +0 -15
  204. package/skills/verify/SKILL.md +0 -56
  205. package/skills/verify/references/evidence-workflow.md +0 -39
  206. package/skills/verify/references/output-contract.md +0 -23
  207. package/skills/verify/references/preflight.md +0 -11
  208. package/skills/verify/references/report-handoff.md +0 -35
  209. package/skills/verify/references/strict-mode.md +0 -12
  210. package/templates/CONTEXT.md.tmpl +0 -53
  211. package/templates/PROJECT.md.tmpl +0 -59
  212. package/templates/ROADMAP.md.tmpl +0 -50
  213. package/templates/STATE.md.tmpl +0 -49
  214. package/templates/config.json.tmpl +0 -51
  215. package/templates/design.md.tmpl +0 -83
  216. package/templates/progress.md.tmpl +0 -77
  217. package/templates/requirements.md.tmpl +0 -76
  218. package/templates/research.md.tmpl +0 -83
  219. package/templates/tasks.md.tmpl +0 -107
@@ -1,262 +0,0 @@
1
- # Atomic Commits — Atomic Commit Rules
2
-
3
- > One task, one commit. This is the iron rule for all execution agents in CurdX-Flow.
4
- >
5
- > Agents reference this via `@${CLAUDE_PLUGIN_ROOT}/knowledge/atomic-commits.md`.
6
-
7
- ---
8
-
9
- ## Core Principle
10
-
11
- **One task = one commit = one rollback unit.**
12
-
13
- Why:
14
- - `git bisect` can pinpoint a problem to a specific task
15
- - `git revert <hash>` can undo a single task in isolation
16
- - PR review can walk through changes commit-by-commit
17
- - Downstream agents can trace "which AD / FR this change came from" via commit history
18
-
19
- ---
20
-
21
- ## Commit Message Format (Conventional Commits + CurdX-Flow extensions)
22
-
23
- ```
24
- <type>(<scope>): <summary>
25
-
26
- [body - explain why, not what]
27
-
28
- [footer - reference IDs]
29
- ```
30
-
31
- ### Type (required)
32
-
33
- | Type | Purpose | Example |
34
- |------|---------|---------|
35
- | `feat` | New feature | `feat(auth): add JWT refresh endpoint` |
36
- | `fix` | Bug fix | `fix(login): handle empty email case` |
37
- | `refactor` | Refactor (behavior unchanged) | `refactor(db): extract connection pool` |
38
- | `test` | Tests | `test(auth): red - add login validation tests` |
39
- | `docs` | Documentation | `docs(readme): add install instructions` |
40
- | `chore` | Misc (deps, config) | `chore(deps): upgrade bcrypt to 5.1.0` |
41
- | `perf` | Performance | `perf(query): cache user lookups` |
42
- | `style` | Formatting (no behavior change) | `style: fix indentation in auth module` |
43
- | `build` | Build config | `build(tsconfig): enable strict mode` |
44
- | `ci` | CI config | `ci(github): add test workflow` |
45
-
46
- ### TDD phase markers (used in Phase 3)
47
-
48
- | Phase | Type + suffix | Example |
49
- |-------|--------------|---------|
50
- | RED | `test(scope): red - ...` | `test(auth): red - login validation` |
51
- | GREEN | `feat(scope): green - ...` | `feat(auth): green - satisfy login test` |
52
- | YELLOW | `refactor(scope): yellow - ...` | `refactor(auth): yellow - extract validator` |
53
-
54
- ### Scope
55
-
56
- - Module name (`auth`, `db`, `ui`, `api`)
57
- - Or file name (without extension)
58
- - Or `(spec-name)` if spanning multiple modules
59
-
60
- ### Summary
61
-
62
- - Imperative mood (`add`, `fix`, not `added`, `fixes`)
63
- - Lowercase start (unless a proper noun)
64
- - No trailing period
65
- - ≤ 70 characters
66
-
67
- ---
68
-
69
- ## Body (optional but recommended)
70
-
71
- Explain **why**. Do not explain **what** (the diff shows what).
72
-
73
- ```
74
- feat(auth): implement JWT refresh flow
75
-
76
- Tokens expire after 15 minutes. Without refresh, users get
77
- logged out mid-session. This adds a refresh endpoint that
78
- validates the refresh_token and issues a new access_token.
79
-
80
- Per AD-03: use rotating refresh tokens to mitigate theft.
81
- ```
82
-
83
- Do NOT write:
84
- ```
85
- feat(auth): implement JWT refresh flow
86
-
87
- Added refreshToken() function in auth.ts.
88
- Added POST /auth/refresh endpoint.
89
- Added tests for success and failure cases.
90
- ```
91
- ← the diff already shows this; it wastes commit message space.
92
-
93
- ---
94
-
95
- ## Footer (reference IDs)
96
-
97
- CurdX-Flow extension: if a task references FR / AC / AD / D-NN, list them in the footer:
98
-
99
- ```
100
- feat(auth): implement JWT refresh flow
101
-
102
- Refresh tokens rotate on each use, preventing replay attacks.
103
-
104
- Requirements: FR-03, AC-2.1
105
- Design: AD-03
106
- Decisions: D-07 (session storage strategy)
107
- Task: spec/auth-system/tasks.md#3.2
108
- ```
109
-
110
- Fields:
111
- - `Requirements:` lists implemented FR / AC
112
- - `Design:` lists related AD
113
- - `Decisions:` lists referenced project-level decisions (D-NN)
114
- - `Task:` optional, points at the task definition location
115
-
116
- ---
117
-
118
- ## Concrete Rules for Atomicity
119
-
120
- ### 1. One commit does one thing
121
-
122
- ✗ **Bad**:
123
- ```
124
- feat: add login + fix typo + refactor db connection
125
- ```
126
-
127
- ✓ **Good** (split into 3 commits):
128
- ```
129
- feat(auth): add login endpoint
130
- docs: fix typo in README
131
- refactor(db): extract connection factory
132
- ```
133
-
134
- ### 2. Do not mix "task code" and "cleanup"
135
-
136
- ✗ **Bad**:
137
- ```
138
- feat(auth): add JWT + remove unused imports in user.ts
139
- ```
140
-
141
- ✓ **Good**:
142
- ```
143
- feat(auth): add JWT endpoint
144
- chore: remove unused imports in user.ts
145
- ```
146
-
147
- ### 3. Every commit must pass tests independently
148
-
149
- This is what makes `git bisect` work.
150
-
151
- - Do not commit "broken intermediate states"
152
- - Even WIP should build + test (even with few tests)
153
- - For a large change that truly must be split, use a feature branch and squash at the end
154
-
155
- ### 4. The file change scope should match the commit message
156
-
157
- If the commit is `feat(auth): ...`, it should not include changes under `src/ui/`. Otherwise you actually did two things.
158
-
159
- ---
160
-
161
- ## The flow-executor Agent's Commit Flow
162
-
163
- ```bash
164
- # Step 1: git add only the files involved in the task
165
- git add src/auth/login.ts src/auth/login.test.ts
166
-
167
- # Step 2: check that staged diff matches the commit message
168
- git diff --cached --stat
169
-
170
- # Step 3: ensure no unexpected changes sneaked in
171
- # (if you see a file that shouldn't be there, git reset HEAD <file>)
172
-
173
- # Step 4: commit
174
- git commit -m "feat(auth): green - implement login endpoint
175
-
176
- Per AD-03, uses bcrypt for password hashing.
177
-
178
- Requirements: FR-01
179
- Design: AD-03
180
- "
181
-
182
- # Step 5: record the hash
183
- COMMIT_HASH=$(git rev-parse --short HEAD)
184
- echo "✓ Committed: $COMMIT_HASH"
185
- ```
186
-
187
- ---
188
-
189
- ## Forbidden Patterns
190
-
191
- ### ✗ Giant commit
192
- ```
193
- feat(auth): implement entire authentication system
194
- ```
195
- Too large, cannot review, cannot bisect. Split into N small commits.
196
-
197
- ### ✗ Hedging words
198
- ```
199
- feat(auth): maybe fix login issue?
200
- ```
201
- If unsure, do not commit yet. A commit is a definitive operation.
202
-
203
- ### ✗ Meaningless commits
204
- ```
205
- wip
206
- fix
207
- update
208
- ```
209
- Future maintainers will curse you. At minimum write `wip(auth): placeholder for token refresh`.
210
-
211
- ### ✗ `--amend` on a pushed commit
212
- ```
213
- git commit --amend # after push
214
- git push -f # overwrite remote
215
- ```
216
- Destroys shared history. Only amend local, unpushed commits.
217
-
218
- ### ✗ Skipping hooks
219
- ```
220
- git commit --no-verify
221
- ```
222
- Unless the user explicitly requests it. Hooks exist for reasons (pre-commit lint, commit-msg check).
223
-
224
- ---
225
-
226
- ## Relationship to PR Review
227
-
228
- PR review reads each commit's message.
229
-
230
- - Good commit message → reviewer finishes in 5 minutes
231
- - Bad commit message → reviewer either rubber-stamps or blocks without reading
232
-
233
- CurdX-Flow's review handoff expects atomic commits plus verification/review reports. Poor commit quality yields poor PR descriptions and weak release evidence.
234
-
235
- ---
236
-
237
- ## Real Example (commit history for a full spec execution)
238
-
239
- ```
240
- $ git log --oneline auth-system spec
241
-
242
- abc123f feat(auth): green - implement login endpoint (Requirements: FR-01)
243
- def456g feat(auth): green - implement password hashing (Design: AD-03)
244
- ghi789h test(auth): red - add login endpoint tests
245
- jkl012i test(auth): red - add password hash tests
246
- mno345j chore(deps): add bcrypt@5.1.0
247
- pqr678k docs(auth): add design.md for JWT authentication
248
- stu901l docs(auth): add requirements.md
249
- vwx234m docs(auth): add research.md (initial spec)
250
- ```
251
-
252
- Reading this history, anyone can understand:
253
- - First came research → requirements → design (doc commits)
254
- - Then a dependency was added
255
- - Then TDD red (tests) → green (implementation)
256
- - Every step is atomic
257
-
258
- This is the quality CurdX-Flow demands.
259
-
260
- ---
261
-
262
- _CurdX-Flow internal rule. Violation counts as a flow-executor task failure._
@@ -1,240 +0,0 @@
1
- # Claude Code Runtime Contracts — CurDX-Flow Notes
2
-
3
- CurDX-Flow depends on Claude Code's plugin, hook, skill, and subagent runtime surfaces. This page records the operational contracts we rely on so agents and maintainers do not drift from the current official behavior.
4
-
5
- ## Source of Truth
6
-
7
- - Official docs entry: `https://code.claude.com/docs/en/overview`
8
- - Runtime-specific pages to re-check when changing behavior:
9
- - Hooks: `/docs/en/hooks`
10
- - Subagents: `/docs/en/sub-agents`
11
- - Skills: `/docs/en/skills`
12
- - Commands: `/docs/en/commands`
13
- - Plugins: `/docs/en/plugins`
14
- - Settings: `/docs/en/settings`
15
- - Plugin manifest reference: `/docs/en/plugins-reference`
16
- - Output styles: `/docs/en/output-styles`
17
- - Status line: `/docs/en/statusline`
18
- - Plugin dependency constraints: `/docs/en/plugin-dependencies`
19
- - Routines / scheduled tasks: `/docs/en/routines`, `/docs/en/scheduled-tasks`
20
-
21
- When a behavior is unclear, prefer the official docs and `claude plugin validate .` over inferred behavior from older examples.
22
-
23
- ## Hook Output Rules
24
-
25
- - Standard plugin hooks live at `hooks/hooks.json` in the plugin root and are discovered automatically. Do not also set `plugin.json.hooks` to that same file; current Claude runtimes treat that as a duplicate load.
26
- - `SessionStart` context injection must use:
27
- - `hookSpecificOutput.hookEventName = "SessionStart"`
28
- - `hookSpecificOutput.additionalContext = "..."`
29
- - Persistent environment for later hook/script invocations must be written to `CLAUDE_ENV_FILE` as shell exports. Do not invent a JSON top-level `environmentVariables` field.
30
- - `Stop` / `SubagentStop` continuation blocking uses top-level `decision: "block"` plus `reason`.
31
- - `PreToolUse` denial uses `hookSpecificOutput.permissionDecision = "deny"` and `permissionDecisionReason`.
32
- - `PreToolUse` also supports `hookSpecificOutput.permissionDecision = "defer"` for deferred tool handling in `-p` / SDK-style flows; do not assume deny/allow are the only valid permission outcomes.
33
- - `PermissionDenied` can return `{ "retry": true }` to let Claude try a different approach after an auto-mode classifier denial.
34
- - Hooks must fail open when runtime prerequisites are missing (`python3`, malformed stdin JSON, absent `.flow/` state). The exception is an explicit, success-looking subagent completion with a missing required artifact.
35
- - Hook and monitor scripts must not assume the current working directory is the repo root. Official `CwdChanged` exists, and users often work from nested package/app directories, so CurDX-Flow runtime scripts should prefer `CLAUDE_PROJECT_DIR` and otherwise walk upward until they find the project `.flow/` root.
36
- - CurDX-Flow may use `CwdChanged` + `FileChanged` to maintain dynamic watch paths for `.flow/.active-spec`, the active spec `.state.json`, and `tasks.md`. Treat that watch layer as reactive context plumbing, not as a replacement for the monitor or disk-backed truth.
37
- - `TaskCreated` / `TaskCompleted` can be used as native-task-sync guardrails, but only for CurDX-shaped task subjects. Never let those hooks break unrelated user task-list workflows that happen outside an active CurDX spec.
38
- - `ConfigChange` can block project/local settings updates from taking effect in the running session. CurDX-Flow may use that to reject mid-execute changes that would disable hooks or reroute the main thread away from `flow-orchestrator`.
39
- - `TeammateIdle` has less context than `SubagentStop`, so CurDX-Flow should resolve `teammate_name -> agent_type` through `~/.claude/teams/<team-name>/config.json` before enforcing artifact gates for team-mode workers.
40
-
41
- ## Subagent Artifact Discipline
42
-
43
- Subagents that produce long reports must write the artifact before producing the final assistant summary. The final summary should be short and point to the file path.
44
-
45
- Guarded artifact targets:
46
-
47
- | Agent | Expected artifact |
48
- | --- | --- |
49
- | `flow-researcher` | `.flow/specs/<active>/research.md` |
50
- | `flow-product-designer` | `.flow/specs/<active>/requirements.md` |
51
- | `flow-architect` | `.flow/specs/<active>/design.md` |
52
- | `flow-planner` | `.flow/specs/<active>/tasks.md` |
53
- | `flow-reviewer` | `.flow/specs/<active>/review-report.md` |
54
- | `flow-verifier` | `.flow/specs/<active>/verification-report.md` |
55
- | `flow-security-auditor` | `.flow/specs/<active>/security-audit.md` |
56
- | `flow-qa-engineer` | `.flow/specs/<active>/qa-report.md` |
57
- | `flow-edge-hunter` | `.flow/specs/<active>/edge-cases.md` |
58
- | `flow-adversary` | `.flow/specs/<active>/adversarial-review.md` |
59
- | `flow-ui-researcher` | `.flow/specs/<active>/ui-research.md` |
60
- | `flow-ux-designer` | `.flow/specs/<active>/ui-sketch/index.html` |
61
- | `flow-triage-analyst` | `.flow/_epics/<epic-name>/epic.md` |
62
- | `flow-brownfield-analyst` | `.flow/codebase-index.md` |
63
-
64
- `flow-executor` is marker-driven rather than report-driven: it must update task state and end with `TASK_COMPLETE: <task_id>` or `TASK_FAILED: <task_id>`.
65
-
66
- ## Background Subagent Policy
67
-
68
- - Official background subagents keep the main conversation free while the worker runs, but any `AskUserQuestion` call inside that worker auto-denies instead of surfacing an interactive clarification prompt.
69
- - CurDX-Flow should therefore reserve `background: true` for agents that are:
70
- - artifact-producing or evidence-gathering
71
- - long-running enough to justify concurrency
72
- - not dependent on `AskUserQuestion` for normal operation
73
- - Do not set `background: true` by default on `flow-executor`, `flow-debugger`, `flow-qa-engineer`, `flow-product-designer`, `flow-security-auditor`, `flow-triage-analyst`, or `flow-ux-designer` without a tighter clarification/permission contract.
74
- - If those same agent definitions are reused as teammates, `TeammateIdle` quality gates should reuse the same disk-artifact contract as subagent completion whenever the agent is artifact-bearing.
75
-
76
- ## Agent Teams Compatibility
77
-
78
- - Official `agent-teams` behavior differs from regular subagent invocation in one critical way: when a subagent definition runs as a teammate, its `skills` and `mcpServers` frontmatter fields are not applied.
79
- - Team coordination tools remain available to teammates, but any agent that relies on a preloaded skill must also have access to the `Skill` tool so it can invoke that skill explicitly when used as a teammate.
80
- - A project file like `.claude/teams/teams.json` is not configuration. Official docs say team config lives under user scope, not project scope.
81
-
82
- ## Skills and Frontmatter
83
-
84
- - Keep `SKILL.md` frontmatter minimal and schema-backed.
85
- - Use `description` for the concise trigger phrase; put longer trigger examples in `when_to_use`.
86
- - Use forked context and a named agent only when the skill's work benefits from isolation or a specialized role.
87
- - Avoid preloading broad tool access. Prefer the smallest useful tool set per skill/agent.
88
- - Do not make bundled skills or agents implicitly depend on runtime-gated tools such as `SendMessage`, `TeamCreate`, `TeamDelete`, or `ToolSearch` unless CurDX-Flow also ships the matching feature-flag/setup contract.
89
- - Interactive Claude sessions expose the Task tool family (`TaskCreate`, `TaskGet`, `TaskList`, `TaskUpdate`) while headless / SDK flows use `TodoWrite`. Any CurDX native task-list sync must therefore be optional UX, not a correctness dependency.
90
- - Official interactive-mode docs also support `CLAUDE_CODE_TASK_LIST_ID` for sharing a native task list across sessions. CurDX-Flow may use that later as an optimization, but current execution must still recover correctly when the native task list changes or disappears.
91
- - If CurDX uses task lifecycle hooks, `TaskCreated` should reject orphan CurDX-native tasks that do not map to `tasks.md`, and `TaskCompleted` should reject UI completion that happens before `tasks.md` is updated.
92
-
93
- ## Plugin Settings
94
-
95
- - Claude Code plugin-root `settings.json` currently supports only `agent` and `subagentStatusLine`.
96
- - CurDX-Flow ships both:
97
- - `agent: "flow-orchestrator"` to route the main thread through the CurDX-Flow coordinator by default.
98
- - `subagentStatusLine`, pointing at `${CLAUDE_PLUGIN_ROOT}/hooks/scripts/subagent-statusline.sh`.
99
- - The status-line script must fail open on malformed input or missing `python3`; UI decoration must never break agent execution.
100
- - Plugin-root references must never traverse outside the plugin directory. Installed marketplace plugins run from Claude Code's plugin cache, so parent-directory references are invalid even if they work in a development checkout.
101
- - CurDX-Flow should not declare `plugin.json.hooks` while using the standard `hooks/hooks.json` location; keep the file on disk, let Claude discover it implicitly, and reserve `plugin.json.hooks` for non-default or additional hook files only.
102
- - If adding plugin settings, update `schemas/plugin-settings.schema.json`, `test/plugin-structure-contract.test.js`, `test/pack-tarball-smoke.test.js`, and `scripts/validate-plugin-contracts.mjs` in the same change.
103
-
104
- ## Plugin Monitors and User Config
105
-
106
- - CurDX-Flow ships a plugin monitor at `${CLAUDE_PLUGIN_ROOT}/monitors/monitors.json` to surface `.flow` state changes back into the active Claude session.
107
- - Monitors run only when the Claude `Monitor` tool is available, and only in interactive CLI sessions.
108
- - The monitor must keep working even when Claude's cwd moves below the repo root; `.flow` discovery should be project-root aware rather than cwd-fragile.
109
- - CurDX-Flow `userConfig` values are exported to plugin subprocesses as `CLAUDE_PLUGIN_OPTION_<KEY>`.
110
- - Current runtime knobs:
111
- - `autonomous_blocking`: lets users disable stop-hook continuation without editing plugin files.
112
- - `daily_dependency_check`: silences or enables the once-per-day recommended-plugin reminder.
113
- - `monitor_interval_seconds`: controls plugin monitor polling cadence.
114
- - `doctor` should explain both the machine-effective config value and the projected plugin subprocess env var for these knobs, since hook/monitor behavior depends on the env projection rather than direct JSON parsing.
115
- - Current `doctor` inspection includes file-based managed settings (`managed-settings.json` plus sorted `managed-settings.d/*.json` fragments) before local/project/user settings. It still cannot see server-managed settings, MDM/registry policy delivery, or one-off CLI overrides.
116
-
117
- ## Plugin Dependency Constraints
118
-
119
- - Official dependency version constraints require upstream plugin release tags in the `{plugin-name}--v{version}` format.
120
- - Do not add a version constraint to the `context7-plugin` dependency unless the Upstash marketplace has matching `context7-plugin--v*` tags. Claude resolves plugin dependency ranges against `{plugin-name}--v*` tags; a semver range without those tags can disable dependency resolution and surface the installed plugin version as `unknown`.
121
- - Keep the CLI registry and `.claude-plugin/plugin.json` dependency entry aligned: Context7 remains a required companion plugin, while optional tools stay in `RECOMMENDED_PLUGINS`.
122
-
123
- ## Shared Settings Guardrails
124
-
125
- - `.claude/settings.json` is a shared project surface. Keep machine-local scripts, secrets, and credential helpers out of it.
126
- - Official docs say these keys are ignored or not accepted at project scope and must live in user/local/managed settings instead:
127
- - `autoMemoryDirectory`
128
- - `autoMode`
129
- - `useAutoModeDuringPlan`
130
- - `permissions.skipDangerousModePermissionPrompt`
131
- - `sshConfigs`
132
- - `teammateMode` belongs in the global `~/.claude.json` config, not project `settings.json`.
133
- - Treat shared auto-approval settings as high risk:
134
- - `enableAllProjectMcpServers`
135
- - `enabledMcpjsonServers`
136
- - Treat shared hook and skill policy as behavior-changing:
137
- - `disableSkillShellExecution: true` replaces inline shell output in project/plugin skills and commands with a disabled placeholder.
138
- - Empty `allowedHttpHookUrls` blocks all HTTP hook targets.
139
- - Empty `httpHookAllowedEnvVars` prevents HTTP hook header environment interpolation.
140
- - Treat shared `env` injection as behavior-changing when it flips Claude runtime modes:
141
- - `CLAUDE_CODE_SIMPLE=1` puts Claude Code into bare/simple mode and disables hooks, skills, plugins, MCP discovery, auto memory, and `CLAUDE.md`.
142
- - `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT=1` keeps discovery enabled but swaps in the minimal Claude system prompt.
143
- - `CLAUDE_CODE_EFFORT_LEVEL=low|medium` lowers reasoning for every collaborator session.
144
- - `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` enables experimental teammate surfaces for every collaborator session.
145
- - Provider-specific pinned model IDs (`ANTHROPIC_DEFAULT_*_MODEL`, `ANTHROPIC_CUSTOM_MODEL_OPTION`) should usually be paired with `_SUPPORTED_CAPABILITIES` so Claude keeps effort / thinking feature detection.
146
- - In CI / headless runs, `CLAUDE_CODE_SYNC_PLUGIN_INSTALL=1` makes marketplace plugins available before the first turn; otherwise they can install in the background and miss turn one.
147
- - `CLAUDE_CODE_PLUGIN_SEED_DIR` is the official way to pre-populate marketplace plugins in containers and CI images.
148
- - Treat shared sandbox policy as runtime-sensitive:
149
- - `sandbox.failIfUnavailable: true` can fail Claude Code startup on unsupported hosts.
150
- - `sandbox.filesystem.denyRead` / `denyWrite` must not block `.flow`, `.git`, or the project root.
151
- - Empty `sandbox.network.allowedDomains` blocks outbound network access for sandboxed commands.
152
- - Prefer `attribution` over deprecated `includeCoAuthoredBy`.
153
- - Treat shared runtime blockers as high risk for CurDX-Flow:
154
- - `disableAllHooks: true` disables stop-hook recovery, artifact guards, and custom status lines.
155
- - `agent: "<name>"` routes the main thread through a named subagent, replacing the normal CurDX-Flow prompt, tool surface, and model for the whole session.
156
- - `permissions.defaultMode: "dontAsk"` can auto-deny clarification and Agent dispatch prompts.
157
- - `permissions.deny` rules for `Agent`, `AskUserQuestion`, CurDX-Flow `flow-*` agents, or broad `Bash` / `Monitor` / `Read` / `Write` / `Edit` / `Grep` / `Glob` tools can make workflows fail.
158
- - `availableModels` must include the portable `sonnet` and `opus` aliases used by bundled agents.
159
- - Shared `effortLevel: "low"` or `"medium"` may underpower main-thread planning/review turns; prefer `high` / `xhigh` for CurDX-Flow-heavy projects.
160
- - `CLAUDE_CODE_SIMPLE=1` in the launch environment is a hard runtime blocker for CurDX-Flow because Claude stops discovering plugin assets and `CLAUDE.md`.
161
- - `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT=1` in the launch environment is not a hard blocker, but it weakens the normal Claude Code system prompt CurDX-Flow expects.
162
- - Provider-specific model IDs in `ANTHROPIC_DEFAULT_*_MODEL` or `ANTHROPIC_CUSTOM_MODEL_OPTION` can disable feature detection for effort and thinking unless the matching `_SUPPORTED_CAPABILITIES` env var is declared.
163
- - In CI / `claude -p` runs that depend on marketplace plugins, missing `CLAUDE_CODE_SYNC_PLUGIN_INSTALL=1` (or a seeded plugin cache via `CLAUDE_CODE_PLUGIN_SEED_DIR`) can leave plugins unavailable on the first turn.
164
- - Prefer `claude --bare -p` for CI / scripted runs so hooks, skills, plugins, MCP discovery, auto memory, and `CLAUDE.md` do not vary by machine; add `--plugin-dir`, `--settings`, and `--mcp-config` explicitly when needed.
165
- - Do not depend on interactive `/curdx-flow:*` slash commands in `claude -p`; scripted runs should ask for the desired outcome directly.
166
- - `settings.json` does not accept `effortLevel: "max"`; official docs reserve `max` for session-only `/effort` (or `CLAUDE_CODE_EFFORT_LEVEL`), so do not commit it to shared project settings.
167
- - `enabledPlugins` entries set to `false` for `curdx-flow@curdx-flow-marketplace` or required companion plugins override user-level installs in that project.
168
-
169
- ## Browser and UI Verification
170
-
171
- For UI-facing acceptance criteria, code inspection and DOM unit tests are not sufficient evidence. Use `chrome-devtools` MCP when available to drive the real browser, capture screenshots, list console messages, and inspect network requests. If the MCP is unavailable, mark UI-facing acceptance criteria as unverified instead of silently passing them.
172
-
173
-
174
- ## Reality Verification Contract
175
-
176
- For fix/debug/regression specs, green tests alone do not prove the user-visible problem was fixed. The workflow must preserve a BEFORE/AFTER evidence trail:
177
-
178
- 1. BEFORE: record the original reproduction command, observed failure output, and timestamp in `.progress.md` before changing code.
179
- 2. FIX: change the smallest root cause and run the task's Verify command.
180
- 3. AFTER: rerun the original reproduction command and compare output against BEFORE.
181
- 4. COMPLETE: write `Verified: Issue resolved` only when the original failure is gone.
182
-
183
- Planner duties:
184
- - Add a `VF` task for fix/debug specs unless `STATE.md` has an explicit D-NN waiver.
185
- - Treat missing `VF` coverage as a coverage-audit gap.
186
-
187
- Executor duties:
188
- - Do not mark `VF` complete unless `.progress.md` has the BEFORE/AFTER comparison.
189
- - Use the same reproduction command for AFTER unless a documented D-NN explains why the command changed.
190
-
191
- Verifier duties:
192
- - Mark fix/debug specs `PARTIAL` when BEFORE/AFTER evidence is missing, even if the normal test suite is green.
193
-
194
- ## Task Split Contract
195
-
196
- When a task is too broad, under-specified, or unsafe to complete surgically, the executor must stop rather than expand scope. It returns `TASK_FAILED` with a split proposal containing at most 3 replacement tasks, each with `Do`, `Files`, `Done when`, `Verify`, and `Commit` fields.
197
-
198
- The coordinator or planner owns updates to `tasks.md`. An executor must not create new tasks and execute them in the same turn.
199
-
200
- ## Failure Recovery Contract
201
-
202
- Execution failure recovery is ledger-first:
203
-
204
- - Default `manual` recovery blocks progress past `TASK_FAILED`; retry the first unchecked task after root-cause analysis.
205
- - `fix-task` recovery may create one targeted `[FIX <task_id>]` task immediately after the failed task, but only before execution resumes.
206
- - `.state.json` `execute_state.fix_task_map` records attempts, generated fix task ids, and the last error per original task.
207
- - `max_fix_tasks_per_original` is a hard ceiling, not a suggestion.
208
-
209
- Generated fix tasks must include `Do`, `Files`, `Done when`, `Verify`, and `Commit`. A recovery task that cannot name a verification command is not actionable and should stop for user input rather than guessing.
210
-
211
- ## Stop-Hook Recovery Contract
212
-
213
- The stop-hook strategy must never trust one source of completion by itself:
214
-
215
- - `.state.json` tracks execution cursor and phase.
216
- - `tasks.md` is the task ledger; unchecked tasks mean work remains.
217
- - `ALL_TASKS_COMPLETE` is a signal, not proof.
218
-
219
- Completion requires both completed state and zero unchecked tasks. If they disagree, continue `tasks.md`'s unchecked tasks and do not add new tasks. When Claude Code sends `stop_hook_active=true`, allow stop to prevent recursive stop-hook loops; resume from persisted state on the next turn.
220
-
221
- ## Status / Cancel Contract
222
-
223
- `/curdx-flow:status` is read-only. It must compare both machine state (`.state.json`) and human task ledger (`tasks.md`) before reporting health. If they disagree, report `NEEDS_ATTENTION` and give one concrete recovery command.
224
-
225
- `/curdx-flow:cancel` is non-destructive by default. It cancels execution state while preserving spec artifacts, progress, reports, and project-level `.flow` files. Deleting a spec requires both `--delete-spec` and `--yes`.
226
-
227
- If state JSON is corrupt, preserve it by renaming to `.state.json.corrupt.<timestamp>` rather than deleting it. Recovery commands should prefer `/curdx-flow:status` followed by `/curdx-flow:implement --strategy=subagent`.
228
-
229
- ## Test Quality Contract
230
-
231
- Tests used as FR/AC evidence must exercise real behavior. Mock-only tests are not proof of implementation.
232
-
233
- Blocking evidence problems:
234
- - The test only asserts mock/spies were called.
235
- - The real module/function under test is not invoked.
236
- - The test is skipped, assertion-free, or would pass with an empty implementation.
237
- - Mock setup overwhelms behavioral assertions and no integration/e2e backup exists.
238
- - Stateful mocks are not cleaned up between tests.
239
-
240
- Mocks are acceptable for boundaries (network, payment provider, clock/randomness) when the assertion still verifies production logic. If a requirement is backed only by weak tests, `/curdx-flow:verify` and `/curdx-flow:review` must not return full PASS.