mindforge-cc 3.0.0 → 5.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 (114) hide show
  1. package/.agent/CLAUDE.md +50 -545
  2. package/.claude/CLAUDE.md +50 -545
  3. package/.mindforge/audit/AUDIT-SCHEMA.md +20 -1
  4. package/.mindforge/engine/nexus-tracer.js +115 -0
  5. package/.mindforge/engine/persona-factory.md +45 -0
  6. package/.mindforge/engine/swarm-controller.md +59 -0
  7. package/.mindforge/engine/wave-executor.md +104 -54
  8. package/.mindforge/memory/pattern-library.jsonl +1 -2
  9. package/.mindforge/personas/swarm-templates.json +118 -0
  10. package/.planning/ROI.jsonl +2 -0
  11. package/CHANGELOG.md +133 -22
  12. package/MINDFORGE.md +75 -106
  13. package/README.md +71 -101
  14. package/RELEASENOTES.md +41 -24
  15. package/bin/autonomous/auto-runner.js +154 -4
  16. package/bin/autonomous/context-refactorer.js +64 -0
  17. package/bin/autonomous/steer.js +19 -1
  18. package/bin/autonomous/stuck-monitor.js +43 -0
  19. package/bin/engine/feedback-loop.js +71 -0
  20. package/bin/engine/handover-manager.js +69 -0
  21. package/bin/engine/nexus-tracer.js +215 -0
  22. package/bin/engine/sre-manager.js +63 -0
  23. package/bin/engine/temporal-hindsight.js +88 -0
  24. package/bin/governance/policies/default-policies.jsonl +33 -0
  25. package/bin/governance/policy-engine.js +106 -0
  26. package/bin/governance/rbac-manager.js +109 -0
  27. package/bin/governance/trust-verifier.js +81 -0
  28. package/bin/governance/ztai-archiver.js +104 -0
  29. package/bin/governance/ztai-manager.js +203 -0
  30. package/bin/memory/eis-client.js +95 -0
  31. package/bin/memory/federated-sync.js +127 -0
  32. package/bin/memory/ghost-pattern-detector.js +69 -0
  33. package/bin/memory/knowledge-graph.js +37 -0
  34. package/bin/memory/semantic-hub.js +104 -0
  35. package/bin/models/cloud-broker.js +83 -0
  36. package/bin/models/finops-hub.js +79 -0
  37. package/bin/models/model-broker.js +129 -0
  38. package/bin/skill-validator.js +41 -0
  39. package/docs/INTELLIGENCE-MESH.md +35 -0
  40. package/docs/PERSONAS.md +63 -0
  41. package/docs/{references → References}/audit-events.md +6 -0
  42. package/docs/architecture/NEXUS-DASHBOARD.md +35 -0
  43. package/docs/architecture/PAR-ZTS-SURVEY.md +43 -0
  44. package/docs/architecture/README.md +31 -64
  45. package/docs/architecture/V4-SWARM-MESH.md +77 -0
  46. package/docs/architecture/V5-ENTERPRISE.md +113 -0
  47. package/docs/feature-dashboard.md +6 -1
  48. package/docs/governance-guide.md +47 -23
  49. package/docs/security/SECURITY.md +20 -7
  50. package/docs/security/ZTAI-OVERVIEW.md +37 -0
  51. package/docs/user-guide.md +29 -3
  52. package/docs/usp-features.md +79 -5
  53. package/package.json +1 -1
  54. /package/docs/{context → Context}/Master-Context.md +0 -0
  55. /package/docs/{references → References}/checkpoints.md +0 -0
  56. /package/docs/{references → References}/commands.md +0 -0
  57. /package/docs/{references → References}/config-reference.md +0 -0
  58. /package/docs/{references → References}/continuation-format.md +0 -0
  59. /package/docs/{references → References}/decimal-phase-calculation.md +0 -0
  60. /package/docs/{references → References}/git-integration.md +0 -0
  61. /package/docs/{references → References}/git-planning-commit.md +0 -0
  62. /package/docs/{references → References}/model-profile-resolution.md +0 -0
  63. /package/docs/{references → References}/model-profiles.md +0 -0
  64. /package/docs/{references → References}/phase-argument-parsing.md +0 -0
  65. /package/docs/{references → References}/planning-config.md +0 -0
  66. /package/docs/{references → References}/questioning.md +0 -0
  67. /package/docs/{references → References}/sdk-api.md +0 -0
  68. /package/docs/{references → References}/skills-api.md +0 -0
  69. /package/docs/{references → References}/tdd.md +0 -0
  70. /package/docs/{references → References}/ui-brand.md +0 -0
  71. /package/docs/{references → References}/user-profiling.md +0 -0
  72. /package/docs/{references → References}/verification-patterns.md +0 -0
  73. /package/docs/{references → References}/workstream-flag.md +0 -0
  74. /package/docs/{templates → Templates}/Agents/CLAUDE-MD.md +0 -0
  75. /package/docs/{templates → Templates}/Agents/COPILOT-INSTRUCTIONS.md +0 -0
  76. /package/docs/{templates → Templates}/Agents/DEBUGGER-PROMPT.md +0 -0
  77. /package/docs/{templates → Templates}/Agents/PLANNER-PROMPT.md +0 -0
  78. /package/docs/{templates/codebase → Templates/Codebase}/architecture.md +0 -0
  79. /package/docs/{templates/codebase → Templates/Codebase}/concerns.md +0 -0
  80. /package/docs/{templates/codebase → Templates/Codebase}/conventions.md +0 -0
  81. /package/docs/{templates/codebase → Templates/Codebase}/integrations.md +0 -0
  82. /package/docs/{templates/codebase → Templates/Codebase}/stack.md +0 -0
  83. /package/docs/{templates/codebase → Templates/Codebase}/structure.md +0 -0
  84. /package/docs/{templates/codebase → Templates/Codebase}/testing.md +0 -0
  85. /package/docs/{templates → Templates}/Execution/CONTINUE-HERE.md +0 -0
  86. /package/docs/{templates → Templates}/Execution/DISCUSSION-LOG.md +0 -0
  87. /package/docs/{templates → Templates}/Execution/PHASE-PROMPT.md +0 -0
  88. /package/docs/{templates → Templates}/Execution/STATE.md +0 -0
  89. /package/docs/{templates → Templates}/Execution/SUMMARY-COMPLEX.md +0 -0
  90. /package/docs/{templates → Templates}/Execution/SUMMARY-MINIMAL.md +0 -0
  91. /package/docs/{templates → Templates}/Execution/SUMMARY-STANDARD.md +0 -0
  92. /package/docs/{templates → Templates}/Execution/SUMMARY.md +0 -0
  93. /package/docs/{templates → Templates}/Profile/DEV-PREFERENCES.md +0 -0
  94. /package/docs/{templates → Templates}/Profile/USER-PROFILE.md +0 -0
  95. /package/docs/{templates → Templates}/Profile/USER-SETUP.md +0 -0
  96. /package/docs/{templates → Templates}/Project/DISCOVERY.md +0 -0
  97. /package/docs/{templates → Templates}/Project/MILESTONE-ARCHIVE.md +0 -0
  98. /package/docs/{templates → Templates}/Project/MILESTONE.md +0 -0
  99. /package/docs/{templates → Templates}/Project/PROJECT.md +0 -0
  100. /package/docs/{templates → Templates}/Project/REQUIREMENTS.md +0 -0
  101. /package/docs/{templates → Templates}/Project/RETROSPECTIVE.md +0 -0
  102. /package/docs/{templates → Templates}/Project/ROADMAP.md +0 -0
  103. /package/docs/{templates → Templates}/Quality/DEBUG.md +0 -0
  104. /package/docs/{templates → Templates}/Quality/UAT.md +0 -0
  105. /package/docs/{templates → Templates}/Quality/UI-SPEC.md +0 -0
  106. /package/docs/{templates → Templates}/Quality/VALIDATION.md +0 -0
  107. /package/docs/{templates → Templates}/Quality/VERIFICATION-REPORT.md +0 -0
  108. /package/docs/{templates/research → Templates/Research}/ARCHITECTURE.md +0 -0
  109. /package/docs/{templates/research → Templates/Research}/FEATURES.md +0 -0
  110. /package/docs/{templates/research → Templates/Research}/PITFALLS.md +0 -0
  111. /package/docs/{templates/research → Templates/Research}/STACK.md +0 -0
  112. /package/docs/{templates/research → Templates/Research}/SUMMARY.md +0 -0
  113. /package/docs/{templates → Templates}/System/CONFIG.json +0 -0
  114. /package/docs/{templates → Templates}/System/CONTEXT.md +0 -0
