convoke-agents 3.1.0 → 3.2.1

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 (78) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +37 -10
  3. package/_bmad/bme/_artifacts/config.yaml +15 -0
  4. package/_bmad/bme/_artifacts/workflows/bmad-migrate-artifacts/SKILL.md +6 -0
  5. package/_bmad/bme/_artifacts/workflows/bmad-migrate-artifacts/steps/step-01-scope.md +138 -0
  6. package/_bmad/bme/_artifacts/workflows/bmad-migrate-artifacts/steps/step-02-dryrun.md +199 -0
  7. package/_bmad/bme/_artifacts/workflows/bmad-migrate-artifacts/steps/step-03-resolve.md +174 -0
  8. package/_bmad/bme/_artifacts/workflows/bmad-migrate-artifacts/steps/step-04-execute.md +213 -0
  9. package/_bmad/bme/_artifacts/workflows/bmad-migrate-artifacts/workflow.md +85 -0
  10. package/_bmad/bme/_artifacts/workflows/bmad-portfolio-status/SKILL.md +6 -0
  11. package/_bmad/bme/_artifacts/workflows/bmad-portfolio-status/steps/step-01-scan.md +131 -0
  12. package/_bmad/bme/_artifacts/workflows/bmad-portfolio-status/steps/step-02-explore.md +131 -0
  13. package/_bmad/bme/_artifacts/workflows/bmad-portfolio-status/steps/step-03-recommend.md +149 -0
  14. package/_bmad/bme/_artifacts/workflows/bmad-portfolio-status/workflow.md +78 -0
  15. package/_bmad/bme/_portability/skills/bmad-export-skill/SKILL.md +6 -0
  16. package/_bmad/bme/_portability/skills/bmad-export-skill/workflow.md +74 -0
  17. package/_bmad/bme/_portability/skills/bmad-generate-catalog/SKILL.md +6 -0
  18. package/_bmad/bme/_portability/skills/bmad-generate-catalog/workflow.md +42 -0
  19. package/_bmad/bme/_portability/skills/bmad-seed-catalog/SKILL.md +6 -0
  20. package/_bmad/bme/_portability/skills/bmad-seed-catalog/workflow.md +61 -0
  21. package/_bmad/bme/_portability/skills/bmad-validate-exports/SKILL.md +6 -0
  22. package/_bmad/bme/_portability/skills/bmad-validate-exports/workflow.md +43 -0
  23. package/_bmad/bme/_team-factory/agents/team-factory.md +128 -0
  24. package/_bmad/bme/_team-factory/config.yaml +13 -0
  25. package/_bmad/bme/_team-factory/lib/cascade-logic.js +184 -0
  26. package/_bmad/bme/_team-factory/lib/collision-detector.js +228 -0
  27. package/_bmad/bme/_team-factory/lib/manifest-tracker.js +214 -0
  28. package/_bmad/bme/_team-factory/lib/spec-differ.js +176 -0
  29. package/_bmad/bme/_team-factory/lib/spec-parser.js +201 -0
  30. package/_bmad/bme/_team-factory/lib/spec-writer.js +128 -0
  31. package/_bmad/bme/_team-factory/lib/types/factory-types.js +193 -0
  32. package/_bmad/bme/_team-factory/lib/utils/csv-utils.js +62 -0
  33. package/_bmad/bme/_team-factory/lib/utils/naming-utils.js +45 -0
  34. package/_bmad/bme/_team-factory/lib/validators/end-to-end-validator.js +898 -0
  35. package/_bmad/bme/_team-factory/lib/writers/activation-validator.js +175 -0
  36. package/_bmad/bme/_team-factory/lib/writers/config-appender.js +192 -0
  37. package/_bmad/bme/_team-factory/lib/writers/config-creator.js +215 -0
  38. package/_bmad/bme/_team-factory/lib/writers/csv-appender.js +118 -0
  39. package/_bmad/bme/_team-factory/lib/writers/csv-creator.js +190 -0
  40. package/_bmad/bme/_team-factory/lib/writers/registry-appender.js +372 -0
  41. package/_bmad/bme/_team-factory/lib/writers/registry-writer.js +409 -0
  42. package/_bmad/bme/_team-factory/module-help.csv +3 -0
  43. package/_bmad/bme/_team-factory/schemas/schema-independent.json +147 -0
  44. package/_bmad/bme/_team-factory/schemas/schema-sequential.json +242 -0
  45. package/_bmad/bme/_team-factory/templates/team-spec-template.yaml +86 -0
  46. package/_bmad/bme/_team-factory/workflows/add-team/step-01-scope.md +105 -0
  47. package/_bmad/bme/_team-factory/workflows/add-team/step-02-connect.md +110 -0
  48. package/_bmad/bme/_team-factory/workflows/add-team/step-03-review.md +116 -0
  49. package/_bmad/bme/_team-factory/workflows/add-team/step-04-generate.md +160 -0
  50. package/_bmad/bme/_team-factory/workflows/add-team/step-05-validate.md +146 -0
  51. package/_bmad/bme/_team-factory/workflows/step-00-route.md +76 -0
  52. package/_bmad/bme/_vortex/config.yaml +4 -4
  53. package/package.json +13 -7
  54. package/scripts/convoke-doctor.js +172 -1
  55. package/scripts/install-gyre-agents.js +0 -0
  56. package/scripts/lib/artifact-utils.js +521 -13
  57. package/scripts/lib/portfolio/portfolio-engine.js +301 -34
  58. package/scripts/lib/portfolio/rules/artifact-chain-rule.js +33 -3
  59. package/scripts/lib/portfolio/rules/conflict-resolver.js +22 -0
  60. package/scripts/migrate-artifacts.js +69 -10
  61. package/scripts/portability/catalog-generator.js +353 -0
  62. package/scripts/portability/classify-skills.js +646 -0
  63. package/scripts/portability/convoke-export.js +522 -0
  64. package/scripts/portability/export-engine.js +1156 -0
  65. package/scripts/portability/generate-adapters.js +79 -0
  66. package/scripts/portability/manifest-csv.js +147 -0
  67. package/scripts/portability/seed-catalog-repo.js +427 -0
  68. package/scripts/portability/templates/canonical-example.md +102 -0
  69. package/scripts/portability/templates/canonical-format.md +218 -0
  70. package/scripts/portability/templates/readme-template.md +72 -0
  71. package/scripts/portability/test-constants.js +42 -0
  72. package/scripts/portability/validate-classification.js +529 -0
  73. package/scripts/portability/validate-exports.js +348 -0
  74. package/scripts/update/lib/agent-registry.js +35 -0
  75. package/scripts/update/lib/config-merger.js +140 -10
  76. package/scripts/update/lib/refresh-installation.js +293 -8
  77. package/scripts/update/lib/utils.js +27 -1
  78. package/scripts/update/lib/validator.js +114 -4
