mindforge-cc 2.1.0 → 2.1.2

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 (236) hide show
  1. package/.agent/bin/lib/commands.cjs +959 -0
  2. package/.agent/bin/lib/config.cjs +421 -0
  3. package/.agent/bin/lib/core.cjs +1166 -0
  4. package/.agent/bin/lib/frontmatter.cjs +307 -0
  5. package/.agent/bin/lib/init.cjs +1336 -0
  6. package/.agent/bin/lib/milestone.cjs +252 -0
  7. package/.agent/bin/lib/model-profiles.cjs +68 -0
  8. package/.agent/bin/lib/phase.cjs +888 -0
  9. package/.agent/bin/lib/profile-output.cjs +952 -0
  10. package/.agent/bin/lib/profile-pipeline.cjs +539 -0
  11. package/.agent/bin/lib/roadmap.cjs +329 -0
  12. package/.agent/bin/lib/security.cjs +356 -0
  13. package/.agent/bin/lib/state.cjs +969 -0
  14. package/.agent/bin/lib/template.cjs +222 -0
  15. package/.agent/bin/lib/uat.cjs +189 -0
  16. package/.agent/bin/lib/verify.cjs +851 -0
  17. package/.agent/bin/lib/workstream.cjs +491 -0
  18. package/.agent/bin/mindforge-tools.cjs +897 -0
  19. package/.agent/file-manifest.json +219 -0
  20. package/.agent/hooks/mindforge-check-update.js +114 -0
  21. package/.agent/hooks/mindforge-context-monitor.js +156 -0
  22. package/.agent/hooks/mindforge-prompt-guard.js +96 -0
  23. package/.agent/hooks/mindforge-statusline.js +119 -0
  24. package/.agent/hooks/mindforge-workflow-guard.js +94 -0
  25. package/.agent/mindforge/discuss-phase.md +1 -1
  26. package/.agent/mindforge/help.md +1 -1
  27. package/.agent/mindforge/learn.md +3 -2
  28. package/.agent/mindforge/research.md +3 -2
  29. package/.agent/mindforge/steer.md +1 -1
  30. package/.agent/settings.json +38 -0
  31. package/.agent/skills/mindforge-add-backlog/SKILL.md +72 -0
  32. package/.agent/skills/mindforge-add-phase/SKILL.md +39 -0
  33. package/.agent/skills/mindforge-add-tests/SKILL.md +28 -0
  34. package/.agent/skills/mindforge-add-todo/SKILL.md +42 -0
  35. package/.agent/skills/mindforge-audit-milestone/SKILL.md +29 -0
  36. package/.agent/skills/mindforge-audit-uat/SKILL.md +20 -0
  37. package/.agent/skills/mindforge-autonomous/SKILL.md +33 -0
  38. package/.agent/skills/mindforge-check-todos/SKILL.md +40 -0
  39. package/.agent/skills/mindforge-cleanup/SKILL.md +19 -0
  40. package/.agent/skills/mindforge-complete-milestone/SKILL.md +131 -0
  41. package/.agent/skills/mindforge-debug/SKILL.md +163 -0
  42. package/.agent/skills/mindforge-discuss-phase/SKILL.md +54 -0
  43. package/.agent/skills/mindforge-do/SKILL.md +26 -0
  44. package/.agent/skills/mindforge-execute-phase/SKILL.md +49 -0
  45. package/.agent/skills/mindforge-fast/SKILL.md +23 -0
  46. package/.agent/skills/mindforge-forensics/SKILL.md +49 -0
  47. package/.agent/skills/mindforge-health/SKILL.md +17 -0
  48. package/.agent/skills/mindforge-help/SKILL.md +23 -0
  49. package/.agent/skills/mindforge-insert-phase/SKILL.md +28 -0
  50. package/.agent/skills/mindforge-join-discord/SKILL.md +19 -0
  51. package/.agent/skills/mindforge-list-phase-assumptions/SKILL.md +41 -0
  52. package/.agent/skills/mindforge-list-workspaces/SKILL.md +17 -0
  53. package/.agent/skills/mindforge-manager/SKILL.md +32 -0
  54. package/.agent/skills/mindforge-map-codebase/SKILL.md +64 -0
  55. package/.agent/skills/mindforge-milestone-summary/SKILL.md +44 -0
  56. package/.agent/skills/mindforge-new-milestone/SKILL.md +38 -0
  57. package/.agent/skills/mindforge-new-project/SKILL.md +36 -0
  58. package/.agent/skills/mindforge-new-workspace/SKILL.md +39 -0
  59. package/.agent/skills/mindforge-next/SKILL.md +19 -0
  60. package/.agent/skills/mindforge-note/SKILL.md +29 -0
  61. package/.agent/skills/mindforge-pause-work/SKILL.md +35 -0
  62. package/.agent/skills/mindforge-plan-milestone-gaps/SKILL.md +28 -0
  63. package/.agent/skills/mindforge-plan-phase/SKILL.md +37 -0
  64. package/.agent/skills/mindforge-plant-seed/SKILL.md +22 -0
  65. package/.agent/skills/mindforge-pr-branch/SKILL.md +21 -0
  66. package/.agent/skills/mindforge-profile-user/SKILL.md +38 -0
  67. package/.agent/skills/mindforge-progress/SKILL.md +19 -0
  68. package/.agent/skills/mindforge-quick/SKILL.md +38 -0
  69. package/.agent/skills/mindforge-reapply-patches/SKILL.md +124 -0
  70. package/.agent/skills/mindforge-remove-phase/SKILL.md +26 -0
  71. package/.agent/skills/mindforge-remove-workspace/SKILL.md +22 -0
  72. package/.agent/skills/mindforge-research-phase/SKILL.md +186 -0
  73. package/.agent/skills/mindforge-resume-work/SKILL.md +35 -0
  74. package/.agent/skills/mindforge-review/SKILL.md +31 -0
  75. package/.agent/skills/mindforge-review-backlog/SKILL.md +58 -0
  76. package/.agent/skills/mindforge-session-report/SKILL.md +16 -0
  77. package/.agent/skills/mindforge-set-profile/SKILL.md +9 -0
  78. package/.agent/skills/mindforge-settings/SKILL.md +32 -0
  79. package/.agent/skills/mindforge-ship/SKILL.md +16 -0
  80. package/.agent/skills/mindforge-stats/SKILL.md +16 -0
  81. package/.agent/skills/mindforge-thread/SKILL.md +123 -0
  82. package/.agent/skills/mindforge-ui-phase/SKILL.md +24 -0
  83. package/.agent/skills/mindforge-ui-review/SKILL.md +24 -0
  84. package/.agent/skills/mindforge-update/SKILL.md +35 -0
  85. package/.agent/skills/mindforge-validate-phase/SKILL.md +26 -0
  86. package/.agent/skills/mindforge-verify-work/SKILL.md +30 -0
  87. package/.agent/skills/mindforge-workstreams/SKILL.md +65 -0
  88. package/.agent/workflows/mindforge-add-phase.md +112 -0
  89. package/.agent/workflows/mindforge-add-tests.md +351 -0
  90. package/.agent/workflows/mindforge-add-todo.md +158 -0
  91. package/.agent/workflows/mindforge-audit-milestone.md +332 -0
  92. package/.agent/workflows/mindforge-audit-uat.md +109 -0
  93. package/.agent/workflows/mindforge-autonomous.md +815 -0
  94. package/.agent/workflows/mindforge-check-todos.md +177 -0
  95. package/.agent/workflows/mindforge-cleanup.md +152 -0
  96. package/.agent/workflows/mindforge-complete-milestone.md +766 -0
  97. package/.agent/workflows/mindforge-diagnose-issues.md +220 -0
  98. package/.agent/workflows/mindforge-discovery-phase.md +289 -0
  99. package/.agent/workflows/mindforge-discuss-phase-assumptions.md +645 -0
  100. package/.agent/workflows/mindforge-discuss-phase.md +1047 -0
  101. package/.agent/workflows/mindforge-do.md +104 -0
  102. package/.agent/workflows/mindforge-execute-phase.md +838 -0
  103. package/.agent/workflows/mindforge-execute-plan.md +509 -0
  104. package/.agent/workflows/mindforge-fast.md +105 -0
  105. package/.agent/workflows/mindforge-forensics.md +265 -0
  106. package/.agent/workflows/mindforge-health.md +181 -0
  107. package/.agent/workflows/mindforge-help.md +606 -0
  108. package/.agent/workflows/mindforge-insert-phase.md +130 -0
  109. package/.agent/workflows/mindforge-list-phase-assumptions.md +178 -0
  110. package/.agent/workflows/mindforge-list-workspaces.md +56 -0
  111. package/.agent/workflows/mindforge-manager.md +360 -0
  112. package/.agent/workflows/mindforge-map-codebase.md +370 -0
  113. package/.agent/workflows/mindforge-milestone-summary.md +223 -0
  114. package/.agent/workflows/mindforge-new-milestone.md +469 -0
  115. package/.agent/workflows/mindforge-new-project.md +1226 -0
  116. package/.agent/workflows/mindforge-new-workspace.md +237 -0
  117. package/.agent/workflows/mindforge-next.md +97 -0
  118. package/.agent/workflows/mindforge-node-repair.md +92 -0
  119. package/.agent/workflows/mindforge-note.md +156 -0
  120. package/.agent/workflows/mindforge-pause-work.md +176 -0
  121. package/.agent/workflows/mindforge-plan-milestone-gaps.md +273 -0
  122. package/.agent/workflows/mindforge-plan-phase.md +848 -0
  123. package/.agent/workflows/mindforge-plant-seed.md +169 -0
  124. package/.agent/workflows/mindforge-pr-branch.md +129 -0
  125. package/.agent/workflows/mindforge-profile-user.md +450 -0
  126. package/.agent/workflows/mindforge-progress.md +507 -0
  127. package/.agent/workflows/mindforge-quick.md +732 -0
  128. package/.agent/workflows/mindforge-remove-phase.md +155 -0
  129. package/.agent/workflows/mindforge-remove-workspace.md +90 -0
  130. package/.agent/workflows/mindforge-research-phase.md +74 -0
  131. package/.agent/workflows/mindforge-resume-project.md +325 -0
  132. package/.agent/workflows/mindforge-review.md +228 -0
  133. package/.agent/workflows/mindforge-session-report.md +146 -0
  134. package/.agent/workflows/mindforge-settings.md +283 -0
  135. package/.agent/workflows/mindforge-ship.md +228 -0
  136. package/.agent/workflows/mindforge-stats.md +60 -0
  137. package/.agent/workflows/mindforge-transition.md +671 -0
  138. package/.agent/workflows/mindforge-ui-phase.md +290 -0
  139. package/.agent/workflows/mindforge-ui-review.md +157 -0
  140. package/.agent/workflows/mindforge-update.md +323 -0
  141. package/.agent/workflows/mindforge-validate-phase.md +167 -0
  142. package/.agent/workflows/mindforge-verify-phase.md +254 -0
  143. package/.agent/workflows/mindforge-verify-work.md +623 -0
  144. package/.mindforge/personas/advisor-researcher.md +3 -3
  145. package/.mindforge/personas/debug-specialist.md +1 -1
  146. package/.mindforge/personas/debugger.md +1 -1
  147. package/.mindforge/personas/developer.md +1 -1
  148. package/.mindforge/personas/phase-researcher.md +4 -4
  149. package/.mindforge/personas/project-researcher.md +3 -3
  150. package/.mindforge/personas/research-agent.md +4 -3
  151. package/.mindforge/personas/tech-writer.md +1 -1
  152. package/.mindforge/personas/ui-researcher.md +1 -1
  153. package/.planning/ROADMAP.md +10 -0
  154. package/CHANGELOG.md +34 -0
  155. package/README.md +70 -45
  156. package/RELEASENOTES.md +26 -26
  157. package/bin/install.js +41 -41
  158. package/bin/installer-core.js +67 -26
  159. package/bin/wizard/setup-wizard.js +11 -24
  160. package/bin/wizard/theme.js +141 -0
  161. package/docs/PERSONAS.md +119 -87
  162. package/docs/References/checkpoints.md +778 -0
  163. package/docs/References/config-reference.md +81 -0
  164. package/docs/References/continuation-format.md +249 -0
  165. package/docs/References/decimal-phase-calculation.md +64 -0
  166. package/docs/References/git-integration.md +295 -0
  167. package/docs/References/git-planning-commit.md +38 -0
  168. package/docs/References/model-profile-resolution.md +36 -0
  169. package/docs/References/model-profiles.md +139 -0
  170. package/docs/References/phase-argument-parsing.md +61 -0
  171. package/docs/References/planning-config.md +202 -0
  172. package/docs/References/questioning.md +162 -0
  173. package/docs/References/tdd.md +263 -0
  174. package/docs/References/ui-brand.md +160 -0
  175. package/docs/References/user-profiling.md +681 -0
  176. package/docs/References/verification-patterns.md +612 -0
  177. package/docs/References/workstream-flag.md +58 -0
  178. package/docs/Templates/Agents/CLAUDE-MD.md +122 -0
  179. package/docs/Templates/Agents/COPILOT-INSTRUCTIONS.md +7 -0
  180. package/docs/Templates/Agents/DEBUGGER-PROMPT.md +91 -0
  181. package/docs/Templates/Agents/PLANNER-PROMPT.md +117 -0
  182. package/docs/Templates/Codebase/architecture.md +255 -0
  183. package/docs/Templates/Codebase/concerns.md +310 -0
  184. package/docs/Templates/Codebase/conventions.md +307 -0
  185. package/docs/Templates/Codebase/integrations.md +280 -0
  186. package/docs/Templates/Codebase/stack.md +186 -0
  187. package/docs/Templates/Codebase/structure.md +285 -0
  188. package/docs/Templates/Codebase/testing.md +480 -0
  189. package/docs/Templates/Execution/CONTINUE-HERE.md +78 -0
  190. package/docs/Templates/Execution/DISCUSSION-LOG.md +63 -0
  191. package/docs/Templates/Execution/PHASE-PROMPT.md +610 -0
  192. package/docs/Templates/Execution/STATE.md +176 -0
  193. package/docs/Templates/Execution/SUMMARY-COMPLEX.md +59 -0
  194. package/docs/Templates/Execution/SUMMARY-MINIMAL.md +41 -0
  195. package/docs/Templates/Execution/SUMMARY-STANDARD.md +48 -0
  196. package/docs/Templates/Execution/SUMMARY.md +248 -0
  197. package/docs/Templates/Profile/DEV-PREFERENCES.md +21 -0
  198. package/docs/Templates/Profile/USER-PROFILE.md +146 -0
  199. package/docs/Templates/Profile/USER-SETUP.md +311 -0
  200. package/docs/Templates/Project/DISCOVERY.md +146 -0
  201. package/docs/Templates/Project/MILESTONE-ARCHIVE.md +123 -0
  202. package/docs/Templates/Project/MILESTONE.md +115 -0
  203. package/docs/Templates/Project/PROJECT.md +206 -0
  204. package/docs/Templates/Project/REQUIREMENTS.md +231 -0
  205. package/docs/Templates/Project/RETROSPECTIVE.md +54 -0
  206. package/docs/Templates/Project/ROADMAP.md +202 -0
  207. package/docs/Templates/Quality/DEBUG.md +164 -0
  208. package/docs/Templates/Quality/UAT.md +280 -0
  209. package/docs/Templates/Quality/UI-SPEC.md +100 -0
  210. package/docs/Templates/Quality/VALIDATION.md +76 -0
  211. package/docs/Templates/Quality/VERIFICATION-REPORT.md +322 -0
  212. package/docs/Templates/Research/ARCHITECTURE.md +204 -0
  213. package/docs/Templates/Research/FEATURES.md +147 -0
  214. package/docs/Templates/Research/PITFALLS.md +200 -0
  215. package/docs/Templates/Research/STACK.md +120 -0
  216. package/docs/Templates/Research/SUMMARY.md +170 -0
  217. package/docs/Templates/System/CONFIG.json +43 -0
  218. package/docs/Templates/System/CONTEXT.md +352 -0
  219. package/docs/architecture/README.md +54 -42
  220. package/docs/commands-reference.md +62 -14
  221. package/docs/getting-started.md +26 -18
  222. package/docs/skills-authoring-guide.md +40 -12
  223. package/docs/tutorial.md +83 -116
  224. package/docs/user-guide.md +72 -198
  225. package/package.json +7 -2
  226. package/.mindforge/memory/knowledge-base.jsonl +0 -7
  227. package/.mindforge/memory/pattern-library.jsonl +0 -1
  228. package/.mindforge/memory/team-preferences.jsonl +0 -4
  229. package/.planning/browser-daemon.log +0 -32
  230. package/docs/mindforge-md-reference.md +0 -57
  231. package/docs/reference/config-reference.md +0 -64
  232. /package/{.mindforge/memory/decision-library.jsonl → .planning/phases/01-migrate-gsd-to-mindforge/.gitkeep} +0 -0
  233. /package/docs/{reference → References}/audit-events.md +0 -0
  234. /package/docs/{reference → References}/commands.md +0 -0
  235. /package/docs/{reference → References}/sdk-api.md +0 -0
  236. /package/docs/{reference → References}/skills-api.md +0 -0
