mindforge-cc 6.2.0-alpha → 6.2.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 (110) hide show
  1. package/.agent/bin/lib/commands.cjs +4 -4
  2. package/.agent/bin/lib/state.cjs +1 -1
  3. package/.agent/bin/lib/verify.cjs +7 -7
  4. package/.agent/bin/mindforge-tools.cjs +1 -1
  5. package/.agent/hooks/mindforge-context-monitor.js +1 -1
  6. package/.agent/hooks/mindforge-session-init_extended.js +4 -4
  7. package/.agent/hooks/mindforge-workflow-guard.js +1 -1
  8. package/.agent/mindforge/debug.md +3 -0
  9. package/.agent/mindforge/execute-phase.md +6 -0
  10. package/.agent/mindforge/learning.md +20 -0
  11. package/.agent/mindforge/plan-phase.md +9 -7
  12. package/.agent/mindforge/record-learning.md +22 -0
  13. package/.agent/mindforge/retrospective.md +1 -0
  14. package/.agent/mindforge/ship.md +7 -0
  15. package/.claude/CLAUDE.md +16 -7
  16. package/.claude/commands/mindforge/approve.md +16 -24
  17. package/.claude/commands/mindforge/audit.md +28 -28
  18. package/.claude/commands/mindforge/auto.md +20 -27
  19. package/.claude/commands/mindforge/benchmark.md +31 -24
  20. package/.claude/commands/mindforge/browse.md +24 -22
  21. package/.claude/commands/mindforge/complete-milestone.md +16 -26
  22. package/.claude/commands/mindforge/costs.md +10 -23
  23. package/.claude/commands/mindforge/cross-review.md +15 -25
  24. package/.claude/commands/mindforge/dashboard.md +99 -32
  25. package/.claude/commands/mindforge/debug.md +130 -31
  26. package/.claude/commands/mindforge/discuss-phase.md +139 -33
  27. package/.claude/commands/mindforge/execute-phase.md +197 -34
  28. package/.claude/commands/mindforge/health.md +25 -25
  29. package/.claude/commands/mindforge/help.md +27 -23
  30. package/.claude/commands/mindforge/init-org.md +132 -34
  31. package/.claude/commands/mindforge/init-project.md +167 -37
  32. package/.claude/commands/mindforge/install-skill.md +24 -28
  33. package/.claude/commands/mindforge/learn.md +144 -33
  34. package/.claude/commands/mindforge/learning.md +20 -0
  35. package/.claude/commands/mindforge/map-codebase.md +299 -33
  36. package/.claude/commands/mindforge/marketplace.md +121 -30
  37. package/.claude/commands/mindforge/metrics.md +20 -27
  38. package/.claude/commands/mindforge/migrate.md +41 -30
  39. package/.claude/commands/mindforge/milestone.md +11 -30
  40. package/.claude/commands/mindforge/new-runtime.md +20 -26
  41. package/.claude/commands/mindforge/next.md +106 -31
  42. package/.claude/commands/mindforge/plan-phase.md +128 -31
  43. package/.claude/commands/mindforge/plugins.md +38 -28
  44. package/.claude/commands/mindforge/pr-review.md +42 -29
  45. package/.claude/commands/mindforge/profile-team.md +21 -24
  46. package/.claude/commands/mindforge/publish-skill.md +18 -25
  47. package/.claude/commands/mindforge/qa.md +14 -25
  48. package/.claude/commands/mindforge/quick.md +136 -32
  49. package/.claude/commands/mindforge/record-learning.md +22 -0
  50. package/.claude/commands/mindforge/release.md +9 -24
  51. package/.claude/commands/mindforge/remember.md +24 -23
  52. package/.claude/commands/mindforge/research.md +11 -24
  53. package/.claude/commands/mindforge/retrospective.md +25 -26
  54. package/.claude/commands/mindforge/review.md +158 -34
  55. package/.claude/commands/mindforge/security-scan.md +239 -31
  56. package/.claude/commands/mindforge/ship.md +108 -31
  57. package/.claude/commands/mindforge/skills.md +142 -33
  58. package/.claude/commands/mindforge/status.md +110 -27
  59. package/.claude/commands/mindforge/steer.md +11 -22
  60. package/.claude/commands/mindforge/sync-confluence.md +10 -25
  61. package/.claude/commands/mindforge/sync-jira.md +11 -27
  62. package/.claude/commands/mindforge/tokens.md +7 -22
  63. package/.claude/commands/mindforge/update.md +43 -30
  64. package/.claude/commands/mindforge/verify-phase.md +63 -27
  65. package/.claude/commands/mindforge/workspace.md +27 -26
  66. package/.mindforge/engine/shard-controller.md +1 -1
  67. package/CHANGELOG.md +34 -15
  68. package/README.md +93 -98
  69. package/RELEASENOTES.md +6 -6
  70. package/bin/autonomous/auto-runner.js +1 -1
  71. package/bin/autonomous/mesh-self-healer.js +2 -2
  72. package/bin/change-classifier.js +1 -1
  73. package/bin/dashboard/server.js +4 -4
  74. package/bin/dashboard/sse-bridge.js +1 -1
  75. package/bin/engine/learning-manager.js +181 -0
  76. package/bin/engine/sre-manager.js +1 -1
  77. package/bin/engine/temporal-cli.js +1 -1
  78. package/bin/engine/temporal-hindsight.js +4 -4
  79. package/bin/governance/approve.js +2 -2
  80. package/bin/governance/policy-engine.js +1 -1
  81. package/bin/governance/ztai-manager.js +1 -1
  82. package/bin/hindsight-injector.js +1 -1
  83. package/bin/installer-core.js +8 -0
  84. package/bin/memory/federated-sync.js +7 -7
  85. package/bin/mindforge-cli.js +9 -0
  86. package/bin/models/cloud-broker.js +1 -1
  87. package/bin/review/ads-engine.js +6 -6
  88. package/bin/skill-registry.js +4 -4
  89. package/bin/skills-builder/marketplace-client.js +2 -2
  90. package/bin/skills-builder/pattern-detector.js +2 -2
  91. package/bin/skills-builder/skill-generator.js +1 -1
  92. package/bin/skills-builder/skill-registrar.js +4 -4
  93. package/bin/skills-builder/skill-scorer.js +1 -1
  94. package/bin/skills-builder/source-loader.js +2 -2
  95. package/bin/wizard/theme.js +1 -1
  96. package/docs/CAPABILITIES-MANIFEST.md +2 -2
  97. package/docs/MIND-FORGE-REFERENCE-V6.md +3 -3
  98. package/docs/Templates/Project/AGENTS_LEARNING.md +88 -0
  99. package/docs/architecture/V4-SWARM-MESH.md +1 -1
  100. package/docs/architecture/V5-ENTERPRISE.md +1 -1
  101. package/docs/ci-cd.md +1 -1
  102. package/docs/commands-reference.md +106 -48
  103. package/docs/registry/COMMANDS.md +1 -1
  104. package/docs/registry/PERSONAS.md +1 -1
  105. package/docs/registry/README.md +1 -1
  106. package/docs/registry/SKILLS.md +1 -1
  107. package/docs/security/ZTAI-OVERVIEW.md +1 -1
  108. package/docs/user-guide.md +2 -2
  109. package/docs/workflow-atlas.md +1 -1
  110. package/package.json +1 -1
