mindforge-cc 2.0.0-alpha.8 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/.agent/CLAUDE.md +26 -0
  2. package/.agent/mindforge/execute-phase.md +23 -0
  3. package/.agent/mindforge/install-skill.md +20 -11
  4. package/.agent/mindforge/learn.md +142 -0
  5. package/.agent/mindforge/marketplace.md +120 -0
  6. package/.agent/mindforge/new-runtime.md +19 -0
  7. package/.agent/mindforge/remember.md +16 -4
  8. package/.claude/CLAUDE.md +26 -0
  9. package/.claude/commands/mindforge/execute-phase.md +23 -0
  10. package/.claude/commands/mindforge/learn.md +142 -0
  11. package/.claude/commands/mindforge/marketplace.md +120 -0
  12. package/.claude/commands/mindforge/new-runtime.md +19 -0
  13. package/.mindforge/distribution/marketplace.md +53 -0
  14. package/.mindforge/org/skills/MANIFEST.md +1 -0
  15. package/.mindforge/production/production-checklist.md +34 -123
  16. package/.mindforge/skills-builder/auto-capture-protocol.md +88 -0
  17. package/.mindforge/skills-builder/learn-protocol.md +161 -0
  18. package/.mindforge/skills-builder/quality-scoring.md +120 -0
  19. package/.planning/AUDIT.jsonl +1 -0
  20. package/.planning/decisions/ADR-036-learn-command-docs-as-skill-source.md +26 -0
  21. package/.planning/decisions/ADR-037-auto-capture-frequency-threshold.md +26 -0
  22. package/.planning/decisions/ADR-038-skill-quality-minimum-60.md +27 -0
  23. package/CHANGELOG.md +59 -1
  24. package/MINDFORGE.md +9 -0
  25. package/README.md +42 -5
  26. package/bin/autonomous/auto-runner.js +12 -0
  27. package/bin/install.js +9 -3
  28. package/bin/installer-core.js +141 -27
  29. package/bin/migrations/1.0.0-to-2.0.0.js +115 -0
  30. package/bin/migrations/schema-versions.js +12 -0
  31. package/bin/mindforge-cc.sh +5 -0
  32. package/bin/mindforge-cli.js +35 -0
  33. package/bin/review/cross-review-engine.js +11 -0
  34. package/bin/skill-registry.js +167 -0
  35. package/bin/skill-validator.js +144 -0
  36. package/bin/skills-builder/learn-cli.js +57 -0
  37. package/bin/skills-builder/marketplace-cli.js +54 -0
  38. package/bin/skills-builder/marketplace-client.js +198 -0
  39. package/bin/skills-builder/pattern-detector.js +144 -0
  40. package/bin/skills-builder/skill-generator.js +258 -0
  41. package/bin/skills-builder/skill-registrar.js +107 -0
  42. package/bin/skills-builder/skill-scorer.js +263 -0
  43. package/bin/skills-builder/source-loader.js +268 -0
  44. package/bin/wizard/environment-detector.js +1 -0
  45. package/docs/architecture/README.md +6 -1
  46. package/docs/architecture/adr-039-multi-runtime-support.md +20 -0
  47. package/docs/architecture/adr-040-additive-schema-migration.md +21 -0
  48. package/docs/architecture/adr-041-stable-runtime-interface-contract.md +20 -0
  49. package/docs/architecture/decision-records-index.md +3 -0
  50. package/docs/commands-reference.md +3 -0
  51. package/docs/mindforge-md-reference.md +4 -0
  52. package/docs/skills-authoring-guide.md +29 -0
  53. package/docs/skills-publishing-guide.md +3 -2
  54. package/docs/testing-current-version.md +3 -3
  55. package/docs/upgrade.md +16 -2
  56. package/docs/user-guide.md +57 -8
  57. package/docs/usp-features.md +21 -6
  58. package/package.json +1 -1
  59. package/.mindforge/memory/decision-library.jsonl +0 -0
  60. package/.mindforge/memory/knowledge-base.jsonl +0 -7
  61. package/.mindforge/memory/pattern-library.jsonl +0 -1
  62. package/.mindforge/memory/team-preferences.jsonl +0 -4
  63. package/.planning/browser-daemon.log +0 -32
