ma-agents 3.5.3 → 3.5.5

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 (82) hide show
  1. package/_bmad-output/implementation-artifacts/21-1-install-time-profile-prompt.md +181 -0
  2. package/_bmad-output/implementation-artifacts/21-10-profile-reconfigure.md +137 -0
  3. package/_bmad-output/implementation-artifacts/21-11-profile-uninstall.md +149 -0
  4. package/_bmad-output/implementation-artifacts/21-2-universal-instruction-block-expansion.md +98 -0
  5. package/_bmad-output/implementation-artifacts/21-3-roomodes-template-bmad-modes.md +106 -0
  6. package/_bmad-output/implementation-artifacts/21-4-agents-md-template-opencode.md +86 -0
  7. package/_bmad-output/implementation-artifacts/21-5-clinerules-template-extension.md +82 -0
  8. package/_bmad-output/implementation-artifacts/21-6-onprem-layered-guardrails.md +112 -0
  9. package/_bmad-output/implementation-artifacts/21-7-bmad-persona-phase-prefix.md +126 -0
  10. package/_bmad-output/implementation-artifacts/21-8-vllm-reference-doc-readme.md +100 -0
  11. package/_bmad-output/implementation-artifacts/21-9-tests-validation.md +97 -0
  12. package/_bmad-output/implementation-artifacts/bug-experimentalwarning-about-commonjs-loading-es-module-during-install.md +57 -0
  13. package/_bmad-output/implementation-artifacts/sprint-status.yaml +43 -1
  14. package/_bmad-output/methodology/BMAD_AI_Development_Training.pptx +0 -0
  15. package/_bmad-output/methodology/version.json +1 -1
  16. package/_bmad-output/planning-artifacts/architecture.md +52 -0
  17. package/_bmad-output/planning-artifacts/epics.md +397 -0
  18. package/_bmad-output/planning-artifacts/prd.md +46 -1
  19. package/bin/cli.js +109 -1
  20. package/docs/BMAD_AI_Development_Training.pptx +0 -0
  21. package/lib/bmad-cache/bmb/_git_preserved/index +0 -0
  22. package/lib/bmad-cache/bmb/_git_preserved/logs/HEAD +1 -1
  23. package/lib/bmad-cache/bmb/_git_preserved/logs/refs/heads/main +1 -1
  24. package/lib/bmad-cache/bmb/_git_preserved/logs/refs/remotes/origin/HEAD +1 -1
  25. package/lib/bmad-cache/bmb/_git_preserved/objects/pack/pack-554778ad4e7254827618ebd2497c3f4bce9054a4.idx +0 -0
  26. package/lib/bmad-cache/bmb/_git_preserved/objects/pack/{pack-4b395d030ca386fc5748f1b670dcf8c0ef41c94c.pack → pack-554778ad4e7254827618ebd2497c3f4bce9054a4.pack} +0 -0
  27. package/lib/bmad-cache/bmb/_git_preserved/objects/pack/pack-554778ad4e7254827618ebd2497c3f4bce9054a4.rev +0 -0
  28. package/lib/bmad-cache/bmb/_git_preserved/packed-refs +1 -1
  29. package/lib/bmad-cache/bmb/_git_preserved/refs/heads/main +1 -1
  30. package/lib/bmad-cache/bmb/_git_preserved/shallow +1 -1
  31. package/lib/bmad-cache/bmb/skills/bmad-module-builder/scripts/tests/test-scaffold-setup-skill.py +7 -0
  32. package/lib/bmad-cache/cache-manifest.json +5 -5
  33. package/lib/bmad-cache/tea/_git_preserved/index +0 -0
  34. package/lib/bmad-cache/tea/_git_preserved/objects/pack/pack-e75385cd52b693dbb8a3b2afb50058952543b3a2.idx +0 -0
  35. package/lib/bmad-cache/tea/_git_preserved/objects/pack/{pack-c79805bb3fee27fa6d8c612a971af7fc86fc80e1.pack → pack-e75385cd52b693dbb8a3b2afb50058952543b3a2.pack} +0 -0
  36. package/lib/bmad-cache/tea/_git_preserved/objects/pack/pack-e75385cd52b693dbb8a3b2afb50058952543b3a2.rev +0 -0
  37. package/lib/bmad-cache/tea/_git_preserved/packed-refs +1 -1
  38. package/lib/bmad-cache/tea/_git_preserved/refs/heads/main +1 -1
  39. package/lib/bmad-cache/tea/_git_preserved/refs/tags/v1.10.0 +1 -0
  40. package/lib/bmad-cache/tea/_git_preserved/shallow +1 -1
  41. package/lib/bmad-cache/tea/docs/explanation/tea-overview.md +2 -2
  42. package/lib/bmad-cache/tea/docs/how-to/workflows/run-atdd.md +28 -30
  43. package/lib/bmad-cache/tea/docs/reference/commands.md +4 -4
  44. package/lib/bmad-cache/tea/docs/reference/configuration.md +1 -1
  45. package/lib/bmad-cache/tea/package-lock.json +2 -2
  46. package/lib/bmad-cache/tea/package.json +1 -1
  47. package/lib/bmad-cache/tea/src/module-help.csv +1 -1
  48. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/SKILL.md +1 -1
  49. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/atdd-checklist-template.md +50 -27
  50. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/checklist.md +18 -17
  51. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/instructions.md +1 -1
  52. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/steps-c/step-01-preflight-and-context.md +21 -3
  53. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/steps-c/step-01b-resume.md +1 -1
  54. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/steps-c/step-02-generation-mode.md +1 -1
  55. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/steps-c/step-03-test-strategy.md +1 -1
  56. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/steps-c/step-04-generate-tests.md +20 -19
  57. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/steps-c/step-04a-subagent-api-failing.md +13 -13
  58. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/steps-c/step-04b-subagent-e2e-failing.md +13 -13
  59. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/steps-c/step-04c-aggregate.md +42 -18
  60. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/steps-c/step-05-validate-and-complete.md +12 -3
  61. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/workflow-plan.md +2 -2
  62. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/workflow.md +2 -2
  63. package/lib/bmad-cache/tea/src/workflows/testarch/bmad-testarch-atdd/workflow.yaml +2 -2
  64. package/lib/bmad.js +25 -4
  65. package/lib/installer.js +2 -1
  66. package/lib/methodology/BMAD_AI_Development_Training.pptx +0 -0
  67. package/lib/methodology/version.json +1 -1
  68. package/lib/profile.js +107 -0
  69. package/lib/warning-filter.js +245 -0
  70. package/package.json +2 -2
  71. package/test/experimental-warning.test.js +314 -0
  72. package/test/fixtures/README.md +74 -0
  73. package/test/fixtures/empty-project/README.md +5 -0
  74. package/test/fixtures/empty-project/package.json +5 -0
  75. package/test/fixtures/onprem-profile-baseline/.gitkeep +2 -0
  76. package/test/fixtures/standard-profile-baseline/.gitkeep +2 -0
  77. package/test/onprem-injection.test.js +48 -0
  78. package/test/profile.test.js +301 -0
  79. package/lib/bmad-cache/bmb/_git_preserved/objects/pack/pack-4b395d030ca386fc5748f1b670dcf8c0ef41c94c.idx +0 -0
  80. package/lib/bmad-cache/bmb/_git_preserved/objects/pack/pack-4b395d030ca386fc5748f1b670dcf8c0ef41c94c.rev +0 -0
  81. package/lib/bmad-cache/tea/_git_preserved/objects/pack/pack-c79805bb3fee27fa6d8c612a971af7fc86fc80e1.idx +0 -0
  82. package/lib/bmad-cache/tea/_git_preserved/objects/pack/pack-c79805bb3fee27fa6d8c612a971af7fc86fc80e1.rev +0 -0
