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,1087 @@
1
+ # MindForge — Day 4 Hardening Prompt
2
+ # Branch: `feat/mindforge-enterprise-integrations`
3
+ # Run this AFTER DAY4-REVIEW.md is APPROVED
4
+
5
+ ---
6
+
7
+ ## CONTEXT
8
+
9
+ You are performing **Day 4 Hardening** of the MindForge enterprise integration
10
+ and governance layer.
11
+
12
+ Activate the **`architect.md` + `security-reviewer.md`** personas simultaneously.
13
+
14
+ Day 4 hardening has a distinct focus from previous days:
15
+
16
+ **Day 4 hardening = security-first, then resilience, then completeness.**
17
+
18
+ The governance layer is only useful if it cannot be bypassed. The integration
19
+ layer is only useful if it fails gracefully. These two properties must be
20
+ hardened before any additional features are added.
21
+
22
+ Confirm all review findings resolved:
23
+
24
+ ```bash
25
+ git log --oneline | head -30 # look for review fix commits
26
+ node tests/install.test.js && \
27
+ node tests/wave-engine.test.js && \
28
+ node tests/audit.test.js && \
29
+ node tests/compaction.test.js && \
30
+ node tests/skills-platform.test.js && \
31
+ node tests/integrations.test.js && \
32
+ node tests/governance.test.js
33
+ # all 7 suites must pass
34
+ ```
35
+
36
+ ---
37
+
38
+ ## HARDEN 1 — Fix all review findings
39
+
40
+ For every BLOCKING and MAJOR finding from DAY4-REVIEW.md:
41
+ 1. Read the finding and recommendation precisely
42
+ 2. Make the exact change
43
+ 3. Commit: `fix(day4-review): [finding title]`
44
+
45
+ One fix per commit. After all fixes, re-run the full battery.
46
+
47
+ ---
48
+
49
+ ## HARDEN 2 — Fix Jira transition ID dynamic lookup
50
+
51
+ The hardcoded transition IDs (11, 31) are the most likely runtime failure
52
+ in the Jira integration. Fix by adding a lookup function.
53
+
54
+ Add to `jira.md` after the "Update Story Status" section:
55
+
56
+ ```markdown
57
+ ## Dynamic transition ID lookup
58
+
59
+ Jira transition IDs are instance-specific. Never hardcode them.
60
+ Before any status transition, fetch the available transitions:
61
+
62
+ ```bash
63
+ # Fetch available transitions for a Jira issue
64
+ TRANSITIONS=$(curl -s \
65
+ -H "Authorization: Basic ${AUTH_HEADER}" \
66
+ "${JIRA_BASE_URL}/rest/api/3/issue/${ISSUE_KEY}/transitions" \
67
+ | python3 -c "
68
+ import sys, json
69
+ data = json.load(sys.stdin)
70
+ for t in data.get('transitions', []):
71
+ print(t['id'] + ':' + t['name'])
72
+ ")
73
+
74
+ # Extract the transition ID for a given name
75
+ get_transition_id() {
76
+ local TARGET_NAME="$1"
77
+ echo "${TRANSITIONS}" | while IFS=: read id name; do
78
+ if [ "${name}" = "${TARGET_NAME}" ]; then
79
+ echo "${id}"
80
+ break
81
+ fi
82
+ done
83
+ }
84
+
85
+ # Usage:
86
+ IN_PROGRESS_ID=$(get_transition_id "In Progress")
87
+ DONE_ID=$(get_transition_id "Done")
88
+ ```
89
+
90
+ ### Transition name mapping
91
+ MindForge task state → Jira transition name (not ID):
92
+
93
+ | MindForge event | Jira transition name | Notes |
94
+ |---|---|---|
95
+ | `task_started` | "In Progress" | Most Jira workflows have this |
96
+ | `task_completed` | "Done" | Or "Resolve Issue", "Close Issue" |
97
+ | `task_failed` | "On Hold" | Or "Blocked" — check your workflow |
98
+ | `UAT_signed_off` | "Done" | For epic-level transitions |
99
+
100
+ If a transition name is not found:
101
+ - Log AUDIT: `"sync_warning": "transition not found: In Progress"`
102
+ - Skip the transition
103
+ - Never fail a task because Jira transition lookup failed
104
+
105
+ ### Caching transition IDs
106
+ Cache fetched transition IDs in `jira-sync.json` per project key:
107
+
108
+ ```json
109
+ {
110
+ "transition_cache": {
111
+ "ENG": {
112
+ "in_progress_id": "21",
113
+ "done_id": "31",
114
+ "blocked_id": "41",
115
+ "cached_at": "ISO-8601"
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ Refresh the cache if a transition ID returns 400 (transition no longer exists).
122
+ ```
123
+
124
+ **Commit:**
125
+ ```bash
126
+ git add .mindforge/integrations/jira.md
127
+ git commit -m "harden(jira): replace hardcoded transition IDs with dynamic lookup"
128
+ ```
129
+
130
+ ---
131
+
132
+ ## HARDEN 3 — Harden credential handling against shell history exposure
133
+
134
+ Add to `connection-manager.md`:
135
+
136
+ ```markdown
137
+ ## Credential hygiene in shell operations
138
+
139
+ ### Preventing token exposure in shell history
140
+
141
+ When constructing authentication headers, avoid inline command substitution
142
+ that captures the token in history:
143
+
144
+ ```bash
145
+ # ❌ Appears in shell history with token value visible:
146
+ AUTH_HEADER=$(echo -n "${JIRA_USER_EMAIL}:${JIRA_API_TOKEN}" | base64)
147
+ curl -H "Authorization: Basic ${AUTH_HEADER}" ...
148
+
149
+ # ✅ Use a function — function calls appear in history without arguments:
150
+ build_auth_header() {
151
+ printf '%s' "${1}:${2}" | base64
152
+ }
153
+ AUTH_HEADER=$(build_auth_header "${JIRA_USER_EMAIL}" "${JIRA_API_TOKEN}")
154
+ unset JIRA_API_TOKEN # Clear from environment after use
155
+
156
+ # ✅ Or use a temporary credentials file (if supported by the API client):
157
+ # Never a permanent file — always delete after use
158
+ ```
159
+
160
+ ### Debug mode prohibition
161
+ Never run integration commands with shell debug mode active:
162
+ ```bash
163
+ # ❌ These expose tokens in output:
164
+ set -x
165
+ bash -x script.sh
166
+ sh -xv script.sh
167
+
168
+ # If debug mode is needed for non-credential scripts: explicitly disable
169
+ # debug mode before any credential-bearing commands:
170
+ set +x
171
+ # ... credential operations ...
172
+ set -x # re-enable after if needed
173
+ ```
174
+
175
+ ### curl verbose mode prohibition
176
+ Never use `-v` or `--verbose` with any curl command that includes
177
+ an Authorization header:
178
+ ```bash
179
+ # ❌ Logs the Authorization header value to stderr:
180
+ curl -v -H "Authorization: Bearer ${GITHUB_TOKEN}" ...
181
+
182
+ # ✅ Use -s (silent) and check HTTP status code:
183
+ HTTP_STATUS=$(curl -s -o response.json -w "%{http_code}" \
184
+ -H "Authorization: Bearer ${GITHUB_TOKEN}" ...)
185
+ if [ "${HTTP_STATUS}" != "200" ]; then
186
+ echo "API call failed: HTTP ${HTTP_STATUS}" >&2
187
+ cat response.json >&2
188
+ fi
189
+ ```
190
+
191
+ ### Unset credentials after use
192
+ ```bash
193
+ # After integration operations complete, unset sensitive variables:
194
+ unset JIRA_API_TOKEN
195
+ unset GITHUB_TOKEN
196
+ unset SLACK_BOT_TOKEN
197
+ # The variables will be re-read from environment on next invocation
198
+ ```
199
+ ```
200
+
201
+ **Commit:**
202
+ ```bash
203
+ git add .mindforge/integrations/connection-manager.md
204
+ git commit -m "harden(credentials): add shell credential hygiene and debug-mode prohibition"
205
+ ```
206
+
207
+ ---
208
+
209
+ ## HARDEN 4 — Harden governance: add code-pattern Tier 3 scanning
210
+
211
+ The review identified that Tier 3 classification based only on file paths
212
+ misses security-critical code in non-standard locations.
213
+
214
+ Update `change-classifier.md` — replace the Step 2 section:
215
+
216
+ ```markdown
217
+ ## Step 2 — Apply Tier 3 rules first
218
+
219
+ Tier 3 classification uses THREE independent signals. Any single match = Tier 3.
220
+
221
+ ### Signal A: File path patterns
222
+ Scan changed file paths for security-critical directories and names:
223
+ ```
224
+ Directories: auth/, security/, payment/, billing/, privacy/, crypto/, secrets/
225
+ File names (exact):
226
+ login.ts logout.ts token.ts password.ts credentials.ts
227
+ session.ts oauth.ts jwt.ts hash.ts encrypt.ts
228
+ stripe.ts payment.ts billing.ts pii.ts consent.ts
229
+ ```
230
+
231
+ ### Signal B: Code content patterns (scan the actual diff)
232
+ Scan the diff content — not just filenames — for security-critical patterns:
233
+ ```bash
234
+ # Run against git diff output
235
+ DIFF_CONTENT=$(git diff HEAD)
236
+
237
+ # Libraries and functions that indicate security-critical code:
238
+ TIER3_PATTERNS=(
239
+ "bcrypt" # Password hashing
240
+ "argon2" # Password hashing
241
+ "jwt.sign" # JWT creation
242
+ "jwt.verify" # JWT verification
243
+ "jose.sign" # Modern JWT
244
+ "jose.verify" # Modern JWT
245
+ "stripe\." # Payment processing
246
+ "paypal\." # Payment processing
247
+ "createCipheriv" # Node.js crypto
248
+ "createDecipheriv"# Node.js crypto
249
+ "crypto.subtle" # Web Crypto API
250
+ "hashPassword" # Common auth function name
251
+ "verifyPassword" # Common auth function name
252
+ "encrypt\(" # Generic encrypt calls
253
+ "decrypt\(" # Generic decrypt calls
254
+ "role.*permission" # RBAC patterns
255
+ "hasPermission" # RBAC patterns
256
+ "SET ROLE" # PostgreSQL role switching
257
+ "GRANT" # Database permissions
258
+ )
259
+
260
+ for PATTERN in "${TIER3_PATTERNS[@]}"; do
261
+ if echo "${DIFF_CONTENT}" | grep -qE "${PATTERN}"; then
262
+ echo "Tier 3 triggered by code pattern: ${PATTERN}"
263
+ # Classify as Tier 3
264
+ break
265
+ fi
266
+ done
267
+ ```
268
+
269
+ ### Signal C: AUDIT history patterns
270
+ Check the current session's AUDIT log. If there are recent `security_finding`
271
+ events with HIGH or CRITICAL severity for this phase:
272
+ The next change in this phase is elevated to Tier 3 automatically.
273
+ Rationale: if security issues were found in this phase, all subsequent changes
274
+ deserve elevated scrutiny.
275
+
276
+ ### Tier 3 determination
277
+ If ANY of Signal A, B, or C matches: Tier 3.
278
+ The AUDIT entry must record WHICH signal triggered:
279
+ ```json
280
+ {
281
+ "event": "change_classified",
282
+ "tier": 3,
283
+ "classification_reason": "code pattern: jwt.sign found in src/utils/helper.ts",
284
+ "signals_checked": ["file_path", "code_content", "audit_history"],
285
+ "signal_triggered": "code_content",
286
+ "pattern_matched": "jwt.sign"
287
+ }
288
+ ```
289
+ ```
290
+
291
+ **Commit:**
292
+ ```bash
293
+ git add .mindforge/governance/change-classifier.md
294
+ git commit -m "harden(governance): add code-content and audit-history Tier 3 classification signals"
295
+ ```
296
+
297
+ ---
298
+
299
+ ## HARDEN 5 — Add EMERGENCY_APPROVERS to INTEGRATIONS-CONFIG.md
300
+
301
+ Update `.mindforge/org/integrations/INTEGRATIONS-CONFIG.md` — add after Slack:
302
+
303
+ ```markdown
304
+ ## Governance Configuration
305
+
306
+ # Tier 2 peer review — who can approve
307
+ TIER2_APPROVERS=senior-engineer-1,senior-engineer-2,tech-lead
308
+
309
+ # Tier 3 compliance review — who can approve
310
+ # These individuals are responsible for security and compliance sign-off
311
+ TIER3_APPROVERS=security-officer,compliance-officer,cto
312
+
313
+ # Emergency override — who can approve P0 emergency bypasses
314
+ # This list should be SHORTER than Tier 3 approvers
315
+ # Document who is on this list and why
316
+ EMERGENCY_APPROVERS=cto,vp-engineering
317
+
318
+ # Approval SLAs
319
+ TIER2_SLA_HOURS=24
320
+ TIER3_SLA_HOURS=4
321
+ TIER2_ESCALATE_AFTER_HOURS=48
322
+ TIER3_ESCALATE_AFTER_HOURS=8
323
+
324
+ # Approval expiry — after how long to expire pending requests
325
+ TIER2_EXPIRY_HOURS=48
326
+ TIER3_EXPIRY_HOURS=8
327
+
328
+ # Escalation path (when SLA is breached)
329
+ ESCALATION_CONTACT=engineering-lead@your-org.com
330
+ ESCALATION_SLACK_CHANNEL=C0ESCALATE
331
+ ```
332
+
333
+ Also update `approve.md` to read `EMERGENCY_APPROVERS` from the config file:
334
+
335
+ ```markdown
336
+ ## Validating emergency approver identity
337
+
338
+ Before processing an emergency override:
339
+
340
+ 1. Read `EMERGENCY_APPROVERS` from INTEGRATIONS-CONFIG.md
341
+ 2. Get current developer identity: `git config user.email` or `$USER`
342
+ 3. Verify the identity is in the emergency approvers list
343
+ 4. If NOT in the list:
344
+ ```
345
+ ❌ Emergency override denied.
346
+ Your identity ([identity]) is not in the EMERGENCY_APPROVERS list.
347
+ EMERGENCY_APPROVERS: [list from config]
348
+
349
+ To use emergency override: ensure your git config user.email matches
350
+ an entry in INTEGRATIONS-CONFIG.md EMERGENCY_APPROVERS.
351
+ ```
352
+ 5. If yes: proceed with emergency approval, log identity in AUDIT entry
353
+ ```
354
+
355
+ **Commit:**
356
+ ```bash
357
+ git add .mindforge/org/integrations/INTEGRATIONS-CONFIG.md \
358
+ .claude/commands/mindforge/approve.md \
359
+ .agent/mindforge/approve.md
360
+ git commit -m "harden(governance): add EMERGENCY_APPROVERS config, identity validation in approve command"
361
+ ```
362
+
363
+ ---
364
+
365
+ ## HARDEN 6 — Seal the GDPR Gate 4 independence from skill loading
366
+
367
+ Update `compliance-gates.md` — replace Gate 4 definition:
368
+
369
+ ```markdown
370
+ ### Gate 4 — GDPR/PII compliance check
371
+
372
+ **IMPORTANT: This gate runs independently of skill loading.
373
+ It does NOT require the data-privacy skill to have been active.**
374
+
375
+ **Trigger conditions (checks the diff):**
376
+ 1. New database column names matching PII patterns:
377
+ ```
378
+ email, phone, mobile, address, postcode, zip, ssn, dob, birth_date,
379
+ first_name, last_name, full_name, surname, national_id, passport,
380
+ credit_card, card_number, bank_account, iban, bic
381
+ ```
382
+ 2. New fields in request/response schemas matching the same patterns
383
+ 3. New data model files (prisma schema, SQLAlchemy models, Django models)
384
+ that contain any PII pattern fields
385
+
386
+ **Detection command:**
387
+ ```bash
388
+ # Scan diff for PII column additions
389
+ git diff HEAD | grep "^+" | grep -iE \
390
+ "(email|phone|mobile|address|postcode|zip_code|ssn|date_of_birth|first_name|last_name|national_id|credit_card|bank_account)"
391
+ ```
392
+
393
+ **If triggered — check for retention period documentation:**
394
+ Verify that ARCHITECTURE.md has a data model section with a retention period
395
+ documented for the matching field.
396
+
397
+ ```bash
398
+ # Check ARCHITECTURE.md for retention documentation
399
+ grep -i "retention" .planning/ARCHITECTURE.md
400
+ ```
401
+
402
+ If no retention period is documented:
403
+ - Block phase completion
404
+ - Write AUDIT entry: `"event": "compliance_gate_failed", "gate": "GDPR_retention"`
405
+ - Report: "PII field added without documented retention period.
406
+ Update ARCHITECTURE.md Data Model section with retention policy for [field name]."
407
+
408
+ **Override:** Requires compliance officer approval (Tier 3).
409
+ ```
410
+
411
+ **Commit:**
412
+ ```bash
413
+ git add .mindforge/governance/compliance-gates.md
414
+ git commit -m "harden(governance): make Gate 4 GDPR-independent of skill loading, add PII detection"
415
+ ```
416
+
417
+ ---
418
+
419
+ ## HARDEN 7 — Fix the milestone archive scope bug
420
+
421
+ Update `complete-milestone.md` — replace Step 8 archive section:
422
+
423
+ ```markdown
424
+ ## Step 8 — Archive milestone artifacts (scoped to this milestone only)
425
+
426
+ Archive ONLY the phases included in this milestone, not all phases:
427
+
428
+ ```bash
429
+ # Read the milestone's phase list from the milestone file
430
+ MILESTONE_PHASES=$(grep "Phase [0-9]" ".planning/milestones/MILESTONE-${MILESTONE_NAME}.md" \
431
+ | grep -o "Phase [0-9]*" | grep -o "[0-9]*")
432
+
433
+ # Create the milestone archive directory
434
+ mkdir -p ".planning/archive/milestone-${MILESTONE_NAME}"
435
+
436
+ # Archive only the relevant phases
437
+ for PHASE_NUM in ${MILESTONE_PHASES}; do
438
+ if [ -d ".planning/phases/${PHASE_NUM}" ]; then
439
+ cp -r ".planning/phases/${PHASE_NUM}" \
440
+ ".planning/archive/milestone-${MILESTONE_NAME}/phase-${PHASE_NUM}"
441
+ echo " Archived Phase ${PHASE_NUM}"
442
+ fi
443
+ done
444
+
445
+ # Archive the requirements and architecture snapshots (point-in-time)
446
+ cp ".planning/REQUIREMENTS.md" \
447
+ ".planning/archive/milestone-${MILESTONE_NAME}/REQUIREMENTS-snapshot.md"
448
+ cp ".planning/ARCHITECTURE.md" \
449
+ ".planning/archive/milestone-${MILESTONE_NAME}/ARCHITECTURE-snapshot.md"
450
+
451
+ # Write an archive manifest
452
+ cat > ".planning/archive/milestone-${MILESTONE_NAME}/ARCHIVE-MANIFEST.md" << EOF
453
+ # Milestone Archive: ${MILESTONE_NAME}
454
+ **Archived:** $(date -u +%Y-%m-%dT%H:%M:%SZ)
455
+ **Phases:** ${MILESTONE_PHASES}
456
+ **Release tag:** v${VERSION}
457
+
458
+ ## Files archived
459
+ $(ls ".planning/archive/milestone-${MILESTONE_NAME}/" | grep -v ARCHIVE-MANIFEST)
460
+ EOF
461
+
462
+ echo " Archive complete: .planning/archive/milestone-${MILESTONE_NAME}/"
463
+ ```
464
+
465
+ ### What is NOT archived
466
+ - Phases from PREVIOUS milestones (they have their own archives)
467
+ - The full `.planning/` directory (would duplicate previous milestones' archives)
468
+ - Development tools and configuration (.mindforge/ directory)
469
+
470
+ After archiving, the active phases remain in `.planning/phases/` for reference
471
+ but are logically "owned" by the milestone archive. The next milestone's phases
472
+ will use new phase numbers continuing from the last used phase number.
473
+ ```
474
+
475
+ **Commit:**
476
+ ```bash
477
+ git add .claude/commands/mindforge/complete-milestone.md \
478
+ .agent/mindforge/complete-milestone.md
479
+ git commit -m "harden(milestone): fix archive scope to milestone phases only, prevent exponential growth"
480
+ ```
481
+
482
+ ---
483
+
484
+ ## HARDEN 8 — Add resilience patterns to all integrations
485
+
486
+ All three integrations (Jira, Confluence, Slack) need a shared resilience pattern.
487
+ Add to `connection-manager.md`:
488
+
489
+ ```markdown
490
+ ## Integration resilience: shared patterns for all integrations
491
+
492
+ ### Non-fatal integration failures
493
+ Integration failures must NEVER fail a MindForge phase execution.
494
+ The following are non-fatal:
495
+ - Jira ticket creation fails
496
+ - Confluence page publish fails
497
+ - Slack notification fails
498
+ - GitHub PR creation fails (warn user, but phase is complete)
499
+
500
+ The following ARE fatal (stop execution):
501
+ - The source code change itself fails (test suite failure, verify step failure)
502
+ - A compliance gate fails
503
+ - A Tier 3 approval is rejected
504
+
505
+ ### Retry policy (apply to all integrations)
506
+
507
+ ```
508
+ Attempt 1: immediately
509
+ Attempt 2: after 5 seconds (exponential: 2^1 × 2.5s ≈ 5s)
510
+ Attempt 3: after 20 seconds (exponential: 2^2 × 5s = 20s)
511
+ Give up after attempt 3.
512
+ ```
513
+
514
+ Never retry more than 3 times. After 3 failures:
515
+ 1. Log AUDIT: `"event": "integration_action", "status": "failed", "attempts": 3`
516
+ 2. Write to STATE.md under "Pending integration actions":
517
+ ```markdown
518
+ ## Pending integration actions (manual retry needed)
519
+ - [2026-03-20 14:32] Jira: Failed to create story for Plan 3-02 (3 attempts)
520
+ Retry command: /mindforge:sync-jira --phase 3
521
+ ```
522
+ 3. Alert the user: "Jira sync failed after 3 attempts. Added to pending actions.
523
+ Run /mindforge:sync-jira to retry when the service is available."
524
+ 4. Continue with the next step of the phase. Never block.
525
+
526
+ ### Timeout policy
527
+
528
+ Every integration API call has a 10-second timeout:
529
+ ```bash
530
+ curl -s --max-time 10 -H "Authorization: ..." ...
531
+ # If curl returns exit code 28 (timeout): treat as connection failure
532
+ ```
533
+
534
+ ### Circuit breaker pattern
535
+
536
+ If an integration fails 3 times in a row (across different API calls in the same session):
537
+ - Mark the integration as "circuit-open" in the session state
538
+ - Skip all subsequent calls to that integration for the rest of the session
539
+ - Log: `"event": "integration_circuit_opened", "integration": "jira", "reason": "3 consecutive failures"`
540
+ - The circuit resets on the next session start
541
+ ```
542
+
543
+ **Commit:**
544
+ ```bash
545
+ git add .mindforge/integrations/connection-manager.md
546
+ git commit -m "harden(integrations): add resilience patterns — retry policy, timeouts, circuit breaker"
547
+ ```
548
+
549
+ ---
550
+
551
+ ## HARDEN 9 — Write 3 new ADRs for Day 4 decisions
552
+
553
+ ### `.planning/decisions/ADR-009-integration-credential-model.md`
554
+
555
+ ```markdown
556
+ # ADR-009: Environment-variable-only credential storage for integrations
557
+
558
+ **Status:** Accepted
559
+ **Date:** [today]
560
+
561
+ ## Context
562
+ MindForge integrations (Jira, Confluence, Slack, GitHub) require API credentials.
563
+ The question is: where to store them.
564
+
565
+ ## Decision
566
+ Credentials ONLY in environment variables. Never in MindForge config files.
567
+ INTEGRATIONS-CONFIG.md stores only non-sensitive values (URLs, project keys, channel IDs).
568
+
569
+ ## Rationale
570
+ Config files are committed to git. A credentials file committed accidentally
571
+ becomes a security incident with an indefinite blast radius (all forks, all
572
+ clones, all GitHub Actions that ran while it was committed). Environment variables
573
+ are ephemeral, scoped to the process, and never committed to source control.
574
+
575
+ ## Consequences
576
+ - Developers must configure environment variables before using integrations
577
+ - CI/CD must configure secrets in the CI environment
578
+ - The integration is skipped gracefully if credentials are absent
579
+ - No rotation mechanism is needed (rotating env vars is standard practice)
580
+ ```
581
+
582
+ ### `.planning/decisions/ADR-010-governance-non-bypass.md`
583
+
584
+ ```markdown
585
+ # ADR-010: Compliance gates are non-bypassable; approval workflows are not
586
+
587
+ **Status:** Accepted
588
+ **Date:** [today]
589
+
590
+ ## Context
591
+ Two types of governance controls exist: compliance gates and approval workflows.
592
+ The question is whether both should allow emergency bypass.
593
+
594
+ ## Decision
595
+ - Compliance gates (Gate 1-5): NO bypass. Must be resolved.
596
+ - Approval workflows (Tier 2/3): emergency bypass available for designated approvers.
597
+
598
+ ## Rationale
599
+
600
+ **Compliance gates** enforce technical correctness, not organisational process.
601
+ A secret in a diff is a security incident regardless of business urgency.
602
+ A CRITICAL security finding cannot be "approved away" — it must be fixed.
603
+ These are objective conditions with verifiable resolution paths.
604
+
605
+ **Approval workflows** enforce organisational oversight of risky changes.
606
+ In a genuine P0 production outage, the cost of waiting for approvals may
607
+ exceed the cost of the risk. Emergency overrides allow rapid response while
608
+ maintaining a full audit trail and requiring post-incident review.
609
+
610
+ ## Consequences
611
+ - Developers must fix compliance gate failures — there is no shortcut
612
+ - Emergency overrides are rare, logged, and reviewed post-incident
613
+ - The audit trail captures all emergency overrides for compliance reporting
614
+ ```
615
+
616
+ ### `.planning/decisions/ADR-011-integration-non-blocking.md`
617
+
618
+ ```markdown
619
+ # ADR-011: Integration failures are non-blocking for phase execution
620
+
621
+ **Status:** Accepted
622
+ **Date:** [today]
623
+
624
+ ## Context
625
+ Jira/Confluence/Slack/GitHub integrations can fail (service downtime, rate limits,
626
+ credential expiry). Should integration failure block phase execution?
627
+
628
+ ## Decision
629
+ Integration failures NEVER block phase execution. They are logged, queued for
630
+ retry, and reported to the user — but execution continues.
631
+
632
+ ## Rationale
633
+ The integration layer is a convenience layer, not a correctness layer. The source
634
+ of truth for MindForge project state is the local `.planning/` directory and git
635
+ history — not Jira or Confluence. If Jira is down for 30 minutes, a developer
636
+ should not be blocked from executing their planned tasks. The sync can happen
637
+ when Jira recovers.
638
+
639
+ **Exception**: if an integration action is REQUIRED for governance (e.g., creating
640
+ a Jira approval ticket for a Tier 3 change), and the integration is unavailable:
641
+ the change is blocked by GOVERNANCE (not by the integration). The developer
642
+ must wait for the governance control to be satisfiable — which may require
643
+ manual Jira ticket creation as an alternative path.
644
+
645
+ ## Consequences
646
+ - The `/mindforge:status` command shows "Pending integration actions" for failed syncs
647
+ - Teams must monitor pending actions and run sync commands when services recover
648
+ - The audit log captures all failed integration attempts for reliability analysis
649
+ ```
650
+
651
+ **Commit:**
652
+ ```bash
653
+ git add .planning/decisions/
654
+ git commit -m "docs(adr): add ADR-009 credential model, ADR-010 non-bypass, ADR-011 non-blocking"
655
+ ```
656
+
657
+ ---
658
+
659
+ ## HARDEN 10 — Expand test suites with hardening-prompted cases
660
+
661
+ Add to `tests/governance.test.js`:
662
+
663
+ ```javascript
664
+ // Add after existing tests:
665
+
666
+ console.log('\nHardening-prompted governance tests:');
667
+
668
+ test('change classifier detects Tier 3 code pattern in non-standard file', () => {
669
+ // jwt.sign in a file named utils/helper.ts (not in auth/ directory)
670
+ function classifyByContent(content) {
671
+ const tier3Patterns = ['bcrypt', 'argon2', 'jwt.sign', 'jwt.verify', 'stripe.'];
672
+ return tier3Patterns.some(p => content.includes(p)) ? 3 : 1;
673
+ }
674
+ assert.strictEqual(classifyByContent('const token = jwt.sign(payload, secret)'), 3);
675
+ assert.strictEqual(classifyByContent('const formatted = format(date)'), 1);
676
+ });
677
+
678
+ test('EMERGENCY_APPROVERS is referenced in INTEGRATIONS-CONFIG.md', () => {
679
+ const content = readMd('.mindforge/org/integrations/INTEGRATIONS-CONFIG.md');
680
+ assert.ok(content.includes('EMERGENCY_APPROVERS'), 'INTEGRATIONS-CONFIG.md should define EMERGENCY_APPROVERS');
681
+ });
682
+
683
+ test('approve command validates emergency approver identity', () => {
684
+ const content = readMd('.claude/commands/mindforge/approve.md');
685
+ assert.ok(
686
+ content.includes('EMERGENCY_APPROVERS') && (content.includes('identity') || content.includes('denied')),
687
+ 'Approve command should validate emergency approver identity against config'
688
+ );
689
+ });
690
+
691
+ test('compliance Gate 4 runs independently of data-privacy skill', () => {
692
+ const content = readMd('.mindforge/governance/compliance-gates.md');
693
+ assert.ok(
694
+ content.includes('independently') || content.includes('NOT require'),
695
+ 'Gate 4 should state it runs independently of skill loading'
696
+ );
697
+ });
698
+
699
+ test('governance config file has Tier3 approvers defined', () => {
700
+ const content = readMd('.mindforge/org/integrations/INTEGRATIONS-CONFIG.md');
701
+ assert.ok(content.includes('TIER3_APPROVERS'), 'Config should define TIER3_APPROVERS');
702
+ });
703
+ ```
704
+
705
+ Add to `tests/integrations.test.js`:
706
+
707
+ ```javascript
708
+ // Add after existing tests:
709
+
710
+ console.log('\nHardening-prompted integration tests:');
711
+
712
+ test('jira.md has dynamic transition lookup (not hardcoded IDs)', () => {
713
+ const content = readMd('.mindforge/integrations/jira.md');
714
+ assert.ok(
715
+ content.includes('transition_cache') || content.includes('dynamic') || content.includes('get_transition_id'),
716
+ 'Jira spec should use dynamic transition ID lookup, not hardcoded IDs'
717
+ );
718
+ });
719
+
720
+ test('connection-manager has shell credential hygiene section', () => {
721
+ const content = readMd('.mindforge/integrations/connection-manager.md');
722
+ assert.ok(
723
+ content.includes('shell history') || content.includes('credential hygiene'),
724
+ 'Should have shell credential hygiene documentation'
725
+ );
726
+ });
727
+
728
+ test('connection-manager prohibits curl verbose mode', () => {
729
+ const content = readMd('.mindforge/integrations/connection-manager.md');
730
+ assert.ok(
731
+ content.includes('-v') || content.includes('verbose'),
732
+ 'Should prohibit curl verbose mode with credentials'
733
+ );
734
+ });
735
+
736
+ test('connection-manager has circuit breaker pattern', () => {
737
+ const content = readMd('.mindforge/integrations/connection-manager.md');
738
+ assert.ok(
739
+ content.includes('circuit') || content.includes('circuit breaker'),
740
+ 'Should have circuit breaker resilience pattern'
741
+ );
742
+ });
743
+
744
+ test('complete-milestone archives phases selectively (not all phases)', () => {
745
+ const content = readMd('.claude/commands/mindforge/complete-milestone.md');
746
+ assert.ok(
747
+ content.includes("milestone's phase list") || content.includes('scoped to'),
748
+ 'complete-milestone should archive only milestone phases, not all phases'
749
+ );
750
+ });
751
+
752
+ test('integration failures are non-blocking for phase execution', () => {
753
+ const content = readMd('.mindforge/integrations/connection-manager.md');
754
+ assert.ok(
755
+ content.includes('non-fatal') || content.includes('Non-fatal'),
756
+ 'Integration failures should be documented as non-fatal'
757
+ );
758
+ });
759
+ ```
760
+
761
+ **Commit:**
762
+ ```bash
763
+ git add tests/governance.test.js tests/integrations.test.js
764
+ git commit -m "test(day4): add hardening-prompted test cases for governance and integrations"
765
+ ```
766
+
767
+ ---
768
+
769
+ ## HARDEN 11 — Write `docs/enterprise-setup.md` and `docs/governance-guide.md`
770
+
771
+ ### `docs/enterprise-setup.md`
772
+
773
+ ```markdown
774
+ # MindForge Enterprise Setup Guide
775
+
776
+ ## Prerequisites
777
+ - MindForge v0.4.0+ installed (`npx mindforge-cc@latest`)
778
+ - Jira Cloud account with API token (optional but recommended)
779
+ - Confluence Cloud account (optional but recommended)
780
+ - Slack workspace with bot token (optional but recommended)
781
+ - GitHub or GitLab account with personal access token (optional)
782
+
783
+ ## Step 1 — Configure environment variables
784
+
785
+ Add to your shell profile (`~/.zshrc`, `~/.bashrc`) or CI/CD secrets:
786
+
787
+ ```bash
788
+ # Jira (obtain token from https://id.atlassian.com/manage-profile/security/api-tokens)
789
+ export JIRA_BASE_URL="https://your-org.atlassian.net"
790
+ export JIRA_USER_EMAIL="you@your-org.com"
791
+ export JIRA_API_TOKEN="your-api-token"
792
+
793
+ # Confluence (same token as Jira for Atlassian Cloud)
794
+ export CONFLUENCE_BASE_URL="https://your-org.atlassian.net/wiki"
795
+ export CONFLUENCE_API_TOKEN="${JIRA_API_TOKEN}" # Reuse Atlassian token
796
+
797
+ # Slack (create at https://api.slack.com/apps)
798
+ export SLACK_BOT_TOKEN="xoxb-your-bot-token"
799
+
800
+ # GitHub (create at https://github.com/settings/tokens)
801
+ export GITHUB_TOKEN="ghp_your-personal-access-token"
802
+ ```
803
+
804
+ ## Step 2 — Configure INTEGRATIONS-CONFIG.md
805
+
806
+ Open `.mindforge/org/integrations/INTEGRATIONS-CONFIG.md`.
807
+ Fill in all non-credential configuration values.
808
+ Critical: verify `JIRA_PROJECT_KEY` matches your actual Jira project key.
809
+
810
+ ## Step 3 — Configure GOVERNANCE-CONFIG.md
811
+
812
+ Open `.mindforge/governance/GOVERNANCE-CONFIG.md`.
813
+ Set: `TIER2_APPROVERS`, `TIER3_APPROVERS`, `EMERGENCY_APPROVERS`.
814
+ These should be the git config user.email values of the appropriate team members.
815
+
816
+ ## Step 4 — Fill in org context templates
817
+
818
+ Customise these files for your organisation:
819
+ - `.mindforge/org/ORG.md` — your organisation and tech stack defaults
820
+ - `.mindforge/org/CONVENTIONS.md` — your actual coding conventions
821
+ - `.mindforge/org/SECURITY.md` — your security policies
822
+ - `.mindforge/org/TOOLS.md` — your approved libraries
823
+
824
+ ## Step 5 — Test the integrations
825
+
826
+ ```bash
827
+ # Test Jira connection
828
+ /mindforge:sync-jira --dry-run
829
+
830
+ # Test Confluence connection
831
+ /mindforge:sync-confluence --dry-run
832
+
833
+ # Test Slack notification
834
+ # (runs connection health check from connection-manager.md)
835
+ /mindforge:status
836
+ ```
837
+
838
+ ## Step 6 — Initialise your first project
839
+
840
+ ```bash
841
+ # For a new project:
842
+ /mindforge:init-project
843
+
844
+ # For an existing codebase:
845
+ /mindforge:map-codebase
846
+ ```
847
+ ```
848
+
849
+ ### `docs/governance-guide.md`
850
+
851
+ ```markdown
852
+ # MindForge Governance Guide
853
+
854
+ ## Understanding approval tiers
855
+
856
+ MindForge uses three tiers of change governance. Understanding these helps
857
+ your team configure the right approvers and set realistic SLA expectations.
858
+
859
+ ### Tier 1 — No approval needed
860
+ Routine changes: bug fixes, documentation, test additions, PATCH dependency updates.
861
+ MindForge auto-approves these after quality gates pass. No human action required.
862
+
863
+ ### Tier 2 — Peer review required
864
+ New features, schema changes, new dependencies, infrastructure changes.
865
+ Requires one approval from the `TIER2_APPROVERS` list within 24 hours.
866
+ Suitable reviewer: senior engineer, tech lead, or domain expert.
867
+
868
+ ### Tier 3 — Compliance review required
869
+ Auth, payments, PII, security-critical changes.
870
+ Requires one approval from the `TIER3_APPROVERS` list within 4 hours.
871
+ Suitable reviewer: security officer, compliance officer, or CTO.
872
+
873
+ ## How to approve a change
874
+
875
+ 1. Receive Slack notification (or check with `/mindforge:approve`)
876
+ 2. Review the change description and risk assessment in the notification
877
+ 3. Click the review link to see the actual diff
878
+ 4. Run: `/mindforge:approve [approval-id] --reason "Your notes here"`
879
+ 5. Or reject: `/mindforge:approve [approval-id] --reject --reason "Reason"`
880
+
881
+ ## Compliance gates — what they check
882
+
883
+ | Gate | What fails it | How to fix |
884
+ |---|---|---|
885
+ | No CRITICAL security findings | `security_finding` with `severity: CRITICAL` | Fix the security issue and re-scan |
886
+ | Test suite passing | Any failing test | Fix the failing tests |
887
+ | No secrets in diff | Credential pattern in staged files | Remove secret, rotate credential |
888
+ | Dependency CVE clearance | `npm audit` HIGH/CRITICAL | Update the vulnerable package |
889
+ | GDPR retention | PII field without retention period in ARCHITECTURE.md | Document retention period |
890
+
891
+ ## Querying the audit log for compliance
892
+
893
+ ```bash
894
+ # All security findings (for security auditors)
895
+ /mindforge:audit --event security_finding --export security-report.md
896
+
897
+ # All approvals and rejections (for governance review)
898
+ /mindforge:audit --event change_approved --event change_rejected
899
+
900
+ # Emergency overrides (should be rare — investigate if frequent)
901
+ /mindforge:audit --event change_approved | grep emergency
902
+
903
+ # All activity for a specific phase
904
+ /mindforge:audit --phase 3
905
+ ```
906
+ ```
907
+
908
+ **Commit:**
909
+ ```bash
910
+ git add docs/enterprise-setup.md docs/governance-guide.md
911
+ git commit -m "docs: add enterprise setup guide and governance guide"
912
+ ```
913
+
914
+ ---
915
+
916
+ ## HARDEN 12 — Bump version and update CHANGELOG.md
917
+
918
+ Update `package.json`:
919
+ ```json
920
+ { "version": "0.4.0" }
921
+ ```
922
+
923
+ Update `CHANGELOG.md` — prepend:
924
+
925
+ ```markdown
926
+ ## [0.4.0] — Day 4 Enterprise Integrations
927
+
928
+ ### Added
929
+ - Jira integration: bidirectional sync with epics, stories, and security bugs
930
+ - Confluence integration: publish architecture docs, ADRs, phase docs
931
+ - Slack integration: structured Block Kit notifications for phase events
932
+ - GitHub integration: enhanced PR creation with templates and reviewer assignment
933
+ - GitLab integration: equivalent MR workflow for GitLab teams
934
+ - Governance layer: three-tier change classifier (Tier 1/2/3)
935
+ - Approval workflow: pending approvals, expiry, emergency overrides
936
+ - Compliance gates: 5 non-bypassable quality and security gates
937
+ - Multi-developer HANDOFF: per-developer session files, conflict detection
938
+ - Session merger: artifact reconciliation for multi-developer workflows
939
+ - AUDIT.jsonl archiving: rotate at 10,000 lines, archive to `audit-archive/`
940
+ - /mindforge:audit — query audit log with filters and export
941
+ - /mindforge:milestone — create and track milestones
942
+ - /mindforge:complete-milestone — ship a milestone with release tag
943
+ - /mindforge:approve — process approval requests
944
+ - /mindforge:sync-jira — synchronise with Jira
945
+ - /mindforge:sync-confluence — publish to Confluence
946
+ - 3 new ADRs: ADR-009, ADR-010, ADR-011
947
+ - Enterprise setup guide and governance guide
948
+
949
+ ### Hardened
950
+ - Dynamic Jira transition ID lookup (was hardcoded — would fail on non-standard workflows)
951
+ - Shell credential hygiene (prevent token exposure in shell history and curl verbose mode)
952
+ - Tier 3 change classification now includes code-content scanning (not just file paths)
953
+ - Gate 4 (GDPR) runs independently of data-privacy skill loading
954
+ - Milestone archive scoped to milestone phases only (prevents exponential archive growth)
955
+ - Circuit breaker pattern added to all integrations
956
+ ```
957
+
958
+ **Commit:**
959
+ ```bash
960
+ git add package.json CHANGELOG.md
961
+ git commit -m "chore(release): bump to v0.4.0, update CHANGELOG.md"
962
+ ```
963
+
964
+ ---
965
+
966
+ ## HARDEN 13 — Final pre-merge checklist
967
+
968
+ ```bash
969
+ # 1. All 7 test suites pass
970
+ node tests/install.test.js && echo "✅ install"
971
+ node tests/wave-engine.test.js && echo "✅ wave-engine"
972
+ node tests/audit.test.js && echo "✅ audit"
973
+ node tests/compaction.test.js && echo "✅ compaction"
974
+ node tests/skills-platform.test.js && echo "✅ skills-platform"
975
+ node tests/integrations.test.js && echo "✅ integrations"
976
+ node tests/governance.test.js && echo "✅ governance"
977
+
978
+ # 2. All 21 commands in both runtimes
979
+ ls .claude/commands/mindforge/ | wc -l # Expected: 21
980
+ ls .agent/mindforge/ | wc -l # Expected: 21
981
+ diff <(ls .claude/commands/mindforge/ | sort) <(ls .agent/mindforge/ | sort)
982
+ # Expected: no output
983
+
984
+ # 3. No credentials in any file
985
+ grep -rE "xox[pb]-[a-zA-Z0-9-]+|ghp_[a-zA-Z0-9]+|glpat-[a-zA-Z0-9]+" \
986
+ --include="*.md" --include="*.json" --include="*.js" \
987
+ --exclude-dir=node_modules --exclude-dir=.git . 2>/dev/null
988
+ # Expected: no output
989
+
990
+ # 4. ADRs — now 11 total
991
+ ls .planning/decisions/*.md | wc -l # Expected: 11
992
+
993
+ # 5. Integration files have content
994
+ for f in jira confluence slack github gitlab connection-manager; do
995
+ SIZE=$(wc -c < .mindforge/integrations/${f}.md)
996
+ echo "${f}: ${SIZE} bytes"
997
+ [ "${SIZE}" -gt 500 ] || echo "WARNING: ${f} seems too small"
998
+ done
999
+
1000
+ # 6. Governance files have content
1001
+ for f in approval-workflow change-classifier compliance-gates; do
1002
+ SIZE=$(wc -c < .mindforge/governance/${f}.md)
1003
+ echo "${f}: ${SIZE} bytes"
1004
+ [ "${SIZE}" -gt 500 ] || echo "WARNING: ${f} seems too small"
1005
+ done
1006
+
1007
+ # 7. INTEGRATIONS-CONFIG.md has EMERGENCY_APPROVERS
1008
+ grep "EMERGENCY_APPROVERS" .mindforge/org/integrations/INTEGRATIONS-CONFIG.md
1009
+ # Expected: one match
1010
+
1011
+ # 8. package.json version
1012
+ node -e "const p=require('./package.json'); console.log('Version:', p.version)"
1013
+ # Expected: 0.4.0
1014
+
1015
+ # 9. CHANGELOG.md has 0.4.0 entry
1016
+ grep "0.4.0" CHANGELOG.md
1017
+ # Expected: match
1018
+
1019
+ # 10. Git log — clean Day 4 commits
1020
+ git log --oneline | head -30
1021
+ # Expected: ~14 clean commits
1022
+ ```
1023
+
1024
+ ---
1025
+
1026
+ ## FINAL COMMIT AND PUSH
1027
+
1028
+ ```bash
1029
+ git add .
1030
+ git commit -m "harden(day4): complete Day 4 enterprise hardening — governance, credentials, resilience"
1031
+ git push origin feat/mindforge-enterprise-integrations
1032
+ ```
1033
+
1034
+ ---
1035
+
1036
+ ## DAY 4 COMPLETE — What you have built
1037
+
1038
+ | Component | Files Added/Updated | Status |
1039
+ |---|---|---|
1040
+ | Connection manager | connection-manager.md | ✅ |
1041
+ | Jira integration | jira.md + jira-sync.json schema | ✅ |
1042
+ | Confluence integration | confluence.md + confluence-sync.json schema | ✅ |
1043
+ | Slack integration | slack.md + slack-threads.json schema | ✅ |
1044
+ | GitHub integration | github.md + PR template | ✅ |
1045
+ | GitLab integration | gitlab.md | ✅ |
1046
+ | Governance: classifier | change-classifier.md (3-signal Tier 3) | ✅ |
1047
+ | Governance: approvals | approval-workflow.md + approval JSON schema | ✅ |
1048
+ | Governance: gates | compliance-gates.md (5 gates) | ✅ |
1049
+ | Governance config | GOVERNANCE-CONFIG.md | ✅ |
1050
+ | Multi-dev HANDOFF | multi-handoff.md + session-merger.md | ✅ |
1051
+ | AUDIT archiving | archive protocol in AUDIT-SCHEMA.md | ✅ |
1052
+ | `/mindforge:audit` | 21st command | ✅ |
1053
+ | `/mindforge:milestone` | 22nd command | ✅ |
1054
+ | `/mindforge:complete-milestone` | 23rd command | ✅ |
1055
+ | `/mindforge:approve` | 24th command | ✅ |
1056
+ | `/mindforge:sync-jira` | 25th command | ✅ |
1057
+ | `/mindforge:sync-confluence` | 26th command | ✅ |
1058
+ | Integration test suite | integrations.test.js | ✅ |
1059
+ | Governance test suite | governance.test.js | ✅ |
1060
+ | 3 new ADRs | ADR-009, ADR-010, ADR-011 | ✅ |
1061
+ | Enterprise docs | enterprise-setup.md + governance-guide.md | ✅ |
1062
+ | CHANGELOG.md | v0.4.0 | ✅ |
1063
+
1064
+ **MindForge is now v0.4.0 — 21 commands, 10 skills, 11 ADRs, 7 test suites.**
1065
+
1066
+ ---
1067
+
1068
+ ## DAY 5 PREVIEW
1069
+
1070
+ ```
1071
+ Branch: feat/mindforge-intelligence-layer
1072
+
1073
+ Day 5 scope:
1074
+ - /mindforge:health — comprehensive framework health check and self-repair
1075
+ - /mindforge:profile-team — generate team capability and preference profiles
1076
+ - Intelligent context compaction (AI-summarised, not truncated)
1077
+ - Phase difficulty scoring — estimate effort before planning
1078
+ - Anti-pattern detection engine — proactively flag known pitfalls
1079
+ - Skill gap analysis — what skills are missing for the next phase
1080
+ - /mindforge:retrospective — structured phase and milestone retrospectives
1081
+ - Agent performance metrics — track quality scores over time
1082
+ - MINDFORGE.md — project-level override file for all MindForge defaults
1083
+ - npx mindforge-cc interactive setup wizard — guided first-run experience
1084
+ ```
1085
+
1086
+ **Branch:** `feat/mindforge-enterprise-integrations`
1087
+ **Day 4 complete. Open PR → assign reviewer → merge to main.**