@@ -0,0 +1,115 @@
1
+ /**
2
+ * MindForge Nexus — Core Tracer Engine (v4.1.0-alpha.nexus)
3
+ *
4
+ * Handles Agentic Reasoning Tracing (ART) spans and OpenTelemetry-compatible
5
+ * trace context propagation across the agentic mesh.
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const crypto = require('crypto');
11
+
12
+ class NexusTracer {
13
+ constructor(config = {}) {
14
+ this.projectId = config.projectId || 'mindforge-nexus';
15
+ this.auditPath = config.auditPath || path.join(process.cwd(), '.planning', 'AUDIT.jsonl');
16
+ this.currentTraceId = null;
17
+ this.activeSpans = new Map();
18
+ }
19
+
20
+ /**
21
+ * Initialize or resume a trace.
22
+ */
23
+ startTrace(traceId = null) {
24
+ this.currentTraceId = traceId || `tr_${crypto.randomBytes(8).toString('hex')}`;
25
+ return this.currentTraceId;
26
+ }
27
+
28
+ /**
29
+ * Start a new ART span.
30
+ */
31
+ startSpan(name, attributes = {}, parentSpanId = null) {
32
+ const spanId = `sp_${crypto.randomBytes(6).toString('hex')}`;
33
+ const startTime = new Date().toISOString();
34
+
35
+ const span = {
36
+ id: spanId,
37
+ trace_id: this.currentTraceId,
38
+ parent_id: parentSpanId || null,
39
+ name,
40
+ status: 'active',
41
+ start_time: startTime,
42
+ attributes: {
43
+ ...attributes,
44
+ service: 'mindforge-nexus',
45
+ }
46
+ };
47
+
48
+ this.activeSpans.set(spanId, span);
49
+
50
+ // Record span start in AUDIT.jsonl
51
+ this._recordEvent('span_started', {
52
+ span_id: spanId,
53
+ parent_span_id: parentSpanId,
54
+ span_name: name,
55
+ ...attributes
56
+ });
57
+
58
+ return spanId;
59
+ }
60
+
61
+ /**
62
+ * End an active span.
63
+ */
64
+ endSpan(spanId, status = 'success', metadata = {}) {
65
+ const span = this.activeSpans.get(spanId);
66
+ if (!span) return;
67
+
68
+ span.status = status;
69
+ span.end_time = new Date().toISOString();
70
+
71
+ this._recordEvent('span_completed', {
72
+ span_id: spanId,
73
+ status,
74
+ ...metadata
75
+ });
76
+
77
+ this.activeSpans.delete(spanId);
78
+ }
79
+
80
+ /**
81
+ * Record a Reasoning Trace event (ART granularity).
82
+ */
83
+ recordReasoning(spanId, agent, thought, resolution = 'none') {
84
+ this._recordEvent('reasoning_trace', {
85
+ span_id: spanId,
86
+ agent,
87
+ thought,
88
+ resolution
89
+ });
90
+ }
91
+
92
+ /**
93
+ * Internal AUDIT writer.
94
+ */
95
+ _recordEvent(event, data) {
96
+ const entry = {
97
+ id: crypto.randomUUID(),
98
+ timestamp: new Date().toISOString(),
99
+ event,
100
+ trace_id: this.currentTraceId,
101
+ ...data
102
+ };
103
+
104
+ try {
105
+ if (!fs.existsSync(path.dirname(this.auditPath))) {
106
+ fs.mkdirSync(path.dirname(this.auditPath), { recursive: true });
107
+ }
108
+ fs.appendFileSync(this.auditPath, JSON.stringify(entry) + '\n');
109
+ } catch (err) {
110
+ console.error(`[NexusTracer] Failed to write audit entry: ${err.message}`);
111
+ }
112
+ }
113
+ }
114
+
115
+ module.exports = NexusTracer;
@@ -0,0 +1,45 @@
1
+ # MindForge Engine — Persona Factory
2
+
3
+ ## Purpose
4
+
5
+ Dynamically generate specialized "Micro-Personas" by combining base persona definitions with real-time "Context Patches" (from Context7 or task context).
6
+
7
+ ## The Factory Loop
8
+
9
+ 1. **Base Layer:** Load the base persona file from `.mindforge/personas/[base].md`.
10
+ 2. **Context Patching:**
11
+ - Query `Context7` for library-specific best practices matching the task's `files` list.
12
+ - Example: `mcp__context7__get-library-docs("zod")` → extract validation patterns.
13
+ 3. **Rule Synthesis:**
14
+ - Append the fetched documentation as a `<specialist_knowledge>` block.
15
+ - Add task-specific `<imperative_rules>` (e.g., "Must use strict typing for all new interfaces").
16
+ 4. **Validation:** Ensure the resulting micro-persona is semantically valid and fits within the agent's context window.
17
+
18
+ ## Micro-Persona Schema (Extended)
19
+
20
+ ```markdown
21
+ ---
22
+ name: [base-persona]-specialist-[id]
23
+ base: [path/to/base.md]
24
+ specialization: [library/topic]
25
+ ---
26
+
27
+ <role>
28
+ You are the [base-persona] specialized in [topic].
29
+ [Incorporates base role + specialization]
30
+ </role>
31
+
32
+ <specialist_knowledge>
33
+ [Dynamic docs from Context7]
34
+ </specialist_knowledge>
35
+
36
+ <imperative_rules>
37
+ [Dynamic rules for this specific task]
38
+ </imperative_rules>
39
+ ```
40
+
41
+ ## Persona Persistence
42
+
43
+ - Micro-personas are stored in `.planning/phases/[N]/micro-personas/` for the duration of the task.
44
+ - They are auto-pruned after the task SUMMARY is written to minimize workspace clutter.
45
+ - If a task is resumed, the persona factory re-generates the micro-persona to ensure fresh context from Context7.
@@ -0,0 +1,59 @@
1
+ # MindForge Engine — Swarm Controller
2
+
3
+ ## Purpose
4
+
5
+ Determine when a task requires a "Swarm Cluster" instead of a single persona, and select the optimal cluster configuration.
6
+
7
+ ## Trigger Logic
8
+
9
+ ### 1. Complexity Threshold
10
+
11
+ - Evaluate the task's complexity via `difficulty-scorer.md`.
12
+ - **Trigger Swarm** if `compositeScore >= MINDFORGE.AUTO_SWARM_THRESHOLD` (default 7.0).
13
+
14
+ ### 2. Multi-Disciplinary Detection
15
+
16
+ - Analyze the `files` and `taskName` for cross-stack markers:
17
+ - `UI + API` → **FullStackSwarm**
18
+ - `Auth + Database` → **SecuritySwarm**
19
+ - `Performance + Infrastructure` → **OptimizationSwarm**
20
+
21
+ ### 3. Impact Analysis
22
+
23
+ - **Trigger Swarm** for any task touching:
24
+ - `.mindforge/governance/`
25
+ - `src/auth/`
26
+ - `src/payments/`
27
+ - Core infrastructure config (`docker-compose.yml`, `ci.yml`).
28
+
29
+ ## Cluster Selection
30
+
31
+ Once a swarm is triggered, select a template from `swarm-templates.json`:
32
+
33
+ | Task Category | Template | Core Personas |
34
+ | :--- | :--- | :--- |
35
+ | UI / Styling | `UISwarm` | `ui-auditor` (leader), `developer`, `accessibility` |
36
+ | API / Logic | `BackendSwarm` | `architect` (leader), `developer`, `security-reviewer` |
37
+ | Security | `SecuritySwarm` | `security-reviewer` (leader), `architect`, `developer` |
38
+ | Database | `MigrationSwarm` | `architect` (leader), `database-patterns`, `developer` |
39
+ | Optimization | `PerfSwarm` | `performance` (leader), `analyst`, `developer` |
40
+
41
+ ## Swarm Initialization Protocol
42
+
43
+ 1. **Nexus Trace:** Call `NexusTracer.startSpan('swarm_cluster_[Template]')`.
44
+ 2. **Assign Identity (ZTAI):** For each specialist, call `ztai-manager.registerAgent(persona, tier)`.
45
+ 3. **Select Leader:** The designated leader persona is responsible for the final `SUMMARY` write.
46
+ 4. **Generate Micro-Personas:** Call `persona-factory.md` for each member of the cluster.
47
+ 5. **Establish Shared State:** Initialize `.planning/phases/[N]/SWARM-STATE-[M].json` for inter-agent communication.
48
+ 6. **Nexus ART:** Record reasoning traces for each agent as they join the mesh.
49
+ 7. **Context Injection:** Inject the base context + swarm-specific documentation (from Context7) into all agents.
50
+ 8. **Enforce Trust Tier:** Validate that all agents in the cluster have the required `trust_tier` (ZTAI) for the task.
51
+ 9. **Signing:** All swarm actions MUST be cryptographically signed with the agent's DID (see ZTAI protocol).
52
+
53
+ ## Decision Gates & Governance
54
+
55
+ - **Decision Gate Mode:** If template `decision_gate === "hitl"`, the swarm leader MUST request user approval for Tier 3 actions.
56
+ - **Resource Management:** FinOps Hub monitors the `resource_budget`. If a `high` budget swarm exceeds 50% without a SUMMARY, alert the user.
57
+ - **Audit Signing:** All swarm actions are cryptographically signed with the agent's DID (see ZTAI protocol).
58
+ - **Consolidation:** The Swarm Leader must consolidate all member findings into the unified summary.
59
+ - **Emergency Halt:** If any member finds a **CRITICAL** issue (e.g., security vulnerability), the entire swarm must halt and report.
@@ -1,6 +1,11 @@
1
- # MindForge Engine — Wave Executor
1
+ # MindForge Engine — Wave Execution Engine
2
+
3
+ ## Core Objective
4
+
5
+ Orchestrate the parallel and sequential execution of a MindForge phase with atomic reliability and strict dependency enforcement.
2
6
 