@@ -1,35 +1,139 @@
1
1
  ---
2
- name: mindforge:quick
3
- description: Execute an ad-hoc task without full lifecycle management
4
- argument-hint: [--research] [--review] [--full]
5
- allowed-tools:
6
- - run_command
7
- - view_file
8
- - write_to_file
9
- - list_dir
2
+ description: Use QUICK for:
10
3
  ---
11
4
 
12
- <objective>
13
- Provide a lightweight workflow for small bug fixes, documentation updates, or dependency maintenance that bypasses the formal phase planning while maintaining strict security and quality guardrails.
14
- </objective>
15
-
16
- <execution_context>
17
- .claude/commands/mindforge/quick.md
18
- </execution_context>
19
-
20
- <context>
21
- Scope: < 6 files, < 2 hours of work.
22
- Storage: .planning/quick/[NNN]-[slug]/
23
- Flags: --research (add pre-analysis), --review (add quality check), --full (add comprehensive tests/linting).
24
- </context>
25
-
26
- <process>
27
- 1. **Intake**: Verify the task fits within the "Quick" scope. Redirect to `/mindforge:plan-phase` if too large.
28
- 2. **Research (Optional)**: If `--research` is set, spawn a subagent to investigate the approach and write a research note.
29
- 3. **Plan**: Generate an XML-based task plan in the `.planning/quick/` directory with a sequential ID.
30
- 4. **Security Check**: Automatically load `security-review/SKILL.md` if the task touches sensitive keywords (Auth, PII, Secrets).
31
- 5. **Execute**: Implement the plan, run the specified verify command, and fix any lint errors.
32
- 6. **Review (Optional)**: If `--review` is set, perform a code quality audit on the diff.
33
- 7. **Finalize**: Commit the changes with the `quick/[NNN]` prefix and write a `SUMMARY.md`.
34
- 8. **Audit**: Log `quick_task_completed` with file counts and flag usage.
35
- </process>
5
+ # MindForge — Quick Command
6
+ # Usage: /mindforge:quick [--research] [--review] [--full]
7
+ # For ad-hoc tasks that don't need full lifecycle management.
8
+
9
+ ## When to use quick vs plan-phase
10
+ Use QUICK for:
11
+ - Bug fixes not tied to a current phase
12
+ - Small improvements (< 3 files, < 2 hours)
13
+ - Dependency updates
14
+ - Documentation corrections
15
+ - One-off scripts or utilities
16
+
17
+ Use PLAN-PHASE for:
18
+ - Feature development
19
+ - Anything touching more than 6 files
20
+ - Anything requiring research before implementation
21
+ - Anything with external dependencies or stakeholder requirements
22
+
23
+ ## Step 1 Task intake
24
+
25
+ Ask the user:
26
+ "What do you want to do?"
27
+
28
+ Listen to the description. If the task sounds larger than "quick" scope
29
+ (more than 6 files, architectural change, new feature), say:
30
+ "This sounds like more than a quick task. I recommend using /mindforge:plan-phase
31
+ instead to ensure it's properly planned and verified. Want to proceed with quick anyway?"
32
+
33
+ ## Step 2 — Optional research (--research flag or user requests it)
34
+
35
+ If `--research` is provided or the task involves unfamiliar libraries:
36
+ Spawn a focused research subagent. Give it:
37
+ - The task description
38
+ - The current tech stack from PROJECT.md
39
+ Ask it to: investigate the best approach, identify gotchas, recommend specific
40
+ libraries (with versions), and write a brief research note.
41
+
42
+ Report research findings to the user before proceeding.
43
+
44
+ ## Step 3 — Create a quick plan
45
+
46
+ ### Sequential quick task numbering
47
+ Determine the next quick task number by scanning `.planning/quick/`:
48
+ 1. List directories matching `[0-9][0-9][0-9]-*`
49
+ 2. Take the max numeric prefix and add 1 (start at 001 if none exist)
50
+ 3. If a directory already exists for the chosen number, require `--force` to proceed
51
+
52
+ Create `.planning/quick/[NNN]-[slug]/PLAN.md` where NNN is a sequential number
53
+ and slug is a 2-4 word kebab-case description.
54
+
55
+ Example: `.planning/quick/001-fix-login-null-check/PLAN.md`
56
+
57
+ Use the standard XML plan format:
58
+ ```xml
59
+ <task type="quick">
60
+ <n>[task name]</n>
61
+ <persona>[appropriate persona]</persona>
62
+ <files>[files to touch]</files>
63
+ <context>[relevant context]</context>
64
+ <action>[implementation instructions]</action>
65
+ <verify>[verification command]</verify>
66
+ <done>[definition of done]</done>
67
+ </task>
68
+ ```
69
+
70
+ Show the plan to the user. Wait for approval before executing.
71
+
72
+ ## Step 4 — Execute the quick plan
73
+
74
+ ### Security auto-trigger (mandatory)
75
+ Before execution, scan the task description and files for security keywords:
76
+ auth, authentication, login, password, token, JWT, session, payment, PII, upload,
77
+ credential, secret, key.
78
+
79
+ If any keyword matches: load `security-review/SKILL.md` and activate
80
+ `security-reviewer.md` persona for the implementation. This is required even
81
+ without the `--full` flag.
82
+
83
+ 1. Load persona from `.mindforge/personas/`
84
+ 2. Load any relevant skills based on task keywords
85
+ 3. Execute the plan
86
+ 4. Run `<verify>` — must pass before committing
87
+ 5. Commit: `[type](quick/[NNN]): [task name]`
88
+ 6. Write `.planning/quick/[NNN]-[slug]/SUMMARY.md`
89
+
90
+ ### STATE.md update policy
91
+ Quick tasks do not change phase status. If there is no active phase, note the
92
+ quick task completion in STATE.md under "Last completed task".
93
+
94
+ ## Step 5 — Optional review (--review flag)
95
+
96
+ If `--review` is provided:
97
+ Activate `code-quality.md` skill on the diff.
98
+ Report any issues before committing.
99
+ If BLOCKING issues found: fix before commit.
100
+
101
+ ## Step 6 — Optional full mode (--full flag)
102
+
103
+ If `--full` is provided, additionally:
104
+ - Run the project's full test suite (not just task-specific verify)
105
+ - Run the type checker and linter
106
+ - Activate `security-reviewer.md` if the task touches any security-sensitive code
107
+ - Write an AUDIT entry for the quick task
108
+
109
+ ## Linting always runs
110
+ Regardless of flags, after every quick task execution:
111
+ 1. Run the project's linter (from CONVENTIONS.md — check which linter applies)
112
+ 2. If lint errors found: fix them before committing.
113
+ 3. Linting is not part of `--full` — it is always part of quick.
114
+
115
+ ## Flags are composable
116
+ ```
117
+ /mindforge:quick # minimal — task, plan, execute
118
+ /mindforge:quick --research # adds domain research step
119
+ /mindforge:quick --review # adds code quality review of diff
120
+ /mindforge:quick --full # adds full test suite + linting + security
121
+ /mindforge:quick --research --full # all of the above
122
+ ```
123
+
124
+ ## AUDIT entry for quick tasks
125
+ ```json
126
+ {
127
+ "id": "uuid",
128
+ "timestamp": "ISO-8601",
129
+ "event": "quick_task_completed",
130
+ "agent": "mindforge-orchestrator",
131
+ "phase": null,
132
+ "session_id": "sess_abc",
133
+ "quick_id": "001",
134
+ "task_name": "Fix login null check",
135
+ "commit_sha": "abc1234",
136
+ "files_changed": ["src/auth/login.ts"],
137
+ "flags_used": ["--review"]
138
+ }
139
+ ```
@@ -0,0 +1,22 @@
1
+ ---
2
+ description: Append a new Learning Entry to the Evolution Log in AGENTS_LEARNING.md
3
+ ---
4
+
5
+ # /mindforge:record-learning
6
+
7
+ Append a new Learning Entry to the `Evolution Log`. Recording learnings regularly is a MANDATORY practice to build project intelligence.
8
+
9
+ ## Usage
10
+
11
+ `/mindforge:record-learning`
12
+
13
+ This command initiates a session-end recording. You should provide details on:
14
+ - **Context**: What task was being performed.
15
+ - **Mistake**: What went wrong.
16
+ - **Root Cause**: Why it happened.
17
+ - **Fix**: What was done.
18
+ - **Prevention Rule**: Rule to avoid this in the future.
19
+ - **Category**: (Best Practice, Anti-Pattern, Bug Fix, Architecture).
20
+
21
+ ## Example
22
+ Run after a complex debugging session to capture the root cause and the specific engineering oversight to prevent it from happening again.
@@ -1,29 +1,14 @@
1
1
  ---
