@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
package/package.json CHANGED
@@ -1,61 +1,50 @@
1
1
  {
2
2
  "name": "@curdx/flow",
3
- "version": "3.0.0",
4
- "description": "Skill-first discipline layer and CLI installer for Claude Code",
3
+ "version": "3.1.0",
4
+ "description": "Interactive installer for Claude Code plugins and MCP servers",
5
5
  "type": "module",
6
- "bin": {
7
- "curdx-flow": "bin/curdx-flow.js"
8
- },
9
- "scripts": {
10
- "test": "node --test test/*.test.mjs",
11
- "validate:contracts": "node scripts/validate-plugin-contracts.mjs",
12
- "validate:contracts:strict": "node scripts/validate-plugin-contracts.mjs --strict",
13
- "lint": "echo 'lint placeholder; wired in P5'",
14
- "prepublishOnly": "npm run validate:contracts && npm test"
15
- },
6
+ "bin": "./dist/index.mjs",
16
7
  "files": [
17
- "bin/",
18
- "cli/",
19
- ".claude-plugin/",
20
- "agents/",
21
- "gates/",
22
- "hooks/",
23
- "knowledge/",
24
- "monitors/",
25
- "agent-preamble/",
26
- "output-styles/",
27
- "templates/",
28
- "schemas/",
29
- "skills/",
30
- "settings.json",
31
- "README.md",
32
- "CHANGELOG.md",
33
- "LICENSE"
8
+ "dist",
9
+ "CHANGELOG.md"
34
10
  ],
35
11
  "engines": {
36
- "node": ">=18"
12
+ "node": ">=20.12.0"
37
13
  },
38
- "repository": {
39
- "type": "git",
40
- "url": "git+https://github.com/curdx/curdx-flow.git"
14
+ "scripts": {
15
+ "build": "tsup",
16
+ "dev": "tsup --watch",
17
+ "start": "node ./dist/index.mjs",
18
+ "typecheck": "tsc --noEmit"
41
19
  },
42
- "homepage": "https://github.com/curdx/curdx-flow",
43
- "bugs": "https://github.com/curdx/curdx-flow/issues",
44
- "license": "MIT",
45
- "author": "wdx <bydongxin@gmail.com>",
46
20
  "keywords": [
21
+ "claude",
47
22
  "claude-code",
48
- "cli",
23
+ "mcp",
49
24
  "installer",
50
- "ai-engineering",
51
- "curdx-flow"
25
+ "cli"
52
26
  ],
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/curdx/curdx-flow.git"
30
+ },
31
+ "bugs": {
32
+ "url": "https://github.com/curdx/curdx-flow/issues"
33
+ },
34
+ "homepage": "https://github.com/curdx/curdx-flow#readme",
35
+ "license": "MIT",
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
53
39
  "dependencies": {
54
- "@clack/prompts": "^0.8.2",
55
- "picocolors": "^1.1.1"
40
+ "@clack/prompts": "^1.2.0",
41
+ "citty": "^0.1.6",
42
+ "picocolors": "^1.1.0",
43
+ "tinyexec": "^1.0.0"
56
44
  },
57
45
  "devDependencies": {
58
- "ajv": "^8.18.0",
59
- "yaml": "^2.8.3"
46
+ "@types/node": "^22.10.0",
47
+ "tsup": "^8.3.0",
48
+ "typescript": "^5.6.0"
60
49
  }
61
50
  }