3
7
  ## Purpose
8
+
4
9
  Group tasks from the dependency graph into waves and execute each wave.
5
10
  Within a wave, all tasks are independent and can run in parallel.
6
11
  Between waves, execution is strictly sequential.
@@ -8,11 +13,12 @@ Between waves, execution is strictly sequential.
8
13
  ## Wave grouping algorithm
9
14
 
10
15
  ### Input
16
+
11
17
  The dependency graph from `dependency-parser.md`.
12
18
 
13
19
  ### Algorithm — Kahn's topological sort (adapted for waves)
14
20
 
15
- ```
21
+ ```text
16
22
  Initialize:
17
23
  remaining = all plan IDs
18
24
  completed = empty set
@@ -34,8 +40,9 @@ Repeat until remaining is empty:
34
40
  Return waves
35
41
  ```
36
42
 
37
- ### Example output for the 5-plan example above:
38
- ```
43
+ ### Example output for the 5-plan example above
44
+
45
+ ```text
39
46
  Wave 1: [01, 02] ← No dependencies — run in parallel
40
47
  Wave 2: [03, 04] ← Depend on Wave 1 — run in parallel after Wave 1
41
48
  Wave 3: [05] ← Depends on both Wave 2 tasks — runs after Wave 2
@@ -44,7 +51,15 @@ Wave 3: [05] ← Depends on both Wave 2 tasks — runs after Wave 2
44
51
  ## Wave execution protocol
45
52
 
46
53
  ### Before starting a wave
47
- 1. Confirm all plans in previous wave have:
54
+
55
+ 1. **Nexus Trace:** Call `NexusTracer.startSpan('wave_[W]')`.
56
+ 2. **Identity Verification (ZTAI):**
57
+ - Call `TrustVerifier.verifyAuditLog('.planning/AUDIT.jsonl')`.
58
+ - Ensure all `span_completed` events from the previous wave have a valid cryptographic signature and DID.
59
+ 3. **Identity-Lock (Tier 3):**
60
+ - If any task in the upcoming wave involves Tier 3 actions (e.g., modifying `.mindforge/governance/`), ensure the assigned agent DID has `tier >= 3`.
61
+ - If verification fails or tier is insufficient: **STOP** the phase and report an `identity_lock_violation`.
62
+ 4. Confirm all plans in previous wave have:
48
63
  - Status: Completed in SUMMARY file
49
64
  - Git commit SHA recorded
50
65
  - `<verify>` step passed
@@ -53,18 +68,41 @@ Wave 3: [05] ← Depends on both Wave 2 tasks — runs after Wave 2
53
68
  Do not start the next wave. Report which plan failed and why.
54
69
 
55
70
  ### During a wave — parallel execution
71
+
56
72
  For each plan in the current wave, spawn a subagent with this exact context
57
73
  package (see `context-injector.md` for the injection protocol):
58
74
 
59
75
  ### Subagent invocation protocol (runtime-agnostic)
76
+
60
77
  Use the runtime-specific mechanism, but keep the inputs identical:
78
+
79
+ #### 1. Swarm Check (MindForge V4)
80
+
81
+ Before spawning any subagent, the executor MUST call `swarm-controller.md`.
82
+ - **Input:** The PLAN file, task name, and file list.
83
+ - **Output:** `single_persona` OR `swarm_cluster(template, leader, members)`.
84
+
85
+ #### 2. Single Persona Execution
86
+
87
+ If `single_persona` is returned:
88
+ - **Nexus Trace:** Call `NexusTracer.startSpan('task_[N]-[M]', { parent_span_id: 'wave_[W]' })`.
61
89
  - **Claude Code:** spawn a subagent with the context package and the PLAN file.
62
- Require the subagent to write `SUMMARY-[N]-[M].md` and report completion.
63
- - **Antigravity:** spawn an agent via `.agent/` command with the same context
64
- package and the PLAN file. Require the same SUMMARY file output.
90
+ - **Antigravity:** spawn an agent via `.agent/` command with the same context.
91
+ - Target: `SUMMARY-[N]-[M].md`.
65
92
 
66
- **Context package per subagent:**
67
- ```
93
+ #### 3. Swarm Cluster Execution (The "Mesh" Mode)
94
+
95
+ If `swarm_cluster` is returned:
96
+ - **Nexus Trace:** Call `NexusTracer.startSpan('swarm_[N]-[M]', { parent_span_id: 'wave_[W]', template: '[Template]' })`.
97
+ - **Initialize Swarm State:** Create `.planning/phases/[N]/SWARM-STATE-[M].json`.
98
+ - **Spawn Cluster:** Simultaneously spawn all members in the cluster (e.g., Architect, Dev, Security).
99
+ - **Communication:** Agents in the swarm MUST read/write to `SWARM-STATE-[M].json` for coordination.
100
+ - **Consolidation:** The **Swarm Leader** is responsible for collecting all findings and writing a unified `SWARM-SUMMARY-[N]-[M].md`.
101
+ - **Context:** Each agent gets a specialized persona from `persona-factory.md` (weighted by Context7 insights).
102
+
103
+ **Context package per subagent**
104
+
105
+ ```text
68
106
  REQUIRED (always inject):
69
107
  .mindforge/org/CONVENTIONS.md
70
108
  .mindforge/org/SECURITY.md
@@ -84,6 +122,7 @@ NEVER inject to subagents:
84
122
  ```