2
- name: mindforge:release
3
- description: Execute the MindForge framework release pipeline
4
- argument-hint: [--version X.Y.Z] [--dry-run]
5
- allowed-tools:
6
- - run_command
7
- - view_file
8
- - write_to_file
2
+ description: Execute the complete MindForge v1.0.0 (or any version) release pipeline.
9
3
  ---
10
4
 
11
- <objective>
12
- Coordinate the release of the MindForge framework itself (Core Team only), ensuring all readiness checks pass, changelogs are updated, and packages are correctly versioned.
13
- </objective>
5
+ # MindForge — Release Command
6
+ # Usage: /mindforge:release [--version X.Y.Z] [--dry-run] [--checklist-only]
7
+ # ⚠️ This command is for releasing the MindForge framework itself.
8
+ # For releasing your project phases, use /mindforge:ship instead.
14
9
 
15
- <execution_context>
16
- .claude/commands/mindforge/release.md
17
- </execution_context>
10
+ ## Purpose
11
+ Execute the complete MindForge v1.0.0 (or any version) release pipeline.
12
+ Intended for the MindForge core team.
18
13
 
19
- <context>
20
- Scope: Framework Core (not project phases).
21
- Gates: Production readiness checklist.
22
- </context>
23
-
24
- <process>
25
- 1. **Checklist Audit**: Verify all framework readiness items (tests, docs, security) are marked [x].
26
- 2. **Dry Run**: Preview the release artifacts and target version.
27
- 3. **Pipeline Execution**: Bump versions, update the main CHANGELOG.md, and tag the release in git.
28
- 4. **Finalize**: Trigger the publication to the official registry.
29
- </process>
14
+ ## Gate: Production Readiness Checklist
@@ -1,29 +1,30 @@
1
1
  ---
