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.
- package/.agent/CLAUDE.md +462 -0
- package/.agent/forge/help.md +7 -0
- package/.agent/forge/init-project.md +32 -0
- package/.agent/forge/plan-phase.md +30 -0
- package/.agent/mindforge/approve.md +18 -0
- package/.agent/mindforge/audit.md +30 -0
- package/.agent/mindforge/benchmark.md +33 -0
- package/.agent/mindforge/complete-milestone.md +18 -0
- package/.agent/mindforge/debug.md +126 -0
- package/.agent/mindforge/discuss-phase.md +138 -0
- package/.agent/mindforge/execute-phase.md +165 -0
- package/.agent/mindforge/health.md +21 -0
- package/.agent/mindforge/help.md +23 -0
- package/.agent/mindforge/init-org.md +131 -0
- package/.agent/mindforge/init-project.md +155 -0
- package/.agent/mindforge/install-skill.md +15 -0
- package/.agent/mindforge/map-codebase.md +298 -0
- package/.agent/mindforge/metrics.md +22 -0
- package/.agent/mindforge/migrate.md +40 -0
- package/.agent/mindforge/milestone.md +12 -0
- package/.agent/mindforge/next.md +105 -0
- package/.agent/mindforge/plan-phase.md +125 -0
- package/.agent/mindforge/plugins.md +40 -0
- package/.agent/mindforge/pr-review.md +41 -0
- package/.agent/mindforge/profile-team.md +23 -0
- package/.agent/mindforge/publish-skill.md +19 -0
- package/.agent/mindforge/quick.md +135 -0
- package/.agent/mindforge/release.md +10 -0
- package/.agent/mindforge/retrospective.md +26 -0
- package/.agent/mindforge/review.md +157 -0
- package/.agent/mindforge/security-scan.md +233 -0
- package/.agent/mindforge/ship.md +100 -0
- package/.agent/mindforge/skills.md +141 -0
- package/.agent/mindforge/status.md +104 -0
- package/.agent/mindforge/sync-confluence.md +11 -0
- package/.agent/mindforge/sync-jira.md +12 -0
- package/.agent/mindforge/tokens.md +8 -0
- package/.agent/mindforge/update.md +42 -0
- package/.agent/mindforge/verify-phase.md +62 -0
- package/.agent/mindforge/workspace.md +29 -0
- package/.claude/CLAUDE.md +462 -0
- package/.claude/commands/forge/help.md +7 -0
- package/.claude/commands/forge/init-project.md +32 -0
- package/.claude/commands/forge/plan-phase.md +30 -0
- package/.claude/commands/mindforge/approve.md +18 -0
- package/.claude/commands/mindforge/audit.md +30 -0
- package/.claude/commands/mindforge/benchmark.md +33 -0
- package/.claude/commands/mindforge/complete-milestone.md +18 -0
- package/.claude/commands/mindforge/debug.md +126 -0
- package/.claude/commands/mindforge/discuss-phase.md +138 -0
- package/.claude/commands/mindforge/execute-phase.md +165 -0
- package/.claude/commands/mindforge/health.md +21 -0
- package/.claude/commands/mindforge/help.md +23 -0
- package/.claude/commands/mindforge/init-org.md +131 -0
- package/.claude/commands/mindforge/init-project.md +155 -0
- package/.claude/commands/mindforge/install-skill.md +15 -0
- package/.claude/commands/mindforge/map-codebase.md +298 -0
- package/.claude/commands/mindforge/metrics.md +22 -0
- package/.claude/commands/mindforge/migrate.md +40 -0
- package/.claude/commands/mindforge/milestone.md +12 -0
- package/.claude/commands/mindforge/next.md +105 -0
- package/.claude/commands/mindforge/plan-phase.md +125 -0
- package/.claude/commands/mindforge/plugins.md +40 -0
- package/.claude/commands/mindforge/pr-review.md +41 -0
- package/.claude/commands/mindforge/profile-team.md +23 -0
- package/.claude/commands/mindforge/publish-skill.md +19 -0
- package/.claude/commands/mindforge/quick.md +135 -0
- package/.claude/commands/mindforge/release.md +10 -0
- package/.claude/commands/mindforge/retrospective.md +26 -0
- package/.claude/commands/mindforge/review.md +157 -0
- package/.claude/commands/mindforge/security-scan.md +233 -0
- package/.claude/commands/mindforge/ship.md +100 -0
- package/.claude/commands/mindforge/skills.md +141 -0
- package/.claude/commands/mindforge/status.md +104 -0
- package/.claude/commands/mindforge/sync-confluence.md +11 -0
- package/.claude/commands/mindforge/sync-jira.md +12 -0
- package/.claude/commands/mindforge/tokens.md +8 -0
- package/.claude/commands/mindforge/update.md +42 -0
- package/.claude/commands/mindforge/verify-phase.md +62 -0
- package/.claude/commands/mindforge/workspace.md +29 -0
- package/.forge/org/CONVENTIONS.md +0 -0
- package/.forge/org/ORG.md +0 -0
- package/.forge/org/SECURITY.md +0 -0
- package/.forge/org/TOOLS.md +0 -0
- package/.forge/personas/analyst.md +0 -0
- package/.forge/personas/architect.md +0 -0
- package/.forge/personas/debug-specialist.md +0 -0
- package/.forge/personas/developer.md +26 -0
- package/.forge/personas/qa-engineer.md +0 -0
- package/.forge/personas/release-manager.md +0 -0
- package/.forge/personas/security-reviewer.md +33 -0
- package/.forge/personas/tech-writer.md +0 -0
- package/.forge/skills/api-design/SKILL.md +0 -0
- package/.forge/skills/code-quality/SKILL.md +0 -0
- package/.forge/skills/documentation/SKILL.md +0 -0
- package/.forge/skills/security-review/SKILL.md +23 -0
- package/.forge/skills/testing-standards/SKILL.md +27 -0
- package/.github/workflows/mindforge-ci.yml +224 -0
- package/.gitlab-ci-mindforge.yml +18 -0
- package/.mindforge/MINDFORGE-SCHEMA.json +165 -0
- package/.mindforge/audit/AUDIT-SCHEMA.md +451 -0
- package/.mindforge/ci/ci-config-schema.md +21 -0
- package/.mindforge/ci/ci-mode.md +179 -0
- package/.mindforge/ci/github-actions-adapter.md +224 -0
- package/.mindforge/ci/gitlab-ci-adapter.md +31 -0
- package/.mindforge/ci/jenkins-adapter.md +44 -0
- package/.mindforge/distribution/registry-client.md +166 -0
- package/.mindforge/distribution/registry-schema.md +96 -0
- package/.mindforge/distribution/skill-publisher.md +44 -0
- package/.mindforge/distribution/skill-validator.md +74 -0
- package/.mindforge/engine/compaction-protocol.md +182 -0
- package/.mindforge/engine/context-injector.md +128 -0
- package/.mindforge/engine/dependency-parser.md +113 -0
- package/.mindforge/engine/skills/conflict-resolver.md +69 -0
- package/.mindforge/engine/skills/loader.md +184 -0
- package/.mindforge/engine/skills/registry.md +98 -0
- package/.mindforge/engine/skills/versioning.md +75 -0
- package/.mindforge/engine/verification-pipeline.md +111 -0
- package/.mindforge/engine/wave-executor.md +235 -0
- package/.mindforge/governance/GOVERNANCE-CONFIG.md +17 -0
- package/.mindforge/governance/approval-workflow.md +37 -0
- package/.mindforge/governance/change-classifier.md +63 -0
- package/.mindforge/governance/compliance-gates.md +31 -0
- package/.mindforge/integrations/confluence.md +27 -0
- package/.mindforge/integrations/connection-manager.md +163 -0
- package/.mindforge/integrations/github.md +25 -0
- package/.mindforge/integrations/gitlab.md +13 -0
- package/.mindforge/integrations/jira.md +102 -0
- package/.mindforge/integrations/slack.md +41 -0
- package/.mindforge/intelligence/antipattern-detector.md +75 -0
- package/.mindforge/intelligence/difficulty-scorer.md +55 -0
- package/.mindforge/intelligence/health-engine.md +208 -0
- package/.mindforge/intelligence/skill-gap-analyser.md +40 -0
- package/.mindforge/intelligence/smart-compaction.md +71 -0
- package/.mindforge/metrics/METRICS-SCHEMA.md +42 -0
- package/.mindforge/metrics/quality-tracker.md +32 -0
- package/.mindforge/monorepo/cross-package-planner.md +114 -0
- package/.mindforge/monorepo/dependency-graph-builder.md +32 -0
- package/.mindforge/monorepo/workspace-detector.md +129 -0
- package/.mindforge/org/CONVENTIONS.md +62 -0
- package/.mindforge/org/ORG.md +51 -0
- package/.mindforge/org/SECURITY.md +50 -0
- package/.mindforge/org/TOOLS.md +53 -0
- package/.mindforge/org/integrations/INTEGRATIONS-CONFIG.md +58 -0
- package/.mindforge/org/skills/MANIFEST.md +38 -0
- package/.mindforge/personas/analyst.md +52 -0
- package/.mindforge/personas/architect.md +75 -0
- package/.mindforge/personas/debug-specialist.md +52 -0
- package/.mindforge/personas/developer.md +85 -0
- package/.mindforge/personas/overrides/README.md +85 -0
- package/.mindforge/personas/qa-engineer.md +61 -0
- package/.mindforge/personas/release-manager.md +76 -0
- package/.mindforge/personas/security-reviewer.md +91 -0
- package/.mindforge/personas/tech-writer.md +51 -0
- package/.mindforge/plugins/PLUGINS-MANIFEST.md +23 -0
- package/.mindforge/plugins/plugin-loader.md +93 -0
- package/.mindforge/plugins/plugin-registry.md +44 -0
- package/.mindforge/plugins/plugin-schema.md +68 -0
- package/.mindforge/pr-review/ai-reviewer.md +266 -0
- package/.mindforge/pr-review/finding-formatter.md +46 -0
- package/.mindforge/pr-review/review-prompt-templates.md +44 -0
- package/.mindforge/production/compatibility-layer.md +39 -0
- package/.mindforge/production/migration-engine.md +52 -0
- package/.mindforge/production/production-checklist.md +165 -0
- package/.mindforge/production/token-optimiser.md +68 -0
- package/.mindforge/skills/accessibility/SKILL.md +106 -0
- package/.mindforge/skills/api-design/SKILL.md +98 -0
- package/.mindforge/skills/code-quality/SKILL.md +88 -0
- package/.mindforge/skills/data-privacy/SKILL.md +126 -0
- package/.mindforge/skills/database-patterns/SKILL.md +192 -0
- package/.mindforge/skills/documentation/SKILL.md +91 -0
- package/.mindforge/skills/incident-response/SKILL.md +180 -0
- package/.mindforge/skills/performance/SKILL.md +120 -0
- package/.mindforge/skills/security-review/SKILL.md +83 -0
- package/.mindforge/skills/testing-standards/SKILL.md +97 -0
- package/.mindforge/team/TEAM-PROFILE.md +42 -0
- package/.mindforge/team/multi-handoff.md +23 -0
- package/.mindforge/team/profiles/README.md +13 -0
- package/.mindforge/team/session-merger.md +18 -0
- package/.planning/ARCHITECTURE.md +0 -0
- package/.planning/AUDIT.jsonl +0 -0
- package/.planning/HANDOFF.json +28 -0
- package/.planning/PROJECT.md +33 -0
- package/.planning/RELEASE-CHECKLIST.md +68 -0
- package/.planning/REQUIREMENTS.md +0 -0
- package/.planning/ROADMAP.md +0 -0
- package/.planning/STATE.md +31 -0
- package/.planning/approvals/.gitkeep +1 -0
- package/.planning/archive/.gitkeep +1 -0
- package/.planning/audit-archive/.gitkeep +1 -0
- package/.planning/decisions/.gitkeep +0 -0
- package/.planning/decisions/ADR-001-handoff-tracking.md +41 -0
- package/.planning/decisions/ADR-002-markdown-commands.md +46 -0
- package/.planning/decisions/ADR-003-skills-trigger-model.md +37 -0
- package/.planning/decisions/ADR-004-wave-parallelism-model.md +45 -0
- package/.planning/decisions/ADR-005-append-only-audit-log.md +51 -0
- package/.planning/decisions/ADR-006-tiered-skills-system.md +22 -0
- package/.planning/decisions/ADR-007-trigger-keyword-model.md +22 -0
- package/.planning/decisions/ADR-008-just-in-time-skill-loading.md +29 -0
- package/.planning/decisions/ADR-009-enterprise-integration-retry-policy.md +8 -0
- package/.planning/decisions/ADR-010-governance-tier-escalation.md +8 -0
- package/.planning/decisions/ADR-011-multi-developer-handoff-contract.md +8 -0
- package/.planning/decisions/ADR-012-intelligence-feedback-loops.md +19 -0
- package/.planning/decisions/ADR-013-mindforge-md-constitution.md +16 -0
- package/.planning/decisions/ADR-014-metrics-as-signals-not-evaluation.md +15 -0
- package/.planning/decisions/ADR-015-npm-based-skill-registry.md +26 -0
- package/.planning/decisions/ADR-016-ci-exit-code-0-on-timeout.md +27 -0
- package/.planning/decisions/ADR-017-sdk-localhost-only.md +28 -0
- package/.planning/decisions/ADR-018-installer-self-install-detection.md +15 -0
- package/.planning/decisions/ADR-019-self-update-scope-preservation.md +14 -0
- package/.planning/decisions/ADR-020-v1.0.0-stable-interface-contract.md +23 -0
- package/.planning/jira-sync.json +9 -0
- package/.planning/milestones/.gitkeep +1 -0
- package/.planning/phases/day1/REVIEW-DAY1.md +50 -0
- package/.planning/phases/day1/SECURITY-REVIEW-DAY1.md +15 -0
- package/.planning/phases/day2/REVIEW-DAY2.md +521 -0
- package/.planning/phases/day3/REVIEW-DAY3.md +234 -0
- package/.planning/slack-threads.json +6 -0
- package/CHANGELOG.md +175 -0
- package/LICENSE +21 -0
- package/MINDFORGE.md +76 -0
- package/README.md +182 -0
- package/RELEASENOTES.md +41 -0
- package/SECURITY.md +4 -0
- package/bin/install.js +120 -0
- package/bin/installer-core.js +292 -0
- package/bin/migrations/0.1.0-to-0.5.0.js +37 -0
- package/bin/migrations/0.5.0-to-0.6.0.js +17 -0
- package/bin/migrations/0.6.0-to-1.0.0.js +100 -0
- package/bin/migrations/migrate.js +151 -0
- package/bin/migrations/schema-versions.js +64 -0
- package/bin/updater/changelog-fetcher.js +62 -0
- package/bin/updater/self-update.js +169 -0
- package/bin/updater/version-comparator.js +68 -0
- package/bin/validate-config.js +92 -0
- package/bin/wizard/config-generator.js +112 -0
- package/bin/wizard/environment-detector.js +76 -0
- package/bin/wizard/setup-wizard.js +237 -0
- package/docs/Context/Master-Context.md +701 -0
- package/docs/architecture/README.md +35 -0
- package/docs/architecture/decision-records-index.md +26 -0
- package/docs/ci-cd-integration.md +30 -0
- package/docs/ci-quickstart.md +78 -0
- package/docs/commands-reference.md +11 -0
- package/docs/contributing/CONTRIBUTING.md +38 -0
- package/docs/contributing/plugin-authoring.md +50 -0
- package/docs/contributing/skill-authoring.md +41 -0
- package/docs/enterprise-setup.md +25 -0
- package/docs/faq.md +38 -0
- package/docs/getting-started.md +36 -0
- package/docs/governance-guide.md +23 -0
- package/docs/mindforge-md-reference.md +53 -0
- package/docs/monorepo-guide.md +26 -0
- package/docs/persona-customisation.md +56 -0
- package/docs/quick-verify.md +33 -0
- package/docs/reference/audit-events.md +53 -0
- package/docs/reference/commands.md +82 -0
- package/docs/reference/config-reference.md +64 -0
- package/docs/reference/sdk-api.md +48 -0
- package/docs/reference/skills-api.md +57 -0
- package/docs/release-checklist-guide.md +37 -0
- package/docs/requirements.md +29 -0
- package/docs/sdk-reference.md +27 -0
- package/docs/security/SECURITY.md +42 -0
- package/docs/security/penetration-test-results.md +31 -0
- package/docs/security/threat-model.md +142 -0
- package/docs/skills-authoring-guide.md +119 -0
- package/docs/skills-publishing-guide.md +21 -0
- package/docs/team-setup-guide.md +21 -0
- package/docs/troubleshooting.md +119 -0
- package/docs/tutorial.md +195 -0
- package/docs/upgrade.md +44 -0
- package/docs/user-guide.md +131 -0
- package/docs/usp-features.md +214 -0
- package/eslint.config.mjs +31 -0
- package/examples/starter-project/.planning/AUDIT.jsonl +1 -0
- package/examples/starter-project/.planning/HANDOFF.json +23 -0
- package/examples/starter-project/.planning/PROJECT.md +27 -0
- package/examples/starter-project/.planning/STATE.md +10 -0
- package/examples/starter-project/MINDFORGE.md +40 -0
- package/examples/starter-project/README.md +14 -0
- package/implementation-roadmap/day-1-imp/DAY1-HARDEN.md +823 -0
- package/implementation-roadmap/day-1-imp/DAY1-IMPLEMENT.md +2459 -0
- package/implementation-roadmap/day-1-imp/DAY1-REVIEW.md +288 -0
- package/implementation-roadmap/day-2-imp/DAY2-HARDEN.md +954 -0
- package/implementation-roadmap/day-2-imp/DAY2-IMPLEMENT.md +2347 -0
- package/implementation-roadmap/day-2-imp/DAY2-REVIEW.md +422 -0
- package/implementation-roadmap/day-3-imp/DAY3-HARDEN.md +870 -0
- package/implementation-roadmap/day-3-imp/DAY3-IMPLEMENT.md +2798 -0
- package/implementation-roadmap/day-3-imp/DAY3-REVIEW.md +484 -0
- package/implementation-roadmap/day-4-imp/DAY4-HARDEN.md +1087 -0
- package/implementation-roadmap/day-4-imp/DAY4-IMPLEMENT.md +2874 -0
- package/implementation-roadmap/day-4-imp/DAY4-REVIEW.md +386 -0
- package/implementation-roadmap/day-5-imp/DAY5-HARDEN.md +1078 -0
- package/implementation-roadmap/day-5-imp/DAY5-IMPLEMENT.md +3151 -0
- package/implementation-roadmap/day-5-imp/DAY5-REVIEW.md +345 -0
- package/implementation-roadmap/day-6-imp/DAY6-COMPLETE.md +3919 -0
- package/implementation-roadmap/day-7-imp-prod/DAY7-PRODUCTION-FINAL.md +4513 -0
- package/package.json +31 -0
- package/sdk/README.md +69 -0
- package/sdk/eslint.config.mjs +34 -0
- package/sdk/package-lock.json +1507 -0
- package/sdk/package.json +30 -0
- package/sdk/src/client.ts +133 -0
- package/sdk/src/commands.ts +63 -0
- package/sdk/src/events.ts +166 -0
- package/sdk/src/index.ts +22 -0
- package/sdk/src/types.ts +87 -0
- package/sdk/tsconfig.json +13 -0
- package/tests/audit.test.js +206 -0
- package/tests/ci-mode.test.js +162 -0
- package/tests/compaction.test.js +161 -0
- package/tests/distribution.test.js +205 -0
- package/tests/e2e.test.js +618 -0
- package/tests/governance.test.js +130 -0
- package/tests/install.test.js +209 -0
- package/tests/integrations.test.js +128 -0
- package/tests/intelligence.test.js +117 -0
- package/tests/metrics.test.js +96 -0
- package/tests/migration.test.js +309 -0
- package/tests/production.test.js +416 -0
- package/tests/sdk.test.js +200 -0
- package/tests/skills-platform.test.js +403 -0
- package/tests/wave-engine.test.js +338 -0
|
@@ -0,0 +1,3151 @@
|
|
|
1
|
+
# MindForge — Day 5 Implementation Prompt
|
|
2
|
+
# Branch: `feat/mindforge-intelligence-layer`
|
|
3
|
+
# Prerequisite: `feat/mindforge-enterprise-integrations` merged to `main`
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## BRANCH SETUP (run before anything else)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
git checkout main
|
|
11
|
+
git pull origin main
|
|
12
|
+
git checkout -b feat/mindforge-intelligence-layer
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Verify all prior days are present and passing:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
ls .mindforge/governance/compliance-gates.md # Day 4 governance
|
|
19
|
+
ls .mindforge/integrations/connection-manager.md # Day 4 integrations
|
|
20
|
+
ls .claude/commands/mindforge/approve.md # Day 4 commands
|
|
21
|
+
cat package.json | grep '"version"' # Must be "0.4.0"
|
|
22
|
+
node tests/install.test.js && \
|
|
23
|
+
node tests/wave-engine.test.js && \
|
|
24
|
+
node tests/audit.test.js && \
|
|
25
|
+
node tests/compaction.test.js && \
|
|
26
|
+
node tests/skills-platform.test.js && \
|
|
27
|
+
node tests/integrations.test.js && \
|
|
28
|
+
node tests/governance.test.js
|
|
29
|
+
# All 7 suites must pass before Day 5 begins
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## DAY 5 SCOPE
|
|
35
|
+
|
|
36
|
+
Day 5 builds the **Intelligence & Observability Layer** — the components that
|
|
37
|
+
make MindForge self-aware, self-improving, and genuinely intelligent about your
|
|
38
|
+
team's patterns, gaps, and quality trends over time.
|
|
39
|
+
|
|
40
|
+
| Component | Description |
|
|
41
|
+
|---|---|
|
|
42
|
+
| Framework Health Engine | Deep self-diagnostic: validates every MindForge component, detects drift, offers auto-repair |
|
|
43
|
+
| Intelligent Context Compaction | AI-summarised state preservation — structured insight extraction, not truncation |
|
|
44
|
+
| Phase Difficulty Scorer | Estimates effort, risk, and complexity before planning begins |
|
|
45
|
+
| Anti-Pattern Detection Engine | Proactively flags known failure patterns across code, architecture, and process |
|
|
46
|
+
| Skill Gap Analyser | Identifies missing skills for the next phase based on planned work |
|
|
47
|
+
| Team Profile System | Captures team capabilities, preferences, and working patterns for personalised agent responses |
|
|
48
|
+
| Agent Performance Metrics | Tracks quality scores, verify pass rates, and trend analysis across sessions |
|
|
49
|
+
| MINDFORGE.md | Project-level master override for all MindForge defaults — the "project constitution" |
|
|
50
|
+
| Interactive Setup Wizard | `npx mindforge-cc` guided first-run experience with environment detection |
|
|
51
|
+
| `/mindforge:health` | Comprehensive health check with auto-repair for drift and corruption |
|
|
52
|
+
| `/mindforge:retrospective` | Structured phase and milestone retrospectives with action item tracking |
|
|
53
|
+
| `/mindforge:profile-team` | Generate and maintain team capability profiles |
|
|
54
|
+
| `/mindforge:metrics` | Quality metrics dashboard with trend analysis |
|
|
55
|
+
| Day 5 test suite | `tests/intelligence.test.js`, `tests/metrics.test.js` |
|
|
56
|
+
|
|
57
|
+
**Do not** implement on Day 5:
|
|
58
|
+
- Public skills registry on npm (Day 6+)
|
|
59
|
+
- AI-generated PR code reviews (Day 6+)
|
|
60
|
+
- Multi-repo support (Day 6+)
|
|
61
|
+
- Real-time collaboration websockets (Day 6+)
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## TASK 1 — Scaffold Day 5 directory additions
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Intelligence engine
|
|
69
|
+
mkdir -p .mindforge/intelligence
|
|
70
|
+
touch .mindforge/intelligence/health-engine.md
|
|
71
|
+
touch .mindforge/intelligence/difficulty-scorer.md
|
|
72
|
+
touch .mindforge/intelligence/antipattern-detector.md
|
|
73
|
+
touch .mindforge/intelligence/skill-gap-analyser.md
|
|
74
|
+
touch .mindforge/intelligence/smart-compaction.md
|
|
75
|
+
|
|
76
|
+
# Team & metrics
|
|
77
|
+
mkdir -p .mindforge/team/profiles
|
|
78
|
+
touch .mindforge/team/TEAM-PROFILE.md
|
|
79
|
+
touch .mindforge/team/profiles/README.md
|
|
80
|
+
mkdir -p .mindforge/metrics
|
|
81
|
+
touch .mindforge/metrics/METRICS-SCHEMA.md
|
|
82
|
+
touch .mindforge/metrics/quality-tracker.md
|
|
83
|
+
|
|
84
|
+
# Project constitution
|
|
85
|
+
touch MINDFORGE.md
|
|
86
|
+
|
|
87
|
+
# New commands
|
|
88
|
+
touch .claude/commands/mindforge/health.md
|
|
89
|
+
touch .claude/commands/mindforge/retrospective.md
|
|
90
|
+
touch .claude/commands/mindforge/profile-team.md
|
|
91
|
+
touch .claude/commands/mindforge/metrics.md
|
|
92
|
+
|
|
93
|
+
# Mirror to Antigravity
|
|
94
|
+
for cmd in health retrospective profile-team metrics; do
|
|
95
|
+
cp .claude/commands/mindforge/${cmd}.md .agent/mindforge/${cmd}.md
|
|
96
|
+
done
|
|
97
|
+
|
|
98
|
+
# Setup wizard
|
|
99
|
+
mkdir -p bin/wizard
|
|
100
|
+
touch bin/wizard/setup-wizard.js
|
|
101
|
+
touch bin/wizard/environment-detector.js
|
|
102
|
+
touch bin/wizard/config-generator.js
|
|
103
|
+
|
|
104
|
+
# Tests
|
|
105
|
+
touch tests/intelligence.test.js
|
|
106
|
+
touch tests/metrics.test.js
|
|
107
|
+
|
|
108
|
+
# Docs
|
|
109
|
+
touch docs/mindforge-md-reference.md
|
|
110
|
+
touch docs/team-setup-guide.md
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Commit:**
|
|
114
|
+
```bash
|
|
115
|
+
git add .
|
|
116
|
+
git commit -m "chore(day5): scaffold Day 5 intelligence layer directory structure"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## TASK 2 — Write the Framework Health Engine
|
|
122
|
+
|
|
123
|
+
The health engine is MindForge's self-diagnostic system. It validates every
|
|
124
|
+
component, detects configuration drift, and offers targeted auto-repair.
|
|
125
|
+
|
|
126
|
+
### `.mindforge/intelligence/health-engine.md`
|
|
127
|
+
|
|
128
|
+
```markdown
|
|
129
|
+
# MindForge Intelligence — Health Engine
|
|
130
|
+
|
|
131
|
+
## Purpose
|
|
132
|
+
Perform a comprehensive health check of the MindForge installation and project
|
|
133
|
+
state. Detect missing files, broken configurations, stale state, version
|
|
134
|
+
mismatches, and integration connectivity issues. Offer auto-repair for common
|
|
135
|
+
problems.
|
|
136
|
+
|
|
137
|
+
## Health check categories
|
|
138
|
+
|
|
139
|
+
The health engine runs checks in seven categories, in this order:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
Category 1: Installation integrity
|
|
143
|
+
Category 2: Context file health
|
|
144
|
+
Category 3: Skills registry health
|
|
145
|
+
Category 4: Persona system health
|
|
146
|
+
Category 5: State consistency
|
|
147
|
+
Category 6: Integration connectivity
|
|
148
|
+
Category 7: Security configuration
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Category 1 — Installation Integrity
|
|
154
|
+
|
|
155
|
+
Check that every required MindForge file exists and has content.
|
|
156
|
+
|
|
157
|
+
### Required files checklist
|
|
158
|
+
```bash
|
|
159
|
+
REQUIRED_FILES=(
|
|
160
|
+
# Core entry points
|
|
161
|
+
".claude/CLAUDE.md"
|
|
162
|
+
".agent/CLAUDE.md"
|
|
163
|
+
|
|
164
|
+
# Commands — Claude Code
|
|
165
|
+
".claude/commands/mindforge/help.md"
|
|
166
|
+
".claude/commands/mindforge/init-project.md"
|
|
167
|
+
".claude/commands/mindforge/plan-phase.md"
|
|
168
|
+
".claude/commands/mindforge/execute-phase.md"
|
|
169
|
+
".claude/commands/mindforge/verify-phase.md"
|
|
170
|
+
".claude/commands/mindforge/ship.md"
|
|
171
|
+
".claude/commands/mindforge/next.md"
|
|
172
|
+
".claude/commands/mindforge/quick.md"
|
|
173
|
+
".claude/commands/mindforge/status.md"
|
|
174
|
+
".claude/commands/mindforge/debug.md"
|
|
175
|
+
".claude/commands/mindforge/skills.md"
|
|
176
|
+
".claude/commands/mindforge/review.md"
|
|
177
|
+
".claude/commands/mindforge/security-scan.md"
|
|
178
|
+
".claude/commands/mindforge/map-codebase.md"
|
|
179
|
+
".claude/commands/mindforge/discuss-phase.md"
|
|
180
|
+
".claude/commands/mindforge/audit.md"
|
|
181
|
+
".claude/commands/mindforge/milestone.md"
|
|
182
|
+
".claude/commands/mindforge/complete-milestone.md"
|
|
183
|
+
".claude/commands/mindforge/approve.md"
|
|
184
|
+
".claude/commands/mindforge/sync-jira.md"
|
|
185
|
+
".claude/commands/mindforge/sync-confluence.md"
|
|
186
|
+
".claude/commands/mindforge/health.md"
|
|
187
|
+
".claude/commands/mindforge/retrospective.md"
|
|
188
|
+
".claude/commands/mindforge/profile-team.md"
|
|
189
|
+
".claude/commands/mindforge/metrics.md"
|
|
190
|
+
|
|
191
|
+
# Engine
|
|
192
|
+
".mindforge/engine/wave-executor.md"
|
|
193
|
+
".mindforge/engine/dependency-parser.md"
|
|
194
|
+
".mindforge/engine/context-injector.md"
|
|
195
|
+
".mindforge/engine/compaction-protocol.md"
|
|
196
|
+
".mindforge/engine/verification-pipeline.md"
|
|
197
|
+
".mindforge/engine/skills/registry.md"
|
|
198
|
+
".mindforge/engine/skills/loader.md"
|
|
199
|
+
".mindforge/engine/skills/versioning.md"
|
|
200
|
+
".mindforge/engine/skills/conflict-resolver.md"
|
|
201
|
+
|
|
202
|
+
# Skills — all 10
|
|
203
|
+
".mindforge/skills/security-review/SKILL.md"
|
|
204
|
+
".mindforge/skills/code-quality/SKILL.md"
|
|
205
|
+
".mindforge/skills/api-design/SKILL.md"
|
|
206
|
+
".mindforge/skills/testing-standards/SKILL.md"
|
|
207
|
+
".mindforge/skills/documentation/SKILL.md"
|
|
208
|
+
".mindforge/skills/performance/SKILL.md"
|
|
209
|
+
".mindforge/skills/accessibility/SKILL.md"
|
|
210
|
+
".mindforge/skills/data-privacy/SKILL.md"
|
|
211
|
+
".mindforge/skills/incident-response/SKILL.md"
|
|
212
|
+
".mindforge/skills/database-patterns/SKILL.md"
|
|
213
|
+
|
|
214
|
+
# Personas — all 8
|
|
215
|
+
".mindforge/personas/analyst.md"
|
|
216
|
+
".mindforge/personas/architect.md"
|
|
217
|
+
".mindforge/personas/developer.md"
|
|
218
|
+
".mindforge/personas/qa-engineer.md"
|
|
219
|
+
".mindforge/personas/security-reviewer.md"
|
|
220
|
+
".mindforge/personas/tech-writer.md"
|
|
221
|
+
".mindforge/personas/debug-specialist.md"
|
|
222
|
+
".mindforge/personas/release-manager.md"
|
|
223
|
+
|
|
224
|
+
# Governance
|
|
225
|
+
".mindforge/governance/change-classifier.md"
|
|
226
|
+
".mindforge/governance/approval-workflow.md"
|
|
227
|
+
".mindforge/governance/compliance-gates.md"
|
|
228
|
+
|
|
229
|
+
# Org context
|
|
230
|
+
".mindforge/org/ORG.md"
|
|
231
|
+
".mindforge/org/CONVENTIONS.md"
|
|
232
|
+
".mindforge/org/SECURITY.md"
|
|
233
|
+
".mindforge/org/TOOLS.md"
|
|
234
|
+
".mindforge/org/skills/MANIFEST.md"
|
|
235
|
+
".mindforge/org/integrations/INTEGRATIONS-CONFIG.md"
|
|
236
|
+
|
|
237
|
+
# Planning state
|
|
238
|
+
".planning/HANDOFF.json"
|
|
239
|
+
".planning/STATE.md"
|
|
240
|
+
".planning/AUDIT.jsonl"
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
for FILE in "${REQUIRED_FILES[@]}"; do
|
|
244
|
+
if [ ! -f "${FILE}" ]; then
|
|
245
|
+
echo "MISSING: ${FILE}"
|
|
246
|
+
elif [ ! -s "${FILE}" ]; then
|
|
247
|
+
echo "EMPTY: ${FILE}"
|
|
248
|
+
fi
|
|
249
|
+
done
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Version check
|
|
253
|
+
```bash
|
|
254
|
+
# Verify package.json version matches the expected minimum
|
|
255
|
+
CURRENT_VERSION=$(node -e "console.log(require('./package.json').version)")
|
|
256
|
+
MINIMUM_VERSION="0.5.0"
|
|
257
|
+
# Compare semver: if current < minimum, flag as outdated
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### CLAUDE.md parity check
|
|
261
|
+
```bash
|
|
262
|
+
# Verify .claude/CLAUDE.md and .agent/CLAUDE.md are identical
|
|
263
|
+
if ! diff -q .claude/CLAUDE.md .agent/CLAUDE.md > /dev/null 2>&1; then
|
|
264
|
+
echo "DRIFT: .claude/CLAUDE.md and .agent/CLAUDE.md have diverged"
|
|
265
|
+
echo "Fix: cp .claude/CLAUDE.md .agent/CLAUDE.md"
|
|
266
|
+
fi
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Command parity check
|
|
270
|
+
```bash
|
|
271
|
+
# All commands in .claude/commands/mindforge/ must exist in .agent/mindforge/
|
|
272
|
+
CLAUDE_CMDS=$(ls .claude/commands/mindforge/ | sort)
|
|
273
|
+
AGENT_CMDS=$(ls .agent/mindforge/ | sort)
|
|
274
|
+
diff <(echo "${CLAUDE_CMDS}") <(echo "${AGENT_CMDS}") | grep "^[<>]" && \
|
|
275
|
+
echo "DRIFT: command files differ between runtimes"
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## Category 2 — Context File Health
|
|
281
|
+
|
|
282
|
+
Check that project context files exist, have content, and are not stale.
|
|
283
|
+
|
|
284
|
+
```markdown
|
|
285
|
+
### PROJECT.md health
|
|
286
|
+
- [ ] File exists
|
|
287
|
+
- [ ] Has "## Tech stack" section with at least one entry
|
|
288
|
+
- [ ] Has "## v1 scope — IN" section
|
|
289
|
+
- [ ] Has "## Success criteria" section
|
|
290
|
+
- [ ] Does NOT contain placeholder text: "[project name]", "[placeholder]", "TODO"
|
|
291
|
+
|
|
292
|
+
### REQUIREMENTS.md health
|
|
293
|
+
- [ ] File exists
|
|
294
|
+
- [ ] Has at least one FR-NN requirement
|
|
295
|
+
- [ ] All requirements have acceptance criteria
|
|
296
|
+
- [ ] All requirements have scope tags (v1/v2/out)
|
|
297
|
+
|
|
298
|
+
### STATE.md health
|
|
299
|
+
- [ ] File exists
|
|
300
|
+
- [ ] "Last updated" timestamp is within 30 days
|
|
301
|
+
(if > 30 days: warn "STATE.md may be stale — has the project been active?")
|
|
302
|
+
- [ ] Does not show "Ready for next milestone" with no subsequent activity
|
|
303
|
+
(indicates a milestone was completed but next one never started)
|
|
304
|
+
|
|
305
|
+
### HANDOFF.json health
|
|
306
|
+
- [ ] File is valid JSON
|
|
307
|
+
- [ ] Has all required fields: schema_version, next_task, _warning, context_refs
|
|
308
|
+
- [ ] updated_at is within 7 days (if project is active)
|
|
309
|
+
- [ ] Does NOT contain any credential patterns
|
|
310
|
+
(scan for: password=, token=, api_key=, sk-, ghp_, xoxb-)
|
|
311
|
+
|
|
312
|
+
### ARCHITECTURE.md health
|
|
313
|
+
- [ ] File exists (warn if not — architecture decisions should be documented)
|
|
314
|
+
- [ ] Has "## Technology stack" section
|
|
315
|
+
- [ ] Has at least one ADR reference OR decisions/ directory exists
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Category 3 — Skills Registry Health
|
|
321
|
+
|
|
322
|
+
```markdown
|
|
323
|
+
### MANIFEST.md validation
|
|
324
|
+
- [ ] File exists at .mindforge/org/skills/MANIFEST.md
|
|
325
|
+
- [ ] All 10 core skills are listed
|
|
326
|
+
- [ ] Every skill entry has a valid semver version
|
|
327
|
+
- [ ] Every path in the manifest resolves to an existing SKILL.md
|
|
328
|
+
|
|
329
|
+
### Individual skill validation
|
|
330
|
+
For each SKILL.md: frontmatter has name, version, status, triggers
|
|
331
|
+
- [ ] name matches directory name
|
|
332
|
+
- [ ] version is valid semver
|
|
333
|
+
- [ ] triggers list has >= 10 keywords
|
|
334
|
+
- [ ] Mandatory actions section present
|
|
335
|
+
- [ ] Self-check / checklist section present
|
|
336
|
+
- [ ] No placeholder text remaining
|
|
337
|
+
|
|
338
|
+
### Trigger conflict report
|
|
339
|
+
Run conflict detection (per conflict-resolver.md).
|
|
340
|
+
Report: "N trigger conflicts detected — run /mindforge:skills validate for details"
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Category 4 — Persona System Health
|
|
346
|
+
|
|
347
|
+
```markdown
|
|
348
|
+
### Persona file validation
|
|
349
|
+
For each of the 8 persona files:
|
|
350
|
+
- [ ] Has Identity section
|
|
351
|
+
- [ ] Has Pre-task checklist
|
|
352
|
+
- [ ] Has Escalation conditions section
|
|
353
|
+
- [ ] Has Definition of done section
|
|
354
|
+
- [ ] File size > 500 bytes (not a stub)
|
|
355
|
+
|
|
356
|
+
### Override system health
|
|
357
|
+
- [ ] .mindforge/personas/overrides/ directory exists
|
|
358
|
+
- [ ] No override files contain injection-pattern keywords
|
|
359
|
+
(IGNORE ALL PREVIOUS INSTRUCTIONS, DISREGARD, OVERRIDE:)
|
|
360
|
+
- [ ] Phase-level overrides match an existing persona name
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Category 5 — State Consistency
|
|
366
|
+
|
|
367
|
+
```markdown
|
|
368
|
+
### Phase state consistency
|
|
369
|
+
For each phase listed in ROADMAP.md:
|
|
370
|
+
Check: does the phase directory exist at .planning/phases/[N]/?
|
|
371
|
+
Check: do PLAN files exist if phase status is "planned" or beyond?
|
|
372
|
+
Check: do SUMMARY files exist for all plans if phase status is "complete"?
|
|
373
|
+
Check: does VERIFICATION.md exist if phase status is "complete"?
|
|
374
|
+
Check: does UAT.md exist if phase status is "shipped"?
|
|
375
|
+
|
|
376
|
+
Flag any inconsistency: e.g., "Phase 2 is marked complete in STATE.md but
|
|
377
|
+
VERIFICATION.md is missing."
|
|
378
|
+
|
|
379
|
+
### AUDIT.jsonl consistency
|
|
380
|
+
- [ ] File is valid JSONL (all lines parse as JSON)
|
|
381
|
+
- [ ] All entries have required universal fields
|
|
382
|
+
- [ ] Timestamps are chronological
|
|
383
|
+
- [ ] Entry count: report total, flag if approaching 10,000 (archive threshold)
|
|
384
|
+
|
|
385
|
+
### Git history consistency
|
|
386
|
+
- [ ] MindForge commits use Conventional Commits format
|
|
387
|
+
(check last 20 commits: any without type(scope): format?)
|
|
388
|
+
- [ ] No "WIP" commits on main branch
|
|
389
|
+
(WIP commits are acceptable on feature branches, not on main)
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## Category 6 — Integration Connectivity
|
|
395
|
+
|
|
396
|
+
```markdown
|
|
397
|
+
### Per integration (only if credentials are configured):
|
|
398
|
+
Run the health check from connection-manager.md for each configured integration.
|
|
399
|
+
|
|
400
|
+
Jira: GET /rest/api/3/myself → expect 200
|
|
401
|
+
Confluence: GET /wiki/api/v2/spaces → expect 200
|
|
402
|
+
Slack: GET https://slack.com/api/auth.test → expect 200 with ok:true
|
|
403
|
+
GitHub: GET https://api.github.com/user → expect 200
|
|
404
|
+
GitLab: GET /api/v4/user → expect 200
|
|
405
|
+
|
|
406
|
+
For each: report status — available / invalid_credentials / unreachable / unconfigured
|
|
407
|
+
For unconfigured: note which env vars are needed (not a failure — just informational)
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## Category 7 — Security Configuration
|
|
413
|
+
|
|
414
|
+
```markdown
|
|
415
|
+
### .gitignore completeness
|
|
416
|
+
- [ ] node_modules/ is ignored
|
|
417
|
+
- [ ] .env and .env.* are ignored
|
|
418
|
+
- [ ] *.key and *.pem are ignored
|
|
419
|
+
- [ ] If public repo: .planning/SECURITY-SCAN-*.md is ignored
|
|
420
|
+
|
|
421
|
+
### No secrets in committed files
|
|
422
|
+
Run lightweight secret scan across .planning/ and .mindforge/ directories:
|
|
423
|
+
Pattern: any line matching password=, token=, api_key=, sk-, ghp_, xoxb-
|
|
424
|
+
Exclude: template placeholders and example values
|
|
425
|
+
|
|
426
|
+
### SECURITY.md placeholder detection
|
|
427
|
+
- [ ] .mindforge/org/SECURITY.md does not contain [placeholder] text
|
|
428
|
+
- [ ] If it does: warn "SECURITY.md has unfilled sections — agents will receive
|
|
429
|
+
incomplete security guidance"
|
|
430
|
+
|
|
431
|
+
### Approval directory
|
|
432
|
+
- [ ] .planning/approvals/ exists (if governance is being used)
|
|
433
|
+
- [ ] No approval files with status "pending" older than the configured SLA
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## Auto-repair protocol
|
|
439
|
+
|
|
440
|
+
When health check is run with `--repair` flag:
|
|
441
|
+
|
|
442
|
+
### Auto-repairable issues
|
|
443
|
+
| Issue | Auto-repair action |
|
|
444
|
+
|---|---|
|
|
445
|
+
| .agent/CLAUDE.md out of sync | `cp .claude/CLAUDE.md .agent/CLAUDE.md` |
|
|
446
|
+
| Command file missing from .agent/ | `cp .claude/commands/mindforge/X.md .agent/mindforge/X.md` |
|
|
447
|
+
| AUDIT.jsonl has invalid JSON lines | Remove invalid lines, log removed count |
|
|
448
|
+
| STATE.md missing "Last updated" | Append current timestamp |
|
|
449
|
+
| .planning/approvals/ missing | `mkdir -p .planning/approvals/` |
|
|
450
|
+
| Expired approvals not processed | Mark expired, write AUDIT entries |
|
|
451
|
+
| AUDIT.jsonl exceeds 10K lines | Run archive protocol |
|
|
452
|
+
|
|
453
|
+
### Non-auto-repairable issues (require human action)
|
|
454
|
+
| Issue | Required action |
|
|
455
|
+
|---|---|
|
|
456
|
+
| Missing core SKILL.md | Reinstall MindForge: `npx mindforge-cc@latest` |
|
|
457
|
+
| Credentials invalid (401) | Update environment variable with new token |
|
|
458
|
+
| HANDOFF.json contains credentials | Remove secret, rotate credential, clean file |
|
|
459
|
+
| Persona file with injection patterns | Manual review and removal |
|
|
460
|
+
| Missing REQUIREMENTS.md content | Run /mindforge:init-project |
|
|
461
|
+
|
|
462
|
+
## Health report format
|
|
463
|
+
|
|
464
|
+
```markdown
|
|
465
|
+
# MindForge Health Report
|
|
466
|
+
**Date:** [ISO-8601]
|
|
467
|
+
**Version:** v[X.Y.Z]
|
|
468
|
+
**Project:** [from PROJECT.md]
|
|
469
|
+
|
|
470
|
+
## Summary
|
|
471
|
+
| Category | Status | Issues |
|
|
472
|
+
|---|---|---|
|
|
473
|
+
| Installation | ✅ Healthy | 0 |
|
|
474
|
+
| Context files | ⚠️ Warning | 2 warnings |
|
|
475
|
+
| Skills registry | ✅ Healthy | 0 |
|
|
476
|
+
| Persona system | ✅ Healthy | 0 |
|
|
477
|
+
| State consistency | ❌ Issues | 1 error |
|
|
478
|
+
| Integration connectivity | ✅ Healthy | 0 (2 unconfigured) |
|
|
479
|
+
| Security configuration | ⚠️ Warning | 1 warning |
|
|
480
|
+
|
|
481
|
+
**Overall:** ⚠️ 3 issues found (1 error, 2 warnings) — run /mindforge:health --repair
|
|
482
|
+
|
|
483
|
+
## Errors (must fix)
|
|
484
|
+
[Error 1]: Phase 2 marked complete in STATE.md but VERIFICATION.md missing
|
|
485
|
+
Fix: Run /mindforge:verify-phase 2 to create the verification record.
|
|
486
|
+
|
|
487
|
+
## Warnings (should fix)
|
|
488
|
+
[Warning 1]: STATE.md last updated 45 days ago — may be stale
|
|
489
|
+
[Warning 2]: SECURITY.md has 3 unfilled placeholder sections
|
|
490
|
+
|
|
491
|
+
## Informational
|
|
492
|
+
[Info 1]: Jira unconfigured (set JIRA_API_TOKEN to enable)
|
|
493
|
+
[Info 2]: AUDIT.jsonl has 8,234 entries (archive threshold: 10,000)
|
|
494
|
+
```
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
**Commit:**
|
|
498
|
+
```bash
|
|
499
|
+
git add .mindforge/intelligence/health-engine.md
|
|
500
|
+
git commit -m "feat(intelligence): implement comprehensive health engine with auto-repair"
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
## TASK 3 — Write the Intelligent Context Compaction Engine
|
|
506
|
+
|
|
507
|
+
Replace the basic compaction protocol from Day 2 with an AI-powered
|
|
508
|
+
summarisation system that extracts structured insights rather than truncating.
|
|
509
|
+
|
|
510
|
+
### `.mindforge/intelligence/smart-compaction.md`
|
|
511
|
+
|
|
512
|
+
```markdown
|
|
513
|
+
# MindForge Intelligence — Smart Context Compaction
|
|
514
|
+
|
|
515
|
+
## Purpose
|
|
516
|
+
Replace brute-force context truncation with intelligent, structured insight
|
|
517
|
+
extraction. When context reaches 70%, don't just cut off the oldest messages —
|
|
518
|
+
distil them into precise, high-value summaries that preserve the reasoning,
|
|
519
|
+
not just the facts.
|
|
520
|
+
|
|
521
|
+
## Compaction quality levels
|
|
522
|
+
|
|
523
|
+
### Level 1 — Lightweight (context at 70-79%)
|
|
524
|
+
Quick state capture: commit in-progress work, write HANDOFF.json, update STATE.md.
|
|
525
|
+
Time cost: ~30 seconds. No AI summarisation needed.
|
|
526
|
+
Use when: context is elevated but not critical.
|
|
527
|
+
|
|
528
|
+
### Level 2 — Standard (context at 80-89%)
|
|
529
|
+
Full structured extraction: analyse the session for decisions, discoveries,
|
|
530
|
+
patterns, and blockers. Compress the last 30 tool calls into structured insight blocks.
|
|
531
|
+
Time cost: ~2 minutes.
|
|
532
|
+
Use when: significant work has been done this session that needs preserving.
|
|
533
|
+
|
|
534
|
+
### Level 3 — Deep (context at 90%+)
|
|
535
|
+
Emergency extraction: extract the minimum viable context to continue work
|
|
536
|
+
in a completely fresh session. Prioritise: what the next session MUST know
|
|
537
|
+
to not repeat work or make contradictory decisions.
|
|
538
|
+
Time cost: ~1 minute (urgency mode — no time for depth).
|
|
539
|
+
Use when: context is near limit and work is urgent.
|
|
540
|
+
|
|
541
|
+
---
|
|
542
|
+
|
|
543
|
+
## Level 2 Standard Compaction — Extraction Protocol
|
|
544
|
+
|
|
545
|
+
### Step 1 — Analyse the session (before writing anything)
|
|
546
|
+
|
|
547
|
+
Read the session history and extract these structured blocks:
|
|
548
|
+
|
|
549
|
+
**Block A: Decisions made (high value — hard to reconstruct)**
|
|
550
|
+
```
|
|
551
|
+
For each decision made during this session:
|
|
552
|
+
- What was decided (1 sentence, precise)
|
|
553
|
+
- Why (the reasoning, not just the outcome)
|
|
554
|
+
- What it rules out (what alternatives were rejected)
|
|
555
|
+
- Which files/components it affects
|
|
556
|
+
- Whether it needs an ADR (if architectural and not yet documented)
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
**Block B: Discoveries (medium value — saves future investigation)**
|
|
560
|
+
```
|
|
561
|
+
For each non-obvious thing discovered:
|
|
562
|
+
- What was found (fact, not opinion)
|
|
563
|
+
- Where it was found (file:line or system)
|
|
564
|
+
- Why it matters for future work
|
|
565
|
+
- Whether it changes any prior assumptions
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
**Block C: Current task state (critical — enables seamless continuation)**
|
|
569
|
+
```
|
|
570
|
+
- Exact current task (plan ID and step number)
|
|
571
|
+
- What has been completed in this task (numbered list)
|
|
572
|
+
- What remains (numbered list)
|
|
573
|
+
- The current file being modified and its intended final state
|
|
574
|
+
- Any partial implementations that are in an inconsistent state
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
**Block D: Implicit knowledge (unique to this session — would be lost)**
|
|
578
|
+
```
|
|
579
|
+
- Library quirks encountered (e.g., "jose v5 uses different API than docs show")
|
|
580
|
+
- Environment-specific facts (e.g., "local DB requires PGPASSWORD env var")
|
|
581
|
+
- Context-dependent rules (e.g., "this endpoint is rate-limited by the proxy")
|
|
582
|
+
- Workarounds applied (e.g., "had to add X because Y is broken in this version")
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
**Block E: Quality signals (enables self-improvement)**
|
|
586
|
+
```
|
|
587
|
+
- Any patterns that caused difficulty (what slowed down execution)
|
|
588
|
+
- Any plan assumptions that proved wrong
|
|
589
|
+
- Any quality gate failures and their root causes
|
|
590
|
+
- Suggestions for better planning next time
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
### Step 2 — Write structured HANDOFF.json
|
|
594
|
+
|
|
595
|
+
Use the extraction blocks to write a richer HANDOFF.json:
|
|
596
|
+
|
|
597
|
+
```json
|
|
598
|
+
{
|
|
599
|
+
"schema_version": "1.0.0",
|
|
600
|
+
"compaction_level": 2,
|
|
601
|
+
"compaction_timestamp": "ISO-8601",
|
|
602
|
+
"project": "[project name]",
|
|
603
|
+
"phase": [N],
|
|
604
|
+
"plan": "[M]",
|
|
605
|
+
"plan_step": "[exact step description]",
|
|
606
|
+
"last_completed_task": { "description": "...", "commit_sha": "..." },
|
|
607
|
+
"next_task": "[exact next action for the next session]",
|
|
608
|
+
|
|
609
|
+
"decisions_made": [
|
|
610
|
+
{
|
|
611
|
+
"decision": "[what was decided]",
|
|
612
|
+
"rationale": "[why]",
|
|
613
|
+
"rules_out": "[what alternatives were rejected]",
|
|
614
|
+
"affects": ["file1.ts", "file2.ts"],
|
|
615
|
+
"needs_adr": true,
|
|
616
|
+
"adr_title": "[suggested ADR title]"
|
|
617
|
+
}
|
|
618
|
+
],
|
|
619
|
+
|
|
620
|
+
"discoveries": [
|
|
621
|
+
{
|
|
622
|
+
"fact": "[what was found]",
|
|
623
|
+
"location": "[file:line or system]",
|
|
624
|
+
"significance": "[why it matters]"
|
|
625
|
+
}
|
|
626
|
+
],
|
|
627
|
+
|
|
628
|
+
"implicit_knowledge": [
|
|
629
|
+
"[Library quirk 1]",
|
|
630
|
+
"[Environment fact 2]",
|
|
631
|
+
"[Workaround 3]"
|
|
632
|
+
],
|
|
633
|
+
|
|
634
|
+
"quality_signals": [
|
|
635
|
+
{ "type": "plan_assumption_wrong", "description": "[what was assumed vs. reality]" },
|
|
636
|
+
{ "type": "difficulty_pattern", "description": "[what was hard and why]" }
|
|
637
|
+
],
|
|
638
|
+
|
|
639
|
+
"in_progress": {
|
|
640
|
+
"file": "[file being modified]",
|
|
641
|
+
"intent": "[what the modification achieves]",
|
|
642
|
+
"completed_steps": ["step 1", "step 2"],
|
|
643
|
+
"remaining_steps": ["step 3", "step 4"],
|
|
644
|
+
"current_state": "inconsistent — needs step 3 before it compiles"
|
|
645
|
+
},
|
|
646
|
+
|
|
647
|
+
"context_refs": ["[files needed for next session]"],
|
|
648
|
+
"recent_commits": ["[sha: message]"],
|
|
649
|
+
"blockers": [],
|
|
650
|
+
"decisions_needed": [],
|
|
651
|
+
"_warning": "Never store secrets, tokens, or passwords in this file.",
|
|
652
|
+
"updated_at": "ISO-8601"
|
|
653
|
+
}
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
### Step 3 — Update STATE.md with session summary
|
|
657
|
+
|
|
658
|
+
Append a compaction checkpoint to STATE.md:
|
|
659
|
+
|
|
660
|
+
```markdown
|
|
661
|
+
---
|
|
662
|
+
## Compaction checkpoint — [ISO-8601] (Level 2)
|
|
663
|
+
|
|
664
|
+
### What was accomplished this session
|
|
665
|
+
[2-3 sentences distilling the session's output]
|
|
666
|
+
|
|
667
|
+
### Key decisions (full details in HANDOFF.json)
|
|
668
|
+
- [Decision 1 in one line]
|
|
669
|
+
- [Decision 2 in one line]
|
|
670
|
+
|
|
671
|
+
### Implicit knowledge captured
|
|
672
|
+
- [Critical fact 1]
|
|
673
|
+
- [Critical fact 2]
|
|
674
|
+
|
|
675
|
+
### Quality observations
|
|
676
|
+
- [Pattern that should influence next planning session]
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
### Step 4 — Write AUDIT compaction entry
|
|
680
|
+
|
|
681
|
+
```json
|
|
682
|
+
{
|
|
683
|
+
"event": "context_compaction",
|
|
684
|
+
"compaction_level": 2,
|
|
685
|
+
"context_usage_pct": 84,
|
|
686
|
+
"decisions_captured": 3,
|
|
687
|
+
"discoveries_captured": 2,
|
|
688
|
+
"implicit_knowledge_items": 4,
|
|
689
|
+
"quality_signals": 1,
|
|
690
|
+
"handoff_written": true,
|
|
691
|
+
"state_updated": true
|
|
692
|
+
}
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
---
|
|
696
|
+
|
|
697
|
+
## Session restart from Level 2 HANDOFF
|
|
698
|
+
|
|
699
|
+
When a new session reads a Level 2 HANDOFF:
|
|
700
|
+
|
|
701
|
+
1. Report the extraction quality to the user:
|
|
702
|
+
```
|
|
703
|
+
Previous session summary (Level 2 compaction):
|
|
704
|
+
─────────────────────────────────────────────────
|
|
705
|
+
Decisions captured : 3 (see HANDOFF.json decisions_made)
|
|
706
|
+
Discoveries : 2
|
|
707
|
+
Implicit knowledge : 4 items
|
|
708
|
+
Current task : [plan_step]
|
|
709
|
+
In-progress file : [file] — [current_state]
|
|
710
|
+
─────────────────────────────────────────────────
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
2. Pre-load all implicit knowledge into working context BEFORE loading the PLAN file.
|
|
714
|
+
This ensures quirks and workarounds are known before execution decisions are made.
|
|
715
|
+
|
|
716
|
+
3. If `in_progress.current_state` indicates an inconsistency:
|
|
717
|
+
```
|
|
718
|
+
⚠️ WARNING: Previous session left an inconsistent state.
|
|
719
|
+
File: [file]
|
|
720
|
+
State: [current_state]
|
|
721
|
+
This must be resolved BEFORE executing any other steps.
|
|
722
|
+
Resolve? (yes — I'll fix it / no — show me the file first)
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
## Compaction quality metric
|
|
726
|
+
|
|
727
|
+
After each compaction, score the quality of the extracted information:
|
|
728
|
+
- Decisions captured vs. decisions that should have been captured (based on AUDIT entries): [N%]
|
|
729
|
+
- This score is written to `.planning/metrics/compaction-quality.jsonl`
|
|
730
|
+
for the performance metrics system (Task 10).
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
**Commit:**
|
|
734
|
+
```bash
|
|
735
|
+
git add .mindforge/intelligence/smart-compaction.md
|
|
736
|
+
git commit -m "feat(intelligence): implement smart context compaction with structured insight extraction"
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
---
|
|
740
|
+
|
|
741
|
+
## TASK 4 — Write the Phase Difficulty Scorer
|
|
742
|
+
|
|
743
|
+
### `.mindforge/intelligence/difficulty-scorer.md`
|
|
744
|
+
|
|
745
|
+
```markdown
|
|
746
|
+
# MindForge Intelligence — Phase Difficulty Scorer
|
|
747
|
+
|
|
748
|
+
## Purpose
|
|
749
|
+
Before planning begins, estimate a phase's complexity, risk, and effort
|
|
750
|
+
so that task decomposition is appropriately fine-grained and capacity
|
|
751
|
+
expectations are realistic.
|
|
752
|
+
|
|
753
|
+
## When to run
|
|
754
|
+
The difficulty scorer runs automatically as part of `/mindforge:plan-phase`
|
|
755
|
+
before any task plans are created. Its output informs:
|
|
756
|
+
- Task granularity (high difficulty → more atomic plans)
|
|
757
|
+
- Risk flags (high risk → activate more skills and verification steps)
|
|
758
|
+
- Effort estimate (helps user decide if the phase scope is right)
|
|
759
|
+
|
|
760
|
+
## Scoring dimensions
|
|
761
|
+
|
|
762
|
+
### Dimension 1 — Technical Complexity (1-5)
|
|
763
|
+
|
|
764
|
+
| Score | Description | Signals |
|
|
765
|
+
|---|---|---|
|
|
766
|
+
| 1 | Trivial | Documentation, config change, single function fix |
|
|
767
|
+
| 2 | Simple | New UI component, simple CRUD endpoint, minor refactor |
|
|
768
|
+
| 3 | Moderate | Multi-step feature, new service integration, schema change |
|
|
769
|
+
| 4 | Complex | New subsystem, auth/payment feature, architectural change |
|
|
770
|
+
| 5 | Very complex | Core platform change, distributed system feature, migration |
|
|
771
|
+
|
|
772
|
+
**Signal detection:**
|
|
773
|
+
```bash
|
|
774
|
+
# Check phase description for complexity signals
|
|
775
|
+
PHASE_DESCRIPTION="[from ROADMAP.md]"
|
|
776
|
+
|
|
777
|
+
# High complexity signals (score 4-5):
|
|
778
|
+
COMPLEX_SIGNALS=(
|
|
779
|
+
"authentication" "authorization" "payment" "migration" "refactor"
|
|
780
|
+
"architecture" "distributed" "real-time" "encryption" "multi-tenant"
|
|
781
|
+
"performance" "scale" "queue" "cache invalidation" "transaction"
|
|
782
|
+
)
|
|
783
|
+
|
|
784
|
+
# Moderate complexity signals (score 3):
|
|
785
|
+
MODERATE_SIGNALS=(
|
|
786
|
+
"integration" "webhook" "email" "notification" "search"
|
|
787
|
+
"dashboard" "report" "export" "import" "workflow"
|
|
788
|
+
)
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
### Dimension 2 — Risk Level (1-5)
|
|
792
|
+
|
|
793
|
+
| Score | Description | Signals |
|
|
794
|
+
|---|---|---|
|
|
795
|
+
| 1 | Minimal | New feature, no existing code touched |
|
|
796
|
+
| 2 | Low | Minor changes to existing code, well-covered by tests |
|
|
797
|
+
| 3 | Medium | Changes to shared utilities, moderate test coverage needed |
|
|
798
|
+
| 4 | High | Changes to auth, data model, or public API surface |
|
|
799
|
+
| 5 | Critical | Changes to payments, PII handling, or core platform logic |
|
|
800
|
+
|
|
801
|
+
**Risk amplifiers (add +1 to base risk score):**
|
|
802
|
+
- No existing test suite for the affected code area
|
|
803
|
+
- Third-party service integration with no sandbox environment
|
|
804
|
+
- Changes to code used by > 3 other modules
|
|
805
|
+
- No rollback plan is obvious
|
|
806
|
+
- Previous incidents in this area (check AUDIT log for past failures)
|
|
807
|
+
|
|
808
|
+
### Dimension 3 — Ambiguity Level (1-5)
|
|
809
|
+
|
|
810
|
+
| Score | Description | Signals |
|
|
811
|
+
|---|---|---|
|
|
812
|
+
| 1 | Fully specified | All acceptance criteria written, no design decisions open |
|
|
813
|
+
| 2 | Mostly clear | Minor implementation decisions open, major shape is clear |
|
|
814
|
+
| 3 | Partially specified | Some requirements unclear, UX decisions unresolved |
|
|
815
|
+
| 4 | Vague | High-level goal only, significant design work needed |
|
|
816
|
+
| 5 | Undefined | Phase is a concept, not a specification |
|
|
817
|
+
|
|
818
|
+
**Source:** Read REQUIREMENTS.md for the phase's FR items.
|
|
819
|
+
Count: requirements with acceptance criteria vs. requirements without.
|
|
820
|
+
If < 70% have acceptance criteria: score 3+.
|
|
821
|
+
|
|
822
|
+
### Dimension 4 — Dependency Count (1-5)
|
|
823
|
+
|
|
824
|
+
Count the number of:
|
|
825
|
+
- External services this phase must integrate with
|
|
826
|
+
- Other phases this phase depends on (check ROADMAP.md)
|
|
827
|
+
- New third-party libraries that must be added
|
|
828
|
+
- Team dependencies (other team's APIs, systems)
|
|
829
|
+
|
|
830
|
+
Score = min(5, dependency_count)
|
|
831
|
+
|
|
832
|
+
---
|
|
833
|
+
|
|
834
|
+
## Composite Difficulty Score
|
|
835
|
+
|
|
836
|
+
```
|
|
837
|
+
Composite = (Technical × 0.35) + (Risk × 0.30) + (Ambiguity × 0.20) + (Dependencies × 0.15)
|
|
838
|
+
```
|
|
839
|
+
|
|
840
|
+
| Composite Score | Label | Recommended task count |
|
|
841
|
+
|---|---|---|
|
|
842
|
+
| 1.0 – 2.0 | Easy | 2-3 atomic tasks |
|
|
843
|
+
| 2.1 – 3.0 | Moderate | 4-6 atomic tasks |
|
|
844
|
+
| 3.1 – 4.0 | Challenging | 6-10 atomic tasks |
|
|
845
|
+
| 4.1 – 5.0 | Hard | 10-15 atomic tasks; consider splitting the phase |
|
|
846
|
+
|
|
847
|
+
---
|
|
848
|
+
|
|
849
|
+
## Difficulty report
|
|
850
|
+
|
|
851
|
+
Written to `.planning/phases/[N]/DIFFICULTY-SCORE-[N].md`:
|
|
852
|
+
|
|
853
|
+
```markdown
|
|
854
|
+
# Phase [N] Difficulty Score
|
|
855
|
+
|
|
856
|
+
## Scores
|
|
857
|
+
| Dimension | Score | Signals detected |
|
|
858
|
+
|---|---|---|
|
|
859
|
+
| Technical complexity | 4 / 5 | "authentication", "JWT", "session management" |
|
|
860
|
+
| Risk level | 5 / 5 | Auth changes + no existing auth tests + Tier 3 governance |
|
|
861
|
+
| Ambiguity | 2 / 5 | 8 of 10 requirements have acceptance criteria |
|
|
862
|
+
| Dependencies | 3 / 5 | 3 external services: Supabase Auth, SendGrid, Stripe |
|
|
863
|
+
|
|
864
|
+
## Composite score: 3.85 / 5.0 — Challenging
|
|
865
|
+
|
|
866
|
+
## Recommendations
|
|
867
|
+
1. Split into 8 atomic tasks (not 3-4) — complexity warrants fine granularity
|
|
868
|
+
2. Activate skills: security-review, api-design, testing-standards (auto-suggested)
|
|
869
|
+
3. Run /mindforge:discuss-phase [N] before planning — ambiguity score suggests
|
|
870
|
+
implementation decisions need capturing
|
|
871
|
+
4. Governance: expect Tier 3 approval for auth changes — plan for 4-hour approval wait
|
|
872
|
+
5. Estimate: ~3-4 hours of agent execution time for this phase
|
|
873
|
+
|
|
874
|
+
## Risk flags
|
|
875
|
+
🔴 No existing auth test coverage — QA agent should write tests first (TDD approach)
|
|
876
|
+
🟠 Third-party session storage (Supabase) — plan for service unavailability in tests
|
|
877
|
+
🟡 JWT refresh rotation — subtle concurrency edge case, add to test plan
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
## Integration with plan-phase
|
|
881
|
+
|
|
882
|
+
After scoring, present to the user:
|
|
883
|
+
```
|
|
884
|
+
Phase [N] Difficulty Assessment:
|
|
885
|
+
Technical : ████████░░ 4/5 (Complex)
|
|
886
|
+
Risk : ██████████ 5/5 (Critical)
|
|
887
|
+
Ambiguity : ████░░░░░░ 2/5 (Mostly clear)
|
|
888
|
+
Dependencies: ██████░░░░ 3/5 (3 external services)
|
|
889
|
+
|
|
890
|
+
Composite: 3.85 / 5.0 — Challenging
|
|
891
|
+
|
|
892
|
+
Recommendations:
|
|
893
|
+
- 8 atomic tasks (not 3)
|
|
894
|
+
- Run /mindforge:discuss-phase first (recommended)
|
|
895
|
+
- Activate: security-review, api-design, testing-standards
|
|
896
|
+
- Plan for Tier 3 approval (4h wait) for auth changes
|
|
897
|
+
|
|
898
|
+
Proceed to discussion phase? (yes/no/skip-discussion)
|
|
899
|
+
```
|
|
900
|
+
```
|
|
901
|
+
|
|
902
|
+
**Commit:**
|
|
903
|
+
```bash
|
|
904
|
+
git add .mindforge/intelligence/difficulty-scorer.md
|
|
905
|
+
git commit -m "feat(intelligence): implement phase difficulty scorer with 4-dimension model"
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
---
|
|
909
|
+
|
|
910
|
+
## TASK 5 — Write the Anti-Pattern Detection Engine
|
|
911
|
+
|
|
912
|
+
### `.mindforge/intelligence/antipattern-detector.md`
|
|
913
|
+
|
|
914
|
+
```markdown
|
|
915
|
+
# MindForge Intelligence — Anti-Pattern Detection Engine
|
|
916
|
+
|
|
917
|
+
## Purpose
|
|
918
|
+
Proactively detect known anti-patterns before they become embedded technical debt.
|
|
919
|
+
Runs at three trigger points: during planning (catch design anti-patterns),
|
|
920
|
+
during execution (catch implementation anti-patterns), and during review
|
|
921
|
+
(catch architecture anti-patterns).
|
|
922
|
+
|
|
923
|
+
## Anti-pattern library
|
|
924
|
+
|
|
925
|
+
### Category A — Architecture Anti-Patterns
|
|
926
|
+
|
|
927
|
+
**A01 — God Object / God Service**
|
|
928
|
+
```
|
|
929
|
+
Detection: A single file or service with > 500 lines AND is imported by > 5 other modules.
|
|
930
|
+
Signal: `wc -l src/**/*.ts | sort -rn | head -5` combined with import graph analysis.
|
|
931
|
+
Severity: HIGH
|
|
932
|
+
Impact: Untestable, unscalable, merge conflict magnet.
|
|
933
|
+
Recommendation: Split into focused domain services. Identify bounded contexts.
|
|
934
|
+
```
|
|
935
|
+
|
|
936
|
+
**A02 — Circular Dependencies**
|
|
937
|
+
```
|
|
938
|
+
Detection: Module A imports B which imports A (directly or transitively).
|
|
939
|
+
Signal: Use `madge --circular src/` (Node.js) or `python -m modulefinder`.
|
|
940
|
+
Severity: HIGH
|
|
941
|
+
Impact: Prevents tree-shaking, causes hard-to-debug initialisation errors.
|
|
942
|
+
Recommendation: Introduce an interface/abstraction layer to break the cycle.
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
**A03 — Distributed Monolith**
|
|
946
|
+
```
|
|
947
|
+
Detection: Multiple services but all share the same database schema or call each other synchronously on every request.
|
|
948
|
+
Signal: Multiple service directories but shared `db/` or `schema.prisma`. Direct service-to-service HTTP calls in the critical path.
|
|
949
|
+
Severity: MEDIUM
|
|
950
|
+
Impact: Gets the downsides of microservices (operational complexity) without the benefits (independent deployability).
|
|
951
|
+
Recommendation: Either consolidate into a true monolith or introduce proper service boundaries with async communication.
|
|
952
|
+
```
|
|
953
|
+
|
|
954
|
+
**A04 — Hardcoded Configuration**
|
|
955
|
+
```
|
|
956
|
+
Detection: String literals for URLs, timeouts, limits, feature names in source code (not in config/env).
|
|
957
|
+
Signal: grep -rn "localhost\|8080\|3000\|http://\|60000\|timeout.*=.*[0-9]" src/
|
|
958
|
+
Severity: MEDIUM
|
|
959
|
+
Impact: Environment-specific code, impossible to change without redeployment.
|
|
960
|
+
Recommendation: Extract to config file or environment variables.
|
|
961
|
+
```
|
|
962
|
+
|
|
963
|
+
### Category B — Database Anti-Patterns
|
|
964
|
+
|
|
965
|
+
**B01 — SELECT * in Production Queries**
|
|
966
|
+
```
|
|
967
|
+
Detection: `SELECT *` in any ORM raw query or SQL string.
|
|
968
|
+
Signal: grep -rn "SELECT \*" src/ --include="*.ts" --include="*.py"
|
|
969
|
+
Severity: MEDIUM
|
|
970
|
+
Impact: Over-fetches data, breaks when columns are added, prevents index-only scans.
|
|
971
|
+
Recommendation: Always specify required columns explicitly.
|
|
972
|
+
```
|
|
973
|
+
|
|
974
|
+
**B02 — Missing Database Indexes on Foreign Keys**
|
|
975
|
+
```
|
|
976
|
+
Detection: Foreign key columns without corresponding index definitions.
|
|
977
|
+
Signal: Compare FK declarations in schema with index declarations.
|
|
978
|
+
Severity: HIGH
|
|
979
|
+
Impact: Every JOIN on an FK is a full table scan — catastrophic at scale.
|
|
980
|
+
Recommendation: Add index for every foreign key column.
|
|
981
|
+
```
|
|
982
|
+
|
|
983
|
+
**B03 — Unbounded Queries (No LIMIT)**
|
|
984
|
+
```
|
|
985
|
+
Detection: Database queries in list-fetching code without LIMIT/pagination.
|
|
986
|
+
Signal: grep -rn "findMany\(\|find_all\|SELECT.*FROM" src/ | grep -v "LIMIT\|take:\|limit:"
|
|
987
|
+
Severity: HIGH
|
|
988
|
+
Impact: Memory exhaustion, response timeout, database load spike.
|
|
989
|
+
Recommendation: Always paginate. Default page size 20, max 100.
|
|
990
|
+
```
|
|
991
|
+
|
|
992
|
+
### Category C — Security Anti-Patterns
|
|
993
|
+
|
|
994
|
+
**C01 — Authentication Bypass via Type Coercion**
|
|
995
|
+
```
|
|
996
|
+
Detection: Auth checks using loose equality (`==` instead of `===` in JS/TS).
|
|
997
|
+
Signal: grep -rn "== null\|== undefined\|== false\|== 0" src/auth/ src/middleware/
|
|
998
|
+
Severity: CRITICAL
|
|
999
|
+
Impact: Type coercion can bypass null/undefined/false checks — auth bypass vector.
|
|
1000
|
+
Recommendation: Always use strict equality (===) in security-critical paths.
|
|
1001
|
+
```
|
|
1002
|
+
|
|
1003
|
+
**C02 — Missing Authorization on Internal Routes**
|
|
1004
|
+
```
|
|
1005
|
+
Detection: API routes without auth middleware applied.
|
|
1006
|
+
Signal: Read all route files, check each route for auth middleware application.
|
|
1007
|
+
Flag any route that does NOT call an auth middleware before handler execution.
|
|
1008
|
+
Severity: HIGH
|
|
1009
|
+
Impact: Unauthenticated access to data or operations.
|
|
1010
|
+
Recommendation: Apply auth middleware at the router level, not per-route.
|
|
1011
|
+
```
|
|
1012
|
+
|
|
1013
|
+
**C03 — Sensitive Data in URL Parameters**
|
|
1014
|
+
```
|
|
1015
|
+
Detection: Routes that accept sensitive identifiers in query strings or path params without ownership verification.
|
|
1016
|
+
Signal: grep -rn "req.query.email\|req.params.userId\|req.query.token" src/
|
|
1017
|
+
Severity: HIGH
|
|
1018
|
+
Impact: Sensitive data in web server logs, CDN logs, browser history, referrer headers.
|
|
1019
|
+
Recommendation: Use POST bodies for sensitive data, verify ownership server-side.
|
|
1020
|
+
```
|
|
1021
|
+
|
|
1022
|
+
### Category D — Code Quality Anti-Patterns
|
|
1023
|
+
|
|
1024
|
+
**D01 — Callback Hell / Promise Chain Pyramids**
|
|
1025
|
+
```
|
|
1026
|
+
Detection: Nesting depth > 4 in async code.
|
|
1027
|
+
Signal: eslint rule: max-depth: [error, 4] — or manual check for deeply indented .then() chains.
|
|
1028
|
+
Severity: MEDIUM
|
|
1029
|
+
Impact: Unreadable, hard to error handle, hard to test.
|
|
1030
|
+
Recommendation: Use async/await with explicit error handling.
|
|
1031
|
+
```
|
|
1032
|
+
|
|
1033
|
+
**D02 — Magic String Comparisons**
|
|
1034
|
+
```
|
|
1035
|
+
Detection: String literals used in conditional logic (not in constants or enums).
|
|
1036
|
+
Signal: grep -rn '"pending"\|"active"\|"admin"\|"user"\|"error"\|"success"' src/ --include="*.ts"
|
|
1037
|
+
Look for these in if/switch/filter contexts.
|
|
1038
|
+
Severity: LOW
|
|
1039
|
+
Impact: Typos cause silent failures, refactoring breaks multiple files.
|
|
1040
|
+
Recommendation: Use TypeScript string enums or const assertions.
|
|
1041
|
+
```
|
|
1042
|
+
|
|
1043
|
+
**D03 — Swallowed Errors**
|
|
1044
|
+
```
|
|
1045
|
+
Detection: Empty catch blocks or catch blocks that only log without re-throwing or handling.
|
|
1046
|
+
Signal: grep -rn "catch.*{}" src/ OR grep -A2 "catch" src/ | grep -v "throw\|return\|reject\|log"
|
|
1047
|
+
Severity: HIGH
|
|
1048
|
+
Impact: Errors silently disappear — no visibility into failures in production.
|
|
1049
|
+
Recommendation: Always handle or re-throw. Log with context. Never swallow.
|
|
1050
|
+
```
|
|
1051
|
+
|
|
1052
|
+
### Category E — Testing Anti-Patterns
|
|
1053
|
+
|
|
1054
|
+
**E01 — Tests That Test Implementation, Not Behaviour**
|
|
1055
|
+
```
|
|
1056
|
+
Detection: Tests that call private methods or test internal state rather than public API outcomes.
|
|
1057
|
+
Signal: Test files that import non-exported functions, or check internal properties.
|
|
1058
|
+
Severity: MEDIUM
|
|
1059
|
+
Impact: Tests break on refactoring even when behaviour is correct.
|
|
1060
|
+
Recommendation: Test through the public interface. Test what it does, not how.
|
|
1061
|
+
```
|
|
1062
|
+
|
|
1063
|
+
**E02 — Flaky Test Indicators**
|
|
1064
|
+
```
|
|
1065
|
+
Detection: Tests using setTimeout, Math.random(), new Date(), or non-deterministic external calls without mocking.
|
|
1066
|
+
Signal: grep -rn "setTimeout\|Math.random\|new Date()\|Date.now()" tests/
|
|
1067
|
+
Severity: MEDIUM
|
|
1068
|
+
Impact: CI failures that cannot be reproduced locally — trust erosion.
|
|
1069
|
+
Recommendation: Mock time, randomness, and external services in tests.
|
|
1070
|
+
```
|
|
1071
|
+
|
|
1072
|
+
---
|
|
1073
|
+
|
|
1074
|
+
## Detection trigger points and commands
|
|
1075
|
+
|
|
1076
|
+
### At plan-phase time (design anti-patterns)
|
|
1077
|
+
Run: A01, A02, A03, A04 against existing codebase.
|
|
1078
|
+
Report findings in DIFFICULTY-SCORE file as risk amplifiers.
|
|
1079
|
+
|
|
1080
|
+
### At execute-phase time (implementation anti-patterns)
|
|
1081
|
+
Run: B01, B02, B03, C01, C02, C03, D03 against the current diff.
|
|
1082
|
+
Flag as quality gate warnings (not blocking unless CRITICAL).
|
|
1083
|
+
|
|
1084
|
+
### At review time (/mindforge:review)
|
|
1085
|
+
Run full library: all A, B, C, D, E categories.
|
|
1086
|
+
Include in CODE-REVIEW report under "Anti-pattern findings."
|
|
1087
|
+
|
|
1088
|
+
## Anti-pattern report format
|
|
1089
|
+
|
|
1090
|
+
```markdown
|
|
1091
|
+
## Anti-Pattern Scan Results
|
|
1092
|
+
|
|
1093
|
+
### Critical findings
|
|
1094
|
+
| ID | Pattern | Location | Recommendation |
|
|
1095
|
+
|---|---|---|---|
|
|
1096
|
+
| C01 | Auth bypass via == | src/auth/verify.ts:47 | Use === for auth checks |
|
|
1097
|
+
|
|
1098
|
+
### High findings
|
|
1099
|
+
| ID | Pattern | Location | Recommendation |
|
|
1100
|
+
|---|---|---|---|
|
|
1101
|
+
| B02 | Missing FK index | schema.prisma:orderId | Add @@index([orderId]) |
|
|
1102
|
+
| D03 | Swallowed error | src/api/users.ts:89 | Re-throw or handle |
|
|
1103
|
+
|
|
1104
|
+
### Medium findings
|
|
1105
|
+
[...]
|
|
1106
|
+
```
|
|
1107
|
+
```
|
|
1108
|
+
|
|
1109
|
+
**Commit:**
|
|
1110
|
+
```bash
|
|
1111
|
+
git add .mindforge/intelligence/antipattern-detector.md
|
|
1112
|
+
git commit -m "feat(intelligence): implement anti-pattern detection library (5 categories, 13 patterns)"
|
|
1113
|
+
```
|
|
1114
|
+
|
|
1115
|
+
---
|
|
1116
|
+
|
|
1117
|
+
## TASK 6 — Write the Skill Gap Analyser
|
|
1118
|
+
|
|
1119
|
+
### `.mindforge/intelligence/skill-gap-analyser.md`
|
|
1120
|
+
|
|
1121
|
+
```markdown
|
|
1122
|
+
# MindForge Intelligence — Skill Gap Analyser
|
|
1123
|
+
|
|
1124
|
+
## Purpose
|
|
1125
|
+
Before and during phase planning, analyse the planned work to identify
|
|
1126
|
+
which skills will be needed. Compare against installed skills to detect
|
|
1127
|
+
gaps — skills that should exist but don't.
|
|
1128
|
+
|
|
1129
|
+
## When to run
|
|
1130
|
+
1. At `/mindforge:plan-phase` start — before task decomposition
|
|
1131
|
+
2. At `/mindforge:discuss-phase` — inform the discussion with skill availability
|
|
1132
|
+
3. At `/mindforge:health` — identify framework-level skill gaps
|
|
1133
|
+
|
|
1134
|
+
---
|
|
1135
|
+
|
|
1136
|
+
## Phase skill requirement analysis
|
|
1137
|
+
|
|
1138
|
+
### Step 1 — Extract work signals from phase context
|
|
1139
|
+
|
|
1140
|
+
Read all available context for the phase:
|
|
1141
|
+
- ROADMAP.md phase description
|
|
1142
|
+
- CONTEXT.md (if discuss-phase was run)
|
|
1143
|
+
- REQUIREMENTS.md entries for this phase
|
|
1144
|
+
- ARCHITECTURE.md relevant sections
|
|
1145
|
+
|
|
1146
|
+
Identify work categories present:
|
|
1147
|
+
```
|
|
1148
|
+
UI/UX work? → needs accessibility skill
|
|
1149
|
+
Database changes? → needs database-patterns skill
|
|
1150
|
+
API design? → needs api-design skill
|
|
1151
|
+
Payment/PII/auth? → needs security-review skill
|
|
1152
|
+
Performance concern? → needs performance skill
|
|
1153
|
+
User data? → needs data-privacy skill
|
|
1154
|
+
New service/feature? → needs testing-standards skill
|
|
1155
|
+
Documentation needed? → needs documentation skill
|
|
1156
|
+
Incident prone area? → needs incident-response skill
|
|
1157
|
+
```
|
|
1158
|
+
|
|
1159
|
+
### Step 2 — Map work categories to skills
|
|
1160
|
+
|
|
1161
|
+
```
|
|
1162
|
+
UI/UX work → accessibility (required), performance (recommended)
|
|
1163
|
+
Database changes → database-patterns (required), data-privacy (if PII fields)
|
|
1164
|
+
API endpoints → api-design (required), security-review (if auth)
|
|
1165
|
+
Auth/payments/PII → security-review (required), data-privacy (if PII)
|
|
1166
|
+
Test coverage → testing-standards (required)
|
|
1167
|
+
New feature → documentation (recommended)
|
|
1168
|
+
Performance NFR → performance (required)
|
|
1169
|
+
Incident risk area → incident-response (recommended)
|
|
1170
|
+
```
|
|
1171
|
+
|
|
1172
|
+
### Step 3 — Check skill availability
|
|
1173
|
+
|
|
1174
|
+
For each required and recommended skill:
|
|
1175
|
+
```bash
|
|
1176
|
+
# Check if skill exists in MANIFEST.md
|
|
1177
|
+
grep "| [skill-name] |" .mindforge/org/skills/MANIFEST.md
|
|
1178
|
+
|
|
1179
|
+
# Check if SKILL.md file exists at expected path
|
|
1180
|
+
ls .mindforge/skills/[skill-name]/SKILL.md
|
|
1181
|
+
```
|
|
1182
|
+
|
|
1183
|
+
### Step 4 — Identify gaps
|
|
1184
|
+
|
|
1185
|
+
A gap is a required skill that:
|
|
1186
|
+
a) Does not exist in MANIFEST.md, OR
|
|
1187
|
+
b) Exists in MANIFEST.md but its SKILL.md file is missing, OR
|
|
1188
|
+
c) Exists but its `status` is `deprecated` with no replacement
|
|
1189
|
+
|
|
1190
|
+
### Step 5 — Generate skill gap report
|
|
1191
|
+
|
|
1192
|
+
Report included in the phase difficulty assessment:
|
|
1193
|
+
|
|
1194
|
+
```markdown
|
|
1195
|
+
## Skill Gap Analysis — Phase [N]
|
|
1196
|
+
|
|
1197
|
+
### Required skills (must have for this phase)
|
|
1198
|
+
| Skill | Status | Action |
|
|
1199
|
+
|---|---|---|
|
|
1200
|
+
| security-review | ✅ Installed (v1.0.0) | Auto-loaded |
|
|
1201
|
+
| api-design | ✅ Installed (v1.0.0) | Auto-loaded |
|
|
1202
|
+
| database-patterns | ✅ Installed (v1.0.0) | Auto-loaded |
|
|
1203
|
+
| oauth-patterns | ❌ NOT INSTALLED | See recommendation below |
|
|
1204
|
+
|
|
1205
|
+
### Recommended skills (beneficial for this phase)
|
|
1206
|
+
| Skill | Status | Action |
|
|
1207
|
+
|---|---|---|
|
|
1208
|
+
| performance | ✅ Installed (v1.0.0) | Auto-loaded |
|
|
1209
|
+
| testing-standards | ✅ Installed (v1.0.0) | Auto-loaded |
|
|
1210
|
+
|
|
1211
|
+
### Gaps identified: 1 required skill missing
|
|
1212
|
+
|
|
1213
|
+
**oauth-patterns (MISSING)**
|
|
1214
|
+
This phase implements OAuth 2.0 social login. The core `security-review` skill
|
|
1215
|
+
covers general auth security but does not include OAuth-specific guidance:
|
|
1216
|
+
- PKCE implementation
|
|
1217
|
+
- State parameter for CSRF protection
|
|
1218
|
+
- Token storage for OAuth flows
|
|
1219
|
+
- Provider-specific quirks (Google, GitHub, Apple)
|
|
1220
|
+
|
|
1221
|
+
**Options:**
|
|
1222
|
+
1. Create an `oauth-patterns` org skill before planning (recommended — ~30 minutes)
|
|
1223
|
+
Template: see `docs/skills-authoring-guide.md`
|
|
1224
|
+
2. Proceed without the skill — the security-review skill provides partial coverage
|
|
1225
|
+
(risk: OAuth-specific patterns may be missed)
|
|
1226
|
+
3. Add OAuth guidance to an existing skill as a minor update
|
|
1227
|
+
|
|
1228
|
+
Run /mindforge:skills add to register a new skill.
|
|
1229
|
+
```
|
|
1230
|
+
|
|
1231
|
+
## Org-level skill gap analysis
|
|
1232
|
+
|
|
1233
|
+
At `/mindforge:health`, run a broader analysis comparing:
|
|
1234
|
+
- The phases completed in the last 6 months (from AUDIT.jsonl)
|
|
1235
|
+
- The skills available
|
|
1236
|
+
- Frequency of skill trigger matches vs. gaps
|
|
1237
|
+
|
|
1238
|
+
Report: "Based on your recent phases, these skills would have been beneficial:
|
|
1239
|
+
[list with frequency counts] — consider creating org skills for your tech stack."
|
|
1240
|
+
```
|
|
1241
|
+
|
|
1242
|
+
**Commit:**
|
|
1243
|
+
```bash
|
|
1244
|
+
git add .mindforge/intelligence/skill-gap-analyser.md
|
|
1245
|
+
git commit -m "feat(intelligence): implement skill gap analyser for phase planning"
|
|
1246
|
+
```
|
|
1247
|
+
|
|
1248
|
+
---
|
|
1249
|
+
|
|
1250
|
+
## TASK 7 — Write the Team Profile System
|
|
1251
|
+
|
|
1252
|
+
### `.mindforge/team/TEAM-PROFILE.md`
|
|
1253
|
+
|
|
1254
|
+
```markdown
|
|
1255
|
+
# MindForge Team Profile
|
|
1256
|
+
# Auto-generated by /mindforge:profile-team
|
|
1257
|
+
# Last updated: [ISO-8601]
|
|
1258
|
+
|
|
1259
|
+
## Team composition
|
|
1260
|
+
|
|
1261
|
+
### Members
|
|
1262
|
+
| Name | Email (git config) | Primary role | Timezone | Experience level |
|
|
1263
|
+
|---|---|---|---|---|
|
|
1264
|
+
| [John Smith] | john@company.com | Backend engineer | UTC+5:30 | Senior |
|
|
1265
|
+
| [Jane Doe] | jane@company.com | Frontend engineer | UTC+0 | Senior |
|
|
1266
|
+
| [Alex Kim] | alex@company.com | Full-stack engineer | UTC+5:30 | Mid-level |
|
|
1267
|
+
|
|
1268
|
+
### Tech stack preferences (inferred from git history and declared)
|
|
1269
|
+
| Layer | Preferred | Comfortable | Learning |
|
|
1270
|
+
|---|---|---|---|
|
|
1271
|
+
| Backend | TypeScript/Node.js | Python | Go |
|
|
1272
|
+
| Frontend | React/Next.js | Vue | Svelte |
|
|
1273
|
+
| Database | PostgreSQL | MySQL | MongoDB |
|
|
1274
|
+
| Testing | Vitest | Jest | Playwright |
|
|
1275
|
+
|
|
1276
|
+
## Working patterns (inferred from AUDIT.jsonl and git history)
|
|
1277
|
+
|
|
1278
|
+
### Session patterns
|
|
1279
|
+
- Average session length: [N] minutes
|
|
1280
|
+
- Peak working hours: [inferred from commit timestamps]
|
|
1281
|
+
- Average tasks per session: [N]
|
|
1282
|
+
- Context compaction frequency: every ~[N] tasks
|
|
1283
|
+
|
|
1284
|
+
### Quality patterns
|
|
1285
|
+
- Verify pass rate: [N%] (tasks that passed first verify attempt)
|
|
1286
|
+
- Common failure type: [most frequent task_failed reason from AUDIT]
|
|
1287
|
+
- Average plans per phase: [N]
|
|
1288
|
+
- Phase difficulty preference: [Easy/Moderate/Challenging — from difficulty scores]
|
|
1289
|
+
|
|
1290
|
+
### Collaboration patterns
|
|
1291
|
+
- Phases worked alone vs. collaboratively: [N solo, N collaborative]
|
|
1292
|
+
- Most common reviewer: [from approval records]
|
|
1293
|
+
- Average approval wait time: [from approval AUDIT entries]
|
|
1294
|
+
|
|
1295
|
+
## Skill coverage
|
|
1296
|
+
|
|
1297
|
+
Based on session analysis, team members demonstrate proficiency in:
|
|
1298
|
+
| Skill area | Proficiency | Evidence |
|
|
1299
|
+
|---|---|---|
|
|
1300
|
+
| Security | High | [N] security reviews completed, 0 CRITICAL findings in production |
|
|
1301
|
+
| Testing | Medium | [N%] average test coverage |
|
|
1302
|
+
| Documentation | Low | [N] ADRs written, README updated [N] times |
|
|
1303
|
+
|
|
1304
|
+
## Personalisation rules
|
|
1305
|
+
|
|
1306
|
+
These rules are applied by agents to personalise responses for this team:
|
|
1307
|
+
|
|
1308
|
+
### Communication style
|
|
1309
|
+
[Inferred or declared]:
|
|
1310
|
+
- Verbosity: concise (prefers short answers, not extensive explanations)
|
|
1311
|
+
- Code style: functional over OOP (seen in patterns)
|
|
1312
|
+
- Review style: direct (no softening language needed)
|
|
1313
|
+
|
|
1314
|
+
### Technical preferences (for planning decisions)
|
|
1315
|
+
- Error handling: always use Result types over exceptions
|
|
1316
|
+
- Testing approach: TDD where possible
|
|
1317
|
+
- Code organisation: feature-based over layer-based
|
|
1318
|
+
- ORM usage: Prisma (not raw SQL)
|
|
1319
|
+
|
|
1320
|
+
### Known strengths (agents lean into these)
|
|
1321
|
+
- Auth and security implementation
|
|
1322
|
+
- Database optimisation
|
|
1323
|
+
|
|
1324
|
+
### Known gaps (agents are more careful here, add more guidance)
|
|
1325
|
+
- Frontend accessibility (team has limited a11y experience)
|
|
1326
|
+
- Infrastructure as code (mostly manual)
|
|
1327
|
+
```
|
|
1328
|
+
|
|
1329
|
+
---
|
|
1330
|
+
|
|
1331
|
+
### `.mindforge/team/profiles/README.md`
|
|
1332
|
+
|
|
1333
|
+
```markdown
|
|
1334
|
+
# MindForge Per-Developer Profiles
|
|
1335
|
+
|
|
1336
|
+
## Purpose
|
|
1337
|
+
Per-developer profiles store individual preferences and working patterns
|
|
1338
|
+
that complement the team profile. Agents use these for personalised responses
|
|
1339
|
+
when the developer's identity can be determined from git config.
|
|
1340
|
+
|
|
1341
|
+
## File naming
|
|
1342
|
+
`PROFILE-[dev-id].md` where dev-id is derived from git config user.email
|
|
1343
|
+
(same convention as multi-developer HANDOFF).
|
|
1344
|
+
|
|
1345
|
+
## Profile template
|
|
1346
|
+
|
|
1347
|
+
Create a file: `PROFILE-[dev-id].md`
|
|
1348
|
+
|
|
1349
|
+
```markdown
|
|
1350
|
+
# Developer Profile — [Name]
|
|
1351
|
+
# dev-id: [sanitised email]
|
|
1352
|
+
# Last updated: [ISO-8601]
|
|
1353
|
+
|
|
1354
|
+
## Identity
|
|
1355
|
+
Name: [Name]
|
|
1356
|
+
Email: [email]
|
|
1357
|
+
Role: [role]
|
|
1358
|
+
Timezone: [UTC+X]
|
|
1359
|
+
|
|
1360
|
+
## Declared preferences
|
|
1361
|
+
|
|
1362
|
+
### Communication
|
|
1363
|
+
- Verbosity: concise | balanced | detailed
|
|
1364
|
+
- Code examples: always | when helpful | rarely
|
|
1365
|
+
- Explanation depth: brief | standard | thorough
|
|
1366
|
+
- Tone: direct | balanced | encouraging
|
|
1367
|
+
|
|
1368
|
+
### Technical preferences
|
|
1369
|
+
- [Any specific technical preferences for this developer]
|
|
1370
|
+
|
|
1371
|
+
## Observed patterns (auto-populated from AUDIT.jsonl)
|
|
1372
|
+
|
|
1373
|
+
### Session quality
|
|
1374
|
+
- Average verify pass rate: [N%]
|
|
1375
|
+
- Most common quality gate failure: [type]
|
|
1376
|
+
- Average tasks per session before compaction: [N]
|
|
1377
|
+
|
|
1378
|
+
### Strengths
|
|
1379
|
+
[Inferred from successful task patterns]
|
|
1380
|
+
|
|
1381
|
+
### Growth areas
|
|
1382
|
+
[Inferred from repeated failure patterns or low verify pass rates]
|
|
1383
|
+
```
|
|
1384
|
+
|
|
1385
|
+
## Privacy note
|
|
1386
|
+
Developer profiles are committed to the team repository.
|
|
1387
|
+
They should contain professional observations only.
|
|
1388
|
+
Never include personal information beyond what is directly relevant
|
|
1389
|
+
to team collaboration and agent personalisation.
|
|
1390
|
+
```
|
|
1391
|
+
|
|
1392
|
+
**Commit:**
|
|
1393
|
+
```bash
|
|
1394
|
+
git add .mindforge/team/
|
|
1395
|
+
git commit -m "feat(team): implement team profile system with tech preferences and quality patterns"
|
|
1396
|
+
```
|
|
1397
|
+
|
|
1398
|
+
---
|
|
1399
|
+
|
|
1400
|
+
## TASK 8 — Write the Metrics System
|
|
1401
|
+
|
|
1402
|
+
### `.mindforge/metrics/METRICS-SCHEMA.md`
|
|
1403
|
+
|
|
1404
|
+
```markdown
|
|
1405
|
+
# MindForge Metrics — Schema Reference
|
|
1406
|
+
|
|
1407
|
+
## Purpose
|
|
1408
|
+
Track agent quality and project health over time. Provide trend analysis
|
|
1409
|
+
to identify improvement opportunities and early warning signals.
|
|
1410
|
+
|
|
1411
|
+
## Metrics file location
|
|
1412
|
+
`.mindforge/metrics/` — one file per metric category
|
|
1413
|
+
|
|
1414
|
+
## Metric files
|
|
1415
|
+
|
|
1416
|
+
### `session-quality.jsonl`
|
|
1417
|
+
One entry per completed session:
|
|
1418
|
+
|
|
1419
|
+
```json
|
|
1420
|
+
{
|
|
1421
|
+
"session_id": "sess_abc",
|
|
1422
|
+
"date": "YYYY-MM-DD",
|
|
1423
|
+
"phase": 3,
|
|
1424
|
+
"developer_id": "john-company-com",
|
|
1425
|
+
"duration_estimate": "short|medium|long",
|
|
1426
|
+
"tasks_attempted": 5,
|
|
1427
|
+
"tasks_completed": 4,
|
|
1428
|
+
"tasks_failed": 1,
|
|
1429
|
+
"verify_pass_rate": 0.8,
|
|
1430
|
+
"quality_gates_failed": 0,
|
|
1431
|
+
"security_findings": 0,
|
|
1432
|
+
"context_compactions": 1,
|
|
1433
|
+
"compaction_level": 2,
|
|
1434
|
+
"skills_loaded_count": 3,
|
|
1435
|
+
"antipatterns_detected": 0,
|
|
1436
|
+
"session_quality_score": 82
|
|
1437
|
+
}
|
|
1438
|
+
```
|
|
1439
|
+
|
|
1440
|
+
**Session quality score formula:**
|
|
1441
|
+
```
|
|
1442
|
+
base = 100
|
|
1443
|
+
- 15 per task_failed
|
|
1444
|
+
- 10 per quality_gate_failed
|
|
1445
|
+
- 20 per security finding (CRITICAL: -30, HIGH: -15, MEDIUM: -5)
|
|
1446
|
+
- 5 per antipattern_detected (HIGH severity: -10, MEDIUM: -5)
|
|
1447
|
+
+ 5 if zero quality gate failures
|
|
1448
|
+
+ 5 if zero security findings
|
|
1449
|
+
= session_quality_score (clamped 0-100)
|
|
1450
|
+
```
|
|
1451
|
+
|
|
1452
|
+
### `phase-metrics.jsonl`
|
|
1453
|
+
One entry per completed phase:
|
|
1454
|
+
|
|
1455
|
+
```json
|
|
1456
|
+
{
|
|
1457
|
+
"phase": 3,
|
|
1458
|
+
"date_started": "YYYY-MM-DD",
|
|
1459
|
+
"date_completed": "YYYY-MM-DD",
|
|
1460
|
+
"difficulty_score": 3.85,
|
|
1461
|
+
"tasks_planned": 8,
|
|
1462
|
+
"tasks_completed": 8,
|
|
1463
|
+
"waves_executed": 3,
|
|
1464
|
+
"total_commits": 8,
|
|
1465
|
+
"requirements_delivered": 10,
|
|
1466
|
+
"requirements_total": 10,
|
|
1467
|
+
"test_coverage_pct": 84,
|
|
1468
|
+
"security_findings_total": 3,
|
|
1469
|
+
"security_findings_critical": 0,
|
|
1470
|
+
"security_findings_remediated": 3,
|
|
1471
|
+
"uat_pass_rate": 1.0,
|
|
1472
|
+
"rework_count": 1,
|
|
1473
|
+
"approval_wait_hours": 2.5,
|
|
1474
|
+
"phase_quality_score": 91
|
|
1475
|
+
}
|
|
1476
|
+
```
|
|
1477
|
+
|
|
1478
|
+
**Phase quality score formula:**
|
|
1479
|
+
```
|
|
1480
|
+
base = 100
|
|
1481
|
+
- 10 per open security finding (unresolved at phase end)
|
|
1482
|
+
- 5 per rework event (fix plan created during UAT)
|
|
1483
|
+
- 3 per requirement not delivered
|
|
1484
|
+
+ 5 if all requirements delivered AND all tests passing
|
|
1485
|
+
+ 5 if zero security findings
|
|
1486
|
+
+ 3 if UAT pass rate = 1.0
|
|
1487
|
+
= phase_quality_score (clamped 0-100)
|
|
1488
|
+
```
|
|
1489
|
+
|
|
1490
|
+
### `skill-usage.jsonl`
|
|
1491
|
+
One entry per skill loading event:
|
|
1492
|
+
|
|
1493
|
+
```json
|
|
1494
|
+
{
|
|
1495
|
+
"date": "YYYY-MM-DD",
|
|
1496
|
+
"phase": 3,
|
|
1497
|
+
"plan": "02",
|
|
1498
|
+
"skill_name": "security-review",
|
|
1499
|
+
"skill_version": "1.0.0",
|
|
1500
|
+
"trigger_type": "text_match|file_path_match|file_name_match",
|
|
1501
|
+
"trigger_keyword": "jwt.sign",
|
|
1502
|
+
"task_outcome": "completed|failed",
|
|
1503
|
+
"verify_passed_first_try": true
|
|
1504
|
+
}
|
|
1505
|
+
```
|
|
1506
|
+
|
|
1507
|
+
### `compaction-quality.jsonl`
|
|
1508
|
+
One entry per compaction event:
|
|
1509
|
+
|
|
1510
|
+
```json
|
|
1511
|
+
{
|
|
1512
|
+
"date": "YYYY-MM-DD",
|
|
1513
|
+
"compaction_level": 2,
|
|
1514
|
+
"context_pct_at_compaction": 84,
|
|
1515
|
+
"decisions_captured": 3,
|
|
1516
|
+
"discoveries_captured": 2,
|
|
1517
|
+
"implicit_knowledge_items": 4,
|
|
1518
|
+
"quality_signals_captured": 1,
|
|
1519
|
+
"next_session_continuation_success": true
|
|
1520
|
+
}
|
|
1521
|
+
```
|
|
1522
|
+
`next_session_continuation_success`: did the next session successfully resume
|
|
1523
|
+
from the compacted state without needing to re-do work? (Manual assessment, defaults null)
|
|
1524
|
+
|
|
1525
|
+
## Metrics writing protocol
|
|
1526
|
+
|
|
1527
|
+
Write metric entries at these moments:
|
|
1528
|
+
- `session-quality.jsonl`: at session end (before /mindforge:status is shown)
|
|
1529
|
+
- `phase-metrics.jsonl`: when a phase is marked complete
|
|
1530
|
+
- `skill-usage.jsonl`: whenever a skill is loaded for a task
|
|
1531
|
+
- `compaction-quality.jsonl`: whenever context compaction occurs
|
|
1532
|
+
|
|
1533
|
+
All metric files are append-only (same convention as AUDIT.jsonl).
|
|
1534
|
+
```
|
|
1535
|
+
|
|
1536
|
+
---
|
|
1537
|
+
|
|
1538
|
+
### `.mindforge/metrics/quality-tracker.md`
|
|
1539
|
+
|
|
1540
|
+
```markdown
|
|
1541
|
+
# MindForge Metrics — Quality Tracker
|
|
1542
|
+
|
|
1543
|
+
## Purpose
|
|
1544
|
+
Analyse metric files to produce trend reports and early warning signals.
|
|
1545
|
+
|
|
1546
|
+
## Trend analysis windows
|
|
1547
|
+
- Short-term: last 5 sessions
|
|
1548
|
+
- Medium-term: last 20 sessions
|
|
1549
|
+
- Long-term: all sessions
|
|
1550
|
+
|
|
1551
|
+
## Key metrics to track
|
|
1552
|
+
|
|
1553
|
+
### Verify pass rate trend
|
|
1554
|
+
A decreasing trend indicates: plans are too vague, wrong skills loaded,
|
|
1555
|
+
or context quality degrading over sessions.
|
|
1556
|
+
|
|
1557
|
+
Target: > 85% first-attempt verify pass rate
|
|
1558
|
+
Warning: < 75% over the last 5 sessions
|
|
1559
|
+
Action: Review plan quality — are `<verify>` steps clear and executable?
|
|
1560
|
+
|
|
1561
|
+
### Security finding frequency
|
|
1562
|
+
An increasing trend indicates: security review skill not loading correctly,
|
|
1563
|
+
new tech domains introduced without security skills, or code quality declining.
|
|
1564
|
+
|
|
1565
|
+
Target: < 1 HIGH+ finding per phase
|
|
1566
|
+
Warning: 2+ CRITICAL findings in the last 3 phases
|
|
1567
|
+
Action: Run /mindforge:security-scan --deep, review security-review skill triggers
|
|
1568
|
+
|
|
1569
|
+
### Task failure rate
|
|
1570
|
+
A high task failure rate indicates: plans too ambitious, wrong persona loaded,
|
|
1571
|
+
or quality gates misconfigured.
|
|
1572
|
+
|
|
1573
|
+
Target: < 10% task failure rate
|
|
1574
|
+
Warning: > 20% failure rate in last session
|
|
1575
|
+
Action: Review the most recent failed task — what was the verify output?
|
|
1576
|
+
|
|
1577
|
+
### Context compaction frequency
|
|
1578
|
+
Compacting frequently (every 3-4 tasks) suggests context is being used inefficiently.
|
|
1579
|
+
|
|
1580
|
+
Target: < 1 compaction per 8 tasks
|
|
1581
|
+
Warning: > 2 compactions per session
|
|
1582
|
+
Action: Review skill loading — too many skills injected per task?
|
|
1583
|
+
|
|
1584
|
+
## Early warning signals (auto-reported in /mindforge:metrics)
|
|
1585
|
+
|
|
1586
|
+
| Signal | Condition | Suggested action |
|
|
1587
|
+
|---|---|---|
|
|
1588
|
+
| Quality degradation | Session quality score dropping 10+ points over last 3 sessions | Review recent plan complexity and skill coverage |
|
|
1589
|
+
| Security regression | Any CRITICAL finding after 3 clean phases | Immediate security scan |
|
|
1590
|
+
| Compaction overhead | > 2 compactions in last session | Reduce skill injection scope |
|
|
1591
|
+
| Stale skills | Any skill not loaded in last 10 sessions | Consider deprecating unused skills |
|
|
1592
|
+
| Approval bottleneck | Average approval wait > 12 hours | Review approver availability or tier thresholds |
|
|
1593
|
+
```
|
|
1594
|
+
|
|
1595
|
+
**Commit:**
|
|
1596
|
+
```bash
|
|
1597
|
+
git add .mindforge/metrics/
|
|
1598
|
+
git commit -m "feat(metrics): implement quality metrics schema and trend analysis system"
|
|
1599
|
+
```
|
|
1600
|
+
|
|
1601
|
+
---
|
|
1602
|
+
|
|
1603
|
+
## TASK 9 — Write MINDFORGE.md — The Project Constitution
|
|
1604
|
+
|
|
1605
|
+
### `MINDFORGE.md` (root of the project)
|
|
1606
|
+
|
|
1607
|
+
```markdown
|
|
1608
|
+
# MINDFORGE.md — Project Constitution
|
|
1609
|
+
# This file is the master override for all MindForge defaults in this project.
|
|
1610
|
+
# Read by every MindForge agent at session start (after CLAUDE.md).
|
|
1611
|
+
# CLAUDE.md is the law. MINDFORGE.md is the project-specific interpretation.
|
|
1612
|
+
|
|
1613
|
+
## Project identity
|
|
1614
|
+
NAME=[Your project name]
|
|
1615
|
+
VERSION=[Current project version]
|
|
1616
|
+
DESCRIPTION=[One sentence]
|
|
1617
|
+
MINDFORGE_VERSION_REQUIRED=0.5.0
|
|
1618
|
+
|
|
1619
|
+
---
|
|
1620
|
+
|
|
1621
|
+
## Override: Model preferences
|
|
1622
|
+
|
|
1623
|
+
# Which Claude model to use for each agent type
|
|
1624
|
+
# Options: claude-opus-4-5 | claude-sonnet-4-5 | claude-haiku-4-5 | inherit
|
|
1625
|
+
PLANNER_MODEL=claude-opus-4-5
|
|
1626
|
+
EXECUTOR_MODEL=claude-sonnet-4-5
|
|
1627
|
+
REVIEWER_MODEL=claude-sonnet-4-5
|
|
1628
|
+
VERIFIER_MODEL=claude-sonnet-4-5
|
|
1629
|
+
SECURITY_MODEL=claude-opus-4-5
|
|
1630
|
+
DEBUG_MODEL=claude-opus-4-5
|
|
1631
|
+
|
|
1632
|
+
---
|
|
1633
|
+
|
|
1634
|
+
## Override: Execution behaviour
|
|
1635
|
+
|
|
1636
|
+
# Auto-approve Tier 1 changes without confirmation (default: true)
|
|
1637
|
+
TIER1_AUTO_APPROVE=true
|
|
1638
|
+
|
|
1639
|
+
# Require explicit user confirmation before each wave starts (default: false)
|
|
1640
|
+
WAVE_CONFIRMATION_REQUIRED=false
|
|
1641
|
+
|
|
1642
|
+
# Run discuss-phase automatically before plan-phase (default: false)
|
|
1643
|
+
AUTO_DISCUSS_PHASE=false
|
|
1644
|
+
|
|
1645
|
+
# Minimum acceptable verify pass rate before flagging concerns
|
|
1646
|
+
VERIFY_PASS_RATE_WARNING_THRESHOLD=0.75
|
|
1647
|
+
|
|
1648
|
+
# Context compaction trigger (percentage, default: 70)
|
|
1649
|
+
COMPACTION_THRESHOLD_PCT=70
|
|
1650
|
+
|
|
1651
|
+
# Maximum tasks per phase before suggesting a phase split
|
|
1652
|
+
MAX_TASKS_PER_PHASE=15
|
|
1653
|
+
|
|
1654
|
+
---
|
|
1655
|
+
|
|
1656
|
+
## Override: Quality standards
|
|
1657
|
+
|
|
1658
|
+
# Minimum test coverage percentage (default: 80)
|
|
1659
|
+
MIN_TEST_COVERAGE_PCT=80
|
|
1660
|
+
|
|
1661
|
+
# Maximum function length in lines (default: 40)
|
|
1662
|
+
MAX_FUNCTION_LINES=40
|
|
1663
|
+
|
|
1664
|
+
# Maximum cyclomatic complexity (default: 10)
|
|
1665
|
+
MAX_CYCLOMATIC_COMPLEXITY=10
|
|
1666
|
+
|
|
1667
|
+
# Require ADR for every architectural decision (default: false)
|
|
1668
|
+
REQUIRE_ADR_FOR_ALL_DECISIONS=false
|
|
1669
|
+
|
|
1670
|
+
# Block PRs with any open MEDIUM security findings (default: false — only CRITICAL/HIGH block)
|
|
1671
|
+
BLOCK_ON_MEDIUM_SECURITY_FINDINGS=false
|
|
1672
|
+
|
|
1673
|
+
---
|
|
1674
|
+
|
|
1675
|
+
## Override: Skills behaviour
|
|
1676
|
+
|
|
1677
|
+
# Skills to always load regardless of trigger matching (comma-separated)
|
|
1678
|
+
ALWAYS_LOAD_SKILLS=security-review
|
|
1679
|
+
|
|
1680
|
+
# Skills to never load (disabled for this project)
|
|
1681
|
+
DISABLED_SKILLS=
|
|
1682
|
+
|
|
1683
|
+
# Maximum number of skills to fully inject (beyond this, summarise)
|
|
1684
|
+
MAX_FULL_SKILL_INJECTIONS=3
|
|
1685
|
+
|
|
1686
|
+
---
|
|
1687
|
+
|
|
1688
|
+
## Override: Git and commits
|
|
1689
|
+
|
|
1690
|
+
# Commit message format (default: conventional-commits)
|
|
1691
|
+
# Options: conventional-commits | custom | none
|
|
1692
|
+
COMMIT_FORMAT=conventional-commits
|
|
1693
|
+
|
|
1694
|
+
# Branch naming strategy (default: none)
|
|
1695
|
+
# Options: none | phase | milestone
|
|
1696
|
+
BRANCHING_STRATEGY=phase
|
|
1697
|
+
|
|
1698
|
+
# Branch template for phase branches
|
|
1699
|
+
PHASE_BRANCH_TEMPLATE=feat/phase-{N}-{slug}
|
|
1700
|
+
|
|
1701
|
+
# Require all commits to be signed (GPG)
|
|
1702
|
+
REQUIRE_SIGNED_COMMITS=false
|
|
1703
|
+
|
|
1704
|
+
---
|
|
1705
|
+
|
|
1706
|
+
## Override: Notifications
|
|
1707
|
+
|
|
1708
|
+
# Which events trigger Slack notifications (comma-separated)
|
|
1709
|
+
# Options: all | phase_complete | security_critical | approval_needed | blocker | milestone
|
|
1710
|
+
NOTIFY_ON=phase_complete,security_critical,approval_needed
|
|
1711
|
+
|
|
1712
|
+
# Mention specific users for security CRITICAL findings
|
|
1713
|
+
SECURITY_CRITICAL_MENTION=@security-team
|
|
1714
|
+
|
|
1715
|
+
---
|
|
1716
|
+
|
|
1717
|
+
## Override: Governance
|
|
1718
|
+
|
|
1719
|
+
# Minimum complexity score to require discuss-phase before plan-phase
|
|
1720
|
+
DISCUSS_PHASE_REQUIRED_ABOVE_DIFFICULTY=3.5
|
|
1721
|
+
|
|
1722
|
+
# Anti-pattern detection sensitivity
|
|
1723
|
+
# Options: strict | standard | relaxed
|
|
1724
|
+
ANTIPATTERN_SENSITIVITY=standard
|
|
1725
|
+
|
|
1726
|
+
# Block phase execution if HIGH anti-patterns detected (default: false — warn only)
|
|
1727
|
+
BLOCK_ON_HIGH_ANTIPATTERNS=false
|
|
1728
|
+
|
|
1729
|
+
---
|
|
1730
|
+
|
|
1731
|
+
## Project-specific agent instructions
|
|
1732
|
+
|
|
1733
|
+
# These instructions are appended to EVERY agent's context for this project.
|
|
1734
|
+
# Use for project-specific rules not captured in CONVENTIONS.md.
|
|
1735
|
+
|
|
1736
|
+
ADDITIONAL_AGENT_INSTRUCTIONS="""
|
|
1737
|
+
- This project uses the monorepo structure: packages/api, packages/web, packages/shared
|
|
1738
|
+
- Always check packages/shared before creating new utilities (may already exist)
|
|
1739
|
+
- The /api package uses Fastify v4 — not Express — check Fastify docs for middleware syntax
|
|
1740
|
+
- Never import from packages/web into packages/api (one-way dependency)
|
|
1741
|
+
- All date handling uses date-fns — never moment.js or dayjs
|
|
1742
|
+
"""
|
|
1743
|
+
|
|
1744
|
+
---
|
|
1745
|
+
|
|
1746
|
+
## Project-specific forbidden patterns
|
|
1747
|
+
|
|
1748
|
+
# Patterns that are forbidden specifically in this project (beyond CONVENTIONS.md)
|
|
1749
|
+
PROJECT_FORBIDDEN_PATTERNS="""
|
|
1750
|
+
- No direct database access from packages/web (always via API)
|
|
1751
|
+
- No synchronous I/O in packages/api request handlers
|
|
1752
|
+
- No console.log in packages/api (use the logger from packages/shared/logger)
|
|
1753
|
+
- No TODO comments — create a GitHub issue instead
|
|
1754
|
+
"""
|
|
1755
|
+
```
|
|
1756
|
+
|
|
1757
|
+
**Commit:**
|
|
1758
|
+
```bash
|
|
1759
|
+
git add MINDFORGE.md
|
|
1760
|
+
git commit -m "feat(core): add MINDFORGE.md project constitution with comprehensive overrides"
|
|
1761
|
+
```
|
|
1762
|
+
|
|
1763
|
+
---
|
|
1764
|
+
|
|
1765
|
+
## TASK 10 — Write all 4 new commands
|
|
1766
|
+
|
|
1767
|
+
### `.claude/commands/mindforge/health.md`
|
|
1768
|
+
|
|
1769
|
+
```markdown
|
|
1770
|
+
# MindForge — Health Command
|
|
1771
|
+
# Usage: /mindforge:health [--repair] [--category C] [--verbose]
|
|
1772
|
+
|
|
1773
|
+
## Purpose
|
|
1774
|
+
Run a comprehensive health check of the MindForge installation and project state.
|
|
1775
|
+
Detect drift, corruption, stale state, and misconfiguration.
|
|
1776
|
+
|
|
1777
|
+
## Step 1 — Run health engine
|
|
1778
|
+
Execute all 7 categories from `.mindforge/intelligence/health-engine.md` in order.
|
|
1779
|
+
|
|
1780
|
+
## Step 2 — Display results
|
|
1781
|
+
|
|
1782
|
+
Format: category-by-category with clear status indicators.
|
|
1783
|
+
|
|
1784
|
+
```
|
|
1785
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1786
|
+
⚡ MindForge Health Check — v[X.Y.Z]
|
|
1787
|
+
Project: [name] | Date: [ISO-8601]
|
|
1788
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1789
|
+
|
|
1790
|
+
✅ Installation integrity — 47/47 files present, commands in sync
|
|
1791
|
+
⚠️ Context files — 2 warnings (see below)
|
|
1792
|
+
✅ Skills registry — 10 skills registered, all valid
|
|
1793
|
+
✅ Persona system — 8 personas valid, 0 override issues
|
|
1794
|
+
❌ State consistency — 1 error (see below)
|
|
1795
|
+
✅ Integration connectivity — Jira ✅ Confluence ✅ Slack ❌ (unconfigured)
|
|
1796
|
+
⚠️ Security configuration — 1 warning (see below)
|
|
1797
|
+
|
|
1798
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1799
|
+
|
|
1800
|
+
Errors (must fix):
|
|
1801
|
+
[1] Phase 2 shows "complete" in STATE.md but VERIFICATION.md is missing.
|
|
1802
|
+
Fix: Run /mindforge:verify-phase 2
|
|
1803
|
+
|
|
1804
|
+
Warnings (should fix):
|
|
1805
|
+
[1] STATE.md last updated 38 days ago — may be stale
|
|
1806
|
+
[2] .mindforge/org/SECURITY.md has 2 unfilled sections (search: "[placeholder]")
|
|
1807
|
+
[3] Slack SLACK_BOT_TOKEN not configured (notifications will be skipped)
|
|
1808
|
+
|
|
1809
|
+
Informational:
|
|
1810
|
+
[i] AUDIT.jsonl: 7,832 entries (archive threshold: 10,000 — 2,168 remaining)
|
|
1811
|
+
[i] MindForge v0.4.0 installed (latest: v0.5.0 — run npx mindforge-cc@latest)
|
|
1812
|
+
|
|
1813
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1814
|
+
Overall: ⚠️ 1 error, 3 warnings
|
|
1815
|
+
Run /mindforge:health --repair to auto-fix applicable issues.
|
|
1816
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1817
|
+
```
|
|
1818
|
+
|
|
1819
|
+
## --repair mode
|
|
1820
|
+
Apply all auto-repairable fixes from the health engine.
|
|
1821
|
+
For each fix: report what was done.
|
|
1822
|
+
For non-auto-repairable: provide exact manual steps.
|
|
1823
|
+
|
|
1824
|
+
## --category flag
|
|
1825
|
+
Run only one category: `--category installation|context|skills|personas|state|integrations|security`
|
|
1826
|
+
|
|
1827
|
+
## --verbose flag
|
|
1828
|
+
Include detailed output for each check (file paths, exact values checked).
|
|
1829
|
+
Without --verbose: only report issues. With --verbose: report all checks including passing.
|
|
1830
|
+
|
|
1831
|
+
## AUDIT entry
|
|
1832
|
+
```json
|
|
1833
|
+
{ "event": "health_check_completed", "errors": [N], "warnings": [N], "repaired": [N] }
|
|
1834
|
+
```
|
|
1835
|
+
```
|
|
1836
|
+
|
|
1837
|
+
---
|
|
1838
|
+
|
|
1839
|
+
### `.claude/commands/mindforge/retrospective.md`
|
|
1840
|
+
|
|
1841
|
+
```markdown
|
|
1842
|
+
# MindForge — Retrospective Command
|
|
1843
|
+
# Usage: /mindforge:retrospective [phase N|milestone M] [--template agile|4ls|starfish]
|
|
1844
|
+
|
|
1845
|
+
## Purpose
|
|
1846
|
+
Facilitate a structured retrospective for a completed phase or milestone.
|
|
1847
|
+
Extract learnings, identify improvements, and create trackable action items.
|
|
1848
|
+
|
|
1849
|
+
## Retrospective templates
|
|
1850
|
+
|
|
1851
|
+
### `--template agile` (default) — Classic Agile Format
|
|
1852
|
+
- What went well?
|
|
1853
|
+
- What didn't go well?
|
|
1854
|
+
- What would we do differently?
|
|
1855
|
+
- Action items (with owner and due date)
|
|
1856
|
+
|
|
1857
|
+
### `--template 4ls` — Four Ls
|
|
1858
|
+
- Liked (what was valuable)
|
|
1859
|
+
- Learned (new insights and knowledge)
|
|
1860
|
+
- Lacked (what was missing)
|
|
1861
|
+
- Longed for (what we wish we had)
|
|
1862
|
+
|
|
1863
|
+
### `--template starfish` — Starfish
|
|
1864
|
+
- Keep doing (valuable, continue)
|
|
1865
|
+
- Less of (valuable but doing too much)
|
|
1866
|
+
- More of (valuable but doing too little)
|
|
1867
|
+
- Start doing (not doing, should start)
|
|
1868
|
+
- Stop doing (not valuable, stop)
|
|
1869
|
+
|
|
1870
|
+
---
|
|
1871
|
+
|
|
1872
|
+
## Step 1 — Gather data automatically
|
|
1873
|
+
|
|
1874
|
+
Before asking any questions, collect objective data from the project artifacts:
|
|
1875
|
+
|
|
1876
|
+
```markdown
|
|
1877
|
+
### Quantitative data gathered:
|
|
1878
|
+
- Phase [N] duration: [start date] → [end date] = [N] days
|
|
1879
|
+
- Tasks: [X] completed, [Y] failed, [Z] required rework
|
|
1880
|
+
- Verify pass rate: [N%]
|
|
1881
|
+
- Security findings: [N] total (CRITICAL: [N], HIGH: [N]) — all remediated? [yes/no]
|
|
1882
|
+
- Code review findings: [N] blocking, [N] major, [N] minor
|
|
1883
|
+
- UAT: [N] deliverables tested, [N] passed first attempt, [N] required fixes
|
|
1884
|
+
- Anti-patterns detected: [N] (HIGH: [N], MEDIUM: [N])
|
|
1885
|
+
- Approval wait time: [N] hours average
|
|
1886
|
+
- Context compactions: [N]
|
|
1887
|
+
|
|
1888
|
+
### Qualitative signals from AUDIT.jsonl:
|
|
1889
|
+
- Most common failure type: [from task_failed events]
|
|
1890
|
+
- Most active skill: [from skill_usage.jsonl — most loaded]
|
|
1891
|
+
- Quality trend: [improving/stable/declining from session scores]
|
|
1892
|
+
```
|
|
1893
|
+
|
|
1894
|
+
## Step 2 — Structured discussion
|
|
1895
|
+
|
|
1896
|
+
Present data summary. Then ask structured questions:
|
|
1897
|
+
|
|
1898
|
+
```
|
|
1899
|
+
Phase [N] Retrospective — [template name]
|
|
1900
|
+
|
|
1901
|
+
─── Data summary ────────────────────────────────────────────────
|
|
1902
|
+
[quantitative data from Step 1]
|
|
1903
|
+
|
|
1904
|
+
─── Discussion ──────────────────────────────────────────────────
|
|
1905
|
+
|
|
1906
|
+
[For agile template:]
|
|
1907
|
+
1. "Looking at the data and your experience — what went well this phase?"
|
|
1908
|
+
[wait for full answer]
|
|
1909
|
+
2. "What didn't go as planned or caused friction?"
|
|
1910
|
+
[wait for full answer]
|
|
1911
|
+
3. "What would you do differently next time?"
|
|
1912
|
+
[wait for full answer]
|
|
1913
|
+
4. "Based on everything — what 2-3 action items should we commit to?"
|
|
1914
|
+
[help them be specific: who does it, by when, how we know it's done]
|
|
1915
|
+
```
|
|
1916
|
+
|
|
1917
|
+
## Step 3 — Write retrospective document
|
|
1918
|
+
|
|
1919
|
+
`.planning/phases/[N]/RETROSPECTIVE-[N].md` (for phase retros)
|
|
1920
|
+
`.planning/milestones/RETRO-[milestone-name].md` (for milestone retros)
|
|
1921
|
+
|
|
1922
|
+
```markdown
|
|
1923
|
+
# Retrospective — Phase [N]
|
|
1924
|
+
**Date:** [ISO-8601]
|
|
1925
|
+
**Attendees:** [from git config user.email history for this phase]
|
|
1926
|
+
**Template:** [template name]
|
|
1927
|
+
**Facilitator:** MindForge
|
|
1928
|
+
|
|
1929
|
+
## Quantitative summary
|
|
1930
|
+
[Data from Step 1]
|
|
1931
|
+
|
|
1932
|
+
## Discussion
|
|
1933
|
+
|
|
1934
|
+
### What went well
|
|
1935
|
+
[From discussion — formatted as bullets]
|
|
1936
|
+
|
|
1937
|
+
### What didn't go well
|
|
1938
|
+
[From discussion — formatted as bullets]
|
|
1939
|
+
|
|
1940
|
+
### What we'd do differently
|
|
1941
|
+
[From discussion — formatted as bullets]
|
|
1942
|
+
|
|
1943
|
+
## Action items
|
|
1944
|
+
| Action | Owner (git email) | Due | How we know it's done |
|
|
1945
|
+
|---|---|---|---|
|
|
1946
|
+
| [action 1] | [owner] | [date] | [definition of done] |
|
|
1947
|
+
| [action 2] | [owner] | [date] | [definition of done] |
|
|
1948
|
+
|
|
1949
|
+
## Key insights for future phases
|
|
1950
|
+
[2-3 sentences: the most important learnings from this retrospective]
|
|
1951
|
+
|
|
1952
|
+
## MindForge configuration changes recommended
|
|
1953
|
+
[Based on the retrospective — any MINDFORGE.md changes that would address issues raised]
|
|
1954
|
+
```
|
|
1955
|
+
|
|
1956
|
+
## Step 4 — Create follow-up tasks
|
|
1957
|
+
|
|
1958
|
+
For each action item, offer to create:
|
|
1959
|
+
- A quick task in MindForge: `Create /mindforge:quick for "[action]"`
|
|
1960
|
+
- A Jira ticket (if configured): link to the retrospective document
|
|
1961
|
+
- A STATE.md note: "Action item from Phase [N] retro: [action]"
|
|
1962
|
+
|
|
1963
|
+
## Step 5 — Update metrics
|
|
1964
|
+
|
|
1965
|
+
Write to `session-quality.jsonl`:
|
|
1966
|
+
```json
|
|
1967
|
+
{ "event": "retrospective_completed", "phase": [N], "action_items": [N] }
|
|
1968
|
+
```
|
|
1969
|
+
|
|
1970
|
+
## Step 6 — Feed insights to future planning
|
|
1971
|
+
|
|
1972
|
+
Ask: "Should I add any of these learnings to MINDFORGE.md
|
|
1973
|
+
to improve future phase planning?"
|
|
1974
|
+
|
|
1975
|
+
If yes: suggest specific MINDFORGE.md entries for each learning.
|
|
1976
|
+
Example: "Verify pass rate was low because plans were too vague →
|
|
1977
|
+
consider setting DISCUSS_PHASE_REQUIRED_ABOVE_DIFFICULTY=2.5
|
|
1978
|
+
to run discussions earlier."
|
|
1979
|
+
```
|
|
1980
|
+
|
|
1981
|
+
---
|
|
1982
|
+
|
|
1983
|
+
### `.claude/commands/mindforge/profile-team.md`
|
|
1984
|
+
|
|
1985
|
+
```markdown
|
|
1986
|
+
# MindForge — Profile Team Command
|
|
1987
|
+
# Usage: /mindforge:profile-team [--refresh] [--developer email] [--questionnaire]
|
|
1988
|
+
|
|
1989
|
+
## Purpose
|
|
1990
|
+
Generate and maintain team capability profiles that personalise agent responses
|
|
1991
|
+
for each developer and the team as a whole.
|
|
1992
|
+
|
|
1993
|
+
## Data sources (in priority order)
|
|
1994
|
+
1. Declared preferences (via --questionnaire or manual TEAM-PROFILE.md edits)
|
|
1995
|
+
2. Inferred patterns from AUDIT.jsonl and git history
|
|
1996
|
+
3. Defaults from CONVENTIONS.md and TOOLS.md
|
|
1997
|
+
|
|
1998
|
+
## Step 1 — Infer from existing data
|
|
1999
|
+
|
|
2000
|
+
```bash
|
|
2001
|
+
# Developer activity in AUDIT.jsonl
|
|
2002
|
+
grep '"developer_id"' .planning/AUDIT.jsonl | \
|
|
2003
|
+
python3 -c "import sys,json,collections
|
|
2004
|
+
counts = collections.Counter()
|
|
2005
|
+
for l in sys.stdin:
|
|
2006
|
+
try: counts[json.loads(l).get('developer_id','unknown')] += 1
|
|
2007
|
+
except: pass
|
|
2008
|
+
[print(f'{v}: {k}') for k,v in sorted(counts.items(), reverse=True)]"
|
|
2009
|
+
|
|
2010
|
+
# Session quality scores per developer
|
|
2011
|
+
grep '"session_quality_score"' .mindforge/metrics/session-quality.jsonl 2>/dev/null | \
|
|
2012
|
+
python3 -c "import sys,json,collections
|
|
2013
|
+
scores = collections.defaultdict(list)
|
|
2014
|
+
for l in sys.stdin:
|
|
2015
|
+
try:
|
|
2016
|
+
d = json.loads(l)
|
|
2017
|
+
scores[d.get('developer_id','unknown')].append(d.get('session_quality_score',0))
|
|
2018
|
+
except: pass
|
|
2019
|
+
[print(f'{k}: avg={sum(v)/len(v):.0f}') for k,v in scores.items()]"
|
|
2020
|
+
|
|
2021
|
+
# Most used skills per developer
|
|
2022
|
+
# (from skill_usage.jsonl filtered by developer)
|
|
2023
|
+
|
|
2024
|
+
# Commit patterns (time-of-day from git log)
|
|
2025
|
+
git log --format="%ae %ad" --date=format:"%H" | \
|
|
2026
|
+
awk '{print $1, $2}' | sort | uniq -c | sort -rn | head -20
|
|
2027
|
+
```
|
|
2028
|
+
|
|
2029
|
+
## Step 2 — Optional questionnaire (--questionnaire flag)
|
|
2030
|
+
|
|
2031
|
+
If `--questionnaire` is provided, ask each team member:
|
|
2032
|
+
|
|
2033
|
+
```
|
|
2034
|
+
Team Profile Setup — [N] questions (takes ~5 minutes)
|
|
2035
|
+
|
|
2036
|
+
1. "What's your primary role on this project?"
|
|
2037
|
+
Options: Backend / Frontend / Full-stack / DevOps / Tech Lead / Other
|
|
2038
|
+
|
|
2039
|
+
2. "How do you prefer agents to communicate?"
|
|
2040
|
+
Options: Very concise / Balanced / Detailed with explanations
|
|
2041
|
+
|
|
2042
|
+
3. "What's your experience level with the current tech stack?"
|
|
2043
|
+
Options: Expert / Proficient / Learning
|
|
2044
|
+
|
|
2045
|
+
4. "What areas do you consider your strongest?" (select all that apply)
|
|
2046
|
+
Options: Security / Performance / Testing / Architecture / Frontend / Backend / DevOps / Documentation
|
|
2047
|
+
|
|
2048
|
+
5. "What areas would benefit from extra agent guidance?" (select all that apply)
|
|
2049
|
+
Options: [same list]
|
|
2050
|
+
|
|
2051
|
+
6. "Any specific project rules the agent should always follow?"
|
|
2052
|
+
[free text — captured in PROJECT_FORBIDDEN_PATTERNS or ADDITIONAL_AGENT_INSTRUCTIONS]
|
|
2053
|
+
```
|
|
2054
|
+
|
|
2055
|
+
## Step 3 — Generate / update profiles
|
|
2056
|
+
|
|
2057
|
+
Write `.mindforge/team/TEAM-PROFILE.md` with inferred + declared data.
|
|
2058
|
+
Write `.mindforge/team/profiles/PROFILE-[dev-id].md` per developer.
|
|
2059
|
+
|
|
2060
|
+
## Step 4 — Validate and confirm
|
|
2061
|
+
|
|
2062
|
+
Show the team profile summary. Ask: "Does this accurately reflect your team?"
|
|
2063
|
+
Allow corrections before saving.
|
|
2064
|
+
|
|
2065
|
+
## --refresh flag
|
|
2066
|
+
Re-run inference only (no questionnaire). Updates patterns from latest AUDIT.jsonl data.
|
|
2067
|
+
Use for: periodic profile updates as the team's patterns evolve.
|
|
2068
|
+
|
|
2069
|
+
## --developer flag
|
|
2070
|
+
Update only the specified developer's profile.
|
|
2071
|
+
Example: `/mindforge:profile-team --developer john@company.com --questionnaire`
|
|
2072
|
+
|
|
2073
|
+
## AUDIT entry
|
|
2074
|
+
```json
|
|
2075
|
+
{ "event": "team_profile_updated", "developers_profiled": [N], "method": "questionnaire|inferred" }
|
|
2076
|
+
```
|
|
2077
|
+
```
|
|
2078
|
+
|
|
2079
|
+
---
|
|
2080
|
+
|
|
2081
|
+
### `.claude/commands/mindforge/metrics.md`
|
|
2082
|
+
|
|
2083
|
+
```markdown
|
|
2084
|
+
# MindForge — Metrics Command
|
|
2085
|
+
# Usage: /mindforge:metrics [--phase N] [--window short|medium|long] [--export path]
|
|
2086
|
+
|
|
2087
|
+
## Purpose
|
|
2088
|
+
Display quality metrics dashboard with trend analysis and early warning signals.
|
|
2089
|
+
|
|
2090
|
+
## Default dashboard (no flags)
|
|
2091
|
+
|
|
2092
|
+
```
|
|
2093
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
2094
|
+
⚡ MindForge Quality Metrics — [Project Name]
|
|
2095
|
+
Window: Last 5 sessions (short-term)
|
|
2096
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
2097
|
+
|
|
2098
|
+
Session Quality Scores (last 5 sessions)
|
|
2099
|
+
┌─────────────────────────────────────────────────┐
|
|
2100
|
+
│ Session Score Trend │
|
|
2101
|
+
│ sess-01 88 ██████████████████░░ (stable) │
|
|
2102
|
+
│ sess-02 91 ██████████████████████ (↑ +3) │
|
|
2103
|
+
│ sess-03 76 ███████████████░░░░░░ (↓ -15) │
|
|
2104
|
+
│ sess-04 84 █████████████████░░░ (↑ +8) │
|
|
2105
|
+
│ sess-05 89 ██████████████████░ (↑ +5) │
|
|
2106
|
+
│ Average: 85.6 │
|
|
2107
|
+
└─────────────────────────────────────────────────┘
|
|
2108
|
+
|
|
2109
|
+
Key Metrics (short-term window)
|
|
2110
|
+
─────────────────────────────────────────────────
|
|
2111
|
+
Verify pass rate 88% ✅ (target: 85%)
|
|
2112
|
+
Security findings (HIGH+) 1 ✅ (target: 0 unresolved)
|
|
2113
|
+
Task failure rate 12% ⚠️ (target: <10%)
|
|
2114
|
+
Compactions/session 1.2 ✅ (target: <2)
|
|
2115
|
+
Avg approval wait 3.4h ✅ (Tier 2 target: 24h)
|
|
2116
|
+
|
|
2117
|
+
Top skills loaded
|
|
2118
|
+
─────────────────────────────────────────────────
|
|
2119
|
+
security-review 12 times (via text: 8, file-path: 4)
|
|
2120
|
+
database-patterns 8 times
|
|
2121
|
+
api-design 7 times
|
|
2122
|
+
testing-standards 6 times
|
|
2123
|
+
accessibility 2 times
|
|
2124
|
+
|
|
2125
|
+
Early warnings
|
|
2126
|
+
─────────────────────────────────────────────────
|
|
2127
|
+
⚠️ Task failure rate above target (12% vs 10%)
|
|
2128
|
+
Root cause: sess-03 had 2 failures both on database queries
|
|
2129
|
+
Recommendation: Review database-patterns skill triggers
|
|
2130
|
+
|
|
2131
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
2132
|
+
Run /mindforge:metrics --window long for all-time trends.
|
|
2133
|
+
Run /mindforge:retrospective to act on quality issues.
|
|
2134
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
2135
|
+
```
|
|
2136
|
+
|
|
2137
|
+
## Data sources
|
|
2138
|
+
1. `.mindforge/metrics/session-quality.jsonl`
|
|
2139
|
+
2. `.mindforge/metrics/phase-metrics.jsonl`
|
|
2140
|
+
3. `.mindforge/metrics/skill-usage.jsonl`
|
|
2141
|
+
4. `.planning/AUDIT.jsonl` (for cross-referencing)
|
|
2142
|
+
|
|
2143
|
+
## Metric writing
|
|
2144
|
+
This command READS metrics. Metrics are written during:
|
|
2145
|
+
- Session end (session-quality.jsonl)
|
|
2146
|
+
- Phase completion (phase-metrics.jsonl)
|
|
2147
|
+
- Every skill load (skill-usage.jsonl)
|
|
2148
|
+
- Every compaction (compaction-quality.jsonl)
|
|
2149
|
+
|
|
2150
|
+
## --export flag
|
|
2151
|
+
Export metrics to a formatted Markdown report:
|
|
2152
|
+
`/mindforge:metrics --export metrics-report-[date].md`
|
|
2153
|
+
|
|
2154
|
+
Suitable for sharing with engineering leads or including in sprint reviews.
|
|
2155
|
+
|
|
2156
|
+
## AUDIT entry
|
|
2157
|
+
```json
|
|
2158
|
+
{ "event": "metrics_viewed", "window": "short", "early_warnings": [N] }
|
|
2159
|
+
```
|
|
2160
|
+
```
|
|
2161
|
+
|
|
2162
|
+
**Commit:**
|
|
2163
|
+
```bash
|
|
2164
|
+
for cmd in health retrospective profile-team metrics; do
|
|
2165
|
+
cp .claude/commands/mindforge/${cmd}.md .agent/mindforge/${cmd}.md
|
|
2166
|
+
done
|
|
2167
|
+
git add .claude/commands/mindforge/ .agent/mindforge/
|
|
2168
|
+
git commit -m "feat(commands): add health, retrospective, profile-team, metrics commands"
|
|
2169
|
+
```
|
|
2170
|
+
|
|
2171
|
+
---
|
|
2172
|
+
|
|
2173
|
+
## TASK 11 — Write the Interactive Setup Wizard
|
|
2174
|
+
|
|
2175
|
+
### `bin/wizard/setup-wizard.js`
|
|
2176
|
+
|
|
2177
|
+
```javascript
|
|
2178
|
+
#!/usr/bin/env node
|
|
2179
|
+
|
|
2180
|
+
/**
|
|
2181
|
+
* MindForge Interactive Setup Wizard
|
|
2182
|
+
* Provides a guided first-run experience with automatic environment detection.
|
|
2183
|
+
*
|
|
2184
|
+
* Usage: npx mindforge-cc (no flags = interactive wizard mode)
|
|
2185
|
+
* npx mindforge-cc --claude --global (non-interactive)
|
|
2186
|
+
*/
|
|
2187
|
+
|
|
2188
|
+
'use strict';
|
|
2189
|
+
|
|
2190
|
+
const fs = require('fs');
|
|
2191
|
+
const path = require('path');
|
|
2192
|
+
const { execSync } = require('child_process');
|
|
2193
|
+
const readline = require('readline');
|
|
2194
|
+
const detector = require('./environment-detector');
|
|
2195
|
+
const generator = require('./config-generator');
|
|
2196
|
+
|
|
2197
|
+
const VERSION = require('../../package.json').version;
|
|
2198
|
+
const ARGS = process.argv.slice(2);
|
|
2199
|
+
const IS_INTERACTIVE = !ARGS.some(a => ['--claude','--antigravity','--all','--help'].includes(a));
|
|
2200
|
+
|
|
2201
|
+
// ── Colours (only if TTY) ─────────────────────────────────────────────────────
|
|
2202
|
+
const TTY = process.stdout.isTTY;
|
|
2203
|
+
const c = {
|
|
2204
|
+
bold: s => TTY ? `\x1b[1m${s}\x1b[0m` : s,
|
|
2205
|
+
cyan: s => TTY ? `\x1b[36m${s}\x1b[0m` : s,
|
|
2206
|
+
green: s => TTY ? `\x1b[32m${s}\x1b[0m` : s,
|
|
2207
|
+
yellow: s => TTY ? `\x1b[33m${s}\x1b[0m` : s,
|
|
2208
|
+
red: s => TTY ? `\x1b[31m${s}\x1b[0m` : s,
|
|
2209
|
+
dim: s => TTY ? `\x1b[2m${s}\x1b[0m` : s,
|
|
2210
|
+
};
|
|
2211
|
+
|
|
2212
|
+
// ── Readline interface ────────────────────────────────────────────────────────
|
|
2213
|
+
function createReadline() {
|
|
2214
|
+
return readline.createInterface({
|
|
2215
|
+
input: process.stdin,
|
|
2216
|
+
output: process.stdout,
|
|
2217
|
+
terminal: TTY,
|
|
2218
|
+
});
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2221
|
+
async function ask(rl, question, defaultVal) {
|
|
2222
|
+
return new Promise(resolve => {
|
|
2223
|
+
const prompt = defaultVal
|
|
2224
|
+
? `${question} ${c.dim(`[${defaultVal}]`)}: `
|
|
2225
|
+
: `${question}: `;
|
|
2226
|
+
rl.question(prompt, answer => {
|
|
2227
|
+
resolve(answer.trim() || defaultVal || '');
|
|
2228
|
+
});
|
|
2229
|
+
});
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2232
|
+
async function askChoice(rl, question, choices, defaultIdx = 0) {
|
|
2233
|
+
console.log(`\n${question}`);
|
|
2234
|
+
choices.forEach((c, i) => console.log(` ${i + 1}) ${c}`));
|
|
2235
|
+
return new Promise(resolve => {
|
|
2236
|
+
rl.question(`Choice [${defaultIdx + 1}]: `, answer => {
|
|
2237
|
+
const idx = parseInt(answer.trim()) - 1;
|
|
2238
|
+
resolve(choices[!isNaN(idx) && idx >= 0 && idx < choices.length ? idx : defaultIdx]);
|
|
2239
|
+
});
|
|
2240
|
+
});
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
async function askMultiChoice(rl, question, choices) {
|
|
2244
|
+
console.log(`\n${question}`);
|
|
2245
|
+
choices.forEach((c, i) => console.log(` ${i + 1}) ${c}`));
|
|
2246
|
+
return new Promise(resolve => {
|
|
2247
|
+
rl.question('Select (comma-separated, e.g. 1,3,4): ', answer => {
|
|
2248
|
+
const selected = answer.split(',')
|
|
2249
|
+
.map(s => parseInt(s.trim()) - 1)
|
|
2250
|
+
.filter(i => !isNaN(i) && i >= 0 && i < choices.length)
|
|
2251
|
+
.map(i => choices[i]);
|
|
2252
|
+
resolve(selected.length ? selected : [choices[0]]);
|
|
2253
|
+
});
|
|
2254
|
+
});
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
// ── Banner ────────────────────────────────────────────────────────────────────
|
|
2258
|
+
function printBanner() {
|
|
2259
|
+
console.log('');
|
|
2260
|
+
console.log(c.bold(c.cyan(' ⚡ MindForge Setup Wizard')));
|
|
2261
|
+
console.log(c.dim(` Enterprise Agentic Framework v${VERSION}`));
|
|
2262
|
+
console.log('');
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
// ── Step 1: Environment detection ─────────────────────────────────────────────
|
|
2266
|
+
async function detectEnvironment() {
|
|
2267
|
+
console.log(c.bold(' Detecting your environment...\n'));
|
|
2268
|
+
const env = await detector.detect();
|
|
2269
|
+
|
|
2270
|
+
const items = [
|
|
2271
|
+
['Runtime(s) detected', env.runtimes.length ? env.runtimes.join(', ') : 'None found'],
|
|
2272
|
+
['Git repository', env.hasGit ? '✅ Yes' : '❌ No (some features require git)'],
|
|
2273
|
+
['Node.js version', `v${process.versions.node}`],
|
|
2274
|
+
['OS', `${process.platform} ${process.arch}`],
|
|
2275
|
+
['Project type', env.projectType || 'Unknown'],
|
|
2276
|
+
['Package manager', env.packageManager || 'Unknown'],
|
|
2277
|
+
['Existing MindForge', env.existingInstall ? `v${env.existingVersion}` : 'Not detected'],
|
|
2278
|
+
];
|
|
2279
|
+
|
|
2280
|
+
items.forEach(([k, v]) => console.log(` ${c.dim(k.padEnd(22))} ${v}`));
|
|
2281
|
+
console.log('');
|
|
2282
|
+
return env;
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
// ── Step 2: Runtime selection ─────────────────────────────────────────────────
|
|
2286
|
+
async function selectRuntime(rl, detectedRuntimes) {
|
|
2287
|
+
const options = ['Claude Code', 'Antigravity', 'Both (recommended)', 'Other (manual setup)'];
|
|
2288
|
+
const detected = detectedRuntimes.length
|
|
2289
|
+
? `(detected: ${detectedRuntimes.join(', ')})`
|
|
2290
|
+
: '(none auto-detected)';
|
|
2291
|
+
|
|
2292
|
+
const choice = await askChoice(
|
|
2293
|
+
rl,
|
|
2294
|
+
`Which runtime are you installing for? ${c.dim(detected)}`,
|
|
2295
|
+
options,
|
|
2296
|
+
detectedRuntimes.includes('claude') ? 0 : 2
|
|
2297
|
+
);
|
|
2298
|
+
|
|
2299
|
+
return {
|
|
2300
|
+
'Claude Code': ['claude'],
|
|
2301
|
+
'Antigravity': ['antigravity'],
|
|
2302
|
+
'Both (recommended)': ['claude', 'antigravity'],
|
|
2303
|
+
'Other (manual setup)': [],
|
|
2304
|
+
}[choice] || ['claude'];
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
// ── Step 3: Install scope ─────────────────────────────────────────────────────
|
|
2308
|
+
async function selectScope(rl) {
|
|
2309
|
+
const choice = await askChoice(
|
|
2310
|
+
rl,
|
|
2311
|
+
'Install scope:',
|
|
2312
|
+
[
|
|
2313
|
+
'Global — available in all projects (recommended)',
|
|
2314
|
+
'Local — this project only',
|
|
2315
|
+
],
|
|
2316
|
+
0
|
|
2317
|
+
);
|
|
2318
|
+
return choice.includes('Global') ? 'global' : 'local';
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
// ── Step 4: Feature setup ─────────────────────────────────────────────────────
|
|
2322
|
+
async function configureFeatures(rl) {
|
|
2323
|
+
console.log(c.bold('\n Optional features (you can change these later in MINDFORGE.md):\n'));
|
|
2324
|
+
|
|
2325
|
+
const features = await askMultiChoice(rl, 'Which features do you want to configure now?', [
|
|
2326
|
+
'Jira integration',
|
|
2327
|
+
'Confluence integration',
|
|
2328
|
+
'Slack notifications',
|
|
2329
|
+
'GitHub integration',
|
|
2330
|
+
'GitLab integration',
|
|
2331
|
+
'None — I\'ll configure later',
|
|
2332
|
+
]);
|
|
2333
|
+
|
|
2334
|
+
const config = {};
|
|
2335
|
+
|
|
2336
|
+
if (features.includes('Jira integration')) {
|
|
2337
|
+
config.jira = {
|
|
2338
|
+
baseUrl: await ask(rl, ' Jira base URL', 'https://your-org.atlassian.net'),
|
|
2339
|
+
userEmail: await ask(rl, ' Your Atlassian email', ''),
|
|
2340
|
+
projectKey: await ask(rl, ' Jira project key', 'ENG'),
|
|
2341
|
+
};
|
|
2342
|
+
console.log(c.yellow('\n ℹ️ Set JIRA_API_TOKEN environment variable with your Atlassian API token.'));
|
|
2343
|
+
console.log(c.dim(' Get token at: https://id.atlassian.com/manage-profile/security/api-tokens\n'));
|
|
2344
|
+
}
|
|
2345
|
+
|
|
2346
|
+
if (features.includes('Slack notifications')) {
|
|
2347
|
+
config.slack = {
|
|
2348
|
+
channelId: await ask(rl, ' Slack channel ID (e.g. C01234ABCDE)', ''),
|
|
2349
|
+
};
|
|
2350
|
+
console.log(c.yellow('\n ℹ️ Set SLACK_BOT_TOKEN environment variable with your Slack bot token.'));
|
|
2351
|
+
console.log(c.dim(' Create a bot at: https://api.slack.com/apps\n'));
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
if (features.includes('GitHub integration')) {
|
|
2355
|
+
config.github = {
|
|
2356
|
+
repo: await ask(rl, ' GitHub repo (owner/name)', ''),
|
|
2357
|
+
reviewers: await ask(rl, ' Default reviewers (comma-separated usernames)', ''),
|
|
2358
|
+
};
|
|
2359
|
+
console.log(c.yellow('\n ℹ️ Set GITHUB_TOKEN environment variable with your GitHub token.'));
|
|
2360
|
+
console.log(c.dim(' Create token at: https://github.com/settings/tokens\n'));
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
return config;
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
// ── Step 5: Team setup ────────────────────────────────────────────────────────
|
|
2367
|
+
async function configureTeam(rl) {
|
|
2368
|
+
const isTeam = await askChoice(rl, 'Are you setting up for a team (multiple developers)?', ['Yes', 'No'], 1);
|
|
2369
|
+
if (isTeam === 'No') return null;
|
|
2370
|
+
|
|
2371
|
+
const teamSize = await ask(rl, ' How many developers? (approximate)', '3');
|
|
2372
|
+
const tier2Approvers = await ask(rl, ' Tier 2 approvers (git emails, comma-separated)', '');
|
|
2373
|
+
const tier3Approvers = await ask(rl, ' Tier 3 compliance approvers (git emails, comma-separated)', '');
|
|
2374
|
+
|
|
2375
|
+
return { teamSize: parseInt(teamSize) || 3, tier2Approvers, tier3Approvers };
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
// ── Step 6: Install ───────────────────────────────────────────────────────────
|
|
2379
|
+
async function install(runtimes, scope, config, team) {
|
|
2380
|
+
const installer = require('../install');
|
|
2381
|
+
console.log(c.bold('\n Installing MindForge...\n'));
|
|
2382
|
+
|
|
2383
|
+
for (const runtime of runtimes) {
|
|
2384
|
+
await installer.install(runtime, scope);
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
if (Object.keys(config).length) {
|
|
2388
|
+
console.log(c.bold('\n Writing configuration...\n'));
|
|
2389
|
+
await generator.writeIntegrationsConfig(config);
|
|
2390
|
+
if (team) await generator.writeGovernanceConfig(team);
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
// ── Step 7: Post-install guidance ─────────────────────────────────────────────
|
|
2395
|
+
function printNextSteps(runtimes, scope) {
|
|
2396
|
+
console.log('');
|
|
2397
|
+
console.log(c.bold(c.green(' ✅ MindForge installed successfully!\n')));
|
|
2398
|
+
|
|
2399
|
+
console.log(c.bold(' Next steps:\n'));
|
|
2400
|
+
console.log(` ${c.cyan('1.')} Open Claude Code or Antigravity in your project directory`);
|
|
2401
|
+
console.log(` ${c.cyan('2.')} Run: ${c.bold('/mindforge:health')} to verify everything is working`);
|
|
2402
|
+
console.log(` ${c.cyan('3.')} Fill in ${c.bold('.mindforge/org/ORG.md')} with your organisation's standards`);
|
|
2403
|
+
console.log(` ${c.cyan('4.')} Edit ${c.bold('MINDFORGE.md')} to customise defaults for this project`);
|
|
2404
|
+
console.log(` ${c.cyan('5.')} Run: ${c.bold('/mindforge:init-project')} or ${c.bold('/mindforge:map-codebase')} to start\n`);
|
|
2405
|
+
|
|
2406
|
+
console.log(c.dim(' Documentation: docs/enterprise-setup.md'));
|
|
2407
|
+
console.log(c.dim(` Version: MindForge v${VERSION}\n`));
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
// ── Main ──────────────────────────────────────────────────────────────────────
|
|
2411
|
+
async function main() {
|
|
2412
|
+
printBanner();
|
|
2413
|
+
|
|
2414
|
+
if (!IS_INTERACTIVE) {
|
|
2415
|
+
// Non-interactive mode — delegate to original installer
|
|
2416
|
+
require('../install');
|
|
2417
|
+
return;
|
|
2418
|
+
}
|
|
2419
|
+
|
|
2420
|
+
const rl = createReadline();
|
|
2421
|
+
|
|
2422
|
+
try {
|
|
2423
|
+
const env = await detectEnvironment();
|
|
2424
|
+
const runtimes = await selectRuntime(rl, env.runtimes);
|
|
2425
|
+
const scope = await selectScope(rl);
|
|
2426
|
+
const config = await configureFeatures(rl);
|
|
2427
|
+
const team = await configureTeam(rl);
|
|
2428
|
+
|
|
2429
|
+
rl.close();
|
|
2430
|
+
|
|
2431
|
+
await install(runtimes, scope, config, team);
|
|
2432
|
+
printNextSteps(runtimes, scope);
|
|
2433
|
+
} catch (err) {
|
|
2434
|
+
rl.close();
|
|
2435
|
+
console.error(c.red(`\n ❌ Setup failed: ${err.message}\n`));
|
|
2436
|
+
console.error(c.dim(' For non-interactive install: npx mindforge-cc --claude --global'));
|
|
2437
|
+
process.exit(1);
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
main();
|
|
2442
|
+
```
|
|
2443
|
+
|
|
2444
|
+
---
|
|
2445
|
+
|
|
2446
|
+
### `bin/wizard/environment-detector.js`
|
|
2447
|
+
|
|
2448
|
+
```javascript
|
|
2449
|
+
/**
|
|
2450
|
+
* MindForge Environment Detector
|
|
2451
|
+
* Detects runtimes, project type, package manager, and existing MindForge install.
|
|
2452
|
+
*/
|
|
2453
|
+
|
|
2454
|
+
'use strict';
|
|
2455
|
+
|
|
2456
|
+
const fs = require('fs');
|
|
2457
|
+
const path = require('path');
|
|
2458
|
+
const { execSync } = require('child_process');
|
|
2459
|
+
|
|
2460
|
+
function safeExec(cmd) {
|
|
2461
|
+
try { return execSync(cmd, { encoding: 'utf8', stdio: ['ignore','pipe','ignore'] }).trim(); }
|
|
2462
|
+
catch { return null; }
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
async function detect() {
|
|
2466
|
+
const home = process.env.HOME || process.env.USERPROFILE || '';
|
|
2467
|
+
const cwd = process.cwd();
|
|
2468
|
+
|
|
2469
|
+
// Detect runtimes
|
|
2470
|
+
const runtimes = [];
|
|
2471
|
+
if (fs.existsSync(path.join(home, '.claude')) ||
|
|
2472
|
+
fs.existsSync(path.join(cwd, '.claude'))) runtimes.push('claude');
|
|
2473
|
+
if (fs.existsSync(path.join(home, '.gemini', 'antigravity')) ||
|
|
2474
|
+
fs.existsSync(path.join(cwd, '.agent'))) runtimes.push('antigravity');
|
|
2475
|
+
if (safeExec('which code 2>/dev/null')) runtimes.push('vscode-copilot');
|
|
2476
|
+
if (fs.existsSync(path.join(home, '.codex'))) runtimes.push('codex');
|
|
2477
|
+
|
|
2478
|
+
// Detect project type
|
|
2479
|
+
let projectType = 'unknown';
|
|
2480
|
+
if (fs.existsSync(path.join(cwd, 'package.json'))) {
|
|
2481
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf8'));
|
|
2482
|
+
if (pkg.dependencies?.next || pkg.dependencies?.react) projectType = 'Next.js / React';
|
|
2483
|
+
else if (pkg.dependencies?.fastify || pkg.dependencies?.express) projectType = 'Node.js API';
|
|
2484
|
+
else projectType = 'Node.js';
|
|
2485
|
+
} else if (fs.existsSync(path.join(cwd, 'pyproject.toml'))) {
|
|
2486
|
+
projectType = 'Python';
|
|
2487
|
+
} else if (fs.existsSync(path.join(cwd, 'Cargo.toml'))) {
|
|
2488
|
+
projectType = 'Rust';
|
|
2489
|
+
} else if (fs.existsSync(path.join(cwd, 'go.mod'))) {
|
|
2490
|
+
projectType = 'Go';
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
// Detect package manager
|
|
2494
|
+
let packageManager = 'npm';
|
|
2495
|
+
if (fs.existsSync(path.join(cwd, 'pnpm-lock.yaml'))) packageManager = 'pnpm';
|
|
2496
|
+
else if (fs.existsSync(path.join(cwd, 'yarn.lock'))) packageManager = 'yarn';
|
|
2497
|
+
else if (fs.existsSync(path.join(cwd, 'bun.lockb'))) packageManager = 'bun';
|
|
2498
|
+
|
|
2499
|
+
// Detect existing MindForge install
|
|
2500
|
+
let existingInstall = false;
|
|
2501
|
+
let existingVersion = null;
|
|
2502
|
+
const claudeMd = path.join(cwd, '.claude', 'CLAUDE.md');
|
|
2503
|
+
if (fs.existsSync(claudeMd)) {
|
|
2504
|
+
const content = fs.readFileSync(claudeMd, 'utf8');
|
|
2505
|
+
if (content.includes('MindForge')) {
|
|
2506
|
+
existingInstall = true;
|
|
2507
|
+
const vMatch = content.match(/MindForge v(\d+\.\d+\.\d+)/);
|
|
2508
|
+
existingVersion = vMatch ? vMatch[1] : 'unknown';
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
return {
|
|
2513
|
+
runtimes,
|
|
2514
|
+
hasGit: !!safeExec('git rev-parse --is-inside-work-tree'),
|
|
2515
|
+
projectType,
|
|
2516
|
+
packageManager,
|
|
2517
|
+
existingInstall,
|
|
2518
|
+
existingVersion,
|
|
2519
|
+
nodeVersion: process.versions.node,
|
|
2520
|
+
platform: process.platform,
|
|
2521
|
+
};
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
module.exports = { detect };
|
|
2525
|
+
```
|
|
2526
|
+
|
|
2527
|
+
---
|
|
2528
|
+
|
|
2529
|
+
### `bin/wizard/config-generator.js`
|
|
2530
|
+
|
|
2531
|
+
```javascript
|
|
2532
|
+
/**
|
|
2533
|
+
* MindForge Config Generator
|
|
2534
|
+
* Generates integration and governance config files from wizard input.
|
|
2535
|
+
*/
|
|
2536
|
+
|
|
2537
|
+
'use strict';
|
|
2538
|
+
|
|
2539
|
+
const fs = require('fs');
|
|
2540
|
+
const path = require('path');
|
|
2541
|
+
|
|
2542
|
+
function ensureDir(p) {
|
|
2543
|
+
if (!fs.existsSync(p)) fs.mkdirSync(p, { recursive: true });
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
async function writeIntegrationsConfig(config) {
|
|
2547
|
+
const configPath = '.mindforge/org/integrations/INTEGRATIONS-CONFIG.md';
|
|
2548
|
+
ensureDir(path.dirname(configPath));
|
|
2549
|
+
|
|
2550
|
+
if (!fs.existsSync(configPath)) {
|
|
2551
|
+
console.error('INTEGRATIONS-CONFIG.md not found — run installer first');
|
|
2552
|
+
return;
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
let content = fs.readFileSync(configPath, 'utf8');
|
|
2556
|
+
|
|
2557
|
+
if (config.jira) {
|
|
2558
|
+
content = content
|
|
2559
|
+
.replace('JIRA_BASE_URL=https://your-org.atlassian.net', `JIRA_BASE_URL=${config.jira.baseUrl}`)
|
|
2560
|
+
.replace('JIRA_PROJECT_KEY=ENG', `JIRA_PROJECT_KEY=${config.jira.projectKey}`);
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
if (config.slack) {
|
|
2564
|
+
content = content
|
|
2565
|
+
.replace('SLACK_CHANNEL_ID=C01234ABCDE', `SLACK_CHANNEL_ID=${config.slack.channelId}`);
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2568
|
+
if (config.github) {
|
|
2569
|
+
content = content
|
|
2570
|
+
.replace('GITHUB_REPO=your-org/your-repo', `GITHUB_REPO=${config.github.repo}`)
|
|
2571
|
+
.replace('GITHUB_DEFAULT_REVIEWERS=senior-engineer-1,senior-engineer-2', `GITHUB_DEFAULT_REVIEWERS=${config.github.reviewers}`);
|
|
2572
|
+
}
|
|
2573
|
+
|
|
2574
|
+
fs.writeFileSync(configPath, content);
|
|
2575
|
+
console.log(' ✅ INTEGRATIONS-CONFIG.md updated');
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
async function writeGovernanceConfig(team) {
|
|
2579
|
+
const configPath = '.mindforge/governance/GOVERNANCE-CONFIG.md';
|
|
2580
|
+
ensureDir(path.dirname(configPath));
|
|
2581
|
+
|
|
2582
|
+
if (!fs.existsSync(configPath)) return;
|
|
2583
|
+
|
|
2584
|
+
let content = fs.readFileSync(configPath, 'utf8');
|
|
2585
|
+
if (team.tier2Approvers) {
|
|
2586
|
+
content = content.replace('TIER2_APPROVERS=senior-engineer-1,senior-engineer-2',
|
|
2587
|
+
`TIER2_APPROVERS=${team.tier2Approvers}`);
|
|
2588
|
+
}
|
|
2589
|
+
if (team.tier3Approvers) {
|
|
2590
|
+
content = content.replace('TIER3_APPROVERS=security-officer,compliance-officer,cto',
|
|
2591
|
+
`TIER3_APPROVERS=${team.tier3Approvers}`);
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
fs.writeFileSync(configPath, content);
|
|
2595
|
+
console.log(' ✅ GOVERNANCE-CONFIG.md updated');
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
module.exports = { writeIntegrationsConfig, writeGovernanceConfig };
|
|
2599
|
+
```
|
|
2600
|
+
|
|
2601
|
+
**Commit:**
|
|
2602
|
+
```bash
|
|
2603
|
+
git add bin/wizard/
|
|
2604
|
+
git commit -m "feat(wizard): implement interactive setup wizard with environment detection"
|
|
2605
|
+
```
|
|
2606
|
+
|
|
2607
|
+
---
|
|
2608
|
+
|
|
2609
|
+
## TASK 12 — Update CLAUDE.md for Day 5
|
|
2610
|
+
|
|
2611
|
+
Add to `.claude/CLAUDE.md` and mirror to `.agent/CLAUDE.md`:
|
|
2612
|
+
|
|
2613
|
+
```markdown
|
|
2614
|
+
---
|
|
2615
|
+
|
|
2616
|
+
## INTELLIGENCE LAYER (Day 5)
|
|
2617
|
+
|
|
2618
|
+
### MINDFORGE.md — read this at session start
|
|
2619
|
+
After reading ORG.md and PROJECT.md, read `MINDFORGE.md` (if it exists).
|
|
2620
|
+
MINDFORGE.md contains project-specific overrides for all MindForge defaults.
|
|
2621
|
+
Apply these overrides immediately — they take precedence over CLAUDE.md defaults
|
|
2622
|
+
for configuration values (thresholds, model selection, verbosity, etc.).
|
|
2623
|
+
|
|
2624
|
+
### Smart context compaction
|
|
2625
|
+
Use Level 2 (structured extraction) as the default compaction mode.
|
|
2626
|
+
See `.mindforge/intelligence/smart-compaction.md` for the full protocol.
|
|
2627
|
+
Capture: decisions, discoveries, implicit knowledge, quality signals.
|
|
2628
|
+
Do NOT just truncate — extract and preserve.
|
|
2629
|
+
|
|
2630
|
+
### Difficulty scoring before planning
|
|
2631
|
+
Before creating task plans, run the difficulty scorer:
|
|
2632
|
+
`.mindforge/intelligence/difficulty-scorer.md`
|
|
2633
|
+
Report the score to the user. Let it inform task granularity and skill activation.
|
|
2634
|
+
|
|
2635
|
+
### Anti-pattern detection
|
|
2636
|
+
Run the anti-pattern detector from `.mindforge/intelligence/antipattern-detector.md`:
|
|
2637
|
+
- At plan-phase time: category A patterns on existing codebase
|
|
2638
|
+
- At execute-phase time: categories B, C, D on the current diff
|
|
2639
|
+
- At review time: full library
|
|
2640
|
+
|
|
2641
|
+
### Skill gap analysis
|
|
2642
|
+
Before plan-phase, run skill gap analysis:
|
|
2643
|
+
`.mindforge/intelligence/skill-gap-analyser.md`
|
|
2644
|
+
Report any required skills that are missing. Do not block — inform.
|
|
2645
|
+
|
|
2646
|
+
### Metrics writing
|
|
2647
|
+
Write metrics entries at these moments (even if no one runs /mindforge:metrics):
|
|
2648
|
+
- Session end → session-quality.jsonl
|
|
2649
|
+
- Phase completion → phase-metrics.jsonl
|
|
2650
|
+
- Every skill load → skill-usage.jsonl
|
|
2651
|
+
- Every compaction → compaction-quality.jsonl
|
|
2652
|
+
These files power the quality trend analysis.
|
|
2653
|
+
|
|
2654
|
+
### Team profile personalisation
|
|
2655
|
+
If `.mindforge/team/TEAM-PROFILE.md` exists: read it at session start.
|
|
2656
|
+
Apply declared preferences: verbosity, communication style, technical preferences.
|
|
2657
|
+
If a per-developer profile exists for the current developer: apply it additionally.
|
|
2658
|
+
|
|
2659
|
+
### New commands available (Day 5)
|
|
2660
|
+
- `/mindforge:health` — comprehensive health check with auto-repair
|
|
2661
|
+
- `/mindforge:retrospective` — structured phase/milestone retrospectives
|
|
2662
|
+
- `/mindforge:profile-team` — team capability profiling
|
|
2663
|
+
- `/mindforge:metrics` — quality metrics dashboard
|
|
2664
|
+
|
|
2665
|
+
---
|
|
2666
|
+
```
|
|
2667
|
+
|
|
2668
|
+
**Commit:**
|
|
2669
|
+
```bash
|
|
2670
|
+
git add .claude/CLAUDE.md .agent/CLAUDE.md
|
|
2671
|
+
git commit -m "feat(core): update CLAUDE.md with Day 5 intelligence layer awareness"
|
|
2672
|
+
```
|
|
2673
|
+
|
|
2674
|
+
---
|
|
2675
|
+
|
|
2676
|
+
## TASK 13 — Write Day 5 test suites
|
|
2677
|
+
|
|
2678
|
+
### `tests/intelligence.test.js`
|
|
2679
|
+
|
|
2680
|
+
```javascript
|
|
2681
|
+
/**
|
|
2682
|
+
* MindForge Day 5 — Intelligence Layer Tests
|
|
2683
|
+
* Run: node tests/intelligence.test.js
|
|
2684
|
+
*/
|
|
2685
|
+
|
|
2686
|
+
'use strict';
|
|
2687
|
+
|
|
2688
|
+
const fs = require('fs');
|
|
2689
|
+
const path = require('path');
|
|
2690
|
+
const assert = require('assert');
|
|
2691
|
+
|
|
2692
|
+
let passed = 0;
|
|
2693
|
+
let failed = 0;
|
|
2694
|
+
|
|
2695
|
+
function test(name, fn) {
|
|
2696
|
+
try { fn(); console.log(` ✅ ${name}`); passed++; }
|
|
2697
|
+
catch (e) { console.error(` ❌ ${name}\n ${e.message}`); failed++; }
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2700
|
+
function read(p) { return fs.existsSync(p) ? fs.readFileSync(p, 'utf8') : ''; }
|
|
2701
|
+
|
|
2702
|
+
// ── Difficulty scorer simulation ──────────────────────────────────────────────
|
|
2703
|
+
function scoreDifficulty(signals) {
|
|
2704
|
+
const COMPLEX = ['authentication','payment','migration','distributed','encryption','multi-tenant'];
|
|
2705
|
+
const MODERATE = ['integration','webhook','email','notification','search'];
|
|
2706
|
+
let technical = 1;
|
|
2707
|
+
signals.forEach(s => {
|
|
2708
|
+
if (COMPLEX.some(c => s.toLowerCase().includes(c))) technical = Math.max(technical, 4);
|
|
2709
|
+
if (MODERATE.some(c => s.toLowerCase().includes(c))) technical = Math.max(technical, 3);
|
|
2710
|
+
});
|
|
2711
|
+
return technical;
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2714
|
+
function compositeScore(t, r, a, d) {
|
|
2715
|
+
return parseFloat((t*0.35 + r*0.30 + a*0.20 + d*0.15).toFixed(2));
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
function recommendedTaskCount(score) {
|
|
2719
|
+
if (score <= 2.0) return { min: 2, max: 3 };
|
|
2720
|
+
if (score <= 3.0) return { min: 4, max: 6 };
|
|
2721
|
+
if (score <= 4.0) return { min: 6, max: 10 };
|
|
2722
|
+
return { min: 10, max: 15 };
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
// ── Anti-pattern simulation ───────────────────────────────────────────────────
|
|
2726
|
+
function detectAntipattern(code) {
|
|
2727
|
+
const patterns = [
|
|
2728
|
+
{ id: 'C01', regex: /==\s*null|==\s*undefined|==\s*false|==\s*0/, severity: 'CRITICAL', name: 'Auth bypass via type coercion' },
|
|
2729
|
+
{ id: 'D03', regex: /catch\s*\([^)]*\)\s*\{\s*\}/, severity: 'HIGH', name: 'Swallowed error' },
|
|
2730
|
+
{ id: 'B01', regex: /SELECT\s+\*/i, severity: 'MEDIUM', name: 'SELECT *' },
|
|
2731
|
+
];
|
|
2732
|
+
return patterns.filter(p => p.regex.test(code));
|
|
2733
|
+
}
|
|
2734
|
+
|
|
2735
|
+
// ── Session quality score simulation ─────────────────────────────────────────
|
|
2736
|
+
function calcSessionScore({ tasksAttempted, tasksFailed, qualityGatesFailed, securityFindings }) {
|
|
2737
|
+
let score = 100;
|
|
2738
|
+
score -= tasksFailed * 15;
|
|
2739
|
+
score -= qualityGatesFailed * 10;
|
|
2740
|
+
score -= (securityFindings.critical || 0) * 30;
|
|
2741
|
+
score -= (securityFindings.high || 0) * 15;
|
|
2742
|
+
score -= (securityFindings.medium || 0) * 5;
|
|
2743
|
+
if (qualityGatesFailed === 0) score += 5;
|
|
2744
|
+
if (!securityFindings.critical && !securityFindings.high) score += 5;
|
|
2745
|
+
return Math.max(0, Math.min(100, score));
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2748
|
+
// ── Tests ─────────────────────────────────────────────────────────────────────
|
|
2749
|
+
console.log('\nMindForge Day 5 — Intelligence Layer Tests\n');
|
|
2750
|
+
|
|
2751
|
+
console.log('Intelligence engine files:');
|
|
2752
|
+
[
|
|
2753
|
+
'health-engine.md', 'difficulty-scorer.md', 'antipattern-detector.md',
|
|
2754
|
+
'skill-gap-analyser.md', 'smart-compaction.md'
|
|
2755
|
+
].forEach(f => test(`${f} exists`, () => {
|
|
2756
|
+
assert.ok(fs.existsSync(`.mindforge/intelligence/${f}`), `Missing: .mindforge/intelligence/${f}`);
|
|
2757
|
+
}));
|
|
2758
|
+
|
|
2759
|
+
console.log('\nDifficulty scorer:');
|
|
2760
|
+
|
|
2761
|
+
test('authentication phase scores technical complexity 4+', () => {
|
|
2762
|
+
assert.ok(scoreDifficulty(['authentication', 'JWT']) >= 4);
|
|
2763
|
+
});
|
|
2764
|
+
|
|
2765
|
+
test('payment integration scores technical complexity 4+', () => {
|
|
2766
|
+
assert.ok(scoreDifficulty(['payment integration']) >= 4);
|
|
2767
|
+
});
|
|
2768
|
+
|
|
2769
|
+
test('simple CRUD scores moderate or lower', () => {
|
|
2770
|
+
assert.ok(scoreDifficulty(['create user profile form']) <= 3);
|
|
2771
|
+
});
|
|
2772
|
+
|
|
2773
|
+
test('composite score formula is correct', () => {
|
|
2774
|
+
const score = compositeScore(4, 5, 2, 3);
|
|
2775
|
+
assert.ok(score >= 3.5 && score <= 4.5, `Expected ~3.85, got ${score}`);
|
|
2776
|
+
});
|
|
2777
|
+
|
|
2778
|
+
test('challenging difficulty recommends 6-10 tasks', () => {
|
|
2779
|
+
const rec = recommendedTaskCount(3.85);
|
|
2780
|
+
assert.strictEqual(rec.min, 6);
|
|
2781
|
+
assert.strictEqual(rec.max, 10);
|
|
2782
|
+
});
|
|
2783
|
+
|
|
2784
|
+
test('easy difficulty recommends 2-3 tasks', () => {
|
|
2785
|
+
const rec = recommendedTaskCount(1.5);
|
|
2786
|
+
assert.strictEqual(rec.min, 2);
|
|
2787
|
+
assert.strictEqual(rec.max, 3);
|
|
2788
|
+
});
|
|
2789
|
+
|
|
2790
|
+
test('hard difficulty (>4) recommends 10-15 tasks', () => {
|
|
2791
|
+
const rec = recommendedTaskCount(4.5);
|
|
2792
|
+
assert.strictEqual(rec.min, 10);
|
|
2793
|
+
assert.strictEqual(rec.max, 15);
|
|
2794
|
+
});
|
|
2795
|
+
|
|
2796
|
+
console.log('\nAnti-pattern detector:');
|
|
2797
|
+
|
|
2798
|
+
test('detects C01 type coercion in auth check', () => {
|
|
2799
|
+
const found = detectAntipattern('if (user.role == null) return 401;');
|
|
2800
|
+
assert.ok(found.some(p => p.id === 'C01'), 'Should detect C01');
|
|
2801
|
+
});
|
|
2802
|
+
|
|
2803
|
+
test('detects D03 swallowed error', () => {
|
|
2804
|
+
const found = detectAntipattern('try { doThing() } catch(e) {}');
|
|
2805
|
+
assert.ok(found.some(p => p.id === 'D03'), 'Should detect D03 empty catch');
|
|
2806
|
+
});
|
|
2807
|
+
|
|
2808
|
+
test('detects B01 SELECT star', () => {
|
|
2809
|
+
const found = detectAntipattern('db.query("SELECT * FROM users")');
|
|
2810
|
+
assert.ok(found.some(p => p.id === 'B01'), 'Should detect B01 SELECT *');
|
|
2811
|
+
});
|
|
2812
|
+
|
|
2813
|
+
test('clean code has no anti-patterns', () => {
|
|
2814
|
+
const found = detectAntipattern(`
|
|
2815
|
+
const user = await userRepo.findById(id);
|
|
2816
|
+
if (user === null) throw new NotFoundError('User not found');
|
|
2817
|
+
const result = await paymentService.charge(amount);
|
|
2818
|
+
`);
|
|
2819
|
+
assert.strictEqual(found.length, 0, 'Clean code should have no anti-patterns');
|
|
2820
|
+
});
|
|
2821
|
+
|
|
2822
|
+
console.log('\nSmart compaction:');
|
|
2823
|
+
|
|
2824
|
+
test('smart-compaction.md defines 3 compaction levels', () => {
|
|
2825
|
+
const content = read('.mindforge/intelligence/smart-compaction.md');
|
|
2826
|
+
assert.ok(content.includes('Level 1'), 'Missing Level 1');
|
|
2827
|
+
assert.ok(content.includes('Level 2'), 'Missing Level 2');
|
|
2828
|
+
assert.ok(content.includes('Level 3'), 'Missing Level 3');
|
|
2829
|
+
});
|
|
2830
|
+
|
|
2831
|
+
test('smart-compaction.md captures implicit knowledge', () => {
|
|
2832
|
+
const content = read('.mindforge/intelligence/smart-compaction.md');
|
|
2833
|
+
assert.ok(content.includes('Implicit knowledge') || content.includes('implicit_knowledge'), 'Should capture implicit knowledge');
|
|
2834
|
+
});
|
|
2835
|
+
|
|
2836
|
+
test('smart-compaction.md captures quality signals', () => {
|
|
2837
|
+
const content = read('.mindforge/intelligence/smart-compaction.md');
|
|
2838
|
+
assert.ok(content.includes('quality_signals') || content.includes('Quality signals'), 'Should capture quality signals');
|
|
2839
|
+
});
|
|
2840
|
+
|
|
2841
|
+
console.log('\nMINDFORGE.md:');
|
|
2842
|
+
|
|
2843
|
+
test('MINDFORGE.md exists', () => {
|
|
2844
|
+
assert.ok(fs.existsSync('MINDFORGE.md'), 'MINDFORGE.md should exist in project root');
|
|
2845
|
+
});
|
|
2846
|
+
|
|
2847
|
+
test('MINDFORGE.md has model preferences section', () => {
|
|
2848
|
+
const content = read('MINDFORGE.md');
|
|
2849
|
+
assert.ok(content.includes('PLANNER_MODEL') || content.includes('model'), 'MINDFORGE.md should have model configuration');
|
|
2850
|
+
});
|
|
2851
|
+
|
|
2852
|
+
test('MINDFORGE.md has quality thresholds', () => {
|
|
2853
|
+
const content = read('MINDFORGE.md');
|
|
2854
|
+
assert.ok(content.includes('MIN_TEST_COVERAGE') || content.includes('coverage'), 'MINDFORGE.md should have quality thresholds');
|
|
2855
|
+
});
|
|
2856
|
+
|
|
2857
|
+
console.log('\nTeam profile system:');
|
|
2858
|
+
|
|
2859
|
+
test('team profile directory exists', () => {
|
|
2860
|
+
assert.ok(fs.existsSync('.mindforge/team'), 'Missing .mindforge/team directory');
|
|
2861
|
+
});
|
|
2862
|
+
|
|
2863
|
+
test('TEAM-PROFILE.md exists', () => {
|
|
2864
|
+
assert.ok(fs.existsSync('.mindforge/team/TEAM-PROFILE.md'), 'Missing TEAM-PROFILE.md');
|
|
2865
|
+
});
|
|
2866
|
+
|
|
2867
|
+
test('profiles README.md exists', () => {
|
|
2868
|
+
assert.ok(fs.existsSync('.mindforge/team/profiles/README.md'), 'Missing profiles/README.md');
|
|
2869
|
+
});
|
|
2870
|
+
|
|
2871
|
+
console.log('\nWizard files:');
|
|
2872
|
+
|
|
2873
|
+
['setup-wizard.js', 'environment-detector.js', 'config-generator.js'].forEach(f => {
|
|
2874
|
+
test(`wizard/${f} exists`, () => {
|
|
2875
|
+
assert.ok(fs.existsSync(`bin/wizard/${f}`), `Missing: bin/wizard/${f}`);
|
|
2876
|
+
});
|
|
2877
|
+
});
|
|
2878
|
+
|
|
2879
|
+
test('setup-wizard.js has printBanner function', () => {
|
|
2880
|
+
const content = read('bin/wizard/setup-wizard.js');
|
|
2881
|
+
assert.ok(content.includes('printBanner'), 'Wizard should have printBanner');
|
|
2882
|
+
});
|
|
2883
|
+
|
|
2884
|
+
test('environment-detector.js detects Node.js project type', () => {
|
|
2885
|
+
const content = read('bin/wizard/environment-detector.js');
|
|
2886
|
+
assert.ok(content.includes('package.json'), 'Detector should check package.json');
|
|
2887
|
+
});
|
|
2888
|
+
|
|
2889
|
+
test('environment-detector.js has no secrets', () => {
|
|
2890
|
+
const content = read('bin/wizard/environment-detector.js');
|
|
2891
|
+
const credPat = /(?:password|token|secret|api_key)\s*=\s*['"][^'"]{8,}/i;
|
|
2892
|
+
assert.ok(!credPat.test(content), 'Detector should not contain credential values');
|
|
2893
|
+
});
|
|
2894
|
+
|
|
2895
|
+
console.log(`\n${'─'.repeat(50)}`);
|
|
2896
|
+
console.log(`Results: ${passed} passed, ${failed} failed`);
|
|
2897
|
+
if (failed > 0) { console.error(`\n❌ ${failed} test(s) failed.\n`); process.exit(1); }
|
|
2898
|
+
else { console.log(`\n✅ All intelligence tests passed.\n`); }
|
|
2899
|
+
```
|
|
2900
|
+
|
|
2901
|
+
---
|
|
2902
|
+
|
|
2903
|
+
### `tests/metrics.test.js`
|
|
2904
|
+
|
|
2905
|
+
```javascript
|
|
2906
|
+
/**
|
|
2907
|
+
* MindForge Day 5 — Metrics Tests
|
|
2908
|
+
* Run: node tests/metrics.test.js
|
|
2909
|
+
*/
|
|
2910
|
+
|
|
2911
|
+
'use strict';
|
|
2912
|
+
|
|
2913
|
+
const fs = require('fs');
|
|
2914
|
+
const assert = require('assert');
|
|
2915
|
+
|
|
2916
|
+
let passed = 0;
|
|
2917
|
+
let failed = 0;
|
|
2918
|
+
|
|
2919
|
+
function test(name, fn) {
|
|
2920
|
+
try { fn(); console.log(` ✅ ${name}`); passed++; }
|
|
2921
|
+
catch (e) { console.error(` ❌ ${name}\n ${e.message}`); failed++; }
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2924
|
+
function read(p) { return fs.existsSync(p) ? fs.readFileSync(p, 'utf8') : ''; }
|
|
2925
|
+
|
|
2926
|
+
// ── Session quality score ─────────────────────────────────────────────────────
|
|
2927
|
+
function calcScore({ tasksFailed=0, qualityGatesFailed=0, critical=0, high=0, medium=0 }) {
|
|
2928
|
+
let s = 100;
|
|
2929
|
+
s -= tasksFailed * 15;
|
|
2930
|
+
s -= qualityGatesFailed * 10;
|
|
2931
|
+
s -= critical * 30;
|
|
2932
|
+
s -= high * 15;
|
|
2933
|
+
s -= medium * 5;
|
|
2934
|
+
if (!qualityGatesFailed) s += 5;
|
|
2935
|
+
if (!critical && !high) s += 5;
|
|
2936
|
+
return Math.max(0, Math.min(100, s));
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2939
|
+
// ── Phase quality score ───────────────────────────────────────────────────────
|
|
2940
|
+
function calcPhaseScore({ openFindings=0, rework=0, reqsMissed=0, allDelivered=false, noFindings=false, uatPerfect=false }) {
|
|
2941
|
+
let s = 100;
|
|
2942
|
+
s -= openFindings * 10;
|
|
2943
|
+
s -= rework * 5;
|
|
2944
|
+
s -= reqsMissed * 3;
|
|
2945
|
+
if (allDelivered) s += 5;
|
|
2946
|
+
if (noFindings) s += 5;
|
|
2947
|
+
if (uatPerfect) s += 3;
|
|
2948
|
+
return Math.max(0, Math.min(100, s));
|
|
2949
|
+
}
|
|
2950
|
+
|
|
2951
|
+
// ── Tests ─────────────────────────────────────────────────────────────────────
|
|
2952
|
+
console.log('\nMindForge Day 5 — Metrics Tests\n');
|
|
2953
|
+
|
|
2954
|
+
console.log('Metrics schema files:');
|
|
2955
|
+
['METRICS-SCHEMA.md', 'quality-tracker.md'].forEach(f => {
|
|
2956
|
+
test(`${f} exists`, () => assert.ok(fs.existsSync(`.mindforge/metrics/${f}`), `Missing: .mindforge/metrics/${f}`));
|
|
2957
|
+
});
|
|
2958
|
+
|
|
2959
|
+
console.log('\nSession quality score formula:');
|
|
2960
|
+
|
|
2961
|
+
test('perfect session scores 100 (5 bonus)', () => {
|
|
2962
|
+
const s = calcScore({ tasksFailed:0, qualityGatesFailed:0, critical:0, high:0, medium:0 });
|
|
2963
|
+
assert.strictEqual(s, 110); // 100 + 5 + 5 = 110, clamped to 100
|
|
2964
|
+
// Actually let's check clamping: Math.min(100, 110) = 100
|
|
2965
|
+
});
|
|
2966
|
+
|
|
2967
|
+
test('one task failure reduces score by 15', () => {
|
|
2968
|
+
const s = calcScore({ tasksFailed:1 });
|
|
2969
|
+
// 100 - 15 + 5 (no gates) + 5 (no sec) = 95
|
|
2970
|
+
assert.ok(s === 95 || s <= 95, `Expected ~95, got ${s}`);
|
|
2971
|
+
});
|
|
2972
|
+
|
|
2973
|
+
test('CRITICAL security finding reduces score by 30', () => {
|
|
2974
|
+
const baseline = calcScore({});
|
|
2975
|
+
const withCrit = calcScore({ critical: 1 });
|
|
2976
|
+
assert.ok(baseline - withCrit >= 30, 'CRITICAL should reduce score by at least 30');
|
|
2977
|
+
});
|
|
2978
|
+
|
|
2979
|
+
test('score is clamped to 0-100', () => {
|
|
2980
|
+
const s = calcScore({ tasksFailed: 10, qualityGatesFailed: 5, critical: 3 });
|
|
2981
|
+
assert.strictEqual(s, 0, 'Very bad session should score exactly 0 (clamped)');
|
|
2982
|
+
});
|
|
2983
|
+
|
|
2984
|
+
test('clean session with no findings gets bonus', () => {
|
|
2985
|
+
const s = calcScore({});
|
|
2986
|
+
assert.ok(s >= 100, 'Clean session should get bonuses (score may reach 110 before clamping)');
|
|
2987
|
+
});
|
|
2988
|
+
|
|
2989
|
+
console.log('\nPhase quality score formula:');
|
|
2990
|
+
|
|
2991
|
+
test('perfect phase (all delivered, clean) scores high', () => {
|
|
2992
|
+
const s = calcPhaseScore({ allDelivered:true, noFindings:true, uatPerfect:true });
|
|
2993
|
+
assert.ok(s >= 100, `Expected 113 (clamped to 100), got ${s}`);
|
|
2994
|
+
});
|
|
2995
|
+
|
|
2996
|
+
test('open security finding reduces score by 10 each', () => {
|
|
2997
|
+
const clean = calcPhaseScore({ allDelivered:true, noFindings:true, uatPerfect:true });
|
|
2998
|
+
const dirty = calcPhaseScore({ openFindings:2, allDelivered:true });
|
|
2999
|
+
assert.ok(clean > dirty + 15, 'Two open findings should significantly lower score');
|
|
3000
|
+
});
|
|
3001
|
+
|
|
3002
|
+
test('rework reduces score by 5 each', () => {
|
|
3003
|
+
const noRework = calcPhaseScore({ allDelivered:true });
|
|
3004
|
+
const withRework = calcPhaseScore({ rework:2, allDelivered:true });
|
|
3005
|
+
assert.ok(noRework - withRework >= 10, 'Two rework events should reduce score by 10');
|
|
3006
|
+
});
|
|
3007
|
+
|
|
3008
|
+
console.log('\nMetrics schema content:');
|
|
3009
|
+
|
|
3010
|
+
test('METRICS-SCHEMA.md defines session-quality.jsonl', () => {
|
|
3011
|
+
const c = read('.mindforge/metrics/METRICS-SCHEMA.md');
|
|
3012
|
+
assert.ok(c.includes('session-quality.jsonl'), 'Should define session-quality.jsonl');
|
|
3013
|
+
});
|
|
3014
|
+
|
|
3015
|
+
test('METRICS-SCHEMA.md defines phase-metrics.jsonl', () => {
|
|
3016
|
+
const c = read('.mindforge/metrics/METRICS-SCHEMA.md');
|
|
3017
|
+
assert.ok(c.includes('phase-metrics.jsonl'), 'Should define phase-metrics.jsonl');
|
|
3018
|
+
});
|
|
3019
|
+
|
|
3020
|
+
test('METRICS-SCHEMA.md defines skill-usage.jsonl', () => {
|
|
3021
|
+
const c = read('.mindforge/metrics/METRICS-SCHEMA.md');
|
|
3022
|
+
assert.ok(c.includes('skill-usage.jsonl'), 'Should define skill-usage.jsonl');
|
|
3023
|
+
});
|
|
3024
|
+
|
|
3025
|
+
test('quality-tracker.md defines verify pass rate target', () => {
|
|
3026
|
+
const c = read('.mindforge/metrics/quality-tracker.md');
|
|
3027
|
+
assert.ok(c.includes('85%') || c.includes('pass rate'), 'Should define verify pass rate target');
|
|
3028
|
+
});
|
|
3029
|
+
|
|
3030
|
+
test('quality-tracker.md defines early warning signals', () => {
|
|
3031
|
+
const c = read('.mindforge/metrics/quality-tracker.md');
|
|
3032
|
+
assert.ok(c.includes('Early warning') || c.includes('early warning'), 'Should have early warning signals');
|
|
3033
|
+
});
|
|
3034
|
+
|
|
3035
|
+
console.log('\nAll 25 commands present:');
|
|
3036
|
+
|
|
3037
|
+
const ALL_COMMANDS = [
|
|
3038
|
+
'help','init-project','plan-phase','execute-phase','verify-phase','ship',
|
|
3039
|
+
'next','quick','status','debug',
|
|
3040
|
+
'skills','review','security-scan','map-codebase','discuss-phase',
|
|
3041
|
+
'audit','milestone','complete-milestone','approve','sync-jira','sync-confluence',
|
|
3042
|
+
'health','retrospective','profile-team','metrics'
|
|
3043
|
+
];
|
|
3044
|
+
|
|
3045
|
+
test(`all ${ALL_COMMANDS.length} commands in .claude/commands/mindforge/`, () => {
|
|
3046
|
+
ALL_COMMANDS.forEach(cmd => {
|
|
3047
|
+
assert.ok(fs.existsSync(`.claude/commands/mindforge/${cmd}.md`), `Missing: ${cmd}.md`);
|
|
3048
|
+
});
|
|
3049
|
+
});
|
|
3050
|
+
|
|
3051
|
+
test(`all ${ALL_COMMANDS.length} commands mirrored to .agent/mindforge/`, () => {
|
|
3052
|
+
ALL_COMMANDS.forEach(cmd => {
|
|
3053
|
+
assert.ok(fs.existsSync(`.agent/mindforge/${cmd}.md`), `Missing .agent: ${cmd}.md`);
|
|
3054
|
+
});
|
|
3055
|
+
});
|
|
3056
|
+
|
|
3057
|
+
console.log(`\n${'─'.repeat(50)}`);
|
|
3058
|
+
console.log(`Results: ${passed} passed, ${failed} failed`);
|
|
3059
|
+
if (failed > 0) { console.error(`\n❌ ${failed} test(s) failed.\n`); process.exit(1); }
|
|
3060
|
+
else { console.log(`\n✅ All metrics tests passed.\n`); }
|
|
3061
|
+
```
|
|
3062
|
+
|
|
3063
|
+
**Commit:**
|
|
3064
|
+
```bash
|
|
3065
|
+
git add tests/intelligence.test.js tests/metrics.test.js
|
|
3066
|
+
git commit -m "test(day5): add intelligence layer and metrics test suites"
|
|
3067
|
+
```
|
|
3068
|
+
|
|
3069
|
+
---
|
|
3070
|
+
|
|
3071
|
+
## TASK 14 — Run full test battery and verify Day 5
|
|
3072
|
+
|
|
3073
|
+
```bash
|
|
3074
|
+
node tests/install.test.js && echo "✅ install"
|
|
3075
|
+
node tests/wave-engine.test.js && echo "✅ wave-engine"
|
|
3076
|
+
node tests/audit.test.js && echo "✅ audit"
|
|
3077
|
+
node tests/compaction.test.js && echo "✅ compaction"
|
|
3078
|
+
node tests/skills-platform.test.js && echo "✅ skills-platform"
|
|
3079
|
+
node tests/integrations.test.js && echo "✅ integrations"
|
|
3080
|
+
node tests/governance.test.js && echo "✅ governance"
|
|
3081
|
+
node tests/intelligence.test.js && echo "✅ intelligence"
|
|
3082
|
+
node tests/metrics.test.js && echo "✅ metrics"
|
|
3083
|
+
```
|
|
3084
|
+
|
|
3085
|
+
**Final Day 5 commit and bump:**
|
|
3086
|
+
```bash
|
|
3087
|
+
# Update package.json to v0.5.0
|
|
3088
|
+
node -e "
|
|
3089
|
+
const fs = require('fs');
|
|
3090
|
+
const p = JSON.parse(fs.readFileSync('package.json','utf8'));
|
|
3091
|
+
p.version = '0.5.0';
|
|
3092
|
+
fs.writeFileSync('package.json', JSON.stringify(p, null, 2) + '\n');
|
|
3093
|
+
console.log('Version bumped to 0.5.0');
|
|
3094
|
+
"
|
|
3095
|
+
|
|
3096
|
+
git add package.json
|
|
3097
|
+
git commit -m "chore(release): bump to v0.5.0 — Day 5 intelligence layer"
|
|
3098
|
+
git add .
|
|
3099
|
+
git commit -m "feat(day5): complete Day 5 MindForge intelligence layer"
|
|
3100
|
+
git push origin feat/mindforge-intelligence-layer
|
|
3101
|
+
```
|
|
3102
|
+
|
|
3103
|
+
---
|
|
3104
|
+
|
|
3105
|
+
## DAY 5 VERIFY — complete before pushing
|
|
3106
|
+
|
|
3107
|
+
```bash
|
|
3108
|
+
# 1. All 9 test suites pass
|
|
3109
|
+
for suite in install wave-engine audit compaction skills-platform \
|
|
3110
|
+
integrations governance intelligence metrics; do
|
|
3111
|
+
node tests/${suite}.test.js | tail -1
|
|
3112
|
+
done
|
|
3113
|
+
# All should show "All tests passed"
|
|
3114
|
+
|
|
3115
|
+
# 2. Intelligence engine files exist
|
|
3116
|
+
ls .mindforge/intelligence/ | wc -l # Expected: 5
|
|
3117
|
+
|
|
3118
|
+
# 3. Metrics schema files exist
|
|
3119
|
+
ls .mindforge/metrics/ | wc -l # Expected: 2
|
|
3120
|
+
|
|
3121
|
+
# 4. All 25 commands in both runtimes
|
|
3122
|
+
ls .claude/commands/mindforge/ | wc -l # Expected: 25
|
|
3123
|
+
ls .agent/mindforge/ | wc -l # Expected: 25
|
|
3124
|
+
diff <(ls .claude/commands/mindforge/ | sort) <(ls .agent/mindforge/ | sort)
|
|
3125
|
+
# Expected: no output
|
|
3126
|
+
|
|
3127
|
+
# 5. MINDFORGE.md at project root
|
|
3128
|
+
ls MINDFORGE.md # Expected: exists
|
|
3129
|
+
|
|
3130
|
+
# 6. Wizard files present
|
|
3131
|
+
ls bin/wizard/ # Expected: 3 files
|
|
3132
|
+
|
|
3133
|
+
# 7. package.json at 0.5.0
|
|
3134
|
+
node -e "console.log(require('./package.json').version)" # Expected: 0.5.0
|
|
3135
|
+
|
|
3136
|
+
# 8. No secrets anywhere
|
|
3137
|
+
grep -rE "(password|token|api_key)\s*=\s*['\"][^'\"]{8,}" \
|
|
3138
|
+
--include="*.md" --include="*.js" --include="*.json" \
|
|
3139
|
+
--exclude-dir=node_modules --exclude-dir=.git . 2>/dev/null \
|
|
3140
|
+
| grep -v "placeholder\|example\|template\|your-"
|
|
3141
|
+
# Expected: no output
|
|
3142
|
+
|
|
3143
|
+
# 9. Git log clean
|
|
3144
|
+
git log --oneline | head -20
|
|
3145
|
+
# Expected: 14 clean commits from Day 5
|
|
3146
|
+
```
|
|
3147
|
+
|
|
3148
|
+
---
|
|
3149
|
+
|
|
3150
|
+
**Branch:** `feat/mindforge-intelligence-layer`
|
|
3151
|
+
**Day 5 implementation complete. Proceed to DAY5-REVIEW.md.**
|