85
123
 
86
124
  ### After each plan in a wave completes
125
+
87
126
  The executing subagent must:
88
127
  1. Run the `<verify>` step and capture output
89
128
  2. Write SUMMARY-[N]-[M].md with verify output included
@@ -92,6 +131,7 @@ The executing subagent must:
92
131
  5. Report completion status back to the orchestrator
93
132
 
94
133
  ### Wave completion
134
+
95
135
  After all plans in a wave complete:
96
136
  1. Collect all SUMMARY files from this wave
97
137
  2. Run the project's full test suite
@@ -112,24 +152,28 @@ When a task's `<verify>` step fails:
112
152
  4. **Stop the entire wave.** Other tasks in this wave that have not yet started:
113
153
  do not start them. Tasks already running in parallel: let them complete
114
154
  naturally, but do not start the next wave regardless of their outcome.
115
- 5. **Report to the orchestrator:**
116
- ```
117
- ━━━ Wave [W] STOPPED — Task Failure ━━━━━━━━━━━━━━━━━━━━━━
118
- Failed task : Plan [N]-[M]: [task name]
119
- Verify output:
120
- [full verify output]
121
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
122
- ```
123
- 6. **Ask the user:**
124
- ```
125
- Options:
126
- 1. Spawn debug agent to diagnose the failure
127
- 2. Show me the failing code and I'll fix it manually
128
- 3. Skip this task and continue the wave (not recommended)
129
- 4. Abort the entire phase
130
-
131
- Choose 1, 2, 3, or 4:
132
- ```
155
+ 5. **Report to the orchestrator**
156
+
157
+ ```text
158
+ ━━━ Wave [W] STOPPED — Task Failure ━━━━━━━━━━━━━━━━━━━━━━
159
+ Failed task : Plan [N]-[M]: [task name]
160
+ Verify output:
161
+ [full verify output]
162
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
163
+ ```
164
+
165
+ 6. **Ask the user**
166
+
167
+ ```text
168
+ Options:
169
+ 1. Spawn debug agent to diagnose the failure
170
+ 2. Show me the failing code and I'll fix it manually
171
+ 3. Skip this task and continue the wave (not recommended)
172
+ 4. Abort the entire phase
173
+
174
+ Choose 1, 2, 3, or 4:
175
+ ```
176
+
133
177
  7. If user chooses 1: invoke `/mindforge:debug` with the failure context pre-loaded.
