mindforge-cc 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/.agent/CLAUDE.md +462 -0
  2. package/.agent/forge/help.md +7 -0
  3. package/.agent/forge/init-project.md +32 -0
  4. package/.agent/forge/plan-phase.md +30 -0
  5. package/.agent/mindforge/approve.md +18 -0
  6. package/.agent/mindforge/audit.md +30 -0
  7. package/.agent/mindforge/benchmark.md +33 -0
  8. package/.agent/mindforge/complete-milestone.md +18 -0
  9. package/.agent/mindforge/debug.md +126 -0
  10. package/.agent/mindforge/discuss-phase.md +138 -0
  11. package/.agent/mindforge/execute-phase.md +165 -0
  12. package/.agent/mindforge/health.md +21 -0
  13. package/.agent/mindforge/help.md +23 -0
  14. package/.agent/mindforge/init-org.md +131 -0
  15. package/.agent/mindforge/init-project.md +155 -0
  16. package/.agent/mindforge/install-skill.md +15 -0
  17. package/.agent/mindforge/map-codebase.md +298 -0
  18. package/.agent/mindforge/metrics.md +22 -0
  19. package/.agent/mindforge/migrate.md +40 -0
  20. package/.agent/mindforge/milestone.md +12 -0
  21. package/.agent/mindforge/next.md +105 -0
  22. package/.agent/mindforge/plan-phase.md +125 -0
  23. package/.agent/mindforge/plugins.md +40 -0
  24. package/.agent/mindforge/pr-review.md +41 -0
  25. package/.agent/mindforge/profile-team.md +23 -0
  26. package/.agent/mindforge/publish-skill.md +19 -0
  27. package/.agent/mindforge/quick.md +135 -0
  28. package/.agent/mindforge/release.md +10 -0
  29. package/.agent/mindforge/retrospective.md +26 -0
  30. package/.agent/mindforge/review.md +157 -0
  31. package/.agent/mindforge/security-scan.md +233 -0
  32. package/.agent/mindforge/ship.md +100 -0
  33. package/.agent/mindforge/skills.md +141 -0
  34. package/.agent/mindforge/status.md +104 -0
  35. package/.agent/mindforge/sync-confluence.md +11 -0
  36. package/.agent/mindforge/sync-jira.md +12 -0
  37. package/.agent/mindforge/tokens.md +8 -0
  38. package/.agent/mindforge/update.md +42 -0
  39. package/.agent/mindforge/verify-phase.md +62 -0
  40. package/.agent/mindforge/workspace.md +29 -0
  41. package/.claude/CLAUDE.md +462 -0
  42. package/.claude/commands/forge/help.md +7 -0
  43. package/.claude/commands/forge/init-project.md +32 -0
  44. package/.claude/commands/forge/plan-phase.md +30 -0
  45. package/.claude/commands/mindforge/approve.md +18 -0
  46. package/.claude/commands/mindforge/audit.md +30 -0
  47. package/.claude/commands/mindforge/benchmark.md +33 -0
  48. package/.claude/commands/mindforge/complete-milestone.md +18 -0
  49. package/.claude/commands/mindforge/debug.md +126 -0
  50. package/.claude/commands/mindforge/discuss-phase.md +138 -0
  51. package/.claude/commands/mindforge/execute-phase.md +165 -0
  52. package/.claude/commands/mindforge/health.md +21 -0
  53. package/.claude/commands/mindforge/help.md +23 -0
  54. package/.claude/commands/mindforge/init-org.md +131 -0
  55. package/.claude/commands/mindforge/init-project.md +155 -0
  56. package/.claude/commands/mindforge/install-skill.md +15 -0
  57. package/.claude/commands/mindforge/map-codebase.md +298 -0
  58. package/.claude/commands/mindforge/metrics.md +22 -0
  59. package/.claude/commands/mindforge/migrate.md +40 -0
  60. package/.claude/commands/mindforge/milestone.md +12 -0
  61. package/.claude/commands/mindforge/next.md +105 -0
  62. package/.claude/commands/mindforge/plan-phase.md +125 -0
  63. package/.claude/commands/mindforge/plugins.md +40 -0
  64. package/.claude/commands/mindforge/pr-review.md +41 -0
  65. package/.claude/commands/mindforge/profile-team.md +23 -0
  66. package/.claude/commands/mindforge/publish-skill.md +19 -0
  67. package/.claude/commands/mindforge/quick.md +135 -0
  68. package/.claude/commands/mindforge/release.md +10 -0
  69. package/.claude/commands/mindforge/retrospective.md +26 -0
  70. package/.claude/commands/mindforge/review.md +157 -0
  71. package/.claude/commands/mindforge/security-scan.md +233 -0
  72. package/.claude/commands/mindforge/ship.md +100 -0
  73. package/.claude/commands/mindforge/skills.md +141 -0
  74. package/.claude/commands/mindforge/status.md +104 -0
  75. package/.claude/commands/mindforge/sync-confluence.md +11 -0
  76. package/.claude/commands/mindforge/sync-jira.md +12 -0
  77. package/.claude/commands/mindforge/tokens.md +8 -0
  78. package/.claude/commands/mindforge/update.md +42 -0
  79. package/.claude/commands/mindforge/verify-phase.md +62 -0
  80. package/.claude/commands/mindforge/workspace.md +29 -0
  81. package/.forge/org/CONVENTIONS.md +0 -0
  82. package/.forge/org/ORG.md +0 -0
  83. package/.forge/org/SECURITY.md +0 -0
  84. package/.forge/org/TOOLS.md +0 -0
  85. package/.forge/personas/analyst.md +0 -0
  86. package/.forge/personas/architect.md +0 -0
  87. package/.forge/personas/debug-specialist.md +0 -0
  88. package/.forge/personas/developer.md +26 -0
  89. package/.forge/personas/qa-engineer.md +0 -0
  90. package/.forge/personas/release-manager.md +0 -0
  91. package/.forge/personas/security-reviewer.md +33 -0
  92. package/.forge/personas/tech-writer.md +0 -0
  93. package/.forge/skills/api-design/SKILL.md +0 -0
  94. package/.forge/skills/code-quality/SKILL.md +0 -0
  95. package/.forge/skills/documentation/SKILL.md +0 -0
  96. package/.forge/skills/security-review/SKILL.md +23 -0
  97. package/.forge/skills/testing-standards/SKILL.md +27 -0
  98. package/.github/workflows/mindforge-ci.yml +224 -0
  99. package/.gitlab-ci-mindforge.yml +18 -0
  100. package/.mindforge/MINDFORGE-SCHEMA.json +165 -0
  101. package/.mindforge/audit/AUDIT-SCHEMA.md +451 -0
  102. package/.mindforge/ci/ci-config-schema.md +21 -0
  103. package/.mindforge/ci/ci-mode.md +179 -0
  104. package/.mindforge/ci/github-actions-adapter.md +224 -0
  105. package/.mindforge/ci/gitlab-ci-adapter.md +31 -0
  106. package/.mindforge/ci/jenkins-adapter.md +44 -0
  107. package/.mindforge/distribution/registry-client.md +166 -0
  108. package/.mindforge/distribution/registry-schema.md +96 -0
  109. package/.mindforge/distribution/skill-publisher.md +44 -0
  110. package/.mindforge/distribution/skill-validator.md +74 -0
  111. package/.mindforge/engine/compaction-protocol.md +182 -0
  112. package/.mindforge/engine/context-injector.md +128 -0
  113. package/.mindforge/engine/dependency-parser.md +113 -0
  114. package/.mindforge/engine/skills/conflict-resolver.md +69 -0
  115. package/.mindforge/engine/skills/loader.md +184 -0
  116. package/.mindforge/engine/skills/registry.md +98 -0
  117. package/.mindforge/engine/skills/versioning.md +75 -0
  118. package/.mindforge/engine/verification-pipeline.md +111 -0
  119. package/.mindforge/engine/wave-executor.md +235 -0
  120. package/.mindforge/governance/GOVERNANCE-CONFIG.md +17 -0
  121. package/.mindforge/governance/approval-workflow.md +37 -0
  122. package/.mindforge/governance/change-classifier.md +63 -0
  123. package/.mindforge/governance/compliance-gates.md +31 -0
  124. package/.mindforge/integrations/confluence.md +27 -0
  125. package/.mindforge/integrations/connection-manager.md +163 -0
  126. package/.mindforge/integrations/github.md +25 -0
  127. package/.mindforge/integrations/gitlab.md +13 -0
  128. package/.mindforge/integrations/jira.md +102 -0
  129. package/.mindforge/integrations/slack.md +41 -0
  130. package/.mindforge/intelligence/antipattern-detector.md +75 -0
  131. package/.mindforge/intelligence/difficulty-scorer.md +55 -0
  132. package/.mindforge/intelligence/health-engine.md +208 -0
  133. package/.mindforge/intelligence/skill-gap-analyser.md +40 -0
  134. package/.mindforge/intelligence/smart-compaction.md +71 -0
  135. package/.mindforge/metrics/METRICS-SCHEMA.md +42 -0
  136. package/.mindforge/metrics/quality-tracker.md +32 -0
  137. package/.mindforge/monorepo/cross-package-planner.md +114 -0
  138. package/.mindforge/monorepo/dependency-graph-builder.md +32 -0
  139. package/.mindforge/monorepo/workspace-detector.md +129 -0
  140. package/.mindforge/org/CONVENTIONS.md +62 -0
  141. package/.mindforge/org/ORG.md +51 -0
  142. package/.mindforge/org/SECURITY.md +50 -0
  143. package/.mindforge/org/TOOLS.md +53 -0
  144. package/.mindforge/org/integrations/INTEGRATIONS-CONFIG.md +58 -0
  145. package/.mindforge/org/skills/MANIFEST.md +38 -0
  146. package/.mindforge/personas/analyst.md +52 -0
  147. package/.mindforge/personas/architect.md +75 -0
  148. package/.mindforge/personas/debug-specialist.md +52 -0
  149. package/.mindforge/personas/developer.md +85 -0
  150. package/.mindforge/personas/overrides/README.md +85 -0
  151. package/.mindforge/personas/qa-engineer.md +61 -0
  152. package/.mindforge/personas/release-manager.md +76 -0
  153. package/.mindforge/personas/security-reviewer.md +91 -0
  154. package/.mindforge/personas/tech-writer.md +51 -0
  155. package/.mindforge/plugins/PLUGINS-MANIFEST.md +23 -0
  156. package/.mindforge/plugins/plugin-loader.md +93 -0
  157. package/.mindforge/plugins/plugin-registry.md +44 -0
  158. package/.mindforge/plugins/plugin-schema.md +68 -0
  159. package/.mindforge/pr-review/ai-reviewer.md +266 -0
  160. package/.mindforge/pr-review/finding-formatter.md +46 -0
  161. package/.mindforge/pr-review/review-prompt-templates.md +44 -0
  162. package/.mindforge/production/compatibility-layer.md +39 -0
  163. package/.mindforge/production/migration-engine.md +52 -0
  164. package/.mindforge/production/production-checklist.md +165 -0
  165. package/.mindforge/production/token-optimiser.md +68 -0
  166. package/.mindforge/skills/accessibility/SKILL.md +106 -0
  167. package/.mindforge/skills/api-design/SKILL.md +98 -0
  168. package/.mindforge/skills/code-quality/SKILL.md +88 -0
  169. package/.mindforge/skills/data-privacy/SKILL.md +126 -0
  170. package/.mindforge/skills/database-patterns/SKILL.md +192 -0
  171. package/.mindforge/skills/documentation/SKILL.md +91 -0
  172. package/.mindforge/skills/incident-response/SKILL.md +180 -0
  173. package/.mindforge/skills/performance/SKILL.md +120 -0
  174. package/.mindforge/skills/security-review/SKILL.md +83 -0
  175. package/.mindforge/skills/testing-standards/SKILL.md +97 -0
  176. package/.mindforge/team/TEAM-PROFILE.md +42 -0
  177. package/.mindforge/team/multi-handoff.md +23 -0
  178. package/.mindforge/team/profiles/README.md +13 -0
  179. package/.mindforge/team/session-merger.md +18 -0
  180. package/.planning/ARCHITECTURE.md +0 -0
  181. package/.planning/AUDIT.jsonl +0 -0
  182. package/.planning/HANDOFF.json +28 -0
  183. package/.planning/PROJECT.md +33 -0
  184. package/.planning/RELEASE-CHECKLIST.md +68 -0
  185. package/.planning/REQUIREMENTS.md +0 -0
  186. package/.planning/ROADMAP.md +0 -0
  187. package/.planning/STATE.md +31 -0
  188. package/.planning/approvals/.gitkeep +1 -0
  189. package/.planning/archive/.gitkeep +1 -0
  190. package/.planning/audit-archive/.gitkeep +1 -0
  191. package/.planning/decisions/.gitkeep +0 -0
  192. package/.planning/decisions/ADR-001-handoff-tracking.md +41 -0
  193. package/.planning/decisions/ADR-002-markdown-commands.md +46 -0
  194. package/.planning/decisions/ADR-003-skills-trigger-model.md +37 -0
  195. package/.planning/decisions/ADR-004-wave-parallelism-model.md +45 -0
  196. package/.planning/decisions/ADR-005-append-only-audit-log.md +51 -0
  197. package/.planning/decisions/ADR-006-tiered-skills-system.md +22 -0
  198. package/.planning/decisions/ADR-007-trigger-keyword-model.md +22 -0
  199. package/.planning/decisions/ADR-008-just-in-time-skill-loading.md +29 -0
  200. package/.planning/decisions/ADR-009-enterprise-integration-retry-policy.md +8 -0
  201. package/.planning/decisions/ADR-010-governance-tier-escalation.md +8 -0
  202. package/.planning/decisions/ADR-011-multi-developer-handoff-contract.md +8 -0
  203. package/.planning/decisions/ADR-012-intelligence-feedback-loops.md +19 -0
  204. package/.planning/decisions/ADR-013-mindforge-md-constitution.md +16 -0
  205. package/.planning/decisions/ADR-014-metrics-as-signals-not-evaluation.md +15 -0
  206. package/.planning/decisions/ADR-015-npm-based-skill-registry.md +26 -0
  207. package/.planning/decisions/ADR-016-ci-exit-code-0-on-timeout.md +27 -0
  208. package/.planning/decisions/ADR-017-sdk-localhost-only.md +28 -0
  209. package/.planning/decisions/ADR-018-installer-self-install-detection.md +15 -0
  210. package/.planning/decisions/ADR-019-self-update-scope-preservation.md +14 -0
  211. package/.planning/decisions/ADR-020-v1.0.0-stable-interface-contract.md +23 -0
  212. package/.planning/jira-sync.json +9 -0
  213. package/.planning/milestones/.gitkeep +1 -0
  214. package/.planning/phases/day1/REVIEW-DAY1.md +50 -0
  215. package/.planning/phases/day1/SECURITY-REVIEW-DAY1.md +15 -0
  216. package/.planning/phases/day2/REVIEW-DAY2.md +521 -0
  217. package/.planning/phases/day3/REVIEW-DAY3.md +234 -0
  218. package/.planning/slack-threads.json +6 -0
  219. package/CHANGELOG.md +175 -0
  220. package/LICENSE +21 -0
  221. package/MINDFORGE.md +76 -0
  222. package/README.md +182 -0
  223. package/RELEASENOTES.md +41 -0
  224. package/SECURITY.md +4 -0
  225. package/bin/install.js +120 -0
  226. package/bin/installer-core.js +292 -0
  227. package/bin/migrations/0.1.0-to-0.5.0.js +37 -0
  228. package/bin/migrations/0.5.0-to-0.6.0.js +17 -0
  229. package/bin/migrations/0.6.0-to-1.0.0.js +100 -0
  230. package/bin/migrations/migrate.js +151 -0
  231. package/bin/migrations/schema-versions.js +64 -0
  232. package/bin/updater/changelog-fetcher.js +62 -0
  233. package/bin/updater/self-update.js +169 -0
  234. package/bin/updater/version-comparator.js +68 -0
  235. package/bin/validate-config.js +92 -0
  236. package/bin/wizard/config-generator.js +112 -0
  237. package/bin/wizard/environment-detector.js +76 -0
  238. package/bin/wizard/setup-wizard.js +237 -0
  239. package/docs/Context/Master-Context.md +701 -0
  240. package/docs/architecture/README.md +35 -0
  241. package/docs/architecture/decision-records-index.md +26 -0
  242. package/docs/ci-cd-integration.md +30 -0
  243. package/docs/ci-quickstart.md +78 -0
  244. package/docs/commands-reference.md +11 -0
  245. package/docs/contributing/CONTRIBUTING.md +38 -0
  246. package/docs/contributing/plugin-authoring.md +50 -0
  247. package/docs/contributing/skill-authoring.md +41 -0
  248. package/docs/enterprise-setup.md +25 -0
  249. package/docs/faq.md +38 -0
  250. package/docs/getting-started.md +36 -0
  251. package/docs/governance-guide.md +23 -0
  252. package/docs/mindforge-md-reference.md +53 -0
  253. package/docs/monorepo-guide.md +26 -0
  254. package/docs/persona-customisation.md +56 -0
  255. package/docs/quick-verify.md +33 -0
  256. package/docs/reference/audit-events.md +53 -0
  257. package/docs/reference/commands.md +82 -0
  258. package/docs/reference/config-reference.md +64 -0
  259. package/docs/reference/sdk-api.md +48 -0
  260. package/docs/reference/skills-api.md +57 -0
  261. package/docs/release-checklist-guide.md +37 -0
  262. package/docs/requirements.md +29 -0
  263. package/docs/sdk-reference.md +27 -0
  264. package/docs/security/SECURITY.md +42 -0
  265. package/docs/security/penetration-test-results.md +31 -0
  266. package/docs/security/threat-model.md +142 -0
  267. package/docs/skills-authoring-guide.md +119 -0
  268. package/docs/skills-publishing-guide.md +21 -0
  269. package/docs/team-setup-guide.md +21 -0
  270. package/docs/troubleshooting.md +119 -0
  271. package/docs/tutorial.md +195 -0
  272. package/docs/upgrade.md +44 -0
  273. package/docs/user-guide.md +131 -0
  274. package/docs/usp-features.md +214 -0
  275. package/eslint.config.mjs +31 -0
  276. package/examples/starter-project/.planning/AUDIT.jsonl +1 -0
  277. package/examples/starter-project/.planning/HANDOFF.json +23 -0
  278. package/examples/starter-project/.planning/PROJECT.md +27 -0
  279. package/examples/starter-project/.planning/STATE.md +10 -0
  280. package/examples/starter-project/MINDFORGE.md +40 -0
  281. package/examples/starter-project/README.md +14 -0
  282. package/implementation-roadmap/day-1-imp/DAY1-HARDEN.md +823 -0
  283. package/implementation-roadmap/day-1-imp/DAY1-IMPLEMENT.md +2459 -0
  284. package/implementation-roadmap/day-1-imp/DAY1-REVIEW.md +288 -0
  285. package/implementation-roadmap/day-2-imp/DAY2-HARDEN.md +954 -0
  286. package/implementation-roadmap/day-2-imp/DAY2-IMPLEMENT.md +2347 -0
  287. package/implementation-roadmap/day-2-imp/DAY2-REVIEW.md +422 -0
  288. package/implementation-roadmap/day-3-imp/DAY3-HARDEN.md +870 -0
  289. package/implementation-roadmap/day-3-imp/DAY3-IMPLEMENT.md +2798 -0
  290. package/implementation-roadmap/day-3-imp/DAY3-REVIEW.md +484 -0
  291. package/implementation-roadmap/day-4-imp/DAY4-HARDEN.md +1087 -0
  292. package/implementation-roadmap/day-4-imp/DAY4-IMPLEMENT.md +2874 -0
  293. package/implementation-roadmap/day-4-imp/DAY4-REVIEW.md +386 -0
  294. package/implementation-roadmap/day-5-imp/DAY5-HARDEN.md +1078 -0
  295. package/implementation-roadmap/day-5-imp/DAY5-IMPLEMENT.md +3151 -0
  296. package/implementation-roadmap/day-5-imp/DAY5-REVIEW.md +345 -0
  297. package/implementation-roadmap/day-6-imp/DAY6-COMPLETE.md +3919 -0
  298. package/implementation-roadmap/day-7-imp-prod/DAY7-PRODUCTION-FINAL.md +4513 -0
  299. package/package.json +31 -0
  300. package/sdk/README.md +69 -0
  301. package/sdk/eslint.config.mjs +34 -0
  302. package/sdk/package-lock.json +1507 -0
  303. package/sdk/package.json +30 -0
  304. package/sdk/src/client.ts +133 -0
  305. package/sdk/src/commands.ts +63 -0
  306. package/sdk/src/events.ts +166 -0
  307. package/sdk/src/index.ts +22 -0
  308. package/sdk/src/types.ts +87 -0
  309. package/sdk/tsconfig.json +13 -0
  310. package/tests/audit.test.js +206 -0
  311. package/tests/ci-mode.test.js +162 -0
  312. package/tests/compaction.test.js +161 -0
  313. package/tests/distribution.test.js +205 -0
  314. package/tests/e2e.test.js +618 -0
  315. package/tests/governance.test.js +130 -0
  316. package/tests/install.test.js +209 -0
  317. package/tests/integrations.test.js +128 -0
  318. package/tests/intelligence.test.js +117 -0
  319. package/tests/metrics.test.js +96 -0
  320. package/tests/migration.test.js +309 -0
  321. package/tests/production.test.js +416 -0
  322. package/tests/sdk.test.js +200 -0
  323. package/tests/skills-platform.test.js +403 -0
  324. package/tests/wave-engine.test.js +338 -0