@@ -0,0 +1,97 @@
1
+ # Story 21.9: Tests and Validation
2
+
3
+ Status: backlog
4
+
5
+ ## Story
6
+
7
+ As a **chief architect**,
8
+ I want automated regression tests for the profile system and the universal/on-prem instruction-block injection,
9
+ So that future changes to installer or templates do not silently regress on-prem support or break standard installs.
10
+
11
+ ## Acceptance Criteria
12
+
13
+ 1. A consolidated integration test file `test/onprem-injection.test.js` exists covering the cross-story Epic 21 contracts that per-story tests do not own:
14
+ - **(a) NFR44 — standard profile cleanliness:** A full standard-profile install on a fresh project produces zero occurrences of the strings `/no_think`, `str_replace_editor`, `~/.claude/`, or `Never create files in` (the on-prem rule prefix) across all generated instruction files (`CLAUDE.md`, `.clinerules`, `.cline/clinerules.md`, `.roo/rules/00-ma-agents.md`, `AGENTS.md`, `.roomodes`).
15
+ - **(b) On-prem profile completeness:** A full on-prem-profile install produces all on-prem strings in the expected files (`.roomodes` `customInstructions`, `AGENTS.md`, `.clinerules`, `CLAUDE.md` injection block).
16
+ - **(c) NFR46 — idempotency:** Two consecutive installs with the same profile produce byte-identical content within ma-agents-owned regions (marker blocks for markdown files, owned slugs for `.roomodes`) across all per-tool files.
17
+ - **(d) `.roomodes` slug-collision behavior:** Pre-existing user-defined `customModes` with non-conflicting slugs are preserved through reinstall; conflicting slugs are overwritten with a console warning naming the slug.
18
+ - **(e) NFR47 enforcement contract:** The four ma-agents BMAD modes' `fileRegex` patterns reject the expected code-file extensions and accept the expected planning-file extensions. `bmad-architect` regex matrix tested against `.ts`, `.py`, `.js`, `.go` (rejected) and `.md`, `.xml`, `.drawio` (accepted). Same shape of test for `bmad-pm`, `bmad-techlead`.
19
+ - **(f) Profile switch round-trip:** Install standard → switch to on-prem (via the Story 21.10 reconfigure command, or — until 21.10 lands — by editing `.ma-agents.json` directly and re-running install) → switch back to standard. Final state must match the original standard install (byte-identical for ma-agents-owned regions). User content outside markers preserved across all switches.
20
+ 2. The full test suite (`npm test`) passes after Story 21.9 — no regressions in any pre-Epic-21 tests.
21
+ 3. A short test-coverage table is added to the PR body listing each Epic 21 NFR (44, 45, 46, 47) and the test(s) that cover it. Any uncovered NFR is flagged as an open issue, not silently shipped.
22
+ 4. The integration tests use temporary directories (`fs.mkdtempSync(os.tmpdir() + ...)` per test) to avoid touching the repo's own `.ma-agents.json` or instruction files.
23
+ 5. **Standard-profile baseline fixture (byte-for-byte).** Commit `test/fixtures/standard-profile-baseline/` containing the expected byte-for-byte generated output for a canonical `npx ma-agents install --yes` run against a canonical empty-project fixture (also committed under `test/fixtures/empty-project/`). At a minimum the baseline fixture includes the rendered `CLAUDE.md`, `.clinerules`, `.roo/rules/00-ma-agents.md`, `AGENTS.md`, `.roomodes`, and `.ma-agents.json`. The test harness runs the installer against a scratch temp dir seeded with the empty-project fixture and diffs the result against this baseline byte-for-byte. Any drift in universal-block content, template rendering, or `.roomodes` rendering surfaces as a test failure pointing at the exact file and diff region. This replaces the vague "diff against pre-Epic-21 baseline" language in NFR44 with a concrete, version-controlled artifact.
24
+ 6. **End-to-end installer harness (exercises the actual binary).** The test harness at `test/onprem-injection.test.js` (or a sibling file) exercises the actual installer entry point (`node bin/cli.js install --yes` via `child_process.spawnSync` or equivalent, OR a direct programmatic call to the exported top-level install function that matches what the CLI does — no internal-only helpers) against a scratch tmpdir for BOTH profiles (`standard` and `on-prem`), snapshots the generated filesystem tree, and diffs it against per-profile fixtures (`test/fixtures/standard-profile-baseline/` for standard, `test/fixtures/onprem-profile-baseline/` for on-prem). This is distinct from — and additional to — unit-level template-rendering tests. Unit tests can pass while end-to-end install breaks (wiring bugs, file-path bugs, profile-resolution bugs); this AC closes that gap.
25
+
26
+ ## Tasks / Subtasks
27
+
28
+ - [ ] Task 1: Create `test/onprem-injection.test.js` per AC #1 (a)–(f)
29
+ - [ ] 1.1 Helper: scaffold a fresh test project in a temp dir with all 7 markdown-injection agents + Roo Code + OpenCode selected
30
+ - [ ] 1.2 Helper: run the installer programmatically (not via CLI subprocess if possible — call exported `installSkill` with profile option)
31
+ - [ ] 1.3 Helper: read all generated instruction files and return as `{ filename → content }` map
32
+ - [ ] 1.4 Test (a): standard install — assert no on-prem strings anywhere
33
+ - [ ] 1.5 Test (b): on-prem install — assert on-prem strings present in expected files
34
+ - [ ] 1.6 Test (c): idempotency — two installs, byte-equal content
35
+ - [ ] 1.7 Test (d): `.roomodes` slug-collision matrix
36
+ - [ ] 1.8 Test (e): `fileRegex` accept/reject matrix for all 4 BMAD modes
37
+ - [ ] 1.9 Test (f): standard → on-prem → standard round-trip
38
+ - [ ] Task 2: Run full `npm test` — verify no regressions (AC #2)
39
+ - [ ] Task 3: PR body coverage table (AC #3)
40
+ - [ ] 3.1 Tabulate NFR44, NFR45, NFR46, NFR47 → covering test name(s)
41
+ - [ ] 3.2 Confirm NFR45 (CI/CD compatibility) is covered by `test/profile.test.js` (Story 21.1) tests for `--yes` defaulting and persisted-value precedence (no CLI flag exists)
42
+ - [ ] Task 4: Commit baseline fixtures (AC #5)
43
+ - [ ] 4.1 Create `test/fixtures/empty-project/` — minimal canonical project seed (README.md, package.json, nothing else that affects install output)
44
+ - [ ] 4.2 Generate and commit `test/fixtures/standard-profile-baseline/` by running the installer once against the empty-project fixture with `--yes` (standard profile) and capturing all generated files
45
+ - [ ] 4.3 Generate and commit `test/fixtures/onprem-profile-baseline/` via the same pattern with profile=on-prem persisted in `.ma-agents.json`
46
+ - [ ] 4.4 Document regeneration procedure in a `test/fixtures/README.md` so future dev knows how to refresh when templates intentionally change
47
+ - [ ] Task 5: End-to-end installer harness (AC #6)
48
+ - [ ] 5.1 Harness scaffolds a scratch tmpdir, copies the `empty-project` fixture into it, and invokes the installer entry point for each profile
49
+ - [ ] 5.2 After each install, walk the scratch dir and diff every file against the corresponding baseline fixture; any diff is a test failure naming the file and showing the diff hunk
50
+ - [ ] 5.3 Run for both `standard` and `on-prem` profiles sequentially (not in parallel — shared template files)
51
+
52
+ ## Dev Notes
53
+
54
+ ### Architecture Compliance
55
+
56
+ - **Decision P3-3** — This story closes the testing gap for cross-story contracts. Per-story tests cover their own scope; this story covers integration-level NFRs.
57
+ - **NFR44, NFR45, NFR46, NFR47** — explicit coverage required.
58
+
59
+ ### Source Tree Components to Touch
60
+
61
+ | File | Change |
62
+ |------|--------|
63
+ | `test/onprem-injection.test.js` | CREATE |
64
+
65
+ ### Dependencies
66
+
67
+ - Stories 21.1 through 21.8 all merged.
68
+
69
+ ### Out of Scope
70
+
71
+ - Adding new per-story unit tests (those are owned by their respective stories)
72
+ - Performance benchmarks
73
+ - Manual QA scripts
74
+
75
+ ### Notes on Test Isolation
76
+
77
+ The existing `test/generate-project-context.test.js` (from Epic 13) used `Promise.all` and hit a race because two tests temporarily renamed the template file. Run `test/onprem-injection.test.js` tests sequentially (`for...of` with `await`) — never parallel — because they share template files and depend on full-install state.
78
+
79
+ ## Dev Agent Record
80
+
81
+ ### Agent Model Used
82
+ _(to be filled by dev agent)_
83
+
84
+ ### Debug Log References
85
+ _(to be filled)_
86
+
87
+ ### Completion Notes List
88
+ _(to be filled)_
89
+
90
+ ### File List
91
+ _(to be filled)_
92
+
93
+ ## Change Log
94
+ - 2026-04-14: Story created (Epic 21, Story 21.9)
95
+ - 2026-04-14: Removed prescriptive `--profile=` flag references from test (f) description and Task 3.2 (flag retired; profile switch deferred to Story 21.10 reconfigure). Aligned with P0 spec-alignment PR #34.
96
+ - 2026-04-14: Added ACs #5 and #6 for standard-profile byte-for-byte fixture baseline and end-to-end installer harness (Findings #14, #18, corrective plan step 3). Replaces the vague "diff against pre-Epic-21 baseline" language in NFR44 with concrete committed fixtures and a harness that exercises the actual installer entry point, not just template-rendering internals.
97
+ - 2026-04-14: E2E fixture scaffolding committed (corrective-plan step 7): `test/fixtures/empty-project/` seed, placeholder baseline dirs, pending `test/onprem-injection.test.js` harness (exits 0 until Story 21.9 implementation), regeneration README. Baselines are captured by Story 21.9 implementation per `test/fixtures/README.md`.
@@ -0,0 +1,57 @@
1
+ ---
2
+ type: bug
3
+ status: ready-for-dev
4
+ severity: medium
5
+ bug_type: other
6
+ version_found: 3.5.4
7
+ title: ExperimentalWarning about CommonJS loading ES Module during install
8
+ ---
9
+
10
+ # Bug: ExperimentalWarning about CommonJS loading ES Module during install
11
+
12
+ **Severity:** medium
13
+ **Affected Component:** installer CLI (bin/cli.js + bmad-method child spawn)
14
+
15
+ ## Reproduction Steps
16
+
17
+ 1. Use a Node version that emits the experimental `require()` of ESM warning (Node 20.17+ through early 22.x; see Node release notes on `--experimental-require-module`).
18
+ 2. From a clean working directory, run `node bin/cli.js install --yes --agent claude-code` (or equivalently `npx ma-agents install`).
19
+ 3. Observe startup stderr before the BMAD banner appears.
20
+
21
+ ## Expected Behavior
22
+
23
+ Installer starts cleanly with only intentional informational output. No `ExperimentalWarning` noise appears on any Node version supported by `engines` (`>=16.0.0`).
24
+
25
+ ## Actual Behavior
26
+
27
+ Stderr shows a message of the form:
28
+
29
+ ```
30
+ (node:XXXXX) ExperimentalWarning: CommonJS module <path> is loading ES Module <path> using require().
31
+ Support for loading ES Module in require() is an experimental feature and might change at any time.
32
+ ```
33
+
34
+ The installer still completes successfully, but the warning is noisy, alarms first-time users, and appears in CI logs.
35
+
36
+ ## Root Cause Hypothesis
37
+
38
+ The ma-agents CLI (`bin/cli.js`, CommonJS) spawns the bmad-method CLI (`node_modules/bmad-method/tools/bmad-npx-wrapper.js`, also CommonJS). bmad-method interacts with `@clack/prompts` and `@clack/core`, both of which declare `"type": "module"` in their `package.json`. On Node runtimes that emit `ExperimentalWarning` for `require()` of an ESM package (Node 20.17+ with `--experimental-require-module` default-on), the warning surfaces during install startup. While bmad-method already uses dynamic `import()` for the `@clack/*` packages in newer paths, the warning can still be produced by a transitive CJS → ESM require chain under certain Node versions.
39
+
40
+ ## Affected Files
41
+
42
+ - `bin/cli.js`
43
+ - `lib/bmad.js`
44
+
45
+ ## Suggested Fix
46
+
47
+ Install a process-level warning filter at the top of `bin/cli.js` that suppresses only `ExperimentalWarning` whose message matches the `require()`-of-ESM pattern, while re-emitting every other warning (DeprecationWarning, unhandled rejections, custom warnings) via `process.emitWarning` so they remain visible. Additionally, pass a sanitized `env` to the bmad-method child spawn in `lib/bmad.js` — set `NODE_OPTIONS` to include `--no-warnings=ExperimentalWarning` (Node 22+) or use the equivalent `NODE_NO_WARNINGS=1` as a narrow fallback — so the spawned child is equally quiet. Add `test/experimental-warning.test.js` to assert:
48
+
49
+ 1. The filter swallows the specific ExperimentalWarning.
50
+ 2. Unrelated warnings (e.g., a synthetic `DeprecationWarning`) are still emitted.
51
+ 3. `lib/bmad.js` spawn envs include the expected suppression flag.
52
+
53
+ ## Notes
54
+
55
+ - Created via `create-bug-story` workflow
56
+ - Discoverable by sprint workflows via glob: `_bmad-output/implementation-artifacts/bug-*.md`
57
+ - To add to a sprint, run `/add-to-sprint`
@@ -1,4 +1,8 @@
1
1
  # generated: 2026-03-15
2
+ # updated: 2026-04-13 — Epic 21 (On-Prem / Local-LLM Tuning) added to backlog (9 stories, 21.1-21.9).
3
+ # updated: 2026-04-14 — Epic 21 corrective plan: added Story 21.10 (Profile Reconfigure). Fixes adversarial review Findings #5 and #7.
4
+ # updated: 2026-04-14 — Epic 21 corrective plan: added Story 21.11 (Profile Uninstall). Fixes adversarial review Finding #17.
5
+ # updated: 2026-04-14 — Epic 21 corrective plan: added Epic 18 tracking block to sprint-status (Story 18.1 already delivered at code level; remaining stories backlog). Fixes adversarial review Finding #16.
2
6
  # updated: 2026-04-07 — All Epic 17 stories (17.9-17.24) implemented and marked done. Epic 19 (BMAD Knowledge Graph) added to backlog.
3
7
  # project: agents
4
8
  # project_key: NOKEY
@@ -16,13 +20,17 @@
16
20
  # Old Epic 17 stories (17.1-17.8) archived; replaced by 17.9-17.24.
17
21
 
18
22
  generated: 2026-03-15
19
- last_updated: 2026-04-07 — Epic 19 stories (19.1-19.7) story files created, marked ready-for-dev
23
+ last_updated: 2026-04-13 — Epic 21 (On-Prem / Local-LLM Tuning) added to backlog
20
24
  project: agents
21
25
  project_key: NOKEY
22
26
  tracking_system: file-system
23
27
  story_location: _bmad-output/implementation-artifacts
24
28
 
25
29
  development_status:
30
+ # ─── BUG FIXES (ACTIVE) ───────────────────────────────────────────────────────
31
+ # Bug A (2026-04-14): ExperimentalWarning on installer startup. Severity: medium.
32
+ bug-experimentalwarning-about-commonjs-loading-es-module-during-install: ready-for-dev
33
+
26
34
  # ─── IN PROGRESS ──────────────────────────────────────────────────────────────
27
35
 
28
36
  # Epic 5: Bundled BMAD Installation — stories 5.1-5.4 done (archived), 5.5-5.6 in review
@@ -84,6 +92,40 @@ development_status:
84
92
  19-7-llm-writability-validation-tests: ready-for-dev
85
93
  epic-19-retrospective: optional
86
94
 
95
+ # Epic 18: Roo Code IDE Support (Phase 2)
96
+ # Dependencies: Epic 9 (OpenCode JSON-merge pattern reused), Epic 13 (project-context template stamping pattern)
97
+ # Note: Story 18.1 (Roo Code agent registration in lib/agents.js) was delivered ahead of formal Epic 18 tracking. Remaining stories (18.2-18.8) have not been started.
98
+ # Execution order: 18.1 → 18.2 → 18.3 → 18.4 → 18.5 → 18.6 → 18.7 → 18.8
99
+ epic-18: backlog
100
+ 18-1-add-roo-code-agent-entry: done
101
+ 18-2-create-bmad-ide-config: backlog
102
+ 18-3-update-installer-roo-code-rules-injection: backlog
103
+ 18-4-generate-roomodes-bmad-personas: backlog
104
+ 18-5-deploy-bmad-workflows-slash-commands: backlog
105
+ 18-6-mode-specific-rules-bmad-agents: backlog
106
+ 18-7-cline-to-roo-code-migration: backlog
107
+ 18-8-end-to-end-validation-test-coverage: backlog
108
+ epic-18-retrospective: optional
109
+
110
+ # Epic 21: On-Prem / Local-LLM Tuning (Phase 3)
111
+ # Dependencies: Epics 9 (OpenCode JSON-merge), 13 (project-context template stamping pattern), 15 (customize-loader), 18 (Roo Code agent registration)
112
+ # Architecture: Decision P3-3 in _bmad-output/planning-artifacts/architecture.md
113
+ # Execution order: 21.1 → 21.2 → (21.3 + 21.4 + 21.5 in parallel) → 21.6 → 21.10 → 21.7 → 21.8 → 21.9 → 21.11
114
+ epic-21: backlog
115
+ # 2026-04-14: 21-1 status corrected review → done (PR #34 landed; sprint-status was stale).
116
+ 21-1-install-time-profile-prompt: done
117
+ 21-2-universal-instruction-block-expansion: backlog
118
+ 21-3-roomodes-template-bmad-modes: backlog
119
+ 21-4-agents-md-template-opencode: backlog
120
+ 21-5-clinerules-template-extension: backlog
121
+ 21-6-onprem-layered-guardrails: backlog
122
+ 21-7-bmad-persona-phase-prefix: backlog
123
+ 21-8-vllm-reference-doc-readme: backlog
124
+ 21-9-tests-validation: backlog
125
+ 21-10-profile-reconfigure: backlog
126
+ 21-11-profile-uninstall: backlog
127
+ epic-21-retrospective: optional
128
+
87
129
  # Epic 14: External Tooling Integration
88
130
  # Dependencies: Epic 12, Epic 10, Epic 13 | Analyst + Architect required
89
131
  # Stories 14.4, 14.5 blocked on Story 14.3 architecture approval
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.0",
2
+ "version": "1.1.0",
3
3
  "description": "BMAD-METHOD AI Development Training Presentation",
4
4
  "files": [
5
5
  "BMAD_AI_Development_Training.pptx"
@@ -1885,6 +1885,58 @@ The workflow embeds all process area definitions and rating criteria inline in `
1885
1885
 
1886
1886
  ---
1887
1887
 
1888
+ ### Decision P3-3: Local-LLM / On-Prem Agent Tuning Profile (FR172–FR179, NFR44–NFR47) (2026-04-13)
1889
+
1890
+ **Problem:** The primary deployment target for ma-agents is air-gapped enterprise networks where teams use AI coding agents (Claude Code, Cline, Roo Code, OpenCode) against on-prem LLMs such as Nemotron Super 49B — not Anthropic's Claude. Field experience documented in `optimizing-local-llm-coding-agents-bmad.md` (2026-04 conversation) shows local LLMs misinterpret Claude-tuned system prompts: they create files when asked questions, dump output into `~/.claude/`, hallucinate Claude Code's `str_replace_editor` tool, skip BMAD planning to start coding, and overthink simple prompts because reasoning mode is on by default. The agent host tools (Roo Code, Cline, OpenCode) actually expose strong guardrail mechanisms — file-regex restrictions, Plan/Architect modes, permission gating — but ma-agents does not currently generate the configuration that activates them. Standards-profile installs (Claude on web, Anthropic API) do not need local-LLM-specific guardrails (`/no_think`, `str_replace_editor` warnings) and arguably regress when those are present.
1891
+
1892
+ **Decision:** Introduce a two-layer install-time tuning model driven by a single user-facing choice — **profile** — captured during the install wizard and persisted in `.ma-agents.json`.
1893
+
1894
+ 1. **Universal layer (all profiles):** Expand the existing per-tool instruction injection to enforce text-vs-file discipline and BMAD phase boundaries through richer templates — including a new `.roomodes` template for Roo Code that applies file-regex restrictions per BMAD phase. These guardrails benefit every install regardless of model, because they prevent premature implementation and out-of-scope writes that affect Claude users too.
1895
+ 2. **On-prem layer (profile=on-prem only):** Layer model-specific guardrails on top of the universal block — `/no_think` planning prefix, no-home-dir-writes rule, no-`str_replace_editor` rule, reasoning-mode/sampling guidance, BMAD persona phase-aware prompt prefixes.
1896
+
1897
+ The inference-server tuning (vLLM flags, quantization, context length) is documentation-only at `docs/deployment/vllm-nemotron.md` — the installer does not manage the serving stack.
1898
+
1899
+ **Architecture fit:**
1900
+
1901
+ | Concern | Resolution |
1902
+ |---------|-----------|
1903
+ | User-facing surface | One question added to the install wizard (`Is this an on-prem / air-gapped install using a local LLM?`). Persisted as `"profile": "on-prem"\|"standard"` in `.ma-agents.json`. `--yes` defaults to `standard` (no prompt) for CI/CD. No `--profile=` CLI flag is exposed — on-prem CI/CD is served by committing `.ma-agents.json` with the persisted value to the repo (same pattern repo-layout config already uses) |
1904
+ | Universal injection extension | Existing marker-based injection in [lib/installer.js](lib/installer.js) is extended with richer content; agent registry in [lib/agents.js](lib/agents.js) gains an optional `extraInstructionTemplates` field per agent for tool-specific files (notably `.roomodes` for Roo Code) |
1905
+ | Per-tool templates | New files under [lib/templates/](lib/templates/): `instruction-block-universal.template.md`, `instruction-block-onprem.template.md`, `roomodes.template.yaml`, `agents-md.template.md` (OpenCode), `clinerules.template.md` (Cline). The CLAUDE.md/`.clinerules`/`.roo/rules/` markdown injection composes universal + (optionally) on-prem block within the same `<!-- MA-AGENTS-START -->` markers. The `.roomodes` and `AGENTS.md` files are stamped as separate per-tool artifacts |
1906
+ | Roo Code BMAD modes | The `.roomodes` template defines four custom modes (`bmad-pm`, `bmad-architect`, `bmad-techlead`, `bmad-dev`) with `groups` declaring `fileRegex` restrictions per BMAD phase. Enforcement happens at Roo Code's tool-call layer (`FileRestrictionError`) — not just in the prompt. This is the highest-leverage application-layer guardrail in the design |
1907
+ | BMAD persona phase prefix | When profile=on-prem, [lib/bmad-customize/](lib/bmad-customize/) `*.customize.yaml` files gain an additional system-prompt prefix block keyed by phase. Planning personas (PM, Architect, SM, Analyst, Tech Writer, UX, SQA) get reasoning-OFF / text-response guidance; implementation personas (Dev Amelia, Solo Dev Barry) get reasoning-ON / careful-implementation guidance. The customize loader composes the prefix only when profile=on-prem; standard profile customizations are unchanged |
1908
+ | Profile read site | A small new module [lib/profile.js](lib/profile.js) wraps profile read/write against `.ma-agents.json` with a single-source-of-truth API (`getProfile()`, `setProfile()`, `resolveProfile({ persisted, yesMode })`). All callers in installer/customize go through it |
1909
+ | Log string formats | Canonical formats (pin these exactly): `Using profile: on-prem (from .ma-agents.json)` / `Using profile: standard (from .ma-agents.json)` / `Using profile: standard (from --yes default)` / `Using profile: <value> (from wizard)`. Tests and docs reference these strings verbatim |
1910
+ | OpenCode JSON merge | OpenCode's existing JSON-merge injection into `opencode.json::instructions[]` is reused unchanged. The expanded `AGENTS.md` is added to the instructions array; on-prem block is appended only when profile=on-prem |
1911
+ | Idempotency | Profile-driven content is rewritten only inside marker blocks (`<!-- MA-AGENTS-START -->`/`<!-- MA-AGENTS-END -->`) and inside ma-agents-owned `customModes` slugs in `.roomodes`. User content outside markers is preserved (NFR46) |
1912
+ | Reference deployment doc | `docs/deployment/vllm-nemotron.md` ships in the repo, not under `lib/templates/`. It is not stamped into target projects. Linked from README's on-prem section |
1913
+
1914
+ **Alternatives considered:**
1915
+ - *CLI flag only (`--profile=on-prem`), no interactive prompt:* Rejected — most users run the wizard, won't pass the flag, and would lose the on-prem guardrails entirely.
1916
+ - *Both interactive prompt AND `--profile=` CLI flag as override:* Rejected (2026-04-14 correction) — the product-owner decision is that profile is user-facing or team-facing, not per-invocation. Teams with on-prem CI/CD commit `.ma-agents.json` with the persisted value to the repo; this is the same pattern already used for repo-layout config and avoids the operational footgun of a CI job forgetting the flag. The user-feedback model is "ask once, persist forever," matching the existing wizard pattern.
1917
+ - *Default everyone to on-prem guardrails:* Rejected — `/no_think` and `str_replace_editor` warnings are noise for Claude-on-web users and regress that path. Universal layer goes to everyone; model-specific layer is opt-in.
1918
+ - *Manage the vLLM serving stack from the installer (e.g., generate `serve-nemotron.sh`):* Rejected — the installer runs on engineer dev machines, not inference servers. Mixing concerns. Reference doc is sufficient.
1919
+ - *Generate per-tool config purely via prompt instruction (no `.roomodes`):* Rejected — Roo Code's `fileRegex` restriction is application-layer enforcement that catches violations the prompt cannot. NFR47 makes this enforcement contract testable.
1920
+
1921
+ **Files affected:**
1922
+ - `bin/cli.js` (new wizard prompt only; no CLI flag — correction applied 2026-04-14)
1923
+ - `lib/installer.js` (read profile via `lib/profile.js`; compose universal + on-prem instruction blocks; stamp `.roomodes` and `AGENTS.md` per-tool artifacts)
1924
+ - `lib/profile.js` (new — profile read/write API against `.ma-agents.json`)
1925
+ - `lib/agents.js` (per-agent `extraInstructionTemplates` field for `.roomodes` and `AGENTS.md`)
1926
+ - `lib/templates/instruction-block-universal.template.md` (new)
1927
+ - `lib/templates/instruction-block-onprem.template.md` (new)
1928
+ - `lib/templates/roomodes.template.yaml` (new — 4 BMAD modes with `fileRegex`)
1929
+ - `lib/templates/agents-md.template.md` (new — OpenCode AGENTS.md)
1930
+ - `lib/templates/clinerules.template.md` (new — extended Cline rules)
1931
+ - `lib/bmad-customize/*.customize.yaml` (additive — phase-prefix block, applied only when profile=on-prem at customize-loader time)
1932
+ - `lib/bmad-customize/customize-loader.js` (or equivalent — compose phase prefix when profile=on-prem)
1933
+ - `docs/deployment/vllm-nemotron.md` (new — reference deployment guide; not stamped into projects)
1934
+ - `README.md` (new on-prem section linking to the deployment guide and explaining the profile prompt)
1935
+ - `test/profile.test.js` (new — read/write/resolve precedence)
1936
+ - `test/onprem-injection.test.js` (new — standard vs on-prem produces correct instruction-block content; idempotency; `.roomodes` slug isolation)
1937
+
1938
+ ---
1939
+
1888
1940
  ### Implementation Readiness Validation
1889
1941
 
1890
1942
  **Decision Completeness:** HIGH