134
178
  8. If user chooses 3 (skip): write a `quality_gate_failed` AUDIT entry with
135
179
  `"gate": "verify_skipped_by_user"` and continue. This is tracked.
@@ -140,30 +184,35 @@ When a task's `<verify>` step fails:
140
184
  When the test suite fails after a wave completes:
141
185
 
142
186
  1. **Identify the failing tests** — capture the full test output.
143
- 2. **Identify the likely causal commit:**
144
- ```bash
145
- git log --oneline -[number of tasks in this wave]
146
- ```
147
- 3. **Report specifically:**
148
- ```
149
- ━━━ Test Suite Failure After Wave [W] ━━━━━━━━━━━━━━━━━━━━━
150
- [N] tests failing.
151
-
152
- Likely cause: [commit sha] [commit message]
153
- Failing tests:
154
- - [test name]: [error]
155
- - [test name]: [error]
156
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
157
- ```
187
+ 2. **Identify the likely causal commit**
188
+
189
+ ```bash
190
+ git log --oneline -[number of tasks in this wave]
191
+ ```
192
+
193
+ 3. **Report specifically**
194
+
195
+ ```text
196
+ ━━━ Test Suite Failure After Wave [W] ━━━━━━━━━━━━━━━━━━━━━
197
+ [N] tests failing.
198
+
199
+ Likely cause: [commit sha] [commit message]
200
+ Failing tests:
201
+ - [test name]: [error]
202
+ - [test name]: [error]
203
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
204
+ ```
205
+
158
206
  4. **Write a `quality_gate_failed` AUDIT entry.**