2
- name: mindforge:remember
3
- description: Manage long-term memory and knowledge graph entries
4
- argument-hint: [--add "content"] [--search "query"] [--promote "id"]
5
- allowed-tools:
6
- - view_file
7
- - write_to_file
8
- - run_command
2
+ description: Manage the MindForge long-term memory (knowledge graph).
9
3
  ---
10
4
 
11
- <objective>
12
- Provide a manual interface for steering the agent's long-term memory, allowing users to add specific project knowledge, search the existing graph, and promote local learnings to global availability.
13
- </objective>
5
+ # /mindforge:remember
14
6
 
15
- <execution_context>
16
- .claude/commands/mindforge/remember.md
17
- </execution_context>
7
+ Manage the MindForge long-term memory (knowledge graph).
18
8
 
19
- <context>
20
- Storage: MindForge Knowledge Graph.
21
- Visibility: Project-local vs. Global memory.
22
- </context>
9
+ ## Usage
23
10
 
24
- <process>
25
- 1. **Add**: Capture one-off decisions or constraints manually into the memory store.
26
- 2. **Search**: Query the knowledge base across sessions to retrieve previously captured patterns.
27
- 3. **Promote**: Elevate a specific project-level finding to "Global" status for use in future repositories.
28
- 4. **Analyze**: Provide stats on memory usage and activation frequency.
29
- </process>
11
+ - Add an entry:
12
+ ```bash
13
+ node bin/mindforge-cli.js remember --add "Your knowledge" --topic "Title"
14
+ ```
15
+ - Search memories:
16
+ ```bash
17
+ node bin/mindforge-cli.js remember --search "query" --global
18
+ ```
19
+ - View statistics:
20
+ ```bash
21
+ node bin/mindforge-cli.js remember --stats
22
+ ```
23
+ - Promote to global:
24
+ ```bash
25
+ node bin/mindforge-cli.js remember --promote "id"
26
+ ```
27
+
28
+ ## Description
29
+
30
+ MindForge capture, stores, and retrieves knowledge (architectural decisions, code patterns, team preferences) across all sessions and projects. This command allows for manual management and querying of this data.
@@ -1,29 +1,16 @@
1
1
  ---