package/CHANGELOG.md CHANGED
@@ -7,6 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ---
9
9
 
10
+ ## [3.2.0] - 2026-04-11
11
+
12
+ ### Added
13
+
14
+ - **Portability System** — Export BMAD skills to portable, LLM-agnostic format with platform adapters for Claude, Copilot, and Cursor. New CLI command `convoke-export` and 4 new skills: `bmad-export-skill`, `bmad-generate-catalog`, `bmad-seed-catalog`, `bmad-validate-exports`.
15
+ - **Portability Export Engine** (`scripts/portability/export-engine.js`) — Transforms skill workflows into standalone instructions documents with persona, sections, and configurable warning types. Supports tier classification (standalone, light-deps, pipeline).
16
+ - **Catalog Generator** — Generates a decision-tree skill catalog README from manifest data for the public catalog repository.
17
+ - **Seed Catalog** — Seeds a complete catalog repository staging directory with all exportable skills, adapters, and catalog README.
18
+ - **Export Validation** — Validates exported skill staging directories for structural correctness and BMAD-internal leaks.
19
+ - **Platform Adapters** — Generates Claude (CLAUDE.md commands), GitHub Copilot (`.github/copilot-instructions.md`), and Cursor (`.cursor/rules/`) adapter files from exported skills.
20
+ - **Team Factory module** — Now ships in the npm package (`_bmad/bme/_team-factory/`). Factory workflows for industrializing team, agent, and skill addition.
21
+
22
+ ### Changed
23
+
24
+ - **Test infrastructure recovery** — Resolved the C1 phantom-test bug class discovered in the 2026-04-08 astonishment report. 22 test files in `tests/lib/` converted from Jest API to `node:test` + `node:assert/strict`. Test gate grew from 408 to 1,123 verified-passing tests.
25
+ - **`npm test` glob** — Replaced 8 literal file paths with `tests/lib/*.test.js` glob. New test files in `tests/lib/` are now automatically discovered by CI.
26
+ - **eslint config** — Removed Jest globals (`test`, `expect`, `jest`, `beforeEach`, `afterEach`, `beforeAll`, `afterAll`) from `tests/**/*.js` block. This is the structural fix that prevents future phantom tests from passing lint.
27
+ - **`test:all` script** — Rewritten to compose `npm test && npm run test:integration && npm run test:p0` instead of a broken `tests/**/*.test.js` glob.
28
+ - **`test:p0:gate`** — Now delegates to `test:p0` instead of duplicating the command.
29
+ - **Definition of Done checklist** — Added Phantom Test Guard and Test Wiring Verified items to prevent AI-generated phantom tests from passing story completion.
30
+ - **Golden fixture protection** — `tests/**/golden/` directories excluded from eslint with explanatory README documenting the byte-exact contract.
31
+
32
+ ### Infrastructure
33
+
34
+ - **1,123 tests** across unit, integration, p0, team-factory, and lib suites (was 320+ in v3.1.0)
35
+ - **`tests/mock-cp.js` helper** — Shared child_process mock helper for `node:test` suites. Handles module-cache reset, per-spy restoration, and explicit caller-dirname resolution.
36
+ - **New dependency:** `yaml` ^2.8.3 (for YAML comment preservation in portability exports)
37
+ - **Published modules:** Added `_bmad/bme/_portability/` and `_bmad/bme/_team-factory/` to npm package files
38
+
39
+ ---
40
+
10
41
  ## [3.1.0] - 2026-04-06
11
42
 