159
207
  5. **Do not start the next wave.** This is absolute — no exceptions.
160
- 6. **Ask the user:**
161
- ```
162
- Options:
163
- 1. Debug the failing tests now
164
- 2. Revert the last wave's commits and re-plan
165
- 3. I'll fix the tests manually notify me when done
166
- ```
208
+ 6. **Ask the user**
209
+
210
+ ```text
211
+ Options:
212
+ 1. Debug the failing tests now
213
+ 2. Revert the last wave's commits and re-plan
214
+ 3. I'll fix the tests manually — notify me when done
215
+ ```
167
216
 
168
217
  ### Subagent hang (no SUMMARY file after expected duration)
169
218
 
@@ -185,6 +234,7 @@ When execute-phase discovers a PLAN file referenced in the dependency graph is m
185
234
  3. Do not continue with partial plan execution.
186
235
 
187
236
  ### Phase completion
237
+
188
238
  After all waves complete:
189
239
  1. Run the phase verification pipeline (see `verification-pipeline.md`)
190
240
  2. Write VERIFICATION.md
@@ -200,7 +250,7 @@ Write to `.planning/phases/[N]/WAVE-REPORT-[N].md`:
200
250
 
201
251
  ## Wave 1
202
252
  | Plan | Task Name | Status | Duration | Commit |