2
- name: mindforge:research
3
- description: Perform deep technical or architectural research
4
- argument-hint: [topic] [--type library|codebase|compliance]
5
- allowed-tools:
6
- - run_command
7
- - read_url_content
8
- - view_file
2
+ description: Deep research using Gemini 1.5 Pro's 1-million-token context window.
9
3
  ---
10
4
 
11
- <objective>
12
- Leverage large-context models to ingest massive amounts of external documentation and local code simultaneously to answer complex architectural or compliance questions.
13
- </objective>
5
+ # MindForge v2 — Research Command
6
+ # Usage: /mindforge:research [topic] [--type general|library|codebase|compliance] [--url URL]
14
7
 
15
- <execution_context>
16
- .claude/commands/mindforge/research.md
17
- </execution_context>
8
+ ## Purpose
9
+ Deep research using Gemini 1.5 Pro's 1-million-token context window.
10
+ Uses **Context7 MCP** as the primary engine for real-time documentation and code example retrieval.
18
11
 
19
- <context>
20
- Engine: Gemini 2.0 Pro (high token limit required).
21
- Analysis Areas: Library integration, codebase-wide patterns, compliance audits.
22
- </context>
23
-
24
- <process>
25
- 1. **Define Scope**: Identify target documentation URLs and local source paths.
26
- 2. **Ingest**: Read all relevant sources into the analysis model's context.
27
- 3. **Synthesize**: Answer the user's research topic with citations to specific docs and files.
28
- 4. **Document**: Capture key findings for possible promotion to a skill via `/mindforge:learn`.
29
- </process>
12
+ ## Capabilities
13
+ - Ingest full library documentation via Context7.
14
+ - Codebase-wide architectural analysis.
15
+ - Regulatory compliance audits.
16
+ - Real-time resolution of version-specific API contracts.
@@ -1,32 +1,31 @@
1
1
  ---