12
43
  ### Added
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  Agent teams for complex systems
11
11
  ```
12
12
 
13
- [![Version](https://img.shields.io/badge/version-3.0.4-blue)](https://github.com/amalik/convoke-agents)
13
+ [![Version](https://img.shields.io/badge/version-3.2.0-blue)](https://github.com/amalik/convoke-agents)
14
14
  [![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
15
15
 
16
16
  </div>
@@ -22,11 +22,11 @@ Convoke extends AI agents with two types of installable modules: **Teams** bring
22
22
  | **Vortex** | 7 agents, 22 workflows | Product discovery — from user insight to evidence-based decisions |
23
23
  | **Gyre** | 4 agents, 7 workflows | Production readiness — from stack detection to gap analysis |
24
24
 
25
- ### What's New
25
+ ### What's New in 3.2
26
26
 
27
- - **Gyre team** — 4 agents analyze your project's production readiness: detect your stack, model what "ready" looks like, find what's missing, and help you act on it
28
- - **Team Factory** — guided workflow for creating new BMAD-compliant teams from scratch (`/bmad-team-factory`)
29
- - **Skill Validator** — new `validateSkill()` quality gate in the update system for factory-generated skills ([development docs](docs/development.md))
27
+ - **Portable skills** — export any BMAD skill to a standalone format with platform adapters for Claude, Copilot, and Cursor (`npx convoke-export <skill>`)
28
+ - **Team Factory ships** — the module for creating new BMAD-compliant teams is now included in the npm package
29
+ - **1,123 tests** — test infrastructure recovery resolved a phantom-test bug class; test gate tripled from 320+ to 1,123 verified-passing tests
30
30
  - See the [CHANGELOG](CHANGELOG.md) for the full release details
31
31
 
32
32
  ---
@@ -221,6 +221,26 @@ Three capabilities:
221
221
  - **Add Agent** — extend an existing team with a new agent
222
222
  - **Add Skill** — give an existing agent a new workflow
223
223
 
224
+ ### Portability — Export Skills Anywhere
225
+
226
+ Take any BMAD skill and export it to a standalone, LLM-agnostic format that works outside Claude Code:
227
+
228
+ ```bash
229
+ npx convoke-export bmad-brainstorming --output ./exported
230
+ ```
231
+
232
+ The export engine transforms skill workflows into self-contained instruction documents, then generates platform-specific adapter files:
233
+
234
+ | Platform | Adapter output (written inside the export target) |
235
+ |----------|---------------|
236
+ | Claude | `{target}/CLAUDE.md` commands |
237
+ | GitHub Copilot | `{target}/.github/copilot-instructions.md` |
238
+ | Cursor | `{target}/.cursor/rules/` |
239
+
240
+ Skills are classified by tier: **standalone** skills export cleanly, **light-deps** skills include dependency notes, and **pipeline** skills (multi-step orchestration) are flagged as non-portable.
241
+
242
+ Four skills support the workflow: `bmad-export-skill` (export), `bmad-validate-exports` (validate), `bmad-generate-catalog` (catalog README), `bmad-seed-catalog` (full catalog repo).
243
+
224
244
  ### Enhance — Agent Skills
225
245
 
226
246
  Skills give existing agents new workflows — installed via menu patching, not agent modification. The first skill adds RICE-scored backlog management to the PM agent:
@@ -349,11 +369,17 @@ your-project/
349
369
  │ │ ├── contracts/ # Artifact contract schemas (GC1-GC4)
350
370
  │ │ ├── guides/ # User guides (all 4 agents)
351
371
  │ │ └── config.yaml # Configuration
352
- └── _enhance/ # Skill: Agent Capability Upgrades
353
- ├── workflows/ # Skill workflows (initiatives-backlog)
354
- ├── extensions/ # Agent menu patch descriptors
355
- ├── guides/ # Module author guide
356
- └── config.yaml # Configuration
372
+ ├── _enhance/ # Skill: Agent Capability Upgrades
373
+ ├── workflows/ # Skill workflows (initiatives-backlog)
374
+ ├── extensions/ # Agent menu patch descriptors
375
+ ├── guides/ # Module author guide
376
+ └── config.yaml # Configuration
377
+ │ ├── _portability/ # Skill: Export skills to other platforms
378
+ │ │ └── skills/ # Export, validate, catalog, seed workflows
379
+ │ ├── _team-factory/ # Skill: Create new BMAD-compliant teams
380
+ │ │ └── lib/ # Factory generators and validators
381
+ │ └── _artifacts/ # Skill: Artifact governance & portfolio
382
+ │ └── workflows/ # Migrate artifacts, portfolio status
357
383
  └── _bmad-output/
358
384
  ├── vortex-artifacts/ # Vortex generated artifacts
359
385
  └── gyre-artifacts/ # Gyre generated artifacts
@@ -419,6 +445,7 @@ See [UPDATE-GUIDE.md](UPDATE-GUIDE.md) for migration paths and troubleshooting.
419
445
  - **v1.x** — Vortex foundation: 7 agents, 22 workflows, update system, CI/CD
420
446
  - **v2.0** — Product renamed to Convoke. CLI commands: `convoke-*`. Package: `convoke-agents`
421
447
  - **v2.x** — Enhance module (Skills architecture, RICE initiatives-backlog), Gyre team (production readiness, 4 agents), Team Factory
448
+ - **v3.x** — Artifact governance, portfolio intelligence, portability system (export to Claude/Copilot/Cursor), 1,123 tests
422
449
  - **Next** — Forge (domain knowledge extraction for enterprise brownfield engagements)
423
450
  - **Future** — Additional teams, Forge-Gyre integration, cross-team workflows
424
451
 
@@ -0,0 +1,15 @@
1
+ name: artifacts
2
+ version: 1.0.0
3
+ description: "Artifacts module — operator-facing skills for the Convoke artifact system (migration, portfolio status, future Experience Contract validation)"
4
+ # Workflows in this module are STANDALONE (operator invokes them directly via slash command),
5
+ # unlike _enhance workflows which patch into a target_agent's menu. The `standalone: true`
6
+ # flag is consumed by refresh-installation.js (Story 6.6) to skip menu-patching and only
7
+ # generate a Claude Code skill wrapper. Without this flag, refresh-installation would treat
8
+ # the workflow as a menu-patch workflow (the Enhance default) and fail to find a target_agent.
9
+ workflows:
10
+ - name: bmad-migrate-artifacts
11
+ entry: workflows/bmad-migrate-artifacts/workflow.md
12
+ standalone: true
13
+ - name: bmad-portfolio-status
14
+ entry: workflows/bmad-portfolio-status/workflow.md
15
+ standalone: true
@@ -0,0 +1,6 @@
1
+ ---
2
+ name: bmad-migrate-artifacts
3
+ description: Migrate artifact governance metadata to conform to taxonomy. Use when the user says "run artifact migration" or "migrate artifacts".
4
+ ---
5
+
6
+ IT IS CRITICAL THAT YOU FOLLOW THIS COMMAND: LOAD the FULL {project-root}/_bmad/bme/_artifacts/workflows/bmad-migrate-artifacts/workflow.md, READ its entire contents and follow its directions exactly!
@@ -0,0 +1,138 @@
1
+ # Step 1: Scope Selection
2
+
3
+ ## STEP GOAL:
4
+
5
+ To explain to the operator what artifact migration does, present the default scan scope, and confirm or adjust which directories the migration should cover.
6
+
7
+ ## MANDATORY EXECUTION RULES (READ FIRST):
8
+
9
+ ### Universal Rules:
10
+
11
+ - 🛑 NEVER execute the migration without explicit user confirmation
12
+ - 📖 CRITICAL: Read the complete step file before taking any action
13
+ - 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
14
+ - 📋 YOU ARE A FACILITATOR, not a script runner
15
+ - ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
16
+
17
+ ### Role Reinforcement:
18
+
19
+ - ✅ You are a guided-migration assistant — your job is to make a CLI tool feel like a conversation
20
+ - ✅ You explain what is about to happen in plain language, then defer to the operator's decisions
21
+ - ✅ The CLI does the work; you orchestrate the conversation around it
22
+
23
+ ### Step-Specific Rules:
24
+
25
+ - 🎯 Focus ONLY on scope selection in this step
26
+ - 🚫 FORBIDDEN to invoke the migration CLI in this step (Step 2 does that)
27
+ - 🚫 FORBIDDEN to ask about ambiguous file resolutions yet (Step 3 does that)
28
+ - 💬 Capture the operator's chosen scope as `{{scope}}` for downstream steps
29
+
30
+ ## EXECUTION PROTOCOLS:
31
+
32
+ - 🎯 Start with a 2-sentence explanation of what artifact migration does
33
+ - 💾 Hold scope selection in working memory (no file persisted in this step)
34
+ - 🚫 FORBIDDEN to load next step until the operator selects 'C' AND scope is confirmed
35
+
36
+ ## CONTEXT BOUNDARIES:
37
+
38
+ - Available context: project root, default scan directories
39
+ - Focus: presenting scope, capturing operator confirmation
40
+ - Limits: no CLI invocation, no manifest generation
41
+ - Dependencies: none (this is the first step)
42
+
43
+ ## Sequence of Instructions (Do not deviate, skip, or optimize)
44
+
45
+ ### 1. Welcome and brief explanation
46
+
47
+ Greet `{user_name}` and explain in two sentences:
48
+
49
+ > "Artifact migration scans your `_bmad-output/` directories, infers the right initiative + type for each file, and renames everything to follow the governance convention `{initiative}-{type}-{qualifier}-{date}.md`. It runs in dry-run mode first so you can review every proposed change before anything is touched."
50
+
51
+ ### 2. Count files in default scope directories
52
+
53
+ Run these shell commands and capture the counts:
54
+
55
+ ```
56
+ ls _bmad-output/planning-artifacts | wc -l
57
+ ls _bmad-output/vortex-artifacts | wc -l
58
+ ls _bmad-output/gyre-artifacts | wc -l
59
+ ```
60
+
61
+ If any directory does not exist, report `0` for it (do not error out).
62
+
63
+ ### 3. Present the default scope
64
+
65
+ Present:
66
+
67
+ > **Default scan scope:**
68
+ >
69
+ > - `planning-artifacts` ({N1} files)
70
+ > - `vortex-artifacts` ({N2} files)
71
+ > - `gyre-artifacts` ({N3} files)
72
+ >
73
+ > **Total: {N1+N2+N3} files**
74
+
75
+ ### 4. Ask for confirmation or override
76
+
77
+ Display this menu and HALT for input:
78
+
79
+ ```
80
+ [C] Continue with default scope
81
+ [O] Override — specify a custom comma-separated list of directory names
82
+ [X] Exit — abort the migration entirely
83
+ ```
84
+
85
+ ### 5. Handle the operator's response
86
+
87
+ **IF the operator chose `[C]`:**
88
+ - Set `{{scope}}` = `planning-artifacts,vortex-artifacts,gyre-artifacts`
89
+ - Proceed to step 6 below.
90
+
91
+ **IF the operator chose `[O]`:**
92
+ - Ask: `"Specify a comma-separated list of directory names (relative to _bmad-output/):"`
93
+ - HALT for input.
94
+ - When the operator responds, validate the input:
95
+ - Must be comma-separated
96
+ - Each name must match `^[a-zA-Z0-9_-]+$` (no path traversal, no spaces, no special chars)
97
+ - At least one name must exist as a directory under `_bmad-output/`
98
+ - If validation fails, explain WHY (which name is invalid or missing) and re-ask. Loop until valid or until the operator chooses to abort.
99
+ - Set `{{scope}}` = the validated comma-separated list.
100
+ - Proceed to step 6 below.
101
+
102
+ **IF the operator chose `[X]`:**
103
+ - Reply: `"Migration aborted. No changes made."`
104
+ - HALT permanently. Do NOT load step 2.
105
+
106
+ ### 6. Confirm and transition
107
+
108
+ Show:
109
+
110
+ > ✅ **Scope confirmed:** `{{scope}}`
111
+ >
112
+ > Ready to generate the dry-run manifest. Type `C` to continue.
113
+
114
+ HALT for input. When the operator types `C`, read fully and follow `./step-02-dryrun.md`.
115
+
116
+ ## CRITICAL STEP COMPLETION NOTE
117
+
118
+ ONLY when the operator has confirmed scope and typed `C` will you read fully and follow `./step-02-dryrun.md`. Do NOT auto-proceed.
119
+
120
+ ---
121
+
122
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
123
+
124
+ ### ✅ SUCCESS:
125
+
126
+ - Operator understands what migration does
127
+ - File counts shown for default scope
128
+ - `{{scope}}` captured (default or custom) and validated
129
+ - Operator typed `C` to proceed
130
+
131
+ ### ❌ SYSTEM FAILURE:
132
+
133
+ - Invoking the migration CLI in this step
134
+ - Auto-proceeding without `C`
135
+ - Accepting an unvalidated custom scope
136
+ - Skipping the file count display
137
+
138
+ **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
@@ -0,0 +1,199 @@
1
+ # Step 2: Dry-Run Review
2
+
3
+ ## STEP GOAL:
4
+
5
+ To run the migration in dry-run mode, parse the manifest output into 5 categories, and present them to the operator in a structured format (instead of dumping the raw CLI wall of text).
6
+
7
+ ## MANDATORY EXECUTION RULES (READ FIRST):
8
+
9
+ ### Universal Rules:
10
+
11
+ - 🛑 NEVER skip the dry-run — every migration MUST go through this step
12
+ - 📖 CRITICAL: Read the complete step file before taking any action
13
+ - 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
14
+ - 📋 YOU ARE A FACILITATOR presenting categorized results, not a content generator
15
+ - ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
16
+
17
+ ### Role Reinforcement:
18
+
19
+ - ✅ You parse the CLI's output into buckets and present them clearly
20
+ - ✅ The operator should never see a raw 70-line wall of text — group by category
21
+
22
+ ### Step-Specific Rules:
23
+
24
+ - 🎯 Focus ONLY on dry-run + categorization in this step
25
+ - 🚫 FORBIDDEN to invoke `--apply` (Step 4 does that)
26
+ - 🚫 FORBIDDEN to ask for resolutions yet (Step 3 does that)
27
+ - 💬 Hold the parsed bucket data in working memory for Step 3 to consume
28
+
29
+ ## EXECUTION PROTOCOLS:
30
+
31
+ - 🎯 Shell out to the CLI in dry-run mode
32
+ - 💾 Parse output into 7 buckets via simple substring matching (NOT regex)
33
+ - 🚫 FORBIDDEN to load next step until the operator selects 'C' or 'X'
34
+
35
+ ## CONTEXT BOUNDARIES:
36
+
37
+ - Available context: `{{scope}}` from Step 1
38
+ - Focus: dry-run execution + output parsing + bucket presentation
39
+ - Limits: no resolution prompts, no apply
40
+ - Dependencies: Step 1 must have set `{{scope}}`
41
+
42
+ ## Sequence of Instructions (Do not deviate, skip, or optimize)
43
+
44
+ ### 1. Run the migration in dry-run mode
45
+
46
+ Shell out to:
47
+
48
+ ```
49
+ node scripts/migrate-artifacts.js --include {{scope}}
50
+ ```
51
+
52
+ Capture stdout in full. **Note:** the CLI returns immediately after printing the manifest in dry-run mode (no `--apply`) — it does NOT enter the interactive ambiguity prompt. That only fires in apply mode. So this shell-out cannot hang on operator input. The CLI will output a manifest in this format (defined in `scripts/lib/artifact-utils.js` `formatManifest()`):
53
+
54
+ ```
55
+ [SKIP] dir/file.md -- already governed
56
+ [INJECT] dir/file.md -- frontmatter needed
57
+ dir/old.md -> dir/new.md
58
+ Initiative: name (confidence: high, source: inferred)
59
+ Type: name (confidence: high, source: prefix)
60
+ [!] COLLISION: same target as dir/other.md
61
+ Suggested rename: dir/new-with-suffix.md
62
+ [!] dir/file.md -> CONFLICT (filename says X, frontmatter says Y)
63
+ ACTION REQUIRED: Resolve initiative conflict before migration
64
+ [!] dir/file.md -> ??? (ambiguous -- type: prd, initiative unknown)
65
+ Line 1: "..."
66
+ Line 2: "..."
67
+ Line 3: "..."
68
+ Git author: Name (date)
69
+ Suggested: convoke (source: folder-default, confidence: low)
70
+ REVIEW SUGGESTION: Accept 'convoke' or specify initiative
71
+ [!] dir/file.md -> ??? (ambiguous -- type: prd, initiative unknown)
72
+ Line 1: "..."
73
+ ACTION REQUIRED: Specify initiative for this file
74
+
75
+ --- Manifest Summary ---
76
+ Total: 73 | Rename: 42 | Skip: 0 | Inject: 0 | Conflict: 0 | Ambiguous: 31
77
+ [!] 1 filename collision(s) detected -- resolve before executing
78
+ ```
79
+
80
+ ### 2. Parse the output into 7 buckets
81
+
82
+ Use **simple substring matching**, not regex. Walk the output line by line and bucket each entry by its action label:
83
+
84
+ | Bucket | Detection rule |
85
+ |--------|---------------|
86
+ | **SKIP** | Line starts with `[SKIP] ` |
87
+ | **INJECT_ONLY** | Line starts with `[INJECT] ` |
88
+ | **CLEAN RENAME** | Line contains ` -> ` AND does NOT start with `[!] ` (i.e., the rename arrow appears, the line is not flagged ambiguous/conflict) AND no `[!] COLLISION` appears in the next 2–4 lines |
89
+ | **COLLISION** | A line matching the CLEAN RENAME shape but with `[!] COLLISION:` in one of its 2–4 follow-up lines (categorized as COLLISION instead of CLEAN RENAME) |
90
+ | **CONFLICT** | Line starts with `[!] ` and contains `-> CONFLICT (` |
91
+ | **REVIEW SUGGESTION** | Line starts with `[!] ` and contains `??? (ambiguous` AND a subsequent `Suggested:` line exists before the next entry |
92
+ | **PURE AMBIGUOUS** | Line starts with `[!] ` and contains `??? (ambiguous` AND NO `Suggested:` line follows before the next entry |
93
+
94
+ For each entry, store in working memory:
95
+ - `oldPath` (the full `dir/filename.md`)
96
+ - `category` (one of the 7 above)
97
+ - For RENAMEs: `newPath`, `initiative`, `type`
98
+ - For COLLISIONs: `suggestedNewPath`, `collisionWith`
99
+ - For REVIEW SUGGESTIONs: `suggestedInitiative`, `suggestedFrom`, `suggestedConfidence`, `firstLines` (the 3 context lines), `gitAuthor`
100
+ - For PURE AMBIGUOUS: `firstLines`, `gitAuthor`, `candidates`
101
+
102
+ This bucket data structure becomes `{{buckets}}` for Step 3.
103
+
104
+ ### 3. Present the categorized results
105
+
106
+ Display in this order, with clear visual separation:
107
+
108
+ > ### 📊 Dry-Run Summary
109
+ >
110
+ > **Total entries:** {total}
111
+ >
112
+ > ---
113
+ >
114
+ > ✅ **{N} clean renames** (no operator action needed)
115
+ >
116
+ > First 5 examples:
117
+ > - `{old1}` → `{new1}`
118
+ > - `{old2}` → `{new2}`
119
+ > - ... (truncate after 5; show "_+ {N-5} more_" if there are more)
120
+ >
121
+ > ---
122
+ >
123
+ > 💡 **{N} review suggestions** (the engine has a default — you can accept or override)
124
+ >
125
+ > Each entry on its own line:
126
+ > - `{old}` → suggested `{initiative}` (`{source}`, confidence `{confidence}`)
127
+ > - ...
128
+ >
129
+ > ---
130
+ >
131
+ > ❗ **{N} pure ambiguous** (no suggestion — operator must specify)
132
+ >
133
+ > Each entry with first content line:
134
+ > - `{old}` — _line 1: "{first_line}"_
135
+ > - ...
136
+ >
137
+ > ---
138
+ >
139
+ > ⚠️ **{N} collisions** (auto-suggested differentiator if available)
140
+ >
141
+ > Each entry on its own line:
142
+ > - `{old}` → collides with `{other}`. Suggested: `{suggestedNewPath}`
143
+ >
144
+ > ---
145
+ >
146
+ > 🚨 **{N} conflicts** (filename ↔ frontmatter mismatch — must resolve manually before migration)
147
+ >
148
+ > Each entry with the conflict description.
149
+ >
150
+ > ---
151
+ >
152
+ > 📁 **{N} skip** / 💉 **{N} inject-only** (no action needed)
153
+
154
+ If a bucket is empty, omit its section entirely (don't show "0 collisions").
155
+
156
+ ### 4. Present continuation menu
157
+
158
+ Display this menu and HALT for input:
159
+
160
+ ```
161
+ [C] Continue to resolution (Step 3)
162
+ [X] Exit — abort the migration entirely
163
+ ```
164
+
165
+ ### 5. Handle the operator's response
166
+
167
+ **IF the operator chose `[C]`:**
168
+ - If both `REVIEW SUGGESTION` and `PURE AMBIGUOUS` buckets are EMPTY: skip Step 3 entirely and go directly to Step 4 (nothing to resolve).
169
+ - Otherwise: read fully and follow `./step-03-resolve.md`.
170
+
171
+ **IF the operator chose `[X]`:**
172
+ - Reply: `"Migration aborted at dry-run stage. No changes made."`
173
+ - HALT permanently.
174
+
175
+ ## CRITICAL STEP COMPLETION NOTE
176
+
177
+ ONLY when the operator has typed `C` and the bucket data is captured will you read fully and follow the next step. Do NOT auto-proceed.
178
+
179
+ ---
180
+
181
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
182
+
183
+ ### ✅ SUCCESS:
184
+
185
+ - Dry-run CLI invoked with `{{scope}}`
186
+ - All entries parsed into the correct bucket
187
+ - Categories presented in the correct visual order
188
+ - Bucket data held in working memory for Step 3
189
+ - Operator typed `C` or `X`
190
+
191
+ ### ❌ SYSTEM FAILURE:
192
+
193
+ - Dumping the raw CLI output without parsing
194
+ - Skipping the bucket presentation
195
+ - Auto-proceeding without `C`
196
+ - Invoking `--apply` in this step
197
+ - Asking resolution questions in this step
198
+
199
+ **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
@@ -0,0 +1,174 @@
1
+ # Step 3: Interactive Resolution
2
+
3
+ ## STEP GOAL:
4
+
5
+ To walk the operator through the REVIEW SUGGESTION and PURE AMBIGUOUS entries from Step 2 conversationally, capturing each decision into the `{{resolutions}}` map that Step 4 will write to the resolution-file JSON.
6
+
7
+ ## MANDATORY EXECUTION RULES (READ FIRST):
8
+
9
+ ### Universal Rules:
10
+
11
+ - 🛑 NEVER skip an entry without explicit operator input (or batch shortcut)
12
+ - 📖 CRITICAL: Read the complete step file before taking any action
13
+ - 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
14
+ - 📋 YOU ARE A FACILITATOR — present each decision, capture the answer, move on
15
+ - ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
16
+
17
+ ### Role Reinforcement:
18
+
19
+ - ✅ You are walking the operator through one decision at a time
20
+ - ✅ Operator decisions are AUTHORITATIVE — never override or "fix" them
21
+ - ✅ Use the batch shortcut (`all <initiative>`) to keep the loop manageable
22
+
23
+ ### Step-Specific Rules:
24
+
25
+ - 🎯 Focus ONLY on resolution capture in this step
26
+ - 🚫 FORBIDDEN to invoke the migration CLI in this step (Step 4 does that)
27
+ - 🚫 FORBIDDEN to skip an entry without operator input
28
+ - 💬 Operator overrides MUST be honored — never silently dropped
29
+
30
+ ## EXECUTION PROTOCOLS:
31
+
32
+ - 🎯 Iterate REVIEW SUGGESTION first, then PURE AMBIGUOUS
33
+ - 💾 Build `{{resolutions}}` map keyed by `oldPath` with `{ action, initiative? }` values
34
+ - 🚫 FORBIDDEN to load next step until the operator selects 'C' or all entries are resolved/skipped
35
+
36
+ ## CONTEXT BOUNDARIES:
37
+
38
+ - Available context: `{{scope}}` from Step 1, `{{buckets}}` from Step 2
39
+ - Focus: capturing operator decisions for ambiguous entries
40
+ - Limits: no CLI invocation, no apply
41
+ - Dependencies: Step 2 must have parsed entries into `REVIEW SUGGESTION` and `PURE AMBIGUOUS` buckets
42
+
43
+ ## Sequence of Instructions (Do not deviate, skip, or optimize)
44
+
45
+ ### 1. Initialize the resolutions map
46
+
47
+ In working memory, create:
48
+
49
+ ```
50
+ {{resolutions}} = {} // keyed by oldPath, values: { action: 'rename'|'skip', initiative?: string }
51
+ ```
52
+
53
+ Counters (separate per loop so REVIEW SUGGESTION skips don't bleed into PURE AMBIGUOUS counts):
54
+
55
+ - For the REVIEW SUGGESTION loop: `accepted = 0`, `overriddenSuggestions = 0`, `skippedSuggestions = 0`
56
+ - For the PURE AMBIGUOUS loop: `resolvedAmbiguous = 0`, `skippedAmbiguous = 0`
57
+
58
+ The final summary aggregates these as: `accepted` + `overriddenSuggestions` + `resolvedAmbiguous` = total renames; `skippedSuggestions` + `skippedAmbiguous` = total skipped.
59
+
60
+ ### 2. Walk REVIEW SUGGESTION entries
61
+
62
+ For EACH entry in `{{buckets}}.REVIEW_SUGGESTION` (in order), do:
63
+
64
+ 1. Display:
65
+ ```
66
+ 📄 {oldPath}
67
+ First lines: "{firstLines[0]}"
68
+ "{firstLines[1]}"
69
+ "{firstLines[2]}"
70
+ Git author: {gitAuthor}
71
+ Suggested: {suggestedInitiative} (source: {suggestedFrom}, confidence: {suggestedConfidence})
72
+
73
+ Accept '{suggestedInitiative}'? [y/n/specify <initiative>/skip]
74
+ ```
75
+
76
+ 2. HALT for input.
77
+
78
+ 3. Parse the response:
79
+ - **`y` (or yes, accept)** → `{{resolutions}}[oldPath] = { action: 'rename', initiative: '{suggestedInitiative}' }`. Increment `accepted`.
80
+ - **`n` (or no)** → ask `"Specify initiative or 'skip':"` and HALT. Then:
81
+ - If `skip` → `{{resolutions}}[oldPath] = { action: 'skip' }`. Increment `skippedSuggestions`.
82
+ - If a valid initiative ID (in taxonomy) → `{{resolutions}}[oldPath] = { action: 'rename', initiative: '{specified}' }`. Increment `overriddenSuggestions`.
83
+ - If invalid → re-ask, looping until valid.
84
+ - **`specify <initiative>`** → if the initiative is valid, treat as override. Increment `overriddenSuggestions`.
85
+ - **`skip`** → `{{resolutions}}[oldPath] = { action: 'skip' }`. Increment `skippedSuggestions`.
86
+
87
+ 4. Move to the next entry.
88
+
89
+ After all REVIEW SUGGESTION entries are processed, summarize:
90
+
91
+ > ✅ Review suggestions: {accepted} accepted, {overriddenSuggestions} overridden, {skippedSuggestions} skipped.
92
+
93
+ ### 3. Walk PURE AMBIGUOUS entries
94
+
95
+ For EACH entry in `{{buckets}}.PURE_AMBIGUOUS` (in order), do:
96
+
97
+ 1. Display:
98
+ ```
99
+ 📄 {oldPath}
100
+ First lines: "{firstLines[0]}"
101
+ "{firstLines[1]}"
102
+ "{firstLines[2]}"
103
+ Git author: {gitAuthor}
104
+ Candidates: {candidates joined or 'none'}
105
+
106
+ Specify initiative for this file [<initiative>/skip/all <initiative>]
107
+ ```
108
+
109
+ 2. HALT for input.
110
+
111
+ 3. Parse the response:
112
+ - **`<initiative>`** → if valid (in taxonomy), `{{resolutions}}[oldPath] = { action: 'rename', initiative: '{specified}' }`. Increment `resolvedAmbiguous`.
113
+ - **`skip`** → `{{resolutions}}[oldPath] = { action: 'skip' }`. Increment `skippedAmbiguous`.
114
+ - **`all <initiative>`** → BATCH SHORTCUT. Apply `{ action: 'rename', initiative: '{specified}' }` to THIS entry AND every remaining PURE AMBIGUOUS entry in the SAME directory as this one. Increment `resolvedAmbiguous` for each. Tell the operator: `"Applied '{initiative}' to N files in {dir}/."`. Then continue iterating from where the batch ended.
115
+ - **invalid** → re-ask, looping until valid.
116
+
117
+ 4. Move to the next entry (unless batch-applied).
118
+
119
+ After all PURE AMBIGUOUS entries are processed, summarize:
120
+
121
+ > ❗ Pure ambiguous: {resolvedAmbiguous} resolved, {skippedAmbiguous} skipped.
122
+
123
+ ### 4. Final summary and continuation menu
124
+
125
+ Display:
126
+
127
+ > ### 🎯 Resolution Summary
128
+ >
129
+ > - **Accepted suggestions:** {accepted}
130
+ > - **Operator overrides:** {overriddenSuggestions + resolvedAmbiguous}
131
+ > - **Skipped:** {skippedSuggestions + skippedAmbiguous}
132
+ > - **Total entries in resolution map:** {Object.keys(resolutions).length}
133
+ >
134
+ > ---
135
+ >
136
+ > [C] Continue to confirm & execute (Step 4)
137
+ > [X] Exit — abort the migration entirely
138
+
139
+ HALT for input.
140
+
141
+ ### 5. Handle the operator's response
142
+
143
+ **IF the operator chose `[C]`:**
144
+ - Read fully and follow `./step-04-execute.md`.
145
+
146
+ **IF the operator chose `[X]`:**
147
+ - Reply: `"Migration aborted at resolution stage. No changes made. Resolutions discarded."`
148
+ - HALT permanently.
149
+
150
+ ## CRITICAL STEP COMPLETION NOTE
151
+
152
+ ONLY when every REVIEW SUGGESTION and PURE AMBIGUOUS entry has been processed AND the operator has typed `C` will you read fully and follow `./step-04-execute.md`. Do NOT auto-proceed.
153
+
154
+ ---
155
+
156
+ ## 🚨 SYSTEM SUCCESS/FAILURE METRICS
157
+
158
+ ### ✅ SUCCESS:
159
+
160
+ - Every REVIEW SUGGESTION entry processed (accept/override/skip)
161
+ - Every PURE AMBIGUOUS entry processed (specify/skip/batch)
162
+ - `{{resolutions}}` map populated with `{ action, initiative? }` per entry
163
+ - Counters accurate
164
+ - Operator typed `C` to proceed
165
+
166
+ ### ❌ SYSTEM FAILURE:
167
+
168
+ - Skipping an entry without operator input
169
+ - Silently changing the operator's specified initiative
170
+ - Auto-proceeding without `C`
171
+ - Forgetting to capture the resolution into the map
172
+ - Invoking the CLI in this step
173
+
174
+ **Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.