@@ -0,0 +1,120 @@
1
+ # MindForge v2 — Marketplace Command
2
+ # Usage: /mindforge:marketplace [search|featured|trending|install|publish]
3
+ # Version: v2.0.0-alpha.6
4
+
5
+ ## Purpose
6
+ Discover, evaluate, and install community-published MindForge skills from the
7
+ marketplace — a curated layer on top of the npm registry.
8
+
9
+ The marketplace is the shortcut: instead of learning from documentation yourself,
10
+ install skills that the community has already created, validated, and battle-tested.
11
+
12
+ ## Sub-commands
13
+
14
+ ### search [query]
15
+ Find skills relevant to your tech stack or domain.
16
+ ```
17
+ /mindforge:marketplace search "prisma"
18
+ /mindforge:marketplace search "stripe payment processing"
19
+ /mindforge:marketplace search "HIPAA compliance"
20
+ /mindforge:marketplace search "graphql api"
21
+ ```
22
+
23
+ Output:
24
+ ```
25
+ 🔍 Marketplace search: "prisma" (6 results)
26
+
27
+ 1. prisma-advanced (v1.2.3)
28
+ Advanced Prisma patterns: relations, migrations, performance, cursor pagination
29
+ 847 installs this week
30
+
31
+ 2. prisma-schema (v1.0.1)
32
+ Prisma schema design: models, relations, enums, cascade rules
33
+ 234 installs this week
34
+
35
+ 3. prisma-testing (v1.0.0)
36
+ Testing Prisma with Jest: database seeding, teardown, transaction rollback
37
+ 156 installs this week
38
+
39
+ Install: /mindforge:marketplace install prisma-advanced
40
+ ```
41
+
42
+ ### featured
43
+ Show curated featured skills by category.
44
+ ```
45
+ /mindforge:marketplace featured
46
+ ```
47
+
48
+ Output:
49
+ ```
50
+ 🏪 MindForge Community Skills — Featured
51
+
52
+ Database:
53
+ db-postgres-advanced v2.1.0 — Advanced PostgreSQL patterns, indexes, partitioning
54
+ db-prisma-advanced v1.2.0 — Prisma relations, migrations, query optimisation
55
+ db-drizzle v1.0.0 — Drizzle ORM type-safe patterns
56
+
57
+ API:
58
+ api-graphql v1.4.0 — GraphQL schema, resolvers, N+1 prevention
59
+ api-rest v2.0.0 — REST API design, versioning, error schemas
60
+
61
+ Compliance:
62
+ fintech-pci-compliance v1.1.0 — PCI DSS Level 1 safeguards
63
+ healthtech-hipaa v1.0.1 — HIPAA Security Rule for PHI
64
+ [more...]
65
+ ```
66
+
67
+ ### trending
68
+ Show most-installed skills this month.
69
+ ```
70
+ /mindforge:marketplace trending
71
+ ```
72
+
73
+ ### install [name] [--tier project|org]
74
+ Install a marketplace skill.
75
+ ```
76
+ /mindforge:marketplace install prisma-advanced
77
+ /mindforge:marketplace install mindforge-skill-api-graphql --tier org
78
+ /mindforge:marketplace install fintech-pci-compliance --tier project
79
+ ```
80
+
81
+ Short names work (without `mindforge-skill-` prefix).
82
+ Delegates to `/mindforge:install-skill` for actual installation.
83
+ Shows quality score and session_quality_lift before installing.
84
+
85
+ ### publish [skill-dir]
86
+ Publish a skill to the community marketplace.
87
+ ```
88
+ /mindforge:marketplace publish .mindforge/skills/my-skill/
89
+ ```
90
+
91
+ Requirements:
92
+ - Quality score ≥ 80/100
93
+ - No injection patterns
94
+ - Has complete version history
95
+ - Has author contact (GitHub issues URL)
96
+
97
+ ## Skill quality display format
98
+
99
+ ```
100
+ 📊 Skill: prisma-advanced v1.2.3
101
+ Quality score: 94/100 (Excellent)
102
+ ★★★★★ Session quality lift: +8.2 points (over 1,247 sessions)
103
+ 847 installs/week | Published by: @prisma-community
104
+
105
+ Top trigger keywords: "prisma schema", "@relation", "prisma migrate",
106
+ "prisma generate", "onDelete", "cursor pagination"
107
+
108
+ [Install] [Preview SKILL.md] [View on npm]
109
+ ```
110
+
111
+ ## AUDIT entry
112
+ ```json
113
+ {
114
+ "event": "marketplace_action",
115
+ "action": "search|install|publish",
116
+ "query": "[search query if search]",
117
+ "skill_name": "[name if install/publish]",
118
+ "quality_score": 94
119
+ }
120
+ ```
@@ -0,0 +1,19 @@
1
+ # /mindforge:new-runtime
2
+
3
+ Scaffold support for a new AI coding runtime.
4
+
5
+ ## Usage
6
+
7
+ /mindforge:new-runtime [name]
8
+
9
+ ## Action
10
+
11
+ 1. Identify target runtime's entry file format (e.g. .myrules, instructions.md)
12
+ 2. Scaffold the required directories in both global and local scopes
13
+ 3. Add a new entry to the RUNTIMES configuration in `bin/installer-core.js`
14
+ 4. Generate first-run instructions for the new runtime
15
+
16
+ ## Examples
17
+
18
+ /mindforge:new-runtime void-editor
19
+ /mindforge:new-runtime zed-ai
@@ -0,0 +1,53 @@
1
+ # MindForge v2 — Community Skills Marketplace
2
+
3
+ ## Purpose
4
+ The MindForge Marketplace is a distribution network for reusable AI skills.
5
+ It leverages the `mindforge-skill-` npm package prefix for discovery.
6
+
7
+ ## Naming conventions
8
+ Skills published to the marketplace MUST follow this naming convention:
9
+ `mindforge-skill-[technology-or-pattern]`
10
+
11
+ Example:
12
+ - `mindforge-skill-prisma-schema`
13
+ - `mindforge-skill-zod-api-contracts`
14
+ - `mindforge-skill-stripe-webhooks`
15
+
16
+ ## Marketplace categories
17
+ Skills are grouped into these canonical categories:
18
+ 1. **Engines & Runtimes** (Node.js, Python, Go, Rust)
19
+ 2. **Databases & ORMs** (Prisma, Drizzle, Kysely, Sequelize)
20
+ 3. **API & Integration** (Stripe, Twilio, OpenAI, Anthropic)
21
+ 4. **UI & Frontend** (React, Next.js, Tailwind, Radix)
22
+ 5. **Patterns & Security** (Auth, RBAC, Validation, Error Handling)
23
+
24
+ ## Quality requirements
25
+ To be listed in the marketplace, a skill MUST:
26
+ - Achieve a quality score of ≥ 80/100
27
+ - Pass all level 1 + level 2 validation checks
28
+ - Include at least 5 complete, working code examples
29
+ - Be free of any placeholder text
30
+ - Be licensed under MIT or Apache-2.0
31
+
32
+ ## Publishing process
33
+ 1. Run `/mindforge:learn` to generate/update the skill.
34
+ 2. Achieve score ≥ 80 using `skill-scorer.js`.
35
+ 3. Fill in the optional `author`, `license`, and `category` fields in frontmatter.
36
+ 4. Run `/mindforge:marketplace publish [skill-name]`.
37
+ - This prepares the `package.json`.
38
+ - Runs final verification.
39
+ - Prompts for `npm publish`.
40
+
41
+ ## Interaction interface
42
+ ```
43
+ /mindforge:marketplace search [query] # Search the marketplace
44
+ /mindforge:marketplace featured # Show featured skills
45
+ /mindforge:marketplace trending # Show trending skills
46
+ /mindforge:marketplace info [name] # Show skill details and quality score
47
+ /mindforge:marketplace install [name] # Install a community skill
48
+ /mindforge:marketplace publish [name] # Publish your skill
49
+ ```
50
+
51
+ ## Marketplace Registry
52
+ By default, the marketplace uses the global npm registry with the `mindforge-skill-` prefix.
53
+ Private registries can be configured via `MARKETPLACE_REGISTRY` in MINDFORGE.md.
@@ -22,6 +22,7 @@
22
22
 
