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,266 @@
|
|
|
1
|
+
# MindForge — AI PR Review Engine
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Use the Claude API directly to perform intelligent, contextual code reviews
|
|
5
|
+
on pull request diffs. Goes beyond static analysis to provide reasoning-based
|
|
6
|
+
feedback that understands architectural context.
|
|
7
|
+
|
|
8
|
+
## Review philosophy
|
|
9
|
+
The AI reviewer has three goals:
|
|
10
|
+
1. Catch what static analysis misses (logic errors, design flaws, missing edge cases)
|
|
11
|
+
2. Confirm that the PR delivers what it claims (requirements traceability)
|
|
12
|
+
3. Maintain code quality standards consistently across all reviewers
|
|
13
|
+
|
|
14
|
+
The AI reviewer does NOT replace human reviewers — it prepares them.
|
|
15
|
+
It surfaces issues, explains context, and asks questions.
|
|
16
|
+
Human reviewers make final decisions.
|
|
17
|
+
|
|
18
|
+
## Claude API integration
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
// pr-review/ai-review-runner.js
|
|
22
|
+
|
|
23
|
+
const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY;
|
|
24
|
+
if (!ANTHROPIC_API_KEY) {
|
|
25
|
+
console.error('ANTHROPIC_API_KEY not set — AI review unavailable');
|
|
26
|
+
process.exit(0); // Graceful skip, not failure
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function runAIReview(diff, context) {
|
|
30
|
+
const response = await fetch('https://api.anthropic.com/v1/messages', {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers: {
|
|
33
|
+
'Content-Type': 'application/json',
|
|
34
|
+
'x-api-key': ANTHROPIC_API_KEY,
|
|
35
|
+
'anthropic-version': '2023-06-01',
|
|
36
|
+
},
|
|
37
|
+
body: JSON.stringify({
|
|
38
|
+
model: 'claude-sonnet-4-6',
|
|
39
|
+
max_tokens: 4096,
|
|
40
|
+
system: buildSystemPrompt(context),
|
|
41
|
+
messages: [
|
|
42
|
+
{ role: 'user', content: buildReviewPrompt(diff, context) }
|
|
43
|
+
],
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
const err = await response.text();
|
|
49
|
+
throw new Error(`Claude API error ${response.status}: ${err}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const data = await response.json();
|
|
53
|
+
return data.content[0].text;
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## System prompt construction
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
function buildSystemPrompt(context) {
|
|
61
|
+
return `You are a senior code reviewer performing a pull request review for the project: ${context.projectName}.
|
|
62
|
+
|
|
63
|
+
## Your review context
|
|
64
|
+
Tech stack: ${context.techStack}
|
|
65
|
+
Architecture pattern: ${context.architecturePattern}
|
|
66
|
+
Coding conventions: ${context.conventions}
|
|
67
|
+
Security requirements: ${context.securityRequirements}
|
|
68
|
+
|
|
69
|
+
## Your review approach
|
|
70
|
+
1. Read the diff carefully — understand the INTENT of each change, not just the change itself
|
|
71
|
+
2. Check if the implementation matches the stated PR purpose
|
|
72
|
+
3. Look for: logic errors, missing error handling, security issues, performance concerns
|
|
73
|
+
4. Evaluate: code clarity, convention adherence, test coverage
|
|
74
|
+
5. Flag: anything that seems to contradict the architecture or conventions
|
|
75
|
+
|
|
76
|
+
## Output format
|
|
77
|
+
Produce a structured review in this exact format:
|
|
78
|
+
|
|
79
|
+
### Summary
|
|
80
|
+
[2-3 sentences: what this PR does and overall quality assessment]
|
|
81
|
+
|
|
82
|
+
### Findings
|
|
83
|
+
For each finding, use exactly:
|
|
84
|
+
**[CRITICAL|HIGH|MEDIUM|LOW]** \`file:line\` — [Issue description]
|
|
85
|
+
> [Specific recommendation]
|
|
86
|
+
|
|
87
|
+
### Positive observations
|
|
88
|
+
[What was done well — be genuine, not perfunctory]
|
|
89
|
+
|
|
90
|
+
### Questions for the author
|
|
91
|
+
[Numbered questions about unclear decisions or assumptions]
|
|
92
|
+
|
|
93
|
+
### Verdict
|
|
94
|
+
[APPROVE | REQUEST_CHANGES | COMMENT] — [one sentence rationale]
|
|
95
|
+
|
|
96
|
+
Be direct. Be specific. Cite line numbers. Do not be vague.
|
|
97
|
+
Do not flag issues that are stylistic preferences when conventions permit them.
|
|
98
|
+
Do not repeat findings from the automated checks (secret detection, type errors) — focus on logic and design.`;
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Review prompt construction
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
function buildReviewPrompt(diff, context) {
|
|
106
|
+
return `Please review this pull request diff.
|
|
107
|
+
|
|
108
|
+
## PR Information
|
|
109
|
+
Title: ${context.prTitle}
|
|
110
|
+
Author: ${context.prAuthor}
|
|
111
|
+
Branch: ${context.branch} → ${context.base}
|
|
112
|
+
Files changed: ${context.filesChanged}
|
|
113
|
+
|
|
114
|
+
## Requirements being addressed
|
|
115
|
+
${context.requirements || 'No specific requirements listed'}
|
|
116
|
+
|
|
117
|
+
## Architectural context
|
|
118
|
+
${context.architectureContext || 'See ARCHITECTURE.md for system design'}
|
|
119
|
+
|
|
120
|
+
## The diff
|
|
121
|
+
\`\`\`diff
|
|
122
|
+
${diff}
|
|
123
|
+
\`\`\`
|
|
124
|
+
|
|
125
|
+
Focus your review on correctness, security, and architectural alignment.
|
|
126
|
+
Do not comment on formatting issues handled by the linter.`;
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Context loading
|
|
131
|
+
|
|
132
|
+
Before calling the API, load review context:
|
|
133
|
+
```javascript
|
|
134
|
+
function extractConventionsSections(raw) {
|
|
135
|
+
const sections = [];
|
|
136
|
+
const forbidden = raw.match(/##\s+Forbidden patterns[\s\S]*?(?=\n##\s+|$)/i);
|
|
137
|
+
const naming = raw.match(/##\s+Naming conventions[\s\S]*?(?=\n##\s+|$)/i);
|
|
138
|
+
if (forbidden) sections.push(forbidden[0]);
|
|
139
|
+
if (naming) sections.push(naming[0]);
|
|
140
|
+
return sections.join('\n\n').slice(0, 2000);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function loadReviewContext() {
|
|
144
|
+
const projectMd = readFile('.planning/PROJECT.md');
|
|
145
|
+
const archMd = readFile('.planning/ARCHITECTURE.md');
|
|
146
|
+
const convMd = readFile('.mindforge/org/CONVENTIONS.md');
|
|
147
|
+
const secMd = readFile('.mindforge/org/SECURITY.md');
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
projectName: extractField(projectMd, 'NAME') || 'Unknown',
|
|
151
|
+
techStack: extractTechStack(projectMd),
|
|
152
|
+
architecturePattern: extractField(archMd, '## Architectural pattern') || 'Unknown',
|
|
153
|
+
conventions: extractConventionsSections(convMd) || convMd.slice(0, 2000),
|
|
154
|
+
securityRequirements: secMd.slice(0, 1500),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Rate limiting and cost management
|
|
160
|
+
|
|
161
|
+
```javascript
|
|
162
|
+
// Review request limits to control API costs
|
|
163
|
+
// maxDailyReviews is configurable via MINDFORGE.md: AI_REVIEW_DAILY_LIMIT
|
|
164
|
+
const REVIEW_LIMITS = {
|
|
165
|
+
maxDiffSize: 12000, // Characters — larger diffs get truncated by file
|
|
166
|
+
maxFilesReviewed: 20, // Review the 20 most-changed files
|
|
167
|
+
cacheTtlMinutes: 60, // Cache reviews for the same commit SHA
|
|
168
|
+
maxDailyReviews: 50, // Stop AI reviews after 50 per day (configurable)
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const AI_REVIEW_LOG = path.join(projectRoot, '.mindforge', 'metrics', 'ai-review-usage.jsonl');
|
|
172
|
+
|
|
173
|
+
function logAIReview(prSha) {
|
|
174
|
+
const entry = JSON.stringify({
|
|
175
|
+
timestamp: new Date().toISOString(),
|
|
176
|
+
pr_sha: prSha,
|
|
177
|
+
date: new Date().toISOString().slice(0, 10),
|
|
178
|
+
model: 'claude-sonnet-4-6',
|
|
179
|
+
}) + '\n';
|
|
180
|
+
|
|
181
|
+
// Create parent directory if it doesn't exist
|
|
182
|
+
const dir = path.dirname(AI_REVIEW_LOG);
|
|
183
|
+
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
184
|
+
|
|
185
|
+
fs.appendFileSync(AI_REVIEW_LOG, entry);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Before calling API: check daily limit
|
|
189
|
+
function checkDailyLimit(maxReviews) {
|
|
190
|
+
if (!fs.existsSync(AI_REVIEW_LOG)) return true; // No log = no limit hit
|
|
191
|
+
|
|
192
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
193
|
+
let count = 0;
|
|
194
|
+
|
|
195
|
+
const lines = fs.readFileSync(AI_REVIEW_LOG, 'utf8').split('\n').filter(Boolean);
|
|
196
|
+
for (const line of lines) {
|
|
197
|
+
try {
|
|
198
|
+
const entry = JSON.parse(line);
|
|
199
|
+
if (entry.date === today) count++;
|
|
200
|
+
} catch {
|
|
201
|
+
continue; // Skip malformed lines — don't let parse errors break the limit check
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return count < maxReviews;
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Diff truncation strategy (file-based)
|
|
210
|
+
|
|
211
|
+
```javascript
|
|
212
|
+
function buildDiffForReview(fullDiff) {
|
|
213
|
+
const MAX_CHARS = 12000;
|
|
214
|
+
const MAX_FILES = 20;
|
|
215
|
+
|
|
216
|
+
if (fullDiff.length <= MAX_CHARS) return fullDiff;
|
|
217
|
+
|
|
218
|
+
// Prefer showing fewer complete files over more truncated ones
|
|
219
|
+
// Sort files by change size (largest first — most important to review)
|
|
220
|
+
const fileDiffs = splitDiffByFile(fullDiff);
|
|
221
|
+
const sortedFiles = fileDiffs.sort((a, b) => b.content.length - a.content.length);
|
|
222
|
+
|
|
223
|
+
let result = '';
|
|
224
|
+
let fileCount = 0;
|
|
225
|
+
for (const fileDiff of sortedFiles.slice(0, MAX_FILES)) {
|
|
226
|
+
if (result.length + fileDiff.content.length > MAX_CHARS) break;
|
|
227
|
+
result += fileDiff.content + '\n';
|
|
228
|
+
fileCount++;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const omitted = sortedFiles.length - fileCount;
|
|
232
|
+
if (omitted > 0) {
|
|
233
|
+
result += `\n[${omitted} file(s) omitted from review — diff too large. Run review with --diff on individual files.]\n`;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return result;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function splitDiffByFile(diff) {
|
|
240
|
+
const files = [];
|
|
241
|
+
const parts = diff.split(/^diff --git/m).filter(Boolean);
|
|
242
|
+
for (const part of parts) {
|
|
243
|
+
const header = part.match(/^a\/(.+) b\//);
|
|
244
|
+
files.push({
|
|
245
|
+
filename: header ? header[1] : 'unknown',
|
|
246
|
+
content: 'diff --git' + part,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
return files;
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Output formatting for GitHub
|
|
254
|
+
|
|
255
|
+
```javascript
|
|
256
|
+
function formatForGitHub(aiReview, summary) {
|
|
257
|
+
return `## 🤖 MindForge AI Code Review
|
|
258
|
+
|
|
259
|
+
${aiReview}
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
*Generated by MindForge AI Review Engine v${VERSION}*
|
|
263
|
+
*Model: claude-sonnet-4-6 | Context: PROJECT.md + ARCHITECTURE.md + CONVENTIONS.md*
|
|
264
|
+
*This review supplements but does not replace human code review.*`;
|
|
265
|
+
}
|
|
266
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# MindForge — PR Review Finding Formatter
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Convert AI review output into structured findings for GitHub, JSON, or Markdown.
|
|
5
|
+
|
|
6
|
+
## Supported outputs
|
|
7
|
+
|
|
8
|
+
### GitHub Markdown
|
|
9
|
+
```
|
|
10
|
+
## 🤖 MindForge AI Code Review
|
|
11
|
+
|
|
12
|
+
### Summary
|
|
13
|
+
...
|
|
14
|
+
|
|
15
|
+
### Findings
|
|
16
|
+
**[HIGH]** `src/api/auth.ts:47` — Missing token expiry validation
|
|
17
|
+
> Add expiry validation before accepting the token.
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### JSON
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"summary": "...",
|
|
24
|
+
"findings": [
|
|
25
|
+
{
|
|
26
|
+
"severity": "HIGH",
|
|
27
|
+
"file": "src/api/auth.ts",
|
|
28
|
+
"line": 47,
|
|
29
|
+
"description": "Missing token expiry validation",
|
|
30
|
+
"recommendation": "Add expiry validation before accepting the token"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"verdict": "REQUEST_CHANGES"
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### GitHub annotations
|
|
38
|
+
```
|
|
39
|
+
::warning file=src/api/auth.ts,line=47::Missing token expiry validation
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Formatting rules
|
|
43
|
+
- Always preserve severity (CRITICAL/HIGH/MEDIUM/LOW)
|
|
44
|
+
- Include file and line number when present
|
|
45
|
+
- Do not auto-invent line numbers
|
|
46
|
+
- Keep recommendations actionable and specific
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# MindForge — PR Review Prompt Templates
|
|
2
|
+
|
|
3
|
+
## Specialised review templates by change type
|
|
4
|
+
|
|
5
|
+
### Security-focused review (for Tier 3 changes)
|
|
6
|
+
Used when: PR includes auth, payment, PII, or security changes.
|
|
7
|
+
Additional system prompt addition:
|
|
8
|
+
```
|
|
9
|
+
SECURITY REVIEW MODE ACTIVE.
|
|
10
|
+
Apply the OWASP Top 10 checklist systematically to this diff.
|
|
11
|
+
Flag every instance of:
|
|
12
|
+
- A01: Access control bypasses
|
|
13
|
+
- A02: Cryptographic weaknesses (weak algorithms, insecure storage)
|
|
14
|
+
- A03: Injection vectors (SQL, NoSQL, OS, LDAP)
|
|
15
|
+
- A07: Authentication failures (session management, credential handling)
|
|
16
|
+
Any CRITICAL security finding must be listed first, before other findings.
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Database migration review
|
|
20
|
+
Used when: PR includes database schema changes.
|
|
21
|
+
Additional prompt addition:
|
|
22
|
+
```
|
|
23
|
+
DATABASE MIGRATION REVIEW MODE.
|
|
24
|
+
For this migration, verify:
|
|
25
|
+
1. Migration is reversible — is there a DOWN migration?
|
|
26
|
+
2. Migration is non-blocking — does it avoid full table locks?
|
|
27
|
+
3. New columns with NOT NULL have either a DEFAULT or a two-phase migration
|
|
28
|
+
4. No data-loss operations without explicit confirmation in PR description
|
|
29
|
+
5. New indexes are added CONCURRENTLY (PostgreSQL) to avoid table locks
|
|
30
|
+
6. Foreign key constraints are added with VALIDATE separately from creation
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### API breaking change review
|
|
34
|
+
Used when: PR changes existing API endpoints or response schemas.
|
|
35
|
+
Additional prompt addition:
|
|
36
|
+
```
|
|
37
|
+
API BREAKING CHANGE REVIEW MODE.
|
|
38
|
+
Verify:
|
|
39
|
+
1. Is this change documented as breaking in the PR description?
|
|
40
|
+
2. Is the API version incremented appropriately?
|
|
41
|
+
3. Are existing clients given a deprecation period?
|
|
42
|
+
4. Is a migration guide included for API consumers?
|
|
43
|
+
5. Do integration tests cover both old and new API contracts?
|
|
44
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# MindForge Production — Cross-Version Compatibility Layer
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Allow newer MindForge engines to operate safely against older state files
|
|
5
|
+
and plugin manifests without breaking workflows or corrupting data.
|
|
6
|
+
|
|
7
|
+
## Compatibility principles
|
|
8
|
+
1. **Read old, write new**: old schemas must remain readable; writes should
|
|
9
|
+
upgrade only when explicitly requested (via `/mindforge:migrate`).
|
|
10
|
+
2. **Never block on older schema**: warn, suggest migration, continue.
|
|
11
|
+
3. **Preserve unknown fields**: never delete fields you do not recognize.
|
|
12
|
+
|
|
13
|
+
## State file compatibility
|
|
14
|
+
### HANDOFF.json
|
|
15
|
+
- If `schema_version` is missing, treat as legacy and warn once per session.
|
|
16
|
+
- If `schema_version` < current and delta > patch, suggest `/mindforge:migrate`.
|
|
17
|
+
- Add default values at runtime (do not write) for missing fields.
|
|
18
|
+
|
|
19
|
+
### AUDIT.jsonl
|
|
20
|
+
- Treat unknown `event` types as opaque and pass through.
|
|
21
|
+
- If `session_id` is missing in legacy entries, display as `unknown`.
|
|
22
|
+
|
|
23
|
+
### MINDFORGE.md
|
|
24
|
+
- Enforce non-overridable keys (ADR-013) regardless of file version.
|
|
25
|
+
- If a setting has changed formats (e.g., percent -> decimal), prefer migration.
|
|
26
|
+
|
|
27
|
+
## Plugin compatibility
|
|
28
|
+
Plugin compatibility is enforced at install/validate time:
|
|
29
|
+
1. `plugin_api_version` must be `1.0.0` for v1.x.x.
|
|
30
|
+
2. `min_mindforge_version` must be <= current version.
|
|
31
|
+
3. If incompatible, skip plugin and report to user; do not fail session start.
|
|
32
|
+
|
|
33
|
+
## SDK compatibility
|
|
34
|
+
- SDK clients should tolerate missing optional fields in responses.
|
|
35
|
+
- New event types should be additive (never remove existing types in 1.x.x).
|
|
36
|
+
|
|
37
|
+
## Version policy
|
|
38
|
+
- Backwards-incompatible changes require a MAJOR bump (ADR-020).
|
|
39
|
+
- Additive changes must be documented in CHANGELOG.md and reference docs.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# MindForge Production — Migration Engine
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Provide a safe, repeatable path for upgrading `.planning/` state files across
|
|
5
|
+
MindForge versions without losing data or breaking governance.
|
|
6
|
+
|
|
7
|
+
The migration engine is the authoritative source for state schema upgrades:
|
|
8
|
+
- `HANDOFF.json`
|
|
9
|
+
- `STATE.md`
|
|
10
|
+
- `AUDIT.jsonl`
|
|
11
|
+
- `MINDFORGE.md` (only when format changes are required)
|
|
12
|
+
|
|
13
|
+
## Entry points
|
|
14
|
+
- CLI: `node bin/migrations/migrate.js --from <version> --to <version>`
|
|
15
|
+
- Command: `/mindforge:migrate [--from vX.Y.Z] [--to vA.B.C] [--dry-run]`
|
|
16
|
+
- Update flow: `/mindforge:update --apply` (auto-runs migration)
|
|
17
|
+
|
|
18
|
+
## Version chain
|
|
19
|
+
Migrations are applied in order using `bin/migrations/schema-versions.js`.
|
|
20
|
+
Supported range:
|
|
21
|
+
- `0.1.0` -> `0.5.0`
|
|
22
|
+
- `0.5.0` -> `0.6.0`
|
|
23
|
+
- `0.6.0` -> `1.0.0`
|
|
24
|
+
|
|
25
|
+
## Backup and recovery
|
|
26
|
+
Before any migration:
|
|
27
|
+
1. Create `.planning/backup-<timestamp>/`
|
|
28
|
+
2. Copy `HANDOFF.json`, `STATE.md`, `AUDIT.jsonl`, `MINDFORGE.md` if present
|
|
29
|
+
3. Abort if backup fails
|
|
30
|
+
|
|
31
|
+
If migration fails:
|
|
32
|
+
- Restore files from backup
|
|
33
|
+
- Surface error with next steps
|
|
34
|
+
|
|
35
|
+
## Schema version source of truth
|
|
36
|
+
`HANDOFF.json.schema_version` is the authoritative indicator of state schema.
|
|
37
|
+
If missing, the current package version is used as a fallback.
|
|
38
|
+
|
|
39
|
+
## Safety rules
|
|
40
|
+
- Never mutate or delete `.planning/` files on `--dry-run`
|
|
41
|
+
- If a file is missing, skip it (do not create new state files)
|
|
42
|
+
- Preserve unknown fields for forward compatibility
|
|
43
|
+
|
|
44
|
+
## CI behavior
|
|
45
|
+
- In CI, migrations should be non-interactive
|
|
46
|
+
- Backup directories may be auto-deleted after successful migration
|
|
47
|
+
to avoid disk accumulation in shared runners
|
|
48
|
+
|
|
49
|
+
## Troubleshooting
|
|
50
|
+
- If a migration fails, run `/mindforge:migrate --dry-run` to inspect plan
|
|
51
|
+
- If `AUDIT.jsonl` has invalid lines, they are preserved (not modified)
|
|
52
|
+
- If `MINDFORGE.md` value conversion fails, the file is left unchanged
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# MindForge v1.0.0 — Production Readiness Checklist
|
|
2
|
+
|
|
3
|
+
## Policy: ALL 55 items must be ✅ before tagging v1.0.0
|
|
4
|
+
|
|
5
|
+
This is not a "should" list — it is a hard gate.
|
|
6
|
+
No item can be marked ✅ without:
|
|
7
|
+
1. The specific verification step executed successfully
|
|
8
|
+
2. The verifier's git email recorded
|
|
9
|
+
3. The date verified recorded
|
|
10
|
+
|
|
11
|
+
Document completed checks in `.planning/RELEASE-CHECKLIST.md`.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## SECTION A — Installation & Upgrade (10 points)
|
|
16
|
+
|
|
17
|
+
| # | Check | Verification step | ✅/❌ | Verified by | Date |
|
|
18
|
+
|---|---|---|---|---|---|
|
|
19
|
+
| A01 | `npx mindforge-cc@latest` launches interactive wizard on macOS | Run on macOS terminal with TTY | | | |
|
|
20
|
+
| A02 | `npx mindforge-cc@latest` launches wizard on Linux | Run on Ubuntu 22.04 LTS terminal | | | |
|
|
21
|
+
| A03 | `npx mindforge-cc --claude --local` installs correctly | Verify files, run /mindforge:health | | | |
|
|
22
|
+
| A04 | `npx mindforge-cc --all --global` installs both runtimes | Check ~/.claude and ~/.gemini/antigravity | | | |
|
|
23
|
+
| A05 | `--update` updates and preserves install scope | Install locally, run --update, verify scope preserved | | | |
|
|
24
|
+
| A06 | `--uninstall` removes only MindForge files (not .planning/) | Run uninstall, verify .planning/ intact | | | |
|
|
25
|
+
| A07 | `--version` and `--help` exit 0 with correct output | Run both flags, check exit code | | | |
|
|
26
|
+
| A08 | Install over existing CLAUDE.md backs it up | Create custom CLAUDE.md, install, verify backup | | | |
|
|
27
|
+
| A09 | Install over existing .planning/ preserves it | Create test .planning/, install, verify preserved | | | |
|
|
28
|
+
| A10 | Node.js < 18 prints helpful error and exits 1 | Run with node 16, verify error message | | | |
|
|
29
|
+
|
|
30
|
+
## SECTION B — Command Coverage (10 points)
|
|
31
|
+
|
|
32
|
+
| # | Check | Verification step | ✅/❌ | Verified by | Date |
|
|
33
|
+
|---|---|---|---|---|---|
|
|
34
|
+
| B01 | `/mindforge:help` shows all 36 commands | Count commands in output, verify ≥ 36 | | | |
|
|
35
|
+
| B02 | `/mindforge:init-project` creates all 5 required .planning/ files | Run in empty dir, check file list | | | |
|
|
36
|
+
| B03 | `/mindforge:health` reports ✅ on a fresh install | Fresh install, run health, zero errors | | | |
|
|
37
|
+
| B04 | `/mindforge:health --repair` fixes CLAUDE.md drift | Corrupt .agent/CLAUDE.md, run repair, verify fix | | | |
|
|
38
|
+
| B05 | `/mindforge:skills list` shows all 10 core skills | Count in output, verify all 10 names | | | |
|
|
39
|
+
| B06 | `/mindforge:skills validate` shows all valid | Run, verify zero errors | | | |
|
|
40
|
+
| B07 | `/mindforge:security-scan --secrets` detects fake key | Add test key pattern, scan, verify detection | | | |
|
|
41
|
+
| B08 | `/mindforge:audit --summary` shows metrics dashboard | Run in project with some audit entries | | | |
|
|
42
|
+
| B09 | `/mindforge:update` checks version without changing files | Run without --apply, verify no file changes | | | |
|
|
43
|
+
| B10 | `/mindforge:migrate --dry-run` shows plan without changes | Run dry-run on v0.6.0 schema, verify dry-run | | | |
|
|
44
|
+
|
|
45
|
+
## SECTION C — Governance Gates (10 points)
|
|
46
|
+
|
|
47
|
+
| # | Check | Verification step | ✅/❌ | Verified by | Date |
|
|
48
|
+
|---|---|---|---|---|---|
|
|
49
|
+
| C01 | Gate 3 (secret detection) blocks commit with fake API key | Stage file with `FAKE_ghp_abcdef1234567890abcd`, run gate | | | |
|
|
50
|
+
| C02 | Gate 2 (tests passing) blocks on test failure | Break a test, run gate, verify block | | | |
|
|
51
|
+
| C03 | Gate 1 (CRITICAL findings) blocks PR creation | Add CRITICAL finding to SECURITY-REVIEW, attempt ship | | | |
|
|
52
|
+
| C04 | AUDIT.jsonl gains entry for every task start and complete | Execute one quick task, count new AUDIT lines | | | |
|
|
53
|
+
| C05 | Tier 3 change classifier detects jwt.sign in non-auth path | Create file with jwt.sign, run classifier | | | |
|
|
54
|
+
| C06 | Tier 3 CI block produces clear error message | Simulate CI run with Tier 3 pending, check output | | | |
|
|
55
|
+
| C07 | MINDFORGE.md non-overridable keys are silently enforced | Set SECRET_DETECTION=false, verify it has no effect | | | |
|
|
56
|
+
| C08 | Approval workflow creates APPROVAL-[uuid].json | Request a Tier 2 approval, verify file created | | | |
|
|
57
|
+
| C09 | Plugin injection guard blocks malicious SKILL.md | Create SKILL.md with IGNORE ALL PREVIOUS, run guard | | | |
|
|
58
|
+
| C10 | All 5 compliance gates produce GATE-RESULTS-N.md | Complete a full phase, verify GATE-RESULTS file | | | |
|
|
59
|
+
|
|
60
|
+
## SECTION D — Documentation (10 points)
|
|
61
|
+
|
|
62
|
+
| # | Check | Verification step | ✅/❌ | Verified by | Date |
|
|
63
|
+
|---|---|---|---|---|---|
|
|
64
|
+
| D01 | README.md quick start works end-to-end in < 5 minutes | New developer follows README, measures time | | | |
|
|
65
|
+
| D02 | `docs/reference/commands.md` documents all 36 commands | Count documented commands, verify ≥ 36 | | | |
|
|
66
|
+
| D03 | `docs/enterprise-setup.md` covers all integration steps | Walk through integration setup docs | | | |
|
|
67
|
+
| D04 | `docs/governance-guide.md` explains all 3 tiers clearly | Review with someone unfamiliar with governance | | | |
|
|
68
|
+
| D05 | `docs/security/threat-model.md` covers all 7 threat actors | Count actors, verify controls for each | | | |
|
|
69
|
+
| D06 | `docs/security/SECURITY.md` has disclosure process | Verify email + 90-day policy present | | | |
|
|
70
|
+
| D07 | `docs/contributing/CONTRIBUTING.md` has PR guidelines | Check for: fork, branch, test, PR process | | | |
|
|
71
|
+
| D08 | `docs/contributing/skill-authoring.md` is actionable | Follow guide to create a test skill | | | |
|
|
72
|
+
| D09 | All 20 ADRs listed in decision-records-index.md | Count ADRs, cross-check index | | | |
|
|
73
|
+
| D10 | CHANGELOG.md v1.0.0 entry is complete with date | Verify entry has date, all components listed | | | |
|
|
74
|
+
|
|
75
|
+
## SECTION E — Test Coverage (10 points)
|
|
76
|
+
|
|
77
|
+
| # | Check | Verification step | ✅/❌ | Verified by | Date |
|
|
78
|
+
|---|---|---|---|---|---|
|
|
79
|
+
| E01 | All 15 test suites pass with 0 failures (Run 1) | Execute full test battery | | | |
|
|
80
|
+
| E02 | All 15 test suites pass with 0 failures (Run 2) | Execute full test battery again | | | |
|
|
81
|
+
| E03 | All 15 test suites pass with 0 failures (Run 3) | Execute full test battery third time | | | |
|
|
82
|
+
| E04 | No test uses `process.exit(0)` inside a test function | `grep -rn 'process.exit(0)' tests/` | | | |
|
|
83
|
+
| E05 | E2E tests simulate complete brownfield onboarding | Run tests/e2e.test.js, verify brownfield path | | | |
|
|
84
|
+
| E06 | Migration tests cover v0.1.0 → v1.0.0 full chain | Run tests/migration.test.js full suite | | | |
|
|
85
|
+
| E07 | No test has `// TODO` or `// skip` in test body | `grep -rn 'TODO\|skip' tests/` | | | |
|
|
86
|
+
| E08 | Security penetration test pass (all 7 threat actors) | Run through threat-model.md controls manually | | | |
|
|
87
|
+
| E09 | CI pipeline runs all tests on PR against main | Create test PR, verify CI passes | | | |
|
|
88
|
+
| E10 | Version in package.json matches git tag matches npm dist | `node -e "console.log(require('./package.json').version)"` | | | |
|
|
89
|
+
|
|
90
|
+
## SECTION F — Release Artifacts (5 points)
|
|
91
|
+
|
|
92
|
+
| # | Check | Verification step | ✅/❌ | Verified by | Date |
|
|
93
|
+
|---|---|---|---|---|---|
|
|
94
|
+
| F01 | package.json version === target release version | `node -e "console.log(require('./package.json').version)"` | | | |
|
|
95
|
+
| F02 | SDK package.json version matches root version | `node -e "console.log(require('./sdk/package.json').version)"` | | | |
|
|
96
|
+
| F03 | Git tag v1.0.0 exists and points to correct commit | `git show v1.0.0 --no-patch` | | | |
|
|
97
|
+
| F04 | CHANGELOG.md has v1.0.0 entry with today’s date | `grep -n \"1.0.0\" CHANGELOG.md` | | | |
|
|
98
|
+
| F05 | `npm publish --dry-run` shows no unexpected files | Run dry-run, review output | | | |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Checkbox summary (for quick audits)
|
|
103
|
+
Use this list when you want a fast “all items present” view.
|
|
104
|
+
|
|
105
|
+
- [ ] A01
|
|
106
|
+
- [ ] A02
|
|
107
|
+
- [ ] A03
|
|
108
|
+
- [ ] A04
|
|
109
|
+
- [ ] A05
|
|
110
|
+
- [ ] A06
|
|
111
|
+
- [ ] A07
|
|
112
|
+
- [ ] A08
|
|
113
|
+
- [ ] A09
|
|
114
|
+
- [ ] A10
|
|
115
|
+
- [ ] B01
|
|
116
|
+
- [ ] B02
|
|
117
|
+
- [ ] B03
|
|
118
|
+
- [ ] B04
|
|
119
|
+
- [ ] B05
|
|
120
|
+
- [ ] B06
|
|
121
|
+
- [ ] B07
|
|
122
|
+
- [ ] B08
|
|
123
|
+
- [ ] B09
|
|
124
|
+
- [ ] B10
|
|
125
|
+
- [ ] C01
|
|
126
|
+
- [ ] C02
|
|
127
|
+
- [ ] C03
|
|
128
|
+
- [ ] C04
|
|
129
|
+
- [ ] C05
|
|
130
|
+
- [ ] C06
|
|
131
|
+
- [ ] C07
|
|
132
|
+
- [ ] C08
|
|
133
|
+
- [ ] C09
|
|
134
|
+
- [ ] C10
|
|
135
|
+
- [ ] D01
|
|
136
|
+
- [ ] D02
|
|
137
|
+
- [ ] D03
|
|
138
|
+
- [ ] D04
|
|
139
|
+
- [ ] D05
|
|
140
|
+
- [ ] D06
|
|
141
|
+
- [ ] D07
|
|
142
|
+
- [ ] D08
|
|
143
|
+
- [ ] D09
|
|
144
|
+
- [ ] D10
|
|
145
|
+
- [ ] E01
|
|
146
|
+
- [ ] E02
|
|
147
|
+
- [ ] E03
|
|
148
|
+
- [ ] E04
|
|
149
|
+
- [ ] E05
|
|
150
|
+
- [ ] E06
|
|
151
|
+
- [ ] E07
|
|
152
|
+
- [ ] E08
|
|
153
|
+
- [ ] E09
|
|
154
|
+
- [ ] E10
|
|
155
|
+
- [ ] F01
|
|
156
|
+
- [ ] F02
|
|
157
|
+
- [ ] F03
|
|
158
|
+
- [ ] F04
|
|
159
|
+
- [ ] F05
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Release gate procedure
|
|
164
|
+
|
|
165
|
+
When ALL 50 items show ✅:
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# MindForge Production — Token Usage Optimiser
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Measure, profile, and systematically reduce Claude API token consumption.
|
|
5
|
+
Token efficiency impacts both cost and session quality — a session that
|
|
6
|
+
exhausts its context on large file reads has less capacity for reasoning.
|
|
7
|
+
|
|
8
|
+
## Token consumption model
|
|
9
|
+
|
|
10
|
+
### Where tokens are spent in a typical MindForge session
|
|
11
|
+
|
|
12
|
+
| Component | Typical estimate | Notes |
|
|
13
|
+
|---|---|---|
|
|
14
|
+
| Session startup (CLAUDE.md + ORG.md + PROJECT.md + STATE.md) | 4,000–9,000 | Fixed per session |
|
|
15
|
+
| Each skill injected (full) | 2,500–6,000 | Depends on skill complexity |
|
|
16
|
+
| Each skill injected (summary) | 300–600 | When > 3 skills loaded |
|
|
17
|
+
| PLAN file per task | 400–1,800 | Lean plans save 800+ tokens |
|
|
18
|
+
| File reading per task | 1,500–50,000 | Biggest variable cost |
|
|
19
|
+
| Agent reasoning + response | 1,500–8,000 | |
|
|
20
|
+
| Verify step + output | 400–1,500 | |
|
|
21
|
+
|
|
22
|
+
**Note:** These are estimates based on typical MindForge projects.
|
|
23
|
+
Actual values depend on file sizes, code complexity, and model verbosity.
|
|
24
|
+
Run `/mindforge:tokens` to see measured estimates for your project.
|
|
25
|
+
|
|
26
|
+
### Token efficiency threshold
|
|
27
|
+
|
|
28
|
+
| Efficiency | Meaning | Action |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| > 45% | Excellent — agent spending time on reasoning and output | No action |
|
|
31
|
+
| 35–45% | Good — healthy balance | No action |
|
|
32
|
+
| 20–35% | Acceptable — room to optimise | Review high-cost sessions |
|
|
33
|
+
| < 20% | Poor — most tokens spent on reading, not reasoning | Apply optimisations below |
|
|
34
|
+
|
|
35
|
+
## Token usage logging
|
|
36
|
+
|
|
37
|
+
Token profiles are written to `.planning/token-usage.jsonl`.
|
|
38
|
+
All values are **estimates** (not measured) unless otherwise noted.
|
|
39
|
+
Every entry must include `measured: false` to avoid confusion.
|
|
40
|
+
|
|
41
|
+
### Estimation rules
|
|
42
|
+
- `code_reading_tokens` = sum of file sizes read / 4
|
|
43
|
+
(Average 4 characters per token is a reasonable proxy for code.)
|
|
44
|
+
- `plan_tokens` = PLAN file size / 4
|
|
45
|
+
- `summary_tokens` = SUMMARY file size / 4
|
|
46
|
+
- `useful_output_tokens` = sum of SUMMARY file sizes / 4
|
|
47
|
+
(SUMMARY files are the best proxy for verified output.)
|
|
48
|
+
|
|
49
|
+
### Example entry
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"timestamp": "2026-03-22T08:10:00.000Z",
|
|
53
|
+
"phase": 1,
|
|
54
|
+
"plan": "02",
|
|
55
|
+
"measured": false,
|
|
56
|
+
"token_estimates": {
|
|
57
|
+
"startup": 6200,
|
|
58
|
+
"code_reading": 18400,
|
|
59
|
+
"plan": 900,
|
|
60
|
+
"summary": 600,
|
|
61
|
+
"agent_output": 4200,
|
|
62
|
+
"total": 30300
|
|
63
|
+
},
|
|
64
|
+
"useful_output_tokens": 600,
|
|
65
|
+
"efficiency": 0.20,
|
|
66
|
+
"flags": []
|
|
67
|
+
}
|
|
68
|
+
```
|