203
- |------|---------------------|--------|----------|------------|
253
+ | :--- | :--- | :--- | :--- | :--- |
204
254
  | 01 | Create user model | ✅ | ~8 min | abc1234 |
205
255
  | 02 | Create product model| ✅ | ~6 min | def5678 |
206
256
 
@@ -208,7 +258,7 @@ Write to `.planning/phases/[N]/WAVE-REPORT-[N].md`:
208
258
 
209
259
  ## Wave 2
210
260
  | Plan | Task Name | Status | Duration | Commit |
211
- |------|-----------------------|--------|----------|------------|
261
+ | :--- | :--- | :--- | :--- | :--- |
212
262
  | 03 | User API endpoints | ✅ | ~12 min | ghi9012 |
213
263
  | 04 | Product API endpoints | ✅ | ~10 min | jkl3456 |
214
264
 
@@ -216,14 +266,14 @@ Write to `.planning/phases/[N]/WAVE-REPORT-[N].md`:
216
266
 
217
267
  ## Wave 3
218
268
  | Plan | Task Name | Status | Duration | Commit |
219
- |------|---------------|--------|----------|------------|
269
+ | :--- | :--- | :--- | :--- | :--- |
220
270
  | 05 | Checkout UI | ✅ | ~15 min | mno7890 |
221
271
 
222
272
  **Wave 3 test results:** All passing ✅
223
273
 
224
274
  ### Failure row format (if any task fails)
225
275
  | Plan | Task Name | Status | Duration | Commit | Error |
226
- |------|-------------------|--------|----------|---------|-------|
276
+ | :--- | :--- | :--- | :--- | :--- | :--- |
227
277
  | 02 | Create product model | ❌ | ~4 min | n/a | Verify failed: TypeError ... |
228
278
 
229
279
  ## Phase summary