23
23
  | Name | Version | Status | Min MindForge | Path |
24
24
  |---|---|---|---|---|
25
+ | security-owasp | 1.2.0 | stable | 0.1.0 | .mindforge/org/skills/security-owasp/SKILL.md |
25
26
  | (none yet — see docs/skills-authoring-guide.md to add org skills) | | | | |
26
27
 
27
28
  ## Project Skills — Tier 3 (add project-specific skills here)
@@ -1,6 +1,6 @@
1
- # MindForge v1.0.0 — Production Readiness Checklist
1
+ # MindForge v2.0.0 — Production Readiness Checklist
2
2
 
3
- ## Policy: ALL 55 items must be ✅ before tagging v1.0.0
3
+ ## Policy: ALL 65 items must be ✅ before tagging v2.0.0
4
4
 
5
5
  This is not a "should" list — it is a hard gate.
6
6
  No item can be marked ✅ without:
@@ -13,145 +13,56 @@ Document completed checks in `.planning/RELEASE-CHECKLIST.md`.
13
13
  ---
14
14
 
15
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 | | | |
16
+ ... (existing items A01-A10)
29
17
 
30
18
  ## 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 | | | |
19
+ ... (existing items B01-B10)
44
20
 
45
21
  ## 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 | | | |
22
+ ... (existing items C01-C10)
59
23
 