2
- name: mindforge:retrospective
3
- description: Facilitate a structured retrospective with metrics and insights
4
- argument-hint: [phase N|milestone M] [--template agile|4ls|starfish]
5
- allowed-tools:
6
- - view_file
7
- - write_to_file
8
- - list_dir
2
+ description: Facilitate a structured retrospective with objective metrics + qualitative insights.
9
3
  ---
10
4
 
11
- <objective>
12
- Guide the project team through a structured reflection session at the end of a phase or milestone, combining quantitative delivery data with qualitative feedback to drive process improvement.
13
- </objective>
5
+ # MindForge — Retrospective Command
6
+ # Usage: /mindforge:retrospective [phase N|milestone M] [--template agile|4ls|starfish]
14
7
 
15
- <execution_context>
16
- .claude/commands/mindforge/retrospective.md
17
- </execution_context>
8
+ Facilitate a structured retrospective with objective metrics + qualitative insights.
18
9
 
19
- <context>
20
- Target: Specified Phase or Milestone.
21
- Data: Task stats, pass rates, UAT results, security findings.
22
- Knowledge: MINDFORGE.md (for potential config updates).
23
- </objective>
10
+ ## Workflow
11
+ 1. Gather quantitative signals (tasks, verify pass rate, findings, UAT, approvals).
12
+ 2. Run structured discussion by template.
13
+ 3. Write retrospective artifact in `.planning/phases/...` or `.planning/milestones/...`.
14
+ 4. Create follow-up tasks/tickets for action items.
15
+ 5. Update metrics with retrospective-completed event.
16
+ 6. Run `/mindforge:record-learning` to sync any new architectural "Aha!" moments or significant anti-patterns discovered during this phase/milestone.
24
17
 
25
- <process>
26
- 1. **Signal Gathering**: Collect quantitative performance data for the target period.
27
- 2. **Facilitate Discussion**: Run the interview based on the selected template (Agile, 4Ls, etc.).
28
- 3. **Document**: Write the retrospective artifact in the phase or milestone directory.
29
- 4. **Action Items**: Create follow-up tasks for process improvements.
30
- 5. **Config Update**: Prompt the user to update `MINDFORGE.md` based on learnings (e.g., adjusting task limits).
31
- 6. **Log**: Record `retrospective_completed` in metrics.
32
- </process>
18
+ ## Step 5 — Apply learnings to MINDFORGE.md
19
+ Ask explicitly:
20
+ `Based on this retrospective, should we update MINDFORGE.md to improve future phases?`
21
+
22
+ If yes:
23
+ - propose exact config changes
24
+ - apply only after confirmation
25
+ - commit with clear rationale
26
+
27
+ Common mappings:
28
+ - vague plans -> lower discuss threshold / enable auto-discuss
29
+ - low verify pass rate -> lower max tasks per phase
30
+ - rising security findings -> force-load `security-review,data-privacy`
31
+ - frequent compaction pressure -> lower compaction threshold
@@ -1,37 +1,161 @@
1
1
  ---
2
- name: mindforge:review
3
- description: Perform a comprehensive code quality and security review
4
- argument-hint: [path|phase N|--staged|--last-commit]
5
- allowed-tools:
6
- - run_command
7
- - view_file
8
- - write_to_file
9
- - list_dir
2
+ description: - /mindforge:review (no args) → review all uncommitted changes (git diff)
10
3
  ---
11
4
 