@@ -1,48 +0,0 @@
1
- {
2
- "name": "curdx-flow-marketplace",
3
- "owner": {
4
- "name": "wdx",
5
- "email": "bydongxin@gmail.com"
6
- },
7
- "metadata": {
8
- "description": "Claude Code Discipline Layer — spec-driven workflow + goal-backward verification + Karpathy 4 principles enforced via gates. Stops Claude from faking \"done\" on non-trivial features.",
9
- "version": "3.0.0"
10
- },
11
- "allowCrossMarketplaceDependenciesOn": [
12
- "context7-marketplace"
13
- ],
14
- "plugins": [
15
- {
16
- "name": "curdx-flow",
17
- "source": "./",
18
- "description": "Claude Code Discipline Layer — spec-driven workflow + goal-backward verification + Karpathy 4 principles enforced via gates. Stops Claude from faking \"done\" on non-trivial features.",
19
- "version": "3.0.0",
20
- "author": {
21
- "name": "wdx",
22
- "email": "bydongxin@gmail.com"
23
- },
24
- "homepage": "https://github.com/curdx/curdx-flow",
25
- "repository": "https://github.com/curdx/curdx-flow",
26
- "license": "MIT",
27
- "keywords": [
28
- "workflow",
29
- "spec-driven",
30
- "ai-engineering",
31
- "orchestration"
32
- ],
33
- "tags": [
34
- "claude-code",
35
- "spec-driven",
36
- "verification",
37
- "workflow"
38
- ],
39
- "category": "productivity",
40
- "dependencies": [
41
- {
42
- "name": "context7-plugin",
43
- "marketplace": "context7-marketplace"
44
- }
45
- ]
46
- }
47
- ]
48
- }
@@ -1,52 +0,0 @@
1
- {
2
- "name": "curdx-flow",
3
- "version": "3.0.0",
4
- "description": "Claude Code Discipline Layer — spec-driven workflow + goal-backward verification + Karpathy 4 principles enforced via gates. Stops Claude from faking \"done\" on non-trivial features.",
5
- "author": {
6
- "name": "wdx",
7
- "email": "bydongxin@gmail.com"
8
- },
9
- "homepage": "https://github.com/curdx/curdx-flow",
10
- "repository": "https://github.com/curdx/curdx-flow",
11
- "license": "MIT",
12
- "keywords": [
13
- "workflow",
14
- "spec-driven",
15
- "ai-engineering",
16
- "orchestration",
17
- "karpathy",
18
- "claude-code"
19
- ],
20
- "skills": "./skills/",
21
- "agents": "./agents/",
22
- "outputStyles": "./output-styles/",
23
- "monitors": "./monitors/monitors.json",
24
- "userConfig": {
25
- "autonomous_blocking": {
26
- "type": "boolean",
27
- "title": "Autonomous stop-hook blocking",
28
- "description": "Keep stop-hook execution running until the active spec finishes when work remains.",
29
- "default": true
30
- },
31
- "daily_dependency_check": {
32
- "type": "boolean",
33
- "title": "Daily dependency reminder",
34
- "description": "Show a once-per-day reminder when recommended companion plugins are missing.",
35
- "default": true
36
- },
37
- "monitor_interval_seconds": {
38
- "type": "number",
39
- "title": "Flow monitor polling interval",
40
- "description": "How often the CurDX-Flow plugin monitor polls .flow state and task progress.",
41
- "default": 8,
42
- "min": 3,
43
- "max": 60
44
- }
45
- },
46
- "dependencies": [
47
- {
48
- "name": "context7-plugin",
49
- "marketplace": "context7-marketplace"
50
- }
51
- ]
52
- }
@@ -1,314 +0,0 @@
1
- # CurdX-Flow Agent Shared Preamble
2
-
3
- > All `flow-*` agents inherit this file via `@${CLAUDE_PLUGIN_ROOT}/agent-preamble/preamble.md`.
4
- > This is a behavioral baseline, not a suggestion. Violation counts as agent failure.
5
-
6
- ---
7
-
8
- ## L1: Karpathy Mind Baseline (hard rules)
9
-
10
- ### 1. Think Before Coding
11
- - State your assumptions before starting
12
- - When uncertainty changes product/business direction, use AskUserQuestion unless the current mode forbids it; in quick mode, state the best assumption and continue
13
- - Offer multiple interpretations and let the user choose
14
- - Never skip "understanding" and jump straight to "implementation"
15
-
16
- ### 2. Simplicity First
17
- - YAGNI principle
18
- - No features beyond what was requested
19
- - No single-use abstractions
20
- - If 200 lines suffice, do not write 1000
21
-
22
- ### 3. Surgical Changes
23
- - Modify only the lines that must change
24
- - Match existing style (indentation, naming, quotes)
25
- - Do not delete pre-existing dead code
26
- - Only clean up orphan code that you yourself created
27
-
28
- ### 4. Goal-Driven Execution
29
- - Define a verifiable success criterion
30
- - Do not say done/fixed/working without evidence
31
- - Tests first, goals first
32
-
33
- ### 5. Proportionate Output (stop-condition, not length-quota)
34
-
35
- **Write until the reader's questions are answered. Then stop.** There is no minimum length, no maximum length, no target range. Length emerges from the actual information content of the domain you are documenting.
36
-
37
- Stop conditions (all must hold before you `Write`):
38
- - Every question a reader will ask about this artifact is answered with a concrete fact, decision, or "N/A: <reason>".
39
- - No paragraph restates the template's structure or what you are about to produce.
40
- - No paragraph repeats upstream content (the goal from `.state.json`, a section of requirements.md in your design.md) — reference it instead.
41
- - No section has padding to look "thorough" when the honest answer is "standard for this domain, no novelty".
42
-
43
- Research reference: Anthropic's own prompt guidance — ["arbitrary iteration caps" are an anti-pattern](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices); use a stop condition instead. Claude Opus 4.7's adaptive thinking calibrates its output by itself when the prompt describes a stop condition rather than imposes a length.
44
-
45
- Self-check before `Write`: re-read every paragraph and ask "does this paragraph change a reader's decision or understanding?" If no, delete it. Iterate.
46
-
47
- ---
48
-
49
- ## L2: Mandatory Tool Rules (enforced)
50
-
51
- ### Documentation lookup → context7 MCP
52
-
53
- Query `context7` when EITHER is true:
54
- - The library API is version-sensitive (recent breaking change, typed API in a new version, deprecated method you're considering).
55
- - You are genuinely uncertain (can't recall the method signature, can't recall whether a feature exists in the installed version).
56
-
57
- ```
58
- 1. mcp__context7__resolve-library-id("react") → resolve library ID
59
- 2. mcp__context7__query-docs(libraryId, query) → query latest docs
60
- ```
61
-
62
- Do NOT query context7 for:
63
- - Universally stable APIs you can write from memory (Vue 3 `ref`, React `useState`, Express `app.get`, SQL `SELECT`).
64
- - Syntax you would paste into a test file without thinking.
65
- - Every single library mention in a spec (the spec is planning, not implementation — defer the lookup to the executor when it actually calls the API).
66
-
67
- **Rule of thumb**: if you would paste the code into production without double-checking, don't waste a context7 call checking it. If you would hesitate, query. Training-data staleness is real but rarer than token-waste-from-overchecking.
68
-
69
- **Forbidden**: writing calls to a specific minor version of a library from memory when the code needs to run against that exact version and the API surface is known to have changed. Then you MUST query context7.
70
-
71
- **Fallback**: when context7 MCP is unavailable, use WebSearch with a version number, and annotate the output with "⚠️ context7 unavailable — documentation may not be current".
72
-
73
- ---
74
-
75
- ### Structured thinking → sequential-thinking MCP
76
-
77
- Use `sequential-thinking` proportional to **decision complexity**, not a fixed quota. Any thought count is a **ceiling for genuinely hard cases**, not a floor to hit.
78
-
79
- **Principle**: running 8 thoughts to pick between Vue and React for a Todo is waste. Running 1 thought to architect a distributed queue is irresponsible. Match effort to stakes.
80
-
81
- Hard rule: do NOT emit empty thoughts ("Thought 4: let me also consider X… X is fine"). If you've reached the answer, stop.
82
-
83
- ```
84
- mcp__sequential-thinking__sequentialthinking({
85
- thought: "...",
86
- thoughtNumber: N,
87
- totalThoughts: M,
88
- nextThoughtNeeded: true/false
89
- })
90
- ```
91
-
92
- **Fallback**: when seq-think is unavailable, simulate it inside `<thinking>...</thinking>` blocks
93
- in the response, still listing numbered thoughts proportional to real decision complexity.
94
-
95
- ---
96
-
97
- ### Historical context → claude-mem (if installed)
98
-
99
- Before starting any task (**especially the planning phase**):
100
-
101
- ```
102
- mcp__claude_mem__search("<task keywords>")
103
- → if relevant observations exist:
104
- mcp__claude_mem__get_observations([ids])
105
- → fold the relevant history into your decisions
106
- ```
107
-
108
- **Fallback**: when claude-mem is not installed, read the `decisions` array in `.flow/STATE.md`
109
- and `.flow/specs/*/.progress.md` for project-level history.
110
-
111
- ---
112
-
113
- ### Persistent sub-agent memory (when frontmatter enables `memory`)
114
-
115
- If your frontmatter sets `memory: project`, `memory: user`, or `memory: local`, treat that
116
- memory directory as a curated knowledge base:
117
-
118
- - Review existing memory before starting if the task depends on prior project patterns.
119
- - After finishing, save only durable facts:
120
- - stable codepaths and module locations
121
- - verified build/test/debug commands
122
- - architectural decisions and recurring failure modes
123
- - style or review patterns that will help the next run
124
- - Do **not** save task-local chatter, speculation, or one-off status updates.
125
- - Keep `MEMORY.md` concise. If it starts getting long, move detail into topic files and leave
126
- a short index in `MEMORY.md`.
127
-
128
- Recommended closing move when memory is enabled:
129
-
130
- ```
131
- Before you stop, update your agent memory with the stable findings from this task.
132
- ```
133
-
134
- ---
135
-
136
- ### UI code generation → frontend-design skill (if installed)
137
-
138
- All UI code generation must invoke the official Anthropic `frontend-design` skill.
139
-
140
- **Fallback**: when the skill is unavailable, use Tailwind CSS + shadcn/ui defaults.
141
-
142
- ---
143
-
144
- ### Browser QA → chrome-devtools MCP
145
-
146
- UI testing, performance traces, console inspection, network analysis:
147
-
148
- ```
149
- mcp__chrome_devtools__*
150
- ```
151
-
152
- **Fallback**: when the MCP is unavailable, produce a manual test checklist and explicitly tell the user.
153
-
154
- ### Claude Code runtime contracts → official docs first
155
-
156
- When changing or relying on Claude Code runtime behavior (hooks, subagents, skills, slash commands, plugin manifests, output styles, settings), re-check the official docs starting from `https://code.claude.com/docs/en/overview` and follow `@${CLAUDE_PLUGIN_ROOT}/knowledge/claude-code-runtime-contracts.md`.
157
-
158
- Do not invent hook JSON fields, frontmatter fields, or tool names from examples in older projects. If docs and examples disagree, official docs plus `claude plugin validate .` win.
159
-
160
- ---
161
-
162
- ## L3: Three Red Lines (inherited from pua, universal)
163
-
164
- Self-check before every agent output:
165
-
166
- ### 1. Closed loop
167
- > Claiming "done / fixed / passed"? Provide evidence.
168
-
169
- - ✗ "I fixed the bug"
170
- - ✓ "I fixed the bug. `npm test` output: `✓ 42 tests passed` (log attached)"
171
-
172
- ### 2. Fact-driven
173
- > Verify before saying "maybe" or "probably".
174
-
175
- - ✗ "This is probably a permission issue"
176
- - ✓ "I ran `ls -la config.json` and saw permissions `-rw-------`, unreadable by user. Fix: `chmod 644`"
177
-
178
- ### 3. Exhaust everything
179
- > Before saying "I cannot", complete the systematic 4-stage debugging.
180
-
181
- 1. **Root-cause investigation**: read the error → reproduce → check recent changes → trace the data flow
182
- 2. **Pattern analysis**: find a working counter-example to compare against
183
- 3. **Hypothesize and test**: form a single hypothesis → minimal test → verify
184
- 4. **Implement the fix**: write a failing test → fix the root cause → verify
185
-
186
- If ≥3 fix attempts fail, stop and challenge the architecture (rather than continuing to patch blindly).
187
-
188
- ---
189
-
190
- ## L4: State-Reading Conventions
191
-
192
- ### Read before every task
193
-
194
- 1. `.flow/PROJECT.md` — project vision
195
- 2. `.flow/CONTEXT.md` — user preferences
196
- 3. `.flow/STATE.md` — cross-session state + decisions
197
- 4. `.flow/specs/<active>/.progress.md` — current spec progress
198
- 5. `.flow/.active-spec` — name of the currently active spec
199
-
200
- ### Update after every task
201
-
202
- 1. Update `.progress.md` with what you learned (gotchas, patterns, decisions)
203
- 2. Update `.state.json` to advance the state machine (phase, taskIndex, etc.)
204
- 3. If a significant decision was made, append to the `decisions` array in `STATE.md` (D-NN format)
205
-
206
- ---
207
-
208
- ## L5: Atomic Commit Convention
209
-
210
- One commit per logical unit:
211
-
212
- ```
213
- <type>(<scope>): <summary>
214
-
215
- [body — explain why, not what]
216
-
217
- Decisions: D-01, D-02 (when referencing user decisions)
218
- ```
219
-
220
- **Types**:
221
- - `feat` — new feature
222
- - `fix` — bug fix
223
- - `refactor` — refactor (behavior unchanged)
224
- - `test` — tests (TDD: red/green/yellow)
225
- - `docs` — documentation
226
- - `chore` — miscellaneous
227
-
228
- **TDD stage markers**:
229
- - `test(scope): red - add failing test for X`
230
- - `feat(scope): green - implement X to pass test`
231
- - `refactor(scope): yellow - clean up X`
232
-
233
- ---
234
-
235
- ## L6: Anti-Patterns (forbidden)
236
-
237
- Patterns every agent must avoid:
238
-
239
- - ✗ Starting work without reading `.flow/` state
240
- - ✗ Claiming completion without running a verification command
241
- - ✗ "should / probably / seems" as a conclusion (unless explicitly labeled as an assumption)
242
- - ✗ Skipping context7 and writing library calls directly
243
- - ✗ Skipping sequential-thinking and giving an architecture decision directly
244
- - ✗ Refactoring while fixing a bug (violates the surgical-changes rule)
245
- - ✗ Adding features beyond what was requested (violates YAGNI)
246
- - ✗ Creating `*.md` documentation or README files unless the user explicitly asked for them
247
-
248
- ---
249
-
250
- ## L7: Delegation Convention (sub-agent dispatch)
251
-
252
- When you need to delegate to a sub-agent:
253
-
254
- 1. Give the sub-agent **complete task context** (it cannot read the conversation history)
255
- 2. State the **input paths** and **output paths** explicitly
256
- 3. State the **success criteria** explicitly (must be verifiable)
257
- 4. State the **forbidden behaviors** explicitly (cf. L6)
258
- 5. After the sub-agent finishes, the parent agent **reads the output** and reviews it
259
-
260
- ---
261
-
262
- ## L8: Long-artifact handling (truncation prevention)
263
-
264
- When your job is to produce a long Markdown artifact (`tasks.md`, `verification-report.md`, `review-report.md`, `research.md`, `requirements.md`, `design.md`, etc.), follow these rules. Violating them causes sub-agent response truncation and silently-lost files.
265
-
266
- ### Prefer checkpoint-tracked writes
267
-
268
- Claude Code checkpoints only track edits made through `Write`, `Edit`, and `NotebookEdit`. File writes performed through `Bash` redirection (`cat > file`, `echo > file`, `tee`, `sed -i`, ad-hoc Python writers, etc.) are not reliably rewindable. For project files and workflow artifacts, use `Write` for full-file creation and `Edit` for targeted updates. Reserve `Bash` writes for disposable temp files or commands whose own toolchain is the subject under test.
269
-
270
- ### Write first, explain second
271
-
272
- Your FIRST substantive action after gathering inputs must be a `Write` tool call with the **complete file content**. Do NOT paste the content as assistant text before writing.
273
-
274
- - ✗ *"Here's the tasks.md I'll write:"* followed by a 500-line markdown code block, then a `Write` call containing the same 500 lines — this doubles the output tokens and usually hits the truncation limit mid-`Write`, leaving the file missing or partial.
275
- - ✓ Immediately `Write` the file with full content. Then output a ≤ 5-line summary.
276
-
277
- ### Do not preview
278
-
279
- Never output the file's content in your response. The file IS the deliverable — the reader opens it. Your response is just the ack that you wrote it.
280
-
281
- ### After write, summarize only
282
-
283
- After `Write` returns success, respond with **at most 5 lines** summarizing what you wrote:
284
-
285
- ```
286
- ✓ Wrote .flow/specs/<spec>/tasks.md
287
- 40 tasks across 5 phases
288
- Coverage: FR 10/10, AC 12/12, AD 4/4
289
- Next: /curdx-flow:implement
290
- ```
291
-
292
- Do not re-paste any file contents. Do not narrate your reasoning. Do not list every task inline.
293
-
294
- ### Split when a single `Write` call would approach the output budget
295
-
296
- If the artifact is large enough that one `Write` call risks truncation (sub-agent output tokens are finite), split it:
297
- - `tasks.md` references `tasks-phase-1.md` … `tasks-phase-5.md`
298
- - Each phase file is its own `Write` call
299
- - The index file is a short table linking to the phase files
300
-
301
- Judge by the nature of the content, not a hardcoded line count — the same content density varies wildly in line count depending on how many tables and lists it contains. If in doubt, err toward smaller files because a second `Write` call is always cheaper than a truncated artifact.
302
-
303
- ### If you see a token-budget warning
304
-
305
- Stop narrating and call `Write` with whatever content is ready. Sub-agents do not have a "next response" — continuation is not possible after truncation. Save what you have, then return.
306
-
307
- ### Why this matters
308
-
309
- Sub-agents invoked via the `Task` tool have a ~16 K output-token budget per invocation. A naive agent that previews then writes consumes those tokens twice — once as prose, once inside the tool call — and truncation typically lands inside the `Write` call itself. The parent command then reports "agent did not complete" and re-dispatches, burning compute for no new artifact. Writing first eliminates the failure mode at the source.
310
-
311
- ---
312
-
313
- **Remember**: this preamble exists because, without discipline, AI tends to slack off, hallucinate, and over-engineer.
314
- These rules are not constraints — they are the tools that make you reliable.