60
24
  ## 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 | | | |
25
+ ... (existing items D01-D10)
74
26
 
75
27
  ## SECTION E — Test Coverage (10 points)
28
+ ... (existing items E01-E10)
29
+
30
+ ## SECTION F — v2.0.0 Features (10 points)
76
31
 
77
32
  | # | Check | Verification step | ✅/❌ | Verified by | Date |
78
33
  |---|---|---|---|---|---|
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 FRelease Artifacts (5 points)
34
+ | F01 | `/mindforge:new-runtime` scaffolds commands in both .claude and .agent | Run command, check both dirs | | | |
35
+ | F02 | `--gemini` installs GEMINI.md with correct context substitution | Run install --gemini, verify filename and content | | | |
36
+ | F03 | `--cursor` and `--copilot` entry files contain usage preambles | Run install, verify preambles in rule files | | | |
37
+ | F04 | Migration 1.0.0 2.0.0 backfills `runtime` in AUDIT.jsonl | Run migration on v1 audit, verify backfill | | | |
38
+ | F05 | Migration 1.0.0 2.0.0 backfills `model_group` in tokens | Run migration, verify token-usage.jsonl | | | |
39
+ | F06 | Migration creates automatic backup before modification | Verify `.planning/.backups/` exists with files | | | |
40
+ | F07 | Installer correctly handles the `--runtime <name>` explicit flag | Run with --runtime opencode, verify install | | | |
41
+ | F08 | Install `--all` targets 6 distinct runtimes correctly | Run --all, verify 6 locations | | | |
42
+ | F09 | ADRs 039-041 are present and indexed | Verify ADR files and index entry | | | |
43
+ | F10 | Self-building skills (Day 13) features pass regression tests | Run self-building-skills.test.js | | | |
44
+
45
+ ## SECTION Gfinal packaging (5 points)
91
46
 
92
47
  | # | Check | Verification step | ✅/❌ | Verified by | Date |
93
48
  |---|---|---|---|---|---|
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 | | | |
49
+ | G01 | package.json version === 2.0.0 | `node -e "console.log(require('./package.json').version)"` | | | |
50
+ | G02 | SDK package.json version === 2.0.0 | `node -e "console.log(require('./sdk/package.json').version)"` | | | |
51
+ | G03 | Git tag v2.0.0 exists and points to HEAD | `git show v2.0.0 --no-patch` | | | |
52
+ | G04 | CHANGELOG.md has v2.0.0 entry with release highlights | `grep -n "2.0.0" CHANGELOG.md` | | | |
53
+ | G05 | `npm publish --dry-run` is clean | Run dry-run, verify file list | | | |
99
54
 