12
- <objective>
13
- Conduct a deep code review of a specified target (files, directories, phases, or git SHAs), focusing on structural quality, security vulnerabilities, and adherence to project conventions.
14
- </objective>
15
-
16
- <execution_context>
17
- .claude/commands/mindforge/review.md
18
- </execution_context>
19
-
20
- <context>
21
- Target: Staged changes, last commit, specific phase, or path.
22
- Personas: code-quality.md, security-reviewer.md
23
- Skills: code-quality, security-review, accessibility (for UI), api-design (for routes), database-patterns (for migrations).
24
- </context>
25
-
26
- <process>
27
- 1. **Establish Scope**: Use `git diff` or `git log` to determine the list of files needing review.
28
- 2. **Initialize Personas**: Load the appropriate reviewer personas and skills based on file types.
29
- 3. **Audit Implementation**: For each file, read full content and check:
30
- - Code quality (complexity, naming, error handling).
31
- - Conventions (from CONVENTIONS.md).
32
- - Security (secrets, validation, injection).
33
- - Type safety (TS specifics).
34
- 4. **Generate Report**: Write `CODE-REVIEW-[timestamp].md` with categorized findings (Blocking, Major, Minor, Suggestion) and an overall verdict.
35
- 5. **Update State**: Log `code_review_completed` in `AUDIT.jsonl`.
36
- 6. **Report**: Summarize findings to the user and block merge if "Blocking" issues exist.
37
- </process>
5
+ # MindForge — Review Command
6
+ # Usage: /mindforge:review [path|phase N|--staged|--last-commit]
7
+ # Performs a comprehensive code review using code-quality and security skills.
8
+
9
+ ## Review targets
10
+ - `/mindforge:review` (no args) → review all uncommitted changes (`git diff`)
11
+ - `/mindforge:review --staged` → review staged changes (`git diff --cached`)
12
+ - `/mindforge:review --last-commit` → review the last commit (`git diff HEAD~1`)
13
+ - `/mindforge:review phase [N]` → review all commits in phase N
14
+ - `/mindforge:review [file-path]` review a specific file
15
+ - `/mindforge:review [dir-path]` → review all files in a directory
16
+
17
+ ## Step 1 — Establish review scope
18
+
19
+ Based on the target argument, build the file list to review:
20
+ ```bash
21
+ # Uncommitted changes
22
+ git diff --name-only
23
+
24
+ # Staged changes
25
+ git diff --cached --name-only
26
+
27
+ # Last commit
28
+ git diff HEAD~1 --name-only
29
+
30
+ # Phase N (all commits between phase start and phase end tags)
31
+ git log --oneline --name-only [phase-start-sha]..[phase-end-sha]
32
+ ```
33
+
34
+ Display the file list to the user before reviewing:
35
+ "Reviewing [N] files: [list]"
36
+
37
+ ## Step 2 — Load review personas and skills
38
+
39
+ Activate TWO personas simultaneously for a comprehensive review:
40
+
41
+ **Primary:** `code-quality.md` — structural quality, conventions, complexity
42
+ **Secondary:** `security-reviewer.md` — security issues, data exposure, auth
43
+
44
+ Load these skills:
45
+ - `code-quality/SKILL.md` — always
46
+ - `security-review/SKILL.md` — always
47
+ - Contextual skills based on file types detected in the diff:
48
+ - `.ts`/`.tsx` → also load `api-design/SKILL.md` (if routes present)
49
+ - Database migration files → also load `database-patterns/SKILL.md`
50
+ - UI component files → also load `accessibility/SKILL.md`
51
+
52
+ ## Step 3 — Review each file
53
+
54
+ For each file in the review scope:
55
+
56
+ **Read the full file content** (not just the diff — context matters).
57
+ **Read the diff for this file** to understand what changed.
58
+
59
+ Apply ALL of the following checks:
60
+
61
+ ### Code quality checks
62
+ - [ ] Functions within length limits (CONVENTIONS.md standard)
63
+ - [ ] Cyclomatic complexity ≤ 10 (count if/else/switch/catch/ternary branches)
64
+ - [ ] No magic numbers (named constants used instead)
65
+ - [ ] No commented-out code
66
+ - [ ] No `TODO` or `FIXME` left uncommitted
67
+ - [ ] Error handling is explicit (no empty catch blocks)
68
+ - [ ] Naming is precise and unambiguous (no `data`, `info`, `temp`)
69
+ - [ ] Every exported function has a JSDoc/docstring
70
+ - [ ] DRY: no logic duplicated 3+ times
71
+ - [ ] No dead code (imports/variables defined but never used)
72
+
73
+ ### Convention checks (from CONVENTIONS.md)
74
+ - [ ] File naming follows convention
75
+ - [ ] Import order follows the defined order
76
+ - [ ] All forbidden patterns are absent
77
+ - [ ] Architecture boundaries respected (services don't import routes, etc.)
78
+
79
+ ### Security checks (from security-review SKILL)
80
+ - [ ] No hardcoded credentials or secrets
81
+ - [ ] User input validated at boundaries
82
+ - [ ] SQL queries parameterised
83
+ - [ ] Sensitive data not in logs or error messages
84
+ - [ ] New dependencies CVE-scanned
85
+
86
+ ### Type safety (TypeScript projects)
87
+ - [ ] No `any` types without justification comment
88
+ - [ ] No `as unknown as X` casting without justification
89
+ - [ ] All function parameters typed (no implicit any)
90
+ - [ ] Return types explicitly declared on public functions
91
+
92
+ ## Step 4 — Write the review report
93
+
94
+ Create `.planning/phases/[current-phase]/CODE-REVIEW-[timestamp].md`
95
+ or `.planning/quick/review-[timestamp].md` for ad-hoc reviews:
96
+
97
+ ```markdown
98
+ # Code Review Report
99
+ **Date:** [ISO-8601]
100
+ **Reviewer:** MindForge (code-quality + security-reviewer)
101
+ **Scope:** [what was reviewed]
102
+ **Files reviewed:** [N]
103
+
104
+ ## Summary
105
+ [2-3 sentences: overall quality, major themes, recommendation]
106
+
107
+ ## Findings
108
+
109
+ ### 🔴 Blocking (must fix before merge)
110
+ | # | File | Line | Issue | Recommendation |
111
+ |---|---|---|---|---|
112
+ | 1 | src/auth/login.ts | 47 | Parameterised query not used | Use `db.query('SELECT * FROM users WHERE id = $1', [id])` |
113
+
114
+ ### 🟠 Major (should fix in this PR)
115
+ | # | File | Line | Issue | Recommendation |
116
+ |---|---|---|---|---|
117
+ | 1 | src/api/users.ts | 23 | Function is 67 lines (limit: 40) | Extract `validateUserInput` to separate function |
118
+
119
+ ### 🟡 Minor (fix in follow-up)
120
+ | # | File | Line | Issue | Recommendation |
121
+ |---|---|---|---|---|
122
+ | 1 | src/models/order.ts | 8 | Missing JSDoc on exported function | Add `@param`, `@returns`, `@throws` |
123
+
124
+ ### 💡 Suggestions (optional improvements)
125
+ | # | File | Line | Suggestion |
126
+ |---|---|---|---|
127
+ | 1 | src/services/email.ts | 15 | Consider memoising the template compilation |
128
+
129
+ ## Metrics
130
+ - Files reviewed: [N]
131
+ - Lines reviewed: [N]
132
+ - Blocking findings: [N]
133
+ - Major findings: [N]
134
+ - Minor findings: [N]
135
+ - Suggestions: [N]
136
+
137
+ ## Verdict
138
+ ✅ APPROVED — No blocking or major findings
139
+ ⚠️ APPROVED WITH CONDITIONS — Fix [N] major findings
140
+ ❌ CHANGES REQUIRED — [N] blocking findings must be fixed
141
+ ```
142
+
143
+ ## Step 5 — Write AUDIT entry
144
+
145
+ ```json
146
+ {
147
+ "event": "code_review_completed",
148
+ "scope": "[what was reviewed]",
149
+ "files_reviewed": [N],
150
+ "blocking_findings": [N],
151
+ "major_findings": [N],
152
+ "verdict": "approved | changes_required",
153
+ "report_path": ".planning/.../CODE-REVIEW-[timestamp].md"
154
+ }
155
+ ```
156
+
157
+ ## Step 6 — Report to user
158
+
159
+ Display a summary of findings.
160
+ If blocking findings exist: do not allow merge.
161
+ Tell the user: "Fix the [N] blocking issues, then run /mindforge:review again to re-check."