@@ -0,0 +1,509 @@
1
+ <purpose>
2
+ Execute a phase prompt (PLAN.md) and create the outcome summary (SUMMARY.md).
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ Read STATE.md before any operation to load project context.
7
+ Read config.json for planning behavior settings.
8
+
9
+ @.agent/references/git-integration.md
10
+ </required_reading>
11
+
12
+ <process>
13
+
14
+ <step name="init_context" priority="first">
15
+ Load execution context (paths only to minimize orchestrator context):
16
+
17
+ ```bash
18
+ INIT=$(node ".agent/bin/mindforge-tools.cjs" init execute-phase "${PHASE}")
19
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
20
+ ```
21
+
22
+ Extract from init JSON: `executor_model`, `commit_docs`, `sub_repos`, `phase_dir`, `phase_number`, `plans`, `summaries`, `incomplete_plans`, `state_path`, `config_path`.
23
+
24
+ If `.planning/` missing: error.
25
+ </step>
26
+
27
+ <step name="identify_plan">
28
+ ```bash
29
+ # Use plans/summaries from INIT JSON, or list files
30
+ ls .planning/phases/XX-name/*-PLAN.md 2>/dev/null | sort
31
+ ls .planning/phases/XX-name/*-SUMMARY.md 2>/dev/null | sort
32
+ ```
33
+
34
+ Find first PLAN without matching SUMMARY. Decimal phases supported (`01.1-hotfix/`):
35
+
36
+ ```bash
37
+ PHASE=$(echo "$PLAN_PATH" | grep -oE '[0-9]+(\.[0-9]+)?-[0-9]+')
38
+ # config settings can be fetched via mindforge-tools config-get if needed
39
+ ```
40
+
41
+ <if mode="yolo">
42
+ Auto-approve: `⚡ Execute {phase}-{plan}-PLAN.md [Plan X of Y for Phase Z]` → parse_segments.
43
+ </if>
44
+
45
+ <if mode="interactive" OR="custom with gates.execute_next_plan true">
46
+ Present plan identification, wait for confirmation.
47
+ </if>
48
+ </step>
49
+
50
+ <step name="record_start_time">
51
+ ```bash
52
+ PLAN_START_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
53
+ PLAN_START_EPOCH=$(date +%s)
54
+ ```
55
+ </step>
56
+
57
+ <step name="parse_segments">
58
+ ```bash
59
+ grep -n "type=\"checkpoint" .planning/phases/XX-name/{phase}-{plan}-PLAN.md
60
+ ```
61
+
62
+ **Routing by checkpoint type:**
63
+
64
+ | Checkpoints | Pattern | Execution |
65
+ |-------------|---------|-----------|
66
+ | None | A (autonomous) | Single subagent: full plan + SUMMARY + commit |
67
+ | Verify-only | B (segmented) | Segments between checkpoints. After none/human-verify → SUBAGENT. After decision/human-action → MAIN |
68
+ | Decision | C (main) | Execute entirely in main context |
69
+
70
+ **Pattern A:** init_agent_tracking → spawn Task(subagent_type="mindforge-executor", model=executor_model, isolation="worktree") with prompt: execute plan at [path], autonomous, all tasks + SUMMARY + commit, follow deviation/auth rules, report: plan name, tasks, SUMMARY path, commit hash → track agent_id → wait → update tracking → report.
71
+
72
+ **Pattern B:** Execute segment-by-segment. Autonomous segments: spawn subagent for assigned tasks only (no SUMMARY/commit). Checkpoints: main context. After all segments: aggregate, create SUMMARY, commit. See segment_execution.
73
+
74
+ **Pattern C:** Execute in main using standard flow (step name="execute").
75
+
76
+ Fresh context per subagent preserves peak quality. Main context stays lean.
77
+ </step>
78
+
79
+ <step name="init_agent_tracking">
80
+ ```bash
81
+ if [ ! -f .planning/agent-history.json ]; then
82
+ echo '{"version":"1.0","max_entries":50,"entries":[]}' > .planning/agent-history.json
83
+ fi
84
+ rm -f .planning/current-agent-id.txt
85
+ if [ -f .planning/current-agent-id.txt ]; then
86
+ INTERRUPTED_ID=$(cat .planning/current-agent-id.txt)
87
+ echo "Found interrupted agent: $INTERRUPTED_ID"
88
+ fi
89
+ ```
90
+
91
+ If interrupted: ask user to resume (Task `resume` parameter) or start fresh.
92
+
93
+ **Tracking protocol:** On spawn: write agent_id to `current-agent-id.txt`, append to agent-history.json: `{"agent_id":"[id]","task_description":"[desc]","phase":"[phase]","plan":"[plan]","segment":[num|null],"timestamp":"[ISO]","status":"spawned","completion_timestamp":null}`. On completion: status → "completed", set completion_timestamp, delete current-agent-id.txt. Prune: if entries > max_entries, remove oldest "completed" (never "spawned").
94
+
95
+ Run for Pattern A/B before spawning. Pattern C: skip.
96
+ </step>
97
+
98
+ <step name="segment_execution">
99
+ Pattern B only (verify-only checkpoints). Skip for A/C.
100
+
101
+ 1. Parse segment map: checkpoint locations and types
102
+ 2. Per segment:
103
+ - Subagent route: spawn mindforge-executor for assigned tasks only. Prompt: task range, plan path, read full plan for context, execute assigned tasks, track deviations, NO SUMMARY/commit. Track via agent protocol.
104
+ - Main route: execute tasks using standard flow (step name="execute")
105
+ 3. After ALL segments: aggregate files/deviations/decisions → create SUMMARY.md → commit → self-check:
106
+ - Verify key-files.created exist on disk with `[ -f ]`
107
+ - Check `git log --oneline --all --grep="{phase}-{plan}"` returns ≥1 commit
108
+ - Append `## Self-Check: PASSED` or `## Self-Check: FAILED` to SUMMARY
109
+
110
+ **Known Claude Code bug (classifyHandoffIfNeeded):** If any segment agent reports "failed" with `classifyHandoffIfNeeded is not defined`, this is a Claude Code runtime bug — not a real failure. Run spot-checks; if they pass, treat as successful.
111
+
112
+
113
+
114
+
115
+ </step>
116
+
117
+ <step name="load_prompt">
118
+ ```bash
119
+ cat .planning/phases/XX-name/{phase}-{plan}-PLAN.md
120
+ ```
121
+ This IS the execution instructions. Follow exactly. If plan references CONTEXT.md: honor user's vision throughout.
122
+
123
+ **If plan contains `<interfaces>` block:** These are pre-extracted type definitions and contracts. Use them directly — do NOT re-read the source files to discover types. The planner already extracted what you need.
124
+ </step>
125
+
126
+ <step name="previous_phase_check">
127
+ ```bash
128
+ node ".agent/bin/mindforge-tools.cjs" phases list --type summaries --raw
129
+ # Extract the second-to-last summary from the JSON result
130
+ ```
131
+ If previous SUMMARY has unresolved "Issues Encountered" or "Next Phase Readiness" blockers: AskUserQuestion(header="Previous Issues", options: "Proceed anyway" | "Address first" | "Review previous").
132
+ </step>
133
+
134
+ <step name="execute">
135
+ Deviations are normal — handle via rules below.
136
+
137
+ 1. Read @context files from prompt
138
+ 2. **MCP tools:** If GEMINI.md or project instructions reference MCP tools (e.g. jCodeMunch for code navigation), prefer them over Grep/Glob when available. Fall back to Grep/Glob if MCP tools are not accessible.
139
+ 3. Per task:
140
+ - **MANDATORY read_first gate:** If the task has a `<read_first>` field, you MUST read every listed file BEFORE making any edits. This is not optional. Do not skip files because you "already know" what's in them — read them. The read_first files establish ground truth for the task.
141
+ - `type="auto"`: if `tdd="true"` → TDD execution. Implement with deviation rules + auth gates. Verify done criteria. Commit (see task_commit). Track hash for Summary.
142
+ - `type="checkpoint:*"`: STOP → checkpoint_protocol → wait for user → continue only after confirmation.
143
+ - **MANDATORY acceptance_criteria check:** After completing each task, if it has `<acceptance_criteria>`, verify EVERY criterion before moving to the next task. Use grep, file reads, or CLI commands to confirm each criterion. If any criterion fails, fix the implementation before proceeding. Do not skip criteria or mark them as "will verify later".
144
+ 3. Run `<verification>` checks
145
+ 4. Confirm `<success_criteria>` met
146
+ 5. Document deviations in Summary
147
+ </step>
148
+
149
+ <authentication_gates>
150
+
151
+ ## Authentication Gates
152
+
153
+ Auth errors during execution are NOT failures — they're expected interaction points.
154
+
155
+ **Indicators:** "Not authenticated", "Unauthorized", 401/403, "Please run {tool} login", "Set {ENV_VAR}"
156
+
157
+ **Protocol:**
158
+ 1. Recognize auth gate (not a bug)
159
+ 2. STOP task execution
160
+ 3. Create dynamic checkpoint:human-action with exact auth steps
161
+ 4. Wait for user to authenticate
162
+ 5. Verify credentials work
163
+ 6. Retry original task
164
+ 7. Continue normally
165
+
166
+ **Example:** `vercel --yes` → "Not authenticated" → checkpoint asking user to `vercel login` → verify with `vercel whoami` → retry deploy → continue
167
+
168
+ **In Summary:** Document as normal flow under "## Authentication Gates", not as deviations.
169
+
170
+ </authentication_gates>
171
+
172
+ <deviation_rules>
173
+
174
+ ## Deviation Rules
175
+
176
+ You WILL discover unplanned work. Apply automatically, track all for Summary.
177
+
178
+ | Rule | Trigger | Action | Permission |
179
+ |------|---------|--------|------------|
180
+ | **1: Bug** | Broken behavior, errors, wrong queries, type errors, security vulns, race conditions, leaks | Fix → test → verify → track `[Rule 1 - Bug]` | Auto |
181
+ | **2: Missing Critical** | Missing essentials: error handling, validation, auth, CSRF/CORS, rate limiting, indexes, logging | Add → test → verify → track `[Rule 2 - Missing Critical]` | Auto |
182
+ | **3: Blocking** | Prevents completion: missing deps, wrong types, broken imports, missing env/config/files, circular deps | Fix blocker → verify proceeds → track `[Rule 3 - Blocking]` | Auto |
183
+ | **4: Architectural** | Structural change: new DB table, schema change, new service, switching libs, breaking API, new infra | STOP → present decision (below) → track `[Rule 4 - Architectural]` | Ask user |
184
+
185
+ **Rule 4 format:**
186
+ ```
187
+ ⚠️ Architectural Decision Needed
188
+
189
+ Current task: [task name]
190
+ Discovery: [what prompted this]
191
+ Proposed change: [modification]
192
+ Why needed: [rationale]
193
+ Impact: [what this affects]
194
+ Alternatives: [other approaches]
195
+
196
+ Proceed with proposed change? (yes / different approach / defer)
197
+ ```
198
+
199
+ **Priority:** Rule 4 (STOP) > Rules 1-3 (auto) > unsure → Rule 4
200
+ **Edge cases:** missing validation → R2 | null crash → R1 | new table → R4 | new column → R1/2
201
+ **Heuristic:** Affects correctness/security/completion? → R1-3. Maybe? → R4.
202
+
203
+ </deviation_rules>
204
+
205
+ <deviation_documentation>
206
+
207
+ ## Documenting Deviations
208
+
209
+ Summary MUST include deviations section. None? → `## Deviations from Plan\n\nNone - plan executed exactly as written.`
210
+
211
+ Per deviation: **[Rule N - Category] Title** — Found during: Task X | Issue | Fix | Files modified | Verification | Commit hash
212
+
213
+ End with: **Total deviations:** N auto-fixed (breakdown). **Impact:** assessment.
214
+
215
+ </deviation_documentation>
216
+
217
+ <tdd_plan_execution>
218
+ ## TDD Execution
219
+
220
+ For `type: tdd` plans — RED-GREEN-REFACTOR:
221
+
222
+ 1. **Infrastructure** (first TDD plan only): detect project, install framework, config, verify empty suite
223
+ 2. **RED:** Read `<behavior>` → failing test(s) → run (MUST fail) → commit: `test({phase}-{plan}): add failing test for [feature]`
224
+ 3. **GREEN:** Read `<implementation>` → minimal code → run (MUST pass) → commit: `feat({phase}-{plan}): implement [feature]`
225
+ 4. **REFACTOR:** Clean up → tests MUST pass → commit: `refactor({phase}-{plan}): clean up [feature]`
226
+
227
+ Errors: RED doesn't fail → investigate test/existing feature. GREEN doesn't pass → debug, iterate. REFACTOR breaks → undo.
228
+
229
+ See `.agent/mindforge/references/tdd.md` for structure.
230
+ </tdd_plan_execution>
231
+
232
+ <precommit_failure_handling>
233
+ ## Pre-commit Hook Failure Handling
234
+
235
+ Your commits may trigger pre-commit hooks. Auto-fix hooks handle themselves transparently — files get fixed and re-staged automatically.
236
+
237
+ **If running as a parallel executor agent (spawned by execute-phase):**
238
+ Use `--no-verify` on all commits. Pre-commit hooks cause build lock contention when multiple agents commit simultaneously (e.g., cargo lock fights in Rust projects). The orchestrator validates once after all agents complete.
239
+
240
+ **If running as the sole executor (sequential mode):**
241
+ If a commit is BLOCKED by a hook:
242
+
243
+ 1. The `git commit` command fails with hook error output
244
+ 2. Read the error — it tells you exactly which hook and what failed
245
+ 3. Fix the issue (type error, lint violation, secret leak, etc.)
246
+ 4. `git add` the fixed files
247
+ 5. Retry the commit
248
+ 6. Budget 1-2 retry cycles per commit
249
+ </precommit_failure_handling>
250
+
251
+ <task_commit>
252
+ ## Task Commit Protocol
253
+
254
+ After each task (verification passed, done criteria met), commit immediately.
255
+
256
+ **1. Check:** `git status --short`
257
+
258
+ **2. Stage individually** (NEVER `git add .` or `git add -A`):
259
+ ```bash
260
+ git add src/api/auth.ts
261
+ git add src/types/user.ts
262
+ ```
263
+
264
+ **3. Commit type:**
265
+
266
+ | Type | When | Example |
267
+ |------|------|---------|
268
+ | `feat` | New functionality | feat(08-02): create user registration endpoint |
269
+ | `fix` | Bug fix | fix(08-02): correct email validation regex |
270
+ | `test` | Test-only (TDD RED) | test(08-02): add failing test for password hashing |
271
+ | `refactor` | No behavior change (TDD REFACTOR) | refactor(08-02): extract validation to helper |
272
+ | `perf` | Performance | perf(08-02): add database index |
273
+ | `docs` | Documentation | docs(08-02): add API docs |
274
+ | `style` | Formatting | style(08-02): format auth module |
275
+ | `chore` | Config/deps | chore(08-02): add bcrypt dependency |
276
+
277
+ **4. Format:** `{type}({phase}-{plan}): {description}` with bullet points for key changes.
278
+
279
+ <sub_repos_commit_flow>
280
+ **Sub-repos mode:** If `sub_repos` is configured (non-empty array from init context), use `commit-to-subrepo` instead of standard git commit. This routes files to their correct sub-repo based on path prefix.
281
+
282
+ ```bash
283
+ node .agent/bin/mindforge-tools.cjs commit-to-subrepo "{type}({phase}-{plan}): {description}" --files file1 file2 ...
284
+ ```
285
+
286
+ The command groups files by sub-repo prefix and commits atomically to each. Returns JSON: `{ committed: true, repos: { "backend": { hash: "abc", files: [...] }, ... } }`.
287
+
288
+ Record hashes from each repo in the response for SUMMARY tracking.
289
+
290
+ **If `sub_repos` is empty or not set:** Use standard git commit flow below.
291
+ </sub_repos_commit_flow>
292
+
293
+ **5. Record hash:**
294
+ ```bash
295
+ TASK_COMMIT=$(git rev-parse --short HEAD)
296
+ TASK_COMMITS+=("Task ${TASK_NUM}: ${TASK_COMMIT}")
297
+ ```
298
+
299
+ **6. Check for untracked generated files:**
300
+ ```bash
301
+ git status --short | grep '^??'
302
+ ```
303
+ If new untracked files appeared after running scripts or tools, decide for each:
304
+ - **Commit it** — if it's a source file, config, or intentional artifact
305
+ - **Add to .gitignore** — if it's a generated/runtime output (build artifacts, `.env` files, cache files, compiled output)
306
+ - Do NOT leave generated files untracked
307
+
308
+ </task_commit>
309
+
310
+ <step name="checkpoint_protocol">
311
+ On `type="checkpoint:*"`: automate everything possible first. Checkpoints are for verification/decisions only.
312
+
313
+ Display: `CHECKPOINT: [Type]` box → Progress {X}/{Y} → Task name → type-specific content → `YOUR ACTION: [signal]`
314
+
315
+ | Type | Content | Resume signal |
316
+ |------|---------|---------------|
317
+ | human-verify (90%) | What was built + verification steps (commands/URLs) | "approved" or describe issues |
318
+ | decision (9%) | Decision needed + context + options with pros/cons | "Select: option-id" |
319
+ | human-action (1%) | What was automated + ONE manual step + verification plan | "done" |
320
+
321
+ After response: verify if specified. Pass → continue. Fail → inform, wait. WAIT for user — do NOT hallucinate completion.
322
+
323
+ See .agent/mindforge/references/checkpoints.md for details.
324
+ </step>
325
+
326
+ <step name="checkpoint_return_for_orchestrator">
327
+ When spawned via Task and hitting checkpoint: return structured state (cannot interact with user directly).
328
+
329
+ **Required return:** 1) Completed Tasks table (hashes + files) 2) Current Task (what's blocking) 3) Checkpoint Details (user-facing content) 4) Awaiting (what's needed from user)
330
+
331
+ Orchestrator parses → presents to user → spawns fresh continuation with your completed tasks state. You will NOT be resumed. In main context: use checkpoint_protocol above.
332
+ </step>
333
+
334
+ <step name="verification_failure_gate">
335
+ If verification fails:
336
+
337
+ **Check if node repair is enabled** (default: on):
338
+ ```bash
339
+ NODE_REPAIR=$(node "./.agent/bin/mindforge-tools.cjs" config-get workflow.node_repair 2>/dev/null || echo "true")
340
+ ```
341
+
342
+ If `NODE_REPAIR` is `true`: invoke `@./.agent/mindforge/workflows/mindforge-node-repair.md` with:
343
+ - FAILED_TASK: task number, name, done-criteria
344
+ - ERROR: expected vs actual result
345
+ - PLAN_CONTEXT: adjacent task names + phase goal
346
+ - REPAIR_BUDGET: `workflow.node_repair_budget` from config (default: 2)
347
+
348
+ Node repair will attempt RETRY, DECOMPOSE, or PRUNE autonomously. Only reaches this gate again if repair budget is exhausted (ESCALATE).
349
+
350
+ If `NODE_REPAIR` is `false` OR repair returns ESCALATE: STOP. Present: "Verification failed for Task [X]: [name]. Expected: [criteria]. Actual: [result]. Repair attempted: [summary of what was tried]." Options: Retry | Skip (mark incomplete) | Stop (investigate). If skipped → SUMMARY "Issues Encountered".
351
+ </step>
352
+
353
+ <step name="record_completion_time">
354
+ ```bash
355
+ PLAN_END_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
356
+ PLAN_END_EPOCH=$(date +%s)
357
+
358
+ DURATION_SEC=$(( PLAN_END_EPOCH - PLAN_START_EPOCH ))
359
+ DURATION_MIN=$(( DURATION_SEC / 60 ))
360
+
361
+ if [[ $DURATION_MIN -ge 60 ]]; then
362
+ HRS=$(( DURATION_MIN / 60 ))
363
+ MIN=$(( DURATION_MIN % 60 ))
364
+ DURATION="${HRS}h ${MIN}m"
365
+ else
366
+ DURATION="${DURATION_MIN} min"
367
+ fi
368
+ ```
369
+ </step>
370
+
371
+ <step name="generate_user_setup">
372
+ ```bash
373
+ grep -A 50 "^user_setup:" .planning/phases/XX-name/{phase}-{plan}-PLAN.md | head -50
374
+ ```
375
+
376
+ If user_setup exists: create `{phase}-USER-SETUP.md` using template `.agent/mindforge/templates/user-setup.md`. Per service: env vars table, account setup checklist, dashboard config, local dev notes, verification commands. Status "Incomplete". Set `USER_SETUP_CREATED=true`. If empty/missing: skip.
377
+ </step>
378
+
379
+ <step name="create_summary">
380
+ Create `{phase}-{plan}-SUMMARY.md` at `.planning/phases/XX-name/`. Use `.agent/mindforge/templates/summary.md`.
381
+
382
+ **Frontmatter:** phase, plan, subsystem, tags | requires/provides/affects | tech-stack.added/patterns | key-files.created/modified | key-decisions | requirements-completed (**MUST** copy `requirements` array from PLAN.md frontmatter verbatim) | duration ($DURATION), completed ($PLAN_END_TIME date).
383
+
384
+ Title: `# Phase [X] Plan [Y]: [Name] Summary`
385
+
386
+ One-liner SUBSTANTIVE: "JWT auth with refresh rotation using jose library" not "Authentication implemented"
387
+
388
+ Include: duration, start/end times, task count, file count.
389
+
390
+ Next: more plans → "Ready for {next-plan}" | last → "Phase complete, ready for next step".
391
+ </step>
392
+
393
+ <step name="update_current_position">
394
+ Update STATE.md using mindforge-tools:
395
+
396
+ ```bash
397
+ # Advance plan counter (handles last-plan edge case)
398
+ node ".agent/bin/mindforge-tools.cjs" state advance-plan
399
+
400
+ # Recalculate progress bar from disk state
401
+ node ".agent/bin/mindforge-tools.cjs" state update-progress
402
+
403
+ # Record execution metrics
404
+ node ".agent/bin/mindforge-tools.cjs" state record-metric \
405
+ --phase "${PHASE}" --plan "${PLAN}" --duration "${DURATION}" \
406
+ --tasks "${TASK_COUNT}" --files "${FILE_COUNT}"
407
+ ```
408
+ </step>
409
+
410
+ <step name="extract_decisions_and_issues">
411
+ From SUMMARY: Extract decisions and add to STATE.md:
412
+
413
+ ```bash
414
+ # Add each decision from SUMMARY key-decisions
415
+ # Prefer file inputs for shell-safe text (preserves `$`, `*`, etc. exactly)
416
+ node ".agent/bin/mindforge-tools.cjs" state add-decision \
417
+ --phase "${PHASE}" --summary-file "${DECISION_TEXT_FILE}" --rationale-file "${RATIONALE_FILE}"
418
+
419
+ # Add blockers if any found
420
+ node ".agent/bin/mindforge-tools.cjs" state add-blocker --text-file "${BLOCKER_TEXT_FILE}"
421
+ ```
422
+ </step>
423
+
424
+ <step name="update_session_continuity">
425
+ Update session info using mindforge-tools:
426
+
427
+ ```bash
428
+ node ".agent/bin/mindforge-tools.cjs" state record-session \
429
+ --stopped-at "Completed ${PHASE}-${PLAN}-PLAN.md" \
430
+ --resume-file "None"
431
+ ```
432
+
433
+ Keep STATE.md under 150 lines.
434
+ </step>
435
+
436
+ <step name="issues_review_gate">
437
+ If SUMMARY "Issues Encountered" ≠ "None": yolo → log and continue. Interactive → present issues, wait for acknowledgment.
438
+ </step>
439
+
440
+ <step name="update_roadmap">
441
+ ```bash
442
+ node ".agent/bin/mindforge-tools.cjs" roadmap update-plan-progress "${PHASE}"
443
+ ```
444
+ Counts PLAN vs SUMMARY files on disk. Updates progress table row with correct count and status (`In Progress` or `Complete` with date).
445
+ </step>
446
+
447
+ <step name="update_requirements">
448
+ Mark completed requirements from the PLAN.md frontmatter `requirements:` field:
449
+
450
+ ```bash
451
+ node ".agent/bin/mindforge-tools.cjs" requirements mark-complete ${REQ_IDS}
452
+ ```
453
+
454
+ Extract requirement IDs from the plan's frontmatter (e.g., `requirements: [AUTH-01, AUTH-02]`). If no requirements field, skip.
455
+ </step>
456
+
457
+ <step name="git_commit_metadata">
458
+ Task code already committed per-task. Commit plan metadata:
459
+
460
+ ```bash
461
+ node ".agent/bin/mindforge-tools.cjs" commit "docs({phase}-{plan}): complete [plan-name] plan" --files .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/STATE.md .planning/ROADMAP.md .planning/REQUIREMENTS.md
462
+ ```
463
+ </step>
464
+
465
+ <step name="update_codebase_map">
466
+ If .planning/codebase/ doesn't exist: skip.
467
+
468
+ ```bash
469
+ FIRST_TASK=$(git log --oneline --grep="feat({phase}-{plan}):" --grep="fix({phase}-{plan}):" --grep="test({phase}-{plan}):" --reverse | head -1 | cut -d' ' -f1)
470
+ git diff --name-only ${FIRST_TASK}^..HEAD 2>/dev/null
471
+ ```
472
+
473
+ Update only structural changes: new src/ dir → STRUCTURE.md | deps → STACK.md | file pattern → CONVENTIONS.md | API client → INTEGRATIONS.md | config → STACK.md | renamed → update paths. Skip code-only/bugfix/content changes.
474
+
475
+ ```bash
476
+ node ".agent/bin/mindforge-tools.cjs" commit "" --files .planning/codebase/*.md --amend
477
+ ```
478
+ </step>
479
+
480
+ <step name="offer_next">
481
+ If `USER_SETUP_CREATED=true`: display `⚠️ USER SETUP REQUIRED` with path + env/config tasks at TOP.
482
+
483
+ ```bash
484
+ ls -1 .planning/phases/[current-phase-dir]/*-PLAN.md 2>/dev/null | wc -l
485
+ ls -1 .planning/phases/[current-phase-dir]/*-SUMMARY.md 2>/dev/null | wc -l
486
+ ```
487
+
488
+ | Condition | Route | Action |
489
+ |-----------|-------|--------|
490
+ | summaries < plans | **A: More plans** | Find next PLAN without SUMMARY. Yolo: auto-continue. Interactive: show next plan, suggest `/mindforge-execute-phase {phase}` + `/mindforge-verify-work`. STOP here. |
491
+ | summaries = plans, current < highest phase | **B: Phase done** | Show completion, suggest `/mindforge-plan-phase {Z+1}` + `/mindforge-verify-work {Z}` + `/mindforge-discuss-phase {Z+1}` |
492
+ | summaries = plans, current = highest phase | **C: Milestone done** | Show banner, suggest `/mindforge-complete-milestone` + `/mindforge-verify-work` + `/mindforge-add-phase` |
493
+
494
+ All routes: `/clear` first for fresh context.
495
+ </step>
496
+
497
+ </process>
498
+
499
+ <success_criteria>
500
+
501
+ - All tasks from PLAN.md completed
502
+ - All verifications pass
503
+ - USER-SETUP.md generated if user_setup in frontmatter
504
+ - SUMMARY.md created with substantive content
505
+ - STATE.md updated (position, decisions, issues, session)
506
+ - ROADMAP.md updated
507
+ - If codebase map exists: map updated with execution changes (or skipped if no significant changes)
508
+ - If USER-SETUP.md created: prominently surfaced in completion output
509
+ </success_criteria>
@@ -0,0 +1,105 @@
1
+ <purpose>
2
+ Execute a trivial task inline without subagent overhead. No PLAN.md, no Task spawning,
3
+ no research, no plan checking. Just: understand → do → commit → log.
4
+
5
+ For tasks like: fix a typo, update a config value, add a missing import, rename a
6
+ variable, commit uncommitted work, add a .gitignore entry, bump a version number.
7
+
8
+ Use /mindforge-quick for anything that needs multi-step planning or research.
9
+ </purpose>
10
+
11
+ <process>
12
+
13
+ <step name="parse_task">
14
+ Parse `$ARGUMENTS` for the task description.
15
+
16
+ If empty, ask:
17
+ ```
18
+ What's the quick fix? (one sentence)
19
+ ```
20
+
21
+ Store as `$TASK`.
22
+ </step>
23
+
24
+ <step name="scope_check">
25
+ **Before doing anything, verify this is actually trivial.**
26
+
27
+ A task is trivial if it can be completed in:
28
+ - ≤ 3 file edits
29
+ - ≤ 1 minute of work
30
+ - No new dependencies or architecture changes
31
+ - No research needed
32
+
33
+ If the task seems non-trivial (multi-file refactor, new feature, needs research),
34
+ say:
35
+
36
+ ```
37
+ This looks like it needs planning. Use /mindforge-quick instead:
38
+ /mindforge-quick "{task description}"
39
+ ```
40
+
41
+ And stop.
42
+ </step>
43
+
44
+ <step name="execute_inline">
45
+ Do the work directly:
46
+
47
+ 1. Read the relevant file(s)
48
+ 2. Make the change(s)
49
+ 3. Verify the change works (run existing tests if applicable, or do a quick sanity check)
50
+
51
+ **No PLAN.md.** Just do it.
52
+ </step>
53
+
54
+ <step name="commit">
55
+ Commit the change atomically:
56
+
57
+ ```bash
58
+ git add -A
59
+ git commit -m "fix: {concise description of what changed}"
60
+ ```
61
+
62
+ Use conventional commit format: `fix:`, `feat:`, `docs:`, `chore:`, `refactor:` as appropriate.
63
+ </step>
64
+
65
+ <step name="log_to_state">
66
+ If `.planning/STATE.md` exists, append to the "Quick Tasks Completed" table.
67
+ If the table doesn't exist, skip this step silently.
68
+
69
+ ```bash
70
+ # Check if STATE.md has quick tasks table
71
+ if grep -q "Quick Tasks Completed" .planning/STATE.md 2>/dev/null; then
72
+ # Append entry — workflow handles the format
73
+ echo "| $(date +%Y-%m-%d) | fast | $TASK | ✅ |" >> .planning/STATE.md
74
+ fi
75
+ ```
76
+ </step>
77
+
78
+ <step name="done">
79
+ Report completion:
80
+
81
+ ```
82
+ ✅ Done: {what was changed}
83
+ Commit: {short hash}
84
+ Files: {list of changed files}
85
+ ```
86
+
87
+ No next-step suggestions. No workflow routing. Just done.
88
+ </step>
89
+
90
+ </process>
91
+
92
+ <guardrails>
93
+ - NEVER spawn a Task/subagent — this runs inline
94
+ - NEVER create PLAN.md or SUMMARY.md files
95
+ - NEVER run research or plan-checking
96
+ - If the task takes more than 3 file edits, STOP and redirect to /mindforge-quick
97
+ - If you're unsure how to implement it, STOP and redirect to /mindforge-quick
98
+ </guardrails>
99
+
100
+ <success_criteria>
101
+ - [ ] Task completed in current context (no subagents)
102
+ - [ ] Atomic git commit with conventional message
103
+ - [ ] STATE.md updated if it exists
104
+ - [ ] Total operation under 2 minutes wall time
105
+ </success_criteria>