100
55
  ---
101
56
 
102
57
  ## 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
58
+ - [ ] A01-A10
59
+ - [ ] B01-B10
60
+ - [ ] C01-C10
61
+ - [ ] D01-D10
62
+ - [ ] E01-E10
63
+ - [ ] F01-F10
64
+ - [ ] G01-G05
65
+ [ ] E10
155
66
  - [ ] F01
156
67
  - [ ] F02
157
68
  - [ ] F03
@@ -0,0 +1,88 @@
1
+ # MindForge v2 — Auto-Capture Protocol
2
+
3
+ ## Purpose
4
+ When `AUTO_CAPTURE_SKILLS=true` in MINDFORGE.md, MindForge automatically
5
+ analyses each completed phase for reusable patterns worth capturing as skills.
6
+
7
+ ## When auto-capture runs
8
+ After `/mindforge:verify-phase [N]` completes (all gates passed):
9
+ The auto-capture hook analyses the phase's output for patterns.
10
+
11
+ ## What auto-capture analyses
12
+
13
+ ### Source 1: SUMMARY files
14
+ All SUMMARY-[N]-[M].md files in `.planning/phases/[N]/`.
15
+ Looks for: repeated approaches across 3+ tasks, common code patterns,
16
+ repeated library usage, consistent error handling approaches.
17
+
18
+ ### Source 2: HANDOFF.json implicit_knowledge
19
+ The Level 2/3 compaction extracts implicit knowledge.
20
+ Any item with confidence > 0.7 in the implicit_knowledge array is a
21
+ candidate for skill capture.
22
+
23
+ ### Source 3: ADR files created this phase
24
+ New ADR files represent significant decisions.
25
+ ADRs about technology choices → potential technology skill.
26
+ ADRs about patterns → potential code-pattern skill.
27
+
28
+ ### Source 4: Debug reports
29
+ DEBUG-*.md files contain root cause + fix.
30
+ Root causes that are technology-specific → bug_pattern skill contribution.
31
+
32
+ ## Pattern detection algorithm
33
+
34
+ For each source file, run:
35
+ ```
36
+ Ask EXECUTOR_MODEL:
37
+ "Read these [N] files from a completed software development phase.
38
+ Identify patterns that appeared 2+ times (strong signal) or once but
39
+ are highly important (architectural decisions, security patterns).
40
+
41
+ Focus on:
42
+ 1. Code patterns that appear in multiple files
43
+ 2. Library-specific patterns (how a specific API/library was used)
44
+ 3. Configuration patterns (how something was set up)
45
+ 4. Error handling patterns (what edge cases were handled)
46
+
47
+ For each pattern found, rate:
48
+ - Frequency: how many files/tasks used it?
49
+ - Generality: would this apply to future phases? (high/medium/low)
50
+ - Difficulty: is this hard to get right without knowing it? (high/medium/low)
51
+
52
+ Return: JSON array of { pattern_name, frequency, generality, difficulty, evidence_files }
53
+ Capture candidates: (frequency >= 2 OR difficulty == 'high') AND generality != 'low'
54
+ ```
55
+
56
+ ## Presentation to user
57
+
58
+ After analysis, if patterns are found:
59
+ ```
60
+ 🎯 Auto-capture: 2 reusable patterns found in Phase [N]
61
+
62
+ 1. Prisma relation cascade patterns (★★★ high generality)
63
+ Appeared in: Plan 02, Plan 04, Plan 07
64
+ "Cascade delete must be explicitly configured..."
65
+
66
+ 2. Zod schema composition pattern (★★ medium generality)
67
+ Appeared in: Plan 01, Plan 03
68
+ "Using z.discriminatedUnion() for API response types..."
69
+
70
+ Save as skills? [y=both] [1=first only] [2=second only] [n=skip]
71
+ ```
72
+
73
+ If user selects yes (or a subset):
74
+ - Run full learn protocol (Steps 2-7) for each selected pattern
75
+ - Sources: the identified SUMMARY files as documentation
76
+ - Quality score minimum: 60
77
+
78
+ If user selects skip:
79
+ - Discard pattern drafts
80
+ - Note in AUDIT: "auto_capture_skipped, phase: N"
81
+ - Do NOT add to knowledge-base.jsonl (they must explicitly remember)
82
+
83
+ ## Minimum thresholds (configurable in MINDFORGE.md)
84
+
85
+ ```
86
+ AUTO_CAPTURE_MIN_PATTERN_COUNT=2 # minimum times a pattern appears
87
+ AUTO_CAPTURE_MIN_CONFIDENCE=0.75 # HANDOFF.json implicit_knowledge confidence
88
+ ```
@@ -0,0 +1,161 @@
1
+ # MindForge v2 — Learn Protocol
2
+
3
+ ## Purpose
4
+ Convert any knowledge source (URL, local file/dir, or current session) into a
5
+ reusable, validated, committed MindForge SKILL.md file.
6
+
7
+ ## Activation sources
8
+
9
+ ### Source type: URL
10
+ ```
11
+ /mindforge:learn https://docs.prisma.io/concepts/components/prisma-schema
12
+ ```
13
+ Use RESEARCH_MODEL (default: gemini-2.5-pro with 1M context) to ingest and
14
+ analyse the documentation. For large documentation sets, Gemini 2.5 Pro can
15
+ read the entire page including all examples at once.
16
+
17
+ ### Source type: local file or directory
18
+ ```
19
+ /mindforge:learn ./docs/api-conventions.md
20
+ /mindforge:learn ./docs/internal/
21
+ ```
22
+ Read file(s) directly (no model call needed for reading). Use EXECUTOR_MODEL
23
+ to analyse content and extract patterns.
24
+
25
+ ### Source type: session
26
+ ```
27
+ /mindforge:learn --session
28
+ ```
29
+ Analyse the current session's SUMMARY files, ADR files, debug reports, and
30
+ HANDOFF.json implicit_knowledge to find patterns worth capturing.
31
+
32
+ ### Source type: npm package docs
33
+ ```
34
+ /mindforge:learn npm:zod
35
+ /mindforge:learn npm:prisma
36
+ ```
37
+ Fetch from npmjs.com/package/[name] and read the README + linked docs.
38
+
39
+ ## Step-by-step learn protocol
40
+
41
+ ### Step 1: Read and understand the source
42
+ For URLs: use `source-loader.js` to fetch content (with SSRF protection).
43
+ For local: use `source-loader.js` to read file(s) with walkDir().
44
+ For session: read all SUMMARY-*.md and HANDOFF.json implicit_knowledge.
45
+ For npm: fetch README from npmjs.com API.
46
+
47
+ Maximum context: 900K chars for Gemini (1M context); 50K chars for other models.
48
+
49
+ ### Step 2: Identify the top 10 reusable patterns or rules
50
+ Ask the analysis model:
51
+ ```
52
+ You are an expert at reading technical documentation and extracting reusable
53
+ engineering rules and patterns.
54
+
55
+ Read this documentation carefully:
56
+ [source content]
57
+
58
+ Identify exactly 10 reusable patterns, rules, or best practices that would
59
+ be most valuable to inject into an AI agent before it works with this technology.
60
+
61
+ For each pattern:
62
+ - Give it a short title (≤ 60 chars)
63
+ - Write a concise rule statement (≤ 150 chars, actionable)
64
+ - Include a code example showing correct usage (TypeScript/JavaScript preferred)
65
+ - Identify if there is a common anti-pattern to warn against
66
+ - Rate importance: CRITICAL | HIGH | MEDIUM | LOW
67
+
68
+ Format as JSON array: [{ title, rule, example, anti_pattern, importance }]
69
+ ```
70
+
71
+ ### Step 3: Identify 15-25 trigger keywords
72
+ Ask the analysis model:
73
+ ```
74
+ Based on the patterns above, identify 15-25 keywords that, if found in a
75
+ task description or code file path, should trigger this skill to load.
76
+
77
+ Rules for good trigger keywords:
78
+ - 2-4 words each (single-word triggers are too broad)
79
+ - Specific to this technology (not generic like "database" or "model")
80
+ - Cover: package names, file extensions, common function names, config file names
81
+ - Include both noun and verb forms where applicable
82
+
83
+ Return as JSON array of strings: ["keyword1", "keyword2", ...]
84
+ ```
85
+
86
+ ### Step 4: Write the SKILL.md following the authoring template
87
+ Use the standard MindForge SKILL.md format from `docs/skills-authoring-guide.md`.
88
+ Populate all sections:
89
+ - Frontmatter (name, version, status, triggers, description)
90
+ - Purpose (why this skill exists)
91
+ - Key patterns (from Step 2 — the 10 patterns)
92
+ - Anti-patterns to avoid
93
+ - Code examples (at least 3 complete, working examples)
94
+ - Self-check checklist (5-10 items)
95
+ - Version history
96
+
97
+ ### Step 5: Run Level 1 + Level 2 validation
98
+ Level 1 (schema): frontmatter complete, triggers present, mandatory sections exist.
99
+ Level 2 (content): no placeholder text, code examples parse, triggers are specific.
100
+
101
+ Use `skill-scorer.js` to compute the quality score (target: ≥ 60 for register,
102
+ ≥ 80 for community publish).
103
+
104
+ If score < 60: report the specific gaps and ask user whether to fix or discard.
105
+
106
+ ### Step 6: Present to user for review and approval
107
+
108
+ Display:
109
+ ```
110
+ 📚 Skill Generated: [skill-name]
111
+ ─────────────────────────────────────────────────────
112
+ Source: [source type and location]
113
+ Quality score: [score]/100 ([breakdown])
114
+ Patterns: [N] extracted
115
+ Triggers: [K] keywords
116
+ Tier: [Core/Org/Project]
117
+
118
+ Preview (first 3 patterns):
119
+ 1. [title]: [rule]
120
+ 2. [title]: [rule]
121
+ 3. [title]: [rule]
122
+
123
+ Skill file: .mindforge/skills/[name]/SKILL.md
124
+
125
+ [ y ] Register and commit
126
+ [ n ] Discard
127
+ [ e ] Edit before registering
128
+ [ p ] Publish to community marketplace (requires quality score ≥ 80)
129
+ ```
130
+
131
+ ### Step 7: If approved — register and commit
132
+ ```bash
133
+ # Register in MANIFEST.md (tier determined by target: project=T3, org=T2, core=T1)
134
+ # Default for learned skills: Project tier (T3) unless explicitly set
135
+ node bin/skills-builder/skill-registrar.js --tier project --name [skill-name]
136
+
137
+ # Write AUDIT entry
138
+ {
139
+ "event": "skill_learned",
140
+ "source_type": "url|local|session|npm",
141
+ "source": "[url or path]",
142
+ "skill_name": "[name]",
143
+ "quality_score": [score],
144
+ "pattern_count": [N],
145
+ "trigger_count": [K]
146
+ }
147
+
148
+ # Commit
149
+ git add .mindforge/skills/[name]/SKILL.md .mindforge/org/skills/MANIFEST.md
150
+ git commit -m "feat(skills): learn [skill-name] from [source type]"
151
+ ```
152
+
153
+ ## Session-based learning (`--session` flag)
154
+ Analyse these sources in order:
155
+ 1. All SUMMARY-*.md files in .planning/phases/[current phase]/
156
+ 2. HANDOFF.json implicit_knowledge array (Level 2+ compaction entries)
157
+ 3. All ADR-*.md files created in the current phase
158
+ 4. RETROSPECTIVE-*.md if it exists in the current phase
159
+
160
+ Ask: "What patterns emerged that would have been useful to know before this phase?"
161
+ Generate up to 3 skills from this analysis (not more — quality over quantity).