@@ -1,2 +1 @@
1
- {"id":"a9878977-cb7c-4dcf-8161-760ffd5e7de9","timestamp":"2026-03-22T17:25:37.673Z","type":"code_pattern","topic":"React Memo","content":"Use React.memo to prevent re-renders.","source":"manual","project":"[Project Name]","confidence":0.6,"tags":["ui"],"linked_adrs":[],"times_referenced":0,"last_referenced":null,"deprecated":false,"deprecated_by":null}
2
- {"id":"a9878977-cb7c-4dcf-8161-760ffd5e7de9","timestamp":"2026-03-22T17:25:37.673Z","type":"code_pattern","topic":"React Memo","content":"Use React.memo to prevent re-renders.","source":"manual","project":"[Project Name]","confidence":0.65,"tags":["ui"],"linked_adrs":[],"times_referenced":1,"last_referenced":"2026-03-25T17:42:57.297Z","deprecated":false,"deprecated_by":null}
1
+ {"id":"LOCAL-SAFE-001","tags":["performance"],"description":"Standard optimization"}
@@ -0,0 +1,118 @@
1
+ {
2
+ "version": "4.2.0",
3
+ "mesh_protocols": {
4
+ "shared_state": ".planning/phases/[N]/SWARM-STATE-[M].json",
5
+ "consolidation_format": "SWARM-SUMMARY-[N]-[M].md",
6
+ "trust_verification": "ZTAI-v4"
7
+ },
8
+ "templates": {
9
+ "UISwarm": {
10
+ "leader": "ui-auditor",
11
+ "members": ["developer", "accessibility", "whimsy-injector"],
12
+ "focus": "Visual fidelity, interaction states, and WCAG 2.2 compliance.",
13
+ "trust_tier": 1,
14
+ "decision_gate": "autonomous",
15
+ "resource_budget": "medium",
16
+ "required_skills": ["ui-ux-pro-max"]
17
+ },
18
+ "BackendSwarm": {
19
+ "leader": "architect",
20
+ "members": ["developer", "security-reviewer", "database-optimizer"],
21
+ "focus": "Architectural alignment, performance, and API versioning.",
22
+ "trust_tier": 2,
23
+ "decision_gate": "autonomous",
24
+ "resource_budget": "medium",
25
+ "required_skills": ["system-architecture"]
26
+ },
27
+ "SecuritySwarm": {
28
+ "leader": "security-reviewer",
29
+ "members": ["architect", "developer", "threat-detection-engineer"],
30
+ "focus": "OWASP A01-A10 mitigation, secret detection, and trust boundary enforcement.",
31
+ "trust_tier": 3,
32
+ "decision_gate": "hitl",
33
+ "resource_budget": "high",
34
+ "required_skills": ["security-engineer"]
35
+ },
36
+ "AIEngineeringSwarm": {
37
+ "leader": "ai-engineer",
38
+ "members": ["prompt-engineer", "developer", "model-qa-specialist"],
39
+ "focus": "Model orchestration, prompt grounding, hallucination mitigation, and inference optimization.",
40
+ "trust_tier": 2,
41
+ "decision_gate": "autonomous",
42
+ "resource_budget": "high",
43
+ "required_skills": ["agency-ai-engineer"]
44
+ },
45
+ "DeveloperExperienceSwarm": {
46
+ "leader": "developer-advocate",
47
+ "members": ["devops-automator", "tech-writer", "workflow-optimizer"],
48
+ "focus": "CI/CD pipeline ergonomics, DX documentation, and internal tool optimization.",
49
+ "trust_tier": 1,
50
+ "decision_gate": "autonomous",
51
+ "resource_budget": "low",
52
+ "required_skills": ["agency-developer-advocate"]
53
+ },
54
+ "DataMeshSwarm": {
55
+ "leader": "data-engineer",
56
+ "members": ["database-optimizer", "analytics-reporter", "compliance-auditor"],
57
+ "focus": "Data lakehouse patterns, ETL pipelining, and semantic layer integrity.",
58
+ "trust_tier": 2,
59
+ "decision_gate": "hitl",
60
+ "resource_budget": "medium",
61
+ "required_skills": ["agency-data-engineer"]
62
+ },
63
+ "IdentityTrustSwarm": {
64
+ "leader": "agentic-identity-trust-architect",
65
+ "members": ["security-reviewer", "architect", "blockchain-security-auditor"],
66
+ "focus": "Zero-Trust Agentic Identity (ZTAI), DID-based signing, and authentication bypass mitigation.",
67
+ "trust_tier": 3,
68
+ "decision_gate": "hitl",
69
+ "resource_budget": "high",
70
+ "required_skills": ["agency-agentic-identity-trust-architect"]
71
+ },
72
+ "GrowthAnalyticsSwarm": {
73
+ "leader": "growth-hacker",
74
+ "members": ["analytics-reporter", "ui-auditor", "tracking-measurement-specialist"],
75
+ "focus": "A/B testing, conversion funnel optimization, and telemetry instrumentation.",
76
+ "trust_tier": 1,
77
+ "decision_gate": "autonomous",
78
+ "resource_budget": "medium",
79
+ "required_skills": ["agency-growth-hacker"]
80
+ },
81
+ "IncidentResponseSwarm": {
82
+ "leader": "sre-site-reliability-engineer",
83
+ "members": ["developer", "incident-response-commander", "debug-specialist"],
84
+ "focus": "Rapid root cause analysis (RCA), hotfix deployment, and post-mortem drafting.",
85
+ "trust_tier": 3,
86
+ "decision_gate": "hitl",
87
+ "resource_budget": "high",
88
+ "required_skills": ["gsd-debug"]
89
+ },
90
+ "ComplianceSwarm": {
91
+ "leader": "compliance-auditor",
92
+ "members": ["legal-compliance-checker", "architect", "security-reviewer"],
93
+ "focus": "GDPR/SOC2 alignment, PII masking, and regulatory audit trail verification.",
94
+ "trust_tier": 3,
95
+ "decision_gate": "hitl",
96
+ "resource_budget": "medium",
97
+ "required_skills": ["agency-legal-compliance-checker"]
98
+ },
99
+ "QualityAssuranceSwarm": {
100
+ "leader": "qa-engineer",
101
+ "members": ["developer", "verifier", "test-results-analyzer"],
102
+ "focus": "End-to-end regression, edge-case fuzzing, and coverage-gap analysis.",
103
+ "trust_tier": 1,
104
+ "decision_gate": "autonomous",
105
+ "resource_budget": "medium",
106
+ "required_skills": ["gsd-add-tests"]
107
+ },
108
+ "FullStackSwarm": {
109
+ "leader": "architect",
110
+ "members": ["ui-auditor", "developer", "security-reviewer", "tech-writer"],
111
+ "focus": "End-to-end feature delivery with unified UI, API security, and documentation.",
112
+ "trust_tier": 2,
113
+ "decision_gate": "autonomous",
114
+ "resource_budget": "high",
115
+ "required_skills": ["system-architecture", "ui-ux-pro-max"]
116
+ }
117
+ }
118
+ }
@@ -0,0 +1,2 @@
1
+ {"timestamp":"2026-03-27T20:44:37.178Z","planId":"test-plan-001","task":"Implement Auth","model":"claude-3-5-sonnet","costTier":"medium","inputTokens":1000,"outputTokens":500,"durationMs":1200,"status":"completed","goalAchieved":1,"estimatedCostUSD":0.010499999999999999}
2
+ {"timestamp":"2026-03-27T20:54:21.126Z","planId":"test-plan-001","task":"Implement Auth","model":"claude-3-5-sonnet","costTier":"medium","inputTokens":1000,"outputTokens":500,"durationMs":1200,"status":"completed","goalAchieved":1,"estimatedCostUSD":0.010499999999999999}