@@ -0,0 +1,823 @@
1
+ # MindForge — Day 1 Hardening Prompt
2
+ # Branch: `feat/mindforge-core-scaffold`
3
+ # Run this AFTER DAY1-REVIEW.md is complete and APPROVED
4
+
5
+ ---
6
+
7
+ ## CONTEXT
8
+
9
+ You are performing **Day 1 Hardening** of the MindForge framework foundation.
10
+ Hardening is distinct from implementation and review:
11
+
12
+ - **Implementation** — build it correctly
13
+ - **Review** — find what is wrong
14
+ - **Hardening** — make it robust, resilient, and production-ready
15
+
16
+ Activate the **`architect.md`** persona. Think about failure modes, edge cases,
17
+ and long-term maintainability — not feature completeness.
18
+
19
+ All review findings (BLOCKING and MAJOR) from DAY1-REVIEW.md must be resolved
20
+ before hardening begins. Run `git log --oneline` and confirm the review fix
21
+ commits are present.
22
+
23
+ ---
24
+
25
+ ## HARDEN 1 — Fix all review findings
26
+
27
+ Read `.planning/phases/day1/SECURITY-REVIEW-DAY1.md` and the review output.
28
+
29
+ For each BLOCKING and MAJOR finding:
30
+ 1. Read the finding's recommendation precisely
31
+ 2. Make the exact change described
32
+ 3. Commit: `fix(day1): [finding title]`
33
+
34
+ Do not deviate from the recommended fix without creating an ADR explaining why.
35
+
36
+ After all fixes:
37
+ ```bash
38
+ git log --oneline # verify fix commits are present
39
+ ```
40
+
41
+ ---
42
+
43
+ ## HARDEN 2 — CLAUDE.md: close every ambiguity
44
+
45
+ This is the most critical hardening step. CLAUDE.md is executed by an AI agent
46
+ that will find every gap and fill it with its own judgment — which may be wrong.
47
+
48
+ Work through CLAUDE.md line by line. For every instruction, ask:
49
+ **"Can this instruction be followed in more than one reasonable way?"**
50
+ If yes: make it more specific until the answer is no.
51
+
52
+ ### Required additions (add these if not already present)
53
+
54
+ **Session start — missing file handling:**
55
+ Add after the session start protocol:
56
+ ```markdown
57
+ ### If context files are missing
58
+ - If `.planning/PROJECT.md` is missing: do not proceed. Tell the user:
59
+ "PROJECT.md not found. Run /mindforge:init-project first."
60
+ - If `.planning/STATE.md` is missing: create it using the template from
61
+ `.planning/STATE.md` with status "Unknown — rebuilt from directory scan."
62
+ - If `.planning/HANDOFF.json` is missing: continue normally.
63
+ This is expected on the first session.
64
+ ```
65
+
66
+ **Plan file validation:**
67
+ Add to the Plan-First Rule section:
68
+ ```markdown
69
+ ### Before executing any plan
70
+ Validate the plan file:
71
+ - Does it contain a `<task>` element?
72
+ - Does it have `<n>`, `<files>`, `<action>`, `<verify>`, and `<done>` elements?
73
+ - Does the `<verify>` element contain a runnable command (not "check manually")?
74
+ - Do all files listed in `<files>` exist in the repository?
75
+ If a file does not exist yet: that is expected only if the action creates it.
76
+ If it should exist but does not: stop and flag to the user.
77
+ If validation fails: stop. Tell the user which field is missing or invalid.
78
+ ```
79
+
80
+ **Context compaction — exact procedure:**
81
+ Replace the context window management section with this exact procedure:
82
+ ```markdown
83
+ ## Context window management — compaction procedure
84
+
85
+ Monitor context usage. When approaching 70% capacity:
86
+
87
+ **Step 1:** Write the current session state.
88
+ Update `.planning/STATE.md` — add any decisions made this session.
89
+ Update `.planning/HANDOFF.json` with:
90
+ - Current phase and plan number
91
+ - Last completed task (with git SHA)
92
+ - Next task to begin
93
+ - Any blockers or questions for the user
94
+ - List of the 5 most recently modified files
95
+
96
+ **Step 2:** Compact the context.
97
+ Summarise the last 20 tool calls into one paragraph in HANDOFF.json `agent_notes`.
98
+ Discard the tool call history from your working context.
99
+
100
+ **Step 3:** Continue with a fresh context load.
101
+ Re-read: ORG.md + PROJECT.md + STATE.md + HANDOFF.json + current PLAN file.
102
+ Do not re-read files not relevant to the current task.
103
+
104
+ **Never** continue past 85% context without compacting first.
105
+ ```
106
+
107
+ **Quality gate — enforcement mechanism:**
108
+ Strengthen the quality gates section:
109
+ ```markdown
110
+ ## Quality gates — enforcement
111
+
112
+ These gates are BLOCKING. If any gate fails, you must STOP and NOT commit.
113
+
114
+ When a gate fails:
115
+ 1. State clearly which gate failed and why.
116
+ 2. If the failure is fixable immediately: fix it, then re-run the gate.
117
+ 3. If the failure requires a plan change: create a FIX-PLAN file and
118
+ inform the user. Do not proceed with the original plan.
119
+ 4. Never ask "should I skip this gate?" — the answer is always no.
120
+ 5. Never commit with `--no-verify` or similar bypasses.
121
+
122
+ If the user instructs you to skip a quality gate:
123
+ - Acknowledge the instruction.
124
+ - Explain the specific risk of skipping this gate.
125
+ - Ask for explicit confirmation that they understand the risk.
126
+ - If confirmed: document the skip in STATE.md with the user's rationale.
127
+ - Still do not skip secret detection. Ever.
128
+ ```
129
+
130
+ ---
131
+
132
+ ## HARDEN 3 — Persona files: precision pass
133
+
134
+ For each persona file, apply these specific hardening changes:
135
+
136
+ ### All personas — add failure budget
137
+ Add to every persona's "Definition of done" section:
138
+ ```markdown
139
+ ## Escalation vs. self-resolution
140
+ Resolve yourself (document decision in SUMMARY.md):
141
+ - Ambiguity in implementation approach (not in requirements)
142
+ - Choice between two equivalent libraries
143
+ - Minor code structure decisions within the plan's scope
144
+
145
+ Escalate immediately to the user:
146
+ - Any change that requires modifying files outside the plan's `<files>` list
147
+ - Any decision that contradicts ARCHITECTURE.md
148
+ - Any blocker that cannot be resolved within the current context window
149
+ - Any security concern of MEDIUM severity or higher
150
+ ```
151
+
152
+ ### `developer.md` — add the 5 most common AI coding failures
153
+ Add a section "Common AI coding mistakes to avoid":
154
+ ```markdown
155
+ ## Common AI coding mistakes — actively avoid these
156
+
157
+ 1. **Scope creep** — You noticed something to improve outside your task's files.
158
+ Do not change it. Add it to `.planning/STATE.md` under "Future improvements."
159
+
160
+ 2. **Optimistic verification** — Running verify and assuming it passed without
161
+ reading the output. Read every line of verify output. A passing test suite
162
+ with a suppressed error is a failing test suite.
163
+
164
+ 3. **Confident hallucination** — Stating that a library works a certain way
165
+ without checking. If unsure: check the library's documentation or source
166
+ before writing code that depends on specific behaviour.
167
+
168
+ 4. **Silent assumption resolution** — The plan is ambiguous. You pick one
169
+ interpretation and proceed without noting it. Always note ambiguity
170
+ resolution decisions in SUMMARY.md.
171
+
172
+ 5. **Premature abstraction** — Writing a generic system when the plan calls
173
+ for a specific feature. Implement exactly what the plan specifies.
174
+ Generalisation happens in a later phase, after the specific case works.
175
+ ```
176
+
177
+ ### `security-reviewer.md` — add dependency hardening
178
+ Add after the OWASP checklist:
179
+ ```markdown
180
+ ## Dependency security review (run on every PR that adds or updates a dependency)
181
+
182
+ For every new or updated package:
183
+
184
+ 1. **CVE check**
185
+ ```bash
186
+ npm audit
187
+ # or
188
+ pip-audit
189
+ ```
190
+ Any HIGH or CRITICAL vulnerability: block the PR. Find an alternative.
191
+
192
+ 2. **Maintenance check**
193
+ - Last commit: must be within 6 months (exceptions: intentionally stable libs)
194
+ - Open issues/PRs: check for unaddressed security issues
195
+ - Maintainer count: single-maintainer packages are higher risk
196
+
197
+ 3. **Bundle impact** (for frontend packages)
198
+ Check bundlephobia.com or `npm pack --dry-run` for size impact.
199
+ Alert if a dependency adds > 50KB to the bundle.
200
+
201
+ 4. **Licence check**
202
+ Approved: MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, 0BSD
203
+ Requires legal review: GPL, LGPL, MPL, CDDL
204
+ Blocked: AGPL, SSPL, BUSL, Commons Clause variants
205
+
206
+ 5. **Typosquatting check**
207
+ Search npm for packages with similar names.
208
+ Verify the exact package name matches the intended library.
209
+ (Common attack: `lodash` vs `1odash`, `express` vs `expres`)
210
+ ```
211
+
212
+ ---
213
+
214
+ ## HARDEN 4 — Skill packs: add verification steps
215
+
216
+ Every skill pack should end with a self-verification step. Add this section
217
+ to the end of each `SKILL.md`:
218
+
219
+ ```markdown
220
+ ## Self-check before task completion
221
+
222
+ Before marking a task done when this skill was active:
223
+
224
+ - [ ] Did I read the full SKILL.md before starting? (Not just the triggers)
225
+ - [ ] Did I activate the corresponding persona file?
226
+ - [ ] Did I apply every mandatory action in this skill, not just the ones
227
+ I remembered off the top of my head?
228
+ - [ ] If this skill produced an output file (review, security report, etc.),
229
+ has that file been written to the correct path?
230
+ ```
231
+
232
+ ### Additional hardening for `security-review/SKILL.md`
233
+
234
+ Add this section:
235
+ ```markdown
236
+ ## When you find a vulnerability
237
+
238
+ Do not silently fix it and move on. For every vulnerability found:
239
+
240
+ 1. **Stop the current task.**
241
+ 2. **Classify it** using the severity model (CRITICAL / HIGH / MEDIUM / LOW).
242
+ 3. **For CRITICAL or HIGH:** Write to `SECURITY-REVIEW-N.md` immediately.
243
+ Tell the user. Do not proceed with ANY other work until acknowledged.
244
+ 4. **For MEDIUM:** Write to `SECURITY-REVIEW-N.md`. Finish the current task.
245
+ Flag at the end of the SUMMARY.md.
246
+ 5. **For LOW:** Write to `SECURITY-REVIEW-N.md`. Note in SUMMARY.md.
247
+
248
+ The worst security outcome is a vulnerability that was found, noted mentally,
249
+ and then forgotten when context rolled over. Write it down. Always.
250
+ ```
251
+
252
+ ---
253
+
254
+ ## HARDEN 5 — Installer: edge case hardening
255
+
256
+ Read `bin/install.js`. Add handling for these cases:
257
+
258
+ ### Add version check
259
+ At the start of the installer, before any file operations:
260
+ ```javascript
261
+ const nodeVersion = process.versions.node.split('.').map(Number);
262
+ if (nodeVersion[0] < 18) {
263
+ console.error('❌ MindForge requires Node.js 18 or higher.');
264
+ console.error(` Current version: ${process.versions.node}`);
265
+ console.error(' Install Node.js 18 LTS: https://nodejs.org');
266
+ process.exit(1);
267
+ }
268
+ ```
269
+
270
+ ### Add existing CLAUDE.md detection
271
+ Before overwriting CLAUDE.md:
272
+ ```javascript
273
+ function safeCopyClaude(src, dest) {
274
+ if (fs.existsSync(dest)) {
275
+ const existing = fs.readFileSync(dest, 'utf8');
276
+ if (!existing.includes('MindForge')) {
277
+ // Not a MindForge file — back it up
278
+ const backup = dest + '.backup-' + Date.now();
279
+ fs.copyFileSync(dest, backup);
280
+ console.log(` ⚠️ Existing CLAUDE.md backed up to ${backup}`);
281
+ }
282
+ }
283
+ copyFile(src, dest);
284
+ }
285
+ ```
286
+
287
+ ### Add integrity check after install
288
+ After all files are copied:
289
+ ```javascript
290
+ function verifyInstall(targetBase, commandsDir) {
291
+ const requiredFiles = [
292
+ path.join(targetBase, 'CLAUDE.md'),
293
+ path.join(commandsDir, 'help.md'),
294
+ path.join(commandsDir, 'init-project.md'),
295
+ path.join(commandsDir, 'plan-phase.md'),
296
+ path.join(commandsDir, 'execute-phase.md'),
297
+ path.join(commandsDir, 'verify-phase.md'),
298
+ path.join(commandsDir, 'ship.md'),
299
+ ];
300
+
301
+ const missing = requiredFiles.filter(f => !fs.existsSync(f));
302
+
303
+ if (missing.length > 0) {
304
+ console.error('\n❌ Install verification failed. Missing files:');
305
+ missing.forEach(f => console.error(` ${f}`));
306
+ console.error('\nTry re-running the installer.');
307
+ process.exit(1);
308
+ }
309
+
310
+ console.log(' ✅ Install verified — all required files present');
311
+ }
312
+ ```
313
+
314
+ **Commit:**
315
+ ```bash
316
+ git add bin/install.js
317
+ git commit -m "harden(installer): add node version check, CLAUDE.md backup, install verification"
318
+ ```
319
+
320
+ ---
321
+
322
+ ## HARDEN 6 — `HANDOFF.json`: schema hardening
323
+
324
+ Update the HANDOFF.json template to include a checksum for integrity verification:
325
+
326
+ ```json
327
+ {
328
+ "schema_version": "1.0.0",
329
+ "project": null,
330
+ "phase": null,
331
+ "plan": null,
332
+ "last_completed_task": null,
333
+ "next_task": "Run /mindforge:init-project",
334
+ "blockers": [],
335
+ "decisions_needed": [],
336
+ "context_refs": [],
337
+ "agent_notes": "",
338
+ "session_summary": "",
339
+ "recent_files": [],
340
+ "recent_commits": [],
341
+ "updated_at": null,
342
+ "_warning": "Never store secrets, tokens, or passwords in this file. It is tracked in git."
343
+ }
344
+ ```
345
+
346
+ Add the `_warning` field to make it impossible to accidentally forget that this
347
+ file is committed to the repository.
348
+
349
+ Update `.planning/STATE.md` to reference the warning:
350
+ ```markdown
351
+ ## IMPORTANT
352
+ HANDOFF.json is committed to git. Never write secrets or credentials into it.
353
+ Write "see .env" or "stored in secrets manager" if a note needs to reference credentials.
354
+ ```
355
+
356
+ **Commit:**
357
+ ```bash
358
+ git add .planning/
359
+ git commit -m "harden(state): add anti-secret warning to HANDOFF.json schema"
360
+ ```
361
+
362
+ ---
363
+
364
+ ## HARDEN 7 — Write the first ADR
365
+
366
+ Every framework decision that future contributors will wonder about needs an ADR.
367
+ Write these three ADRs now — they document Day 1 decisions.
368
+
369
+ ### `.planning/decisions/ADR-001-handoff-tracking.md`
370
+
371
+ ```markdown
372
+ # ADR-001: Track HANDOFF.json in git
373
+
374
+ **Status:** Accepted
375
+ **Date:** [today]
376
+ **Deciders:** MindForge core team
377
+
378
+ ## Context
379
+ HANDOFF.json stores the current session state for agent continuity.
380
+ It needs to be readable by the next agent session. The question is whether
381
+ it should be committed to git (team-visible) or gitignored (local-only).
382
+
383
+ ## Decision
384
+ Track HANDOFF.json in git.
385
+
386
+ ## Options considered
387
+
388
+ ### Option A — Track in git (chosen)
389
+ Pros:
390
+ - Any team member or new machine can pick up where the last session left off
391
+ - Git history shows the evolution of session state
392
+ - No risk of losing state on machine failure
393
+
394
+ Cons:
395
+ - File changes create noise in git history
396
+ - Risk of accidentally committing sensitive session data
397
+
398
+ Mitigations:
399
+ - Added `_warning` field to prevent accidental secret storage
400
+ - SUMMARY.md captures human-readable history; HANDOFF.json is machine state only
401
+
402
+ ### Option B — Gitignore
403
+ Pros: No git noise, no secret exposure risk
404
+ Cons: State lost on machine switch or re-clone; breaks team continuity
405
+
406
+ ## Rationale
407
+ Team continuity outweighs the git noise concern. The warning field and
408
+ documentation mitigate the secret exposure risk sufficiently.
409
+
410
+ ## Consequences
411
+ Team must be educated to never write secrets into HANDOFF.json.
412
+ CI should include a secret-scanning step that checks HANDOFF.json.
413
+ ```
414
+
415
+ ### `.planning/decisions/ADR-002-markdown-commands.md`
416
+
417
+ ```markdown
418
+ # ADR-002: Use Markdown files for slash commands (not TypeScript)
419
+
420
+ **Status:** Accepted
421
+ **Date:** [today]
422
+ **Deciders:** MindForge core team
423
+
424
+ ## Context
425
+ MindForge slash commands could be implemented as:
426
+ A) Markdown instruction files (what we chose)
427
+ B) TypeScript/JavaScript executable scripts
428
+ C) A mix of both
429
+
430
+ ## Decision
431
+ Markdown instruction files for all commands.
432
+
433
+ ## Options considered
434
+
435
+ ### Option A — Markdown instruction files (chosen)
436
+ Pros:
437
+ - Readable and editable without a build step
438
+ - Can be updated directly by modifying text — no recompile
439
+ - Agents can read and follow them natively
440
+ - Community can contribute without TypeScript knowledge
441
+ - Work identically across all runtimes (Claude Code, Antigravity, OpenCode)
442
+
443
+ Cons:
444
+ - No type safety for command logic
445
+ - Cannot run unit tests on individual steps
446
+ - Edge case handling is described in prose, not enforced in code
447
+
448
+ ### Option B — TypeScript scripts
449
+ Pros: Type safety, unit testable, programmatic edge case handling
450
+ Cons: Build step required, runtime-specific, harder to contribute to,
451
+ loses the "human-readable instructions" quality that makes them good agent prompts
452
+
453
+ ### Option C — Mix
454
+ Assessed as worst of both: complexity of both without full benefit of either.
455
+
456
+ ## Rationale
457
+ MindForge commands are agent prompts, not programs. Their primary consumer is
458
+ an AI agent reading natural language. Markdown is the best format for that use case.
459
+ Logic enforcement happens through agent quality gates, not code compilation.
460
+
461
+ ## Consequences
462
+ Command edge cases must be described carefully in prose.
463
+ A future "command validator" tool could parse and verify command files statically.
464
+ ```
465
+
466
+ ### `.planning/decisions/ADR-003-skills-trigger-model.md`
467
+
468
+ ```markdown
469
+ # ADR-003: Keyword-trigger model for skill discovery
470
+
471
+ **Status:** Accepted
472
+ **Date:** [today]
473
+ **Deciders:** MindForge core team
474
+
475
+ ## Context
476
+ Skills need to be loaded by the agent at the right time. The question is
477
+ how the agent knows which skills are relevant for a given task.
478
+
479
+ ## Decision
480
+ Keyword matching against a `triggers:` list in skill frontmatter.
481
+
482
+ ## Options considered
483
+
484
+ ### Option A — Keyword triggers in frontmatter (chosen)
485
+ Pros: Simple, transparent, editable by anyone, no dependency on AI judgment
486
+ Cons: Can miss contextual relevance; false positives on common words
487
+
488
+ ### Option B — AI decides which skills to load
489
+ Pros: Contextually accurate matching
490
+ Cons: Non-deterministic; different sessions might load different skills
491
+ for the same task; hard to debug; requires extra model call
492
+
493
+ ### Option C — Explicit user invocation only
494
+ Pros: Precise control
495
+ Cons: Loses the "just-in-time" benefit; users forget to invoke skills
496
+
497
+ ## Rationale
498
+ Determinism is more valuable than perfect accuracy for a framework.
499
+ Teams need to be able to predict what skills will activate. Keyword triggers
500
+ provide that predictability. False positives are acceptable — loading a skill
501
+ unnecessarily has low cost; missing a needed skill has high cost.
502
+
503
+ ## Consequences
504
+ Trigger keyword lists must be maintained as skills evolve.
505
+ A skill with too-narrow triggers will be missed. Err on the side of more triggers.
506
+ ```
507
+
508
+ **Commit:**
509
+ ```bash
510
+ git add .planning/decisions/
511
+ git commit -m "docs(adr): add ADR-001 HANDOFF tracking, ADR-002 markdown commands, ADR-003 skill triggers"
512
+ ```
513
+
514
+ ---
515
+
516
+ ## HARDEN 8 — Add `tests/install.test.js`
517
+
518
+ Write a basic test that verifies the installer works correctly:
519
+
520
+ ```javascript
521
+ /**
522
+ * MindForge installer smoke tests
523
+ * Run: node tests/install.test.js
524
+ */
525
+
526
+ const fs = require('fs');
527
+ const path = require('path');
528
+ const assert = require('assert');
529
+
530
+ let passed = 0;
531
+ let failed = 0;
532
+
533
+ function test(name, fn) {
534
+ try {
535
+ fn();
536
+ console.log(` ✅ ${name}`);
537
+ passed++;
538
+ } catch (err) {
539
+ console.error(` ❌ ${name}`);
540
+ console.error(` ${err.message}`);
541
+ failed++;
542
+ }
543
+ }
544
+
545
+ console.log('\nMindForge Day 1 — Structural Integrity Tests\n');
546
+
547
+ // ── Directory structure tests ─────────────────────────────────────────────────
548
+ console.log('Directories:');
549
+ const dirs = [
550
+ '.claude/commands/mindforge',
551
+ '.agent/mindforge',
552
+ '.mindforge/personas',
553
+ '.mindforge/skills/security-review',
554
+ '.mindforge/skills/code-quality',
555
+ '.mindforge/skills/api-design',
556
+ '.mindforge/skills/testing-standards',
557
+ '.mindforge/skills/documentation',
558
+ '.mindforge/org',
559
+ '.planning/decisions',
560
+ 'bin',
561
+ 'docs',
562
+ 'tests',
563
+ ];
564
+ dirs.forEach(d => test(d, () => assert.ok(fs.existsSync(d), `Missing: ${d}`)));
565
+
566
+ // ── Required files tests ──────────────────────────────────────────────────────
567
+ console.log('\nRequired files:');
568
+ const files = [
569
+ '.claude/CLAUDE.md',
570
+ '.agent/CLAUDE.md',
571
+ '.claude/commands/mindforge/help.md',
572
+ '.claude/commands/mindforge/init-project.md',
573
+ '.claude/commands/mindforge/plan-phase.md',
574
+ '.claude/commands/mindforge/execute-phase.md',
575
+ '.claude/commands/mindforge/verify-phase.md',
576
+ '.claude/commands/mindforge/ship.md',
577
+ '.mindforge/personas/analyst.md',
578
+ '.mindforge/personas/architect.md',
579
+ '.mindforge/personas/developer.md',
580
+ '.mindforge/personas/qa-engineer.md',
581
+ '.mindforge/personas/security-reviewer.md',
582
+ '.mindforge/personas/tech-writer.md',
583
+ '.mindforge/personas/debug-specialist.md',
584
+ '.mindforge/personas/release-manager.md',
585
+ '.mindforge/skills/security-review/SKILL.md',
586
+ '.mindforge/skills/code-quality/SKILL.md',
587
+ '.mindforge/skills/api-design/SKILL.md',
588
+ '.mindforge/skills/testing-standards/SKILL.md',
589
+ '.mindforge/skills/documentation/SKILL.md',
590
+ '.mindforge/org/ORG.md',
591
+ '.mindforge/org/CONVENTIONS.md',
592
+ '.mindforge/org/SECURITY.md',
593
+ '.mindforge/org/TOOLS.md',
594
+ '.planning/STATE.md',
595
+ '.planning/HANDOFF.json',
596
+ 'bin/install.js',
597
+ 'package.json',
598
+ 'README.md',
599
+ ];
600
+ files.forEach(f => test(f, () => assert.ok(fs.existsSync(f), `Missing: ${f}`)));
601
+
602
+ // ── Content tests ─────────────────────────────────────────────────────────────
603
+ console.log('\nContent validation:');
604
+
605
+ test('CLAUDE.md has session start protocol', () => {
606
+ const content = fs.readFileSync('.claude/CLAUDE.md', 'utf8');
607
+ assert.ok(content.includes('SESSION START PROTOCOL'), 'Missing session start protocol');
608
+ assert.ok(content.includes('PLAN-FIRST RULE'), 'Missing plan-first rule');
609
+ assert.ok(content.includes('QUALITY GATES'), 'Missing quality gates');
610
+ assert.ok(content.includes('SECURITY AUTO-TRIGGER'), 'Missing security auto-trigger');
611
+ });
612
+
613
+ test('CLAUDE.md and .agent/CLAUDE.md are identical', () => {
614
+ const claude = fs.readFileSync('.claude/CLAUDE.md', 'utf8');
615
+ const agent = fs.readFileSync('.agent/CLAUDE.md', 'utf8');
616
+ assert.strictEqual(claude, agent, '.claude/CLAUDE.md and .agent/CLAUDE.md differ');
617
+ });
618
+
619
+ test('All 6 commands mirrored to .agent/mindforge/', () => {
620
+ const claudeCommands = fs.readdirSync('.claude/commands/mindforge/').sort();
621
+ const agentCommands = fs.readdirSync('.agent/mindforge/').sort();
622
+ assert.deepStrictEqual(claudeCommands, agentCommands, 'Command files differ between runtimes');
623
+ });
624
+
625
+ test('HANDOFF.json is valid JSON', () => {
626
+ const content = fs.readFileSync('.planning/HANDOFF.json', 'utf8');
627
+ const parsed = JSON.parse(content); // throws if invalid
628
+ assert.ok(parsed.schema_version, 'Missing schema_version field');
629
+ assert.ok(parsed._warning, 'Missing _warning anti-secret field');
630
+ });
631
+
632
+ test('package.json has bin field', () => {
633
+ const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
634
+ assert.ok(pkg.bin, 'Missing bin field');
635
+ assert.ok(pkg.bin.mindforge, 'Missing bin.mindforge');
636
+ assert.ok(pkg.engines, 'Missing engines field');
637
+ assert.ok(pkg.engines.node, 'Missing engines.node');
638
+ });
639
+
640
+ test('All skill packs have frontmatter triggers', () => {
641
+ const skillDirs = fs.readdirSync('.mindforge/skills/');
642
+ skillDirs.forEach(dir => {
643
+ const skillPath = `.mindforge/skills/${dir}/SKILL.md`;
644
+ if (fs.existsSync(skillPath)) {
645
+ const content = fs.readFileSync(skillPath, 'utf8');
646
+ assert.ok(content.includes('triggers:'), `${skillPath} missing triggers frontmatter`);
647
+ assert.ok(content.includes('name:'), `${skillPath} missing name frontmatter`);
648
+ }
649
+ });
650
+ });
651
+
652
+ test('bin/install.js is executable and has no obvious syntax errors', () => {
653
+ const stat = fs.statSync('bin/install.js');
654
+ // Check it is readable (full executable check needs Node child_process)
655
+ assert.ok(stat.size > 1000, 'bin/install.js is suspiciously small');
656
+ const content = fs.readFileSync('bin/install.js', 'utf8');
657
+ assert.ok(content.includes('#!/usr/bin/env node'), 'Missing shebang line');
658
+ assert.ok(content.includes('verifyInstall'), 'Missing install verification function');
659
+ });
660
+
661
+ test('No secrets in any committed file', () => {
662
+ const secretPatterns = [
663
+ /password\s*=\s*['"][^'"]{6,}/i,
664
+ /api[_-]?key\s*=\s*['"][^'"]{10,}/i,
665
+ /secret\s*=\s*['"][^'"]{8,}/i,
666
+ /-----BEGIN (RSA |EC |PRIVATE )?KEY-----/,
667
+ /sk-[a-zA-Z0-9]{20,}/,
668
+ ];
669
+
670
+ function scanDir(dir) {
671
+ if (dir.includes('node_modules') || dir.includes('.git')) return;
672
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
673
+ entries.forEach(entry => {
674
+ const full = path.join(dir, entry.name);
675
+ if (entry.isDirectory()) {
676
+ scanDir(full);
677
+ } else if (entry.name.endsWith('.md') || entry.name.endsWith('.js') || entry.name.endsWith('.json')) {
678
+ const content = fs.readFileSync(full, 'utf8');
679
+ secretPatterns.forEach(pattern => {
680
+ assert.ok(!pattern.test(content), `Potential secret in ${full}`);
681
+ });
682
+ }
683
+ });
684
+ }
685
+
686
+ scanDir('.');
687
+ });
688
+
689
+ // ── Results ───────────────────────────────────────────────────────────────────
690
+ console.log(`\n${'─'.repeat(50)}`);
691
+ console.log(`Results: ${passed} passed, ${failed} failed`);
692
+
693
+ if (failed > 0) {
694
+ console.error(`\n❌ ${failed} test(s) failed. Fix before pushing.\n`);
695
+ process.exit(1);
696
+ } else {
697
+ console.log(`\n✅ All tests passed. Day 1 foundation is solid.\n`);
698
+ }
699
+ ```
700
+
701
+ **Commit:**
702
+ ```bash
703
+ git add tests/install.test.js
704
+ git commit -m "test(day1): add structural integrity test suite"
705
+ ```
706
+
707
+ ---
708
+
709
+ ## HARDEN 9 — Run the full test suite and fix anything that fails
710
+
711
+ ```bash
712
+ node tests/install.test.js
713
+ ```
714
+
715
+ Every failure is a genuine problem. Fix them. Do not mark Day 1 complete
716
+ with failing tests.
717
+
718
+ If a test reveals a missing file or incorrect content:
719
+ 1. Fix the file
720
+ 2. Re-run the test
721
+ 3. Commit the fix: `fix(day1): [description of what was wrong]`
722
+
723
+ ---
724
+
725
+ ## HARDEN 10 — Final pre-merge checklist
726
+
727
+ Run every item. Do not push to remote until all pass.
728
+
729
+ ```bash
730
+ # 1. Tests pass
731
+ node tests/install.test.js
732
+ # Expected: "All tests passed"
733
+
734
+ # 2. CLAUDE.md line count (must be substantial)
735
+ wc -l .claude/CLAUDE.md
736
+ # Expected: > 80 lines
737
+
738
+ # 3. CLAUDE.md and .agent/CLAUDE.md are identical
739
+ diff .claude/CLAUDE.md .agent/CLAUDE.md
740
+ # Expected: no output (files identical)
741
+
742
+ # 4. All command files present in both runtimes
743
+ diff <(ls .claude/commands/mindforge/ | sort) <(ls .agent/mindforge/ | sort)
744
+ # Expected: no output
745
+
746
+ # 5. All 8 persona files present
747
+ ls .mindforge/personas/ | wc -l
748
+ # Expected: 8
749
+
750
+ # 6. All 5 skill packs present
751
+ ls .mindforge/skills/ | wc -l
752
+ # Expected: 5
753
+
754
+ # 7. HANDOFF.json is valid JSON
755
+ node -e "JSON.parse(require('fs').readFileSync('.planning/HANDOFF.json', 'utf8')); console.log('valid')"
756
+ # Expected: "valid"
757
+
758
+ # 8. bin/install.js runs without error
759
+ node bin/install.js 2>&1 | head -5
760
+ # Expected: MindForge installer output
761
+
762
+ # 9. Git log is clean (no WIP commits)
763
+ git log --oneline | grep -iE "wip|temp|fix it|oops|update|stuff"
764
+ # Expected: no output
765
+
766
+ # 10. No merge conflicts remaining
767
+ git diff --check
768
+ # Expected: no output
769
+
770
+ # 11. ADRs present
771
+ ls .planning/decisions/*.md | wc -l
772
+ # Expected: 3 or more
773
+ ```
774
+
775
+ ---
776
+
777
+ ## HARDEN 11 — Final commit and push
778
+
779
+ ```bash
780
+ git add .
781
+ git commit -m "harden(day1): complete Day 1 hardening — tests, ADRs, edge cases, security"
782
+ git push origin feat/mindforge-core-scaffold
783
+ ```
784
+
785
+ ---
786
+
787
+ ## DAY 1 COMPLETE — What you have built
788
+
789
+ After completing all three prompts (IMPLEMENT → REVIEW → HARDEN), you have:
790
+
791
+ | Component | Files | Status |
792
+ |------------------------------|-------|---------|
793
+ | Agent entry point | 2 | ✅ Done |
794
+ | Slash commands | 12 | ✅ Done |
795
+ | Agent personas | 8 | ✅ Done |
796
+ | Core skill packs | 5 | ✅ Done |
797
+ | Org context templates | 4 | ✅ Done |
798
+ | Project context templates | 4 | ✅ Done |
799
+ | npm installer | 1 | ✅ Done |
800
+ | Structural tests | 1 | ✅ Done |
801
+ | Architecture Decision Records| 3 | ✅ Done |
802
+ | **Total files** | **40+** | ✅ Done |
803
+
804
+ ---
805
+
806
+ ## DAY 2 PREVIEW — What comes next
807
+
808
+ ```
809
+ Branch: feat/mindforge-wave-execution
810
+
811
+ Day 2 scope:
812
+ - Wave-based parallel execution engine in execute-phase command
813
+ - Dependency graph parser for PLAN files
814
+ - Subagent spawning with isolated context packages
815
+ - Phase-level verification with automated test running
816
+ - /mindforge:next command (auto-detect next step)
817
+ - /mindforge:quick command (ad-hoc tasks without full lifecycle)
818
+ - Context compaction automation (triggered at 70% threshold)
819
+ - AUDIT.jsonl logging foundation
820
+ ```
821
+
822
+ **Branch:** `feat/mindforge-core-scaffold`
823
+ **Day 1 hardening complete. Open a PR. Assign a reviewer. Ship it.**