loki-mode 6.0.0 → 6.1.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.
@@ -0,0 +1,271 @@
1
+ # BMAD Integration -- Epic and Story Breakdown
2
+
3
+ **Date:** 2026-02-25
4
+ **Scope:** Epic 1 only (P0 -- BMAD Artifact Pipeline)
5
+ **Version Target:** v6.1.0
6
+
7
+ Epics 2 (Engine Embedding) and 3 (Voice Agent Layer) are documented as future work
8
+ but explicitly deferred pending P0 value validation.
9
+
10
+ ---
11
+
12
+ ## Epic 1: BMAD Artifact Pipeline (P0 -- Must Have)
13
+
14
+ **Goal:** Enable Loki Mode to consume BMAD Method output artifacts as structured input,
15
+ producing higher-quality analysis scores and richer execution context than freeform PRDs.
16
+
17
+ **Success Metric:** `loki start --bmad-project <path>` discovers, parses, and loads BMAD
18
+ artifacts with zero regression on existing non-BMAD workflows.
19
+
20
+ ---
21
+
22
+ ### Story 1.1: BMAD PRD Format Adapter
23
+
24
+ **Size:** M
25
+ **Dependencies:** None
26
+ **Files to create:** `autonomy/bmad-adapter.py`
27
+
28
+ **Description:**
29
+ Create a standalone Python module (stdlib only) that discovers BMAD output artifacts,
30
+ parses their YAML frontmatter, normalizes heading structure, extracts project classification
31
+ metadata, and produces a normalized PRD document suitable for prd-analyzer.py.
32
+
33
+ **Acceptance Criteria:**
34
+
35
+ - **Given** a directory containing `_bmad-output/planning-artifacts/prd-*.md`
36
+ **When** bmad-adapter.py is invoked with the project path
37
+ **Then** it discovers the PRD file automatically
38
+
39
+ - **Given** a BMAD PRD with YAML frontmatter (`stepsCompleted`, `inputDocuments`, `workflowType`)
40
+ **When** the adapter parses it
41
+ **Then** frontmatter is extracted as metadata and stripped from the document body
42
+
43
+ - **Given** a BMAD PRD with sections like `## Executive Summary`, `## Project Classification`
44
+ **When** the adapter normalizes headings
45
+ **Then** sections are preserved as-is (no destructive remapping)
46
+
47
+ - **Given** a BMAD project with `architecture.md` alongside the PRD
48
+ **When** the adapter runs
49
+ **Then** architecture content is appended as supplementary context
50
+
51
+ - **Given** a BMAD project with `epics.md`
52
+ **When** the adapter runs
53
+ **Then** epic/story data is extracted into a structured task list (JSON)
54
+
55
+ - **Given** a non-BMAD project directory (no `_bmad-output/`)
56
+ **When** the adapter is invoked
57
+ **Then** it exits with a clear error message and non-zero exit code
58
+
59
+ - **Given** a BMAD project with incomplete workflow state (`stepsCompleted` missing entries)
60
+ **When** the adapter runs
61
+ **Then** it warns about incomplete artifacts but processes what exists
62
+
63
+ ---
64
+
65
+ ### Story 1.2: Enhanced PRD Analyzer for BMAD Documents
66
+
67
+ **Size:** S
68
+ **Dependencies:** Story 1.1 (adapter output format)
69
+ **Files to modify:** `autonomy/prd-analyzer.py`
70
+
71
+ **Description:**
72
+ Add BMAD-specific heading patterns and content patterns to the existing dimension system.
73
+ Add an optional `--architecture` flag to score an architecture document alongside the PRD.
74
+ Maintain full backward compatibility with freeform PRDs.
75
+
76
+ **Acceptance Criteria:**
77
+
78
+ - **Given** a BMAD PRD with `## Executive Summary`
79
+ **When** prd-analyzer.py scores it
80
+ **Then** the section is recognized (new heading pattern in `feature_list` or new dimension)
81
+
82
+ - **Given** a BMAD PRD with `## Functional Requirements` containing `FR1:` items
83
+ **When** prd-analyzer.py scores it
84
+ **Then** `feature_list` dimension scores HIGH
85
+
86
+ - **Given** a BMAD PRD with `## Non-Functional Requirements` > `### Security`, `### Performance`
87
+ **When** prd-analyzer.py scores it
88
+ **Then** `security` and `deployment` dimensions score at least PARTIAL
89
+
90
+ - **Given** the `--architecture path/to/architecture.md` flag
91
+ **When** prd-analyzer.py runs
92
+ **Then** tech_stack, data_model, and api_spec dimensions are also scored from architecture.md
93
+
94
+ - **Given** a freeform PRD (no BMAD structure)
95
+ **When** prd-analyzer.py scores it
96
+ **Then** results are identical to the current version (zero regression)
97
+
98
+ - **Given** a BMAD PRD and a freeform PRD of equivalent completeness
99
+ **When** both are scored
100
+ **Then** BMAD PRD scores equal or higher (structured methodology bonus not required but allowed)
101
+
102
+ ---
103
+
104
+ ### Story 1.3: `--bmad-project` CLI Flag
105
+
106
+ **Size:** M
107
+ **Dependencies:** Story 1.1 (adapter), Story 1.2 (enhanced analyzer)
108
+ **Files to modify:** `autonomy/loki`, `autonomy/run.sh`
109
+
110
+ **Description:**
111
+ Add a `--bmad-project <path>` flag to `loki start`. When provided, the CLI runs
112
+ bmad-adapter.py to discover and parse BMAD artifacts, then feeds the normalized output
113
+ into the standard PRD analysis pipeline. BMAD context (architecture decisions, epic list)
114
+ is injected into build_prompt() as a supplementary context block.
115
+
116
+ **Acceptance Criteria:**
117
+
118
+ - **Given** `loki start --bmad-project ./my-project`
119
+ **When** `./my-project/_bmad-output/` exists with BMAD artifacts
120
+ **Then** artifacts are discovered, parsed, and loaded into `.loki/` state
121
+
122
+ - **Given** `loki start --bmad-project ./my-project`
123
+ **When** `./my-project/_bmad-output/` does NOT exist
124
+ **Then** CLI prints error and exits with non-zero code
125
+
126
+ - **Given** BMAD artifacts are loaded
127
+ **When** build_prompt() constructs the iteration prompt
128
+ **Then** a `BMAD_CONTEXT` block is injected with architecture summary and active epic
129
+
130
+ - **Given** BMAD epics are loaded
131
+ **When** the task queue is populated
132
+ **Then** each BMAD story becomes a `.loki/queue/` task with priority and acceptance criteria
133
+
134
+ - **Given** `loki start ./prd.md` (no --bmad-project flag)
135
+ **When** the CLI runs
136
+ **Then** behavior is identical to current version (zero regression)
137
+
138
+ - **Given** `loki start --bmad-project ./my-project --prd ./override.md`
139
+ **When** both flags are provided
140
+ **Then** the explicit PRD takes precedence; BMAD artifacts provide supplementary context only
141
+
142
+ - **Given** the `--bmad-project` flag
143
+ **When** `loki help start` is run
144
+ **Then** the flag appears in help text with usage description
145
+
146
+ ---
147
+
148
+ ### Story 1.4: BMAD Artifact Chain Validator
149
+
150
+ **Size:** S
151
+ **Dependencies:** Story 1.1 (adapter)
152
+ **Files to create:** Validation logic within `autonomy/bmad-adapter.py`
153
+
154
+ **Description:**
155
+ Validate that BMAD artifacts form a consistent chain: product-brief references are
156
+ reflected in PRD, PRD requirements trace to architecture decisions, architecture maps
157
+ to epics. Report consistency gaps as warnings (not blockers).
158
+
159
+ **Acceptance Criteria:**
160
+
161
+ - **Given** a BMAD project with product-brief, PRD, architecture, and epics
162
+ **When** the validator runs
163
+ **Then** it checks that PRD references product-brief themes
164
+
165
+ - **Given** a BMAD PRD with 20 Functional Requirements and epics.md
166
+ **When** the validator runs
167
+ **Then** it reports how many FRs are covered by at least one epic story
168
+
169
+ - **Given** a BMAD project missing architecture.md
170
+ **When** the validator runs
171
+ **Then** it warns about the missing artifact but does not block processing
172
+
173
+ - **Given** an inconsistency (FR in PRD with no matching story in epics)
174
+ **When** the validator runs
175
+ **Then** the gap is reported as a warning in the adapter output
176
+
177
+ ---
178
+
179
+ ### Story 1.5: BMAD Integration Tests
180
+
181
+ **Size:** M
182
+ **Dependencies:** Stories 1.1-1.4
183
+ **Files to create:** `tests/test-bmad-integration.sh`, `tests/fixtures/bmad/`
184
+
185
+ **Description:**
186
+ Comprehensive test suite covering BMAD adapter parsing, analyzer scoring, CLI flag
187
+ behavior, artifact chain validation, and backward compatibility. Test fixtures created
188
+ from BMAD's own templates populated with realistic data.
189
+
190
+ **Acceptance Criteria:**
191
+
192
+ - **Given** test fixtures in `tests/fixtures/bmad/` with realistic BMAD output
193
+ **When** `bash tests/test-bmad-integration.sh` runs
194
+ **Then** all tests pass with zero failures
195
+
196
+ - **Given** a fixture with a well-formed BMAD PRD
197
+ **When** the adapter and analyzer are run on it
198
+ **Then** quality score is >= 7.0/10
199
+
200
+ - **Given** a fixture with a freeform PRD (non-BMAD)
201
+ **When** the analyzer scores it before and after the Story 1.2 changes
202
+ **Then** scores are identical (backward compatibility)
203
+
204
+ - **Given** a fixture with malformed BMAD artifacts (missing frontmatter, partial steps)
205
+ **When** the adapter processes it
206
+ **Then** it handles gracefully with warnings, no crashes
207
+
208
+ - **Given** a fixture with incomplete artifact chain (PRD but no architecture)
209
+ **When** the adapter and validator run
210
+ **Then** processing succeeds with chain-gap warnings
211
+
212
+ - **Given** the `--bmad-project` CLI flag
213
+ **When** tested against fixtures
214
+ **Then** discovery, loading, and prompt injection all work correctly
215
+
216
+ - **Given** the test suite
217
+ **When** run after any code change
218
+ **Then** execution completes in under 30 seconds
219
+
220
+ ---
221
+
222
+ ## Epic 2: BMAD Engine Embedding (P1 -- Deferred)
223
+
224
+ **Goal:** Programmatically execute BMAD step-file workflows within Loki Mode, enabling
225
+ interactive requirements elicitation without requiring a separate BMAD-aware LLM session.
226
+
227
+ **Status:** Deferred. Requires P0 success validation first.
228
+
229
+ ### Planned Stories (not detailed)
230
+
231
+ - Story 2.1: BMAD agent YAML parser
232
+ - Story 2.2: Step-file processor (execute BMAD workflows programmatically)
233
+ - Story 2.3: Session state manager (track step progress, partial artifacts)
234
+ - Story 2.4: Dashboard "Elicitation" panel
235
+ - Story 2.5: Party Mode adapter (multi-agent collaboration)
236
+
237
+ ---
238
+
239
+ ## Epic 3: Voice Agent Layer (P2 -- Deferred)
240
+
241
+ **Goal:** Transform voice.sh from simple transcription to a structured dialogue system
242
+ that can facilitate BMAD requirements elicitation conversations.
243
+
244
+ **Status:** Deferred. Highest risk. Requires both P0 and P1 success validation.
245
+
246
+ ### Planned Stories (not detailed)
247
+
248
+ - Story 3.1: Structured dialogue manager
249
+ - Story 3.2: BMAD step-to-voice mapper
250
+ - Story 3.3: Technical term correction loop
251
+ - Story 3.4: Voice session persistence
252
+ - Story 3.5: Dual-mode interface (voice for elicitation, visual for review)
253
+
254
+ ---
255
+
256
+ ## Dependency Graph
257
+
258
+ ```
259
+ Story 1.1 (Adapter) -----> Story 1.2 (Analyzer Enhancement)
260
+ | |
261
+ | v
262
+ +---> Story 1.4 (Validator) ---> Story 1.3 (CLI Flag)
263
+ |
264
+ v
265
+ Story 1.5 (Tests)
266
+ ```
267
+
268
+ Stories 1.1 and 1.2 can be developed in parallel.
269
+ Story 1.3 depends on both 1.1 and 1.2.
270
+ Story 1.4 is part of 1.1 but can be developed in parallel.
271
+ Story 1.5 depends on all other stories but fixture creation can start immediately.
@@ -0,0 +1,86 @@
1
+ # BMAD Integration Adversarial Review
2
+
3
+ **Date:** 2026-02-25
4
+ **Methodology:** BMAD-style adversarial review (zero findings = failure, re-analyze)
5
+ **Reviewers:** 3 blind Opus agents + Devil's Advocate pass
6
+
7
+ ## Review Process
8
+
9
+ Three independent reviewers analyzed the full BMAD integration diff across 5 files.
10
+ Combined: 48 unique findings (2 CRITICAL, 12 HIGH, 21 MEDIUM, 13 LOW).
11
+
12
+ After triage: 1 CRITICAL and 5 HIGH findings were fixed before this report.
13
+
14
+ ## Findings Fixed (Pre-Merge)
15
+
16
+ | # | Severity | File | Issue | Fix Applied |
17
+ |---|----------|------|-------|-------------|
18
+ | 1 | CRITICAL | bmad-adapter.py:136-140 | Path traversal via config.json outputDir | Added resolve() + project root boundary check |
19
+ | 2 | HIGH | bmad-adapter.py:266,294,419 | Missing errors="replace" on read_text | Replaced all read_text with _safe_read() helper (size limit + encoding safety) |
20
+ | 3 | HIGH | bmad-adapter.py:576-607 | Non-atomic file writes | Added _write_atomic() using tempfile + os.replace pattern |
21
+ | 4 | HIGH | run.sh:7042-7050 | Unbounded BMAD content in prompt | Added head -c size limits (16K arch, 32K tasks, 8K validation) |
22
+ | 5 | HIGH | run.sh:7066-7074 | BMAD context before human_directive in prompt | Moved bmad_context after human_directive and queue_tasks |
23
+ | 6 | HIGH | test-bmad-integration.sh:37,126,163,248 | Trap quoting + inline Python injection | Fixed trap quoting, replaced open('$var') with sys.argv[1] |
24
+
25
+ ## Findings Accepted (Known Limitations)
26
+
27
+ | # | Severity | Issue | Rationale for Accepting |
28
+ |---|----------|-------|------------------------|
29
+ | 1 | MEDIUM | Regex YAML parser does not handle block-style lists | BMAD fixtures use flow-style. Block-style support is a future enhancement. Documented in code. |
30
+ | 2 | MEDIUM | populate_bmad_queue() has no standalone test | Function tested indirectly through full integration. Standalone test is a future improvement. |
31
+ | 3 | MEDIUM | prd-analyzer scope estimation includes architecture lines | Conservative choice -- slightly inflated feature count is better than missing features. |
32
+ | 4 | MEDIUM | BMAD_PROJECT_PATH exported but unused by run.sh | Intentionally kept for future provider scripts. Added comment. |
33
+ | 5 | LOW | Error messages show full filesystem paths | Acceptable for CLI tool aimed at developers. Not a production web service. |
34
+ | 6 | LOW | mkdir uses default umask | Standard Python behavior, consistent with rest of codebase. |
35
+
36
+ ## Adversarial Scenarios Tested
37
+
38
+ ### What happens when BMAD output format changes in V7?
39
+
40
+ The adapter uses loose pattern matching (regex on headings, not exact schema validation).
41
+ Section headings like "## Functional Requirements" and "FR1:" patterns are generic enough
42
+ to survive minor format changes. The frontmatter parser handles unknown keys gracefully.
43
+ **Risk: LOW.** The adapter degrades gracefully -- fewer dimensions matched means lower
44
+ score, not a crash.
45
+
46
+ ### What happens with malformed BMAD artifacts?
47
+
48
+ Tested with incomplete fixture (partial workflow state). Adapter:
49
+ - Reports workflow completion percentage
50
+ - Warns about missing artifacts
51
+ - Processes what exists without crashing
52
+ - Uses errors="replace" for encoding safety
53
+ - Has 10MB file size limit
54
+
55
+ **Risk: LOW.** Graceful degradation verified.
56
+
57
+ ### What happens when _bmad-output/ contains partial workflow state?
58
+
59
+ Tested with `stepsCompleted: [init, discovery, vision]` (30% complete).
60
+ Adapter reports completion percentage and warns. Does not block processing.
61
+ **Risk: LOW.** User gets informed about incomplete state.
62
+
63
+ ### What happens if someone passes --bmad-project to a non-BMAD project?
64
+
65
+ Clear error message and non-zero exit code:
66
+ ```
67
+ ERROR: BMAD output directory not found: _bmad-output/planning-artifacts
68
+ This does not appear to be a BMAD project.
69
+ ```
70
+ **Risk: NONE.** Clean failure.
71
+
72
+ ### What about backward compatibility for non-BMAD projects?
73
+
74
+ All BMAD code paths are guarded:
75
+ - CLI: only activated by explicit --bmad-project flag
76
+ - run.sh: checks for .loki/bmad-metadata.json existence
77
+ - prd-analyzer.py: new patterns only ADD to existing ones, never replace
78
+
79
+ Freeform PRD test confirms identical scoring (5.0/10) before and after changes.
80
+ **Risk: NONE.** Verified by test.
81
+
82
+ ## Recommendation
83
+
84
+ **PASS.** All CRITICAL and HIGH findings fixed. Remaining MEDIUM/LOW findings are
85
+ acceptable known limitations with documented rationale. Backward compatibility verified.
86
+ Integration is clean, additive, and well-guarded.
@@ -0,0 +1,249 @@
1
+ # BMAD Integration Validation Report
2
+
3
+ **Date:** 2026-02-25
4
+ **Validator:** Automated analysis against Loki Mode v6.0.0 codebase
5
+ **BMAD Version:** Latest main (cloned 2026-02-25)
6
+
7
+ ## Decision: GO (Phase 0 / Epic 1 only)
8
+
9
+ Phase 0 (BMAD Artifact Pipeline) is low-risk, additive, and achievable with the current
10
+ codebase. Phases 1-2 are deferred pending P0 value validation.
11
+
12
+ ---
13
+
14
+ ## 1. Compatibility Matrix
15
+
16
+ | Integration Point | Status | Notes |
17
+ |---|---|---|
18
+ | PRD format parsing | Compatible (minor gaps) | 7/9 analyzer dimensions match BMAD headings directly |
19
+ | Artifact chain discovery | New capability needed | Adapter must find `_bmad-output/planning-artifacts/` |
20
+ | Agent personas | Complementary | BMAD pre-dev agents + Loki execution agents = full coverage |
21
+ | Voice capabilities | Insufficient for P2 | voice.sh only does 4-section dictation, not structured dialogue |
22
+ | Context budget | Safe | ~8-15K tokens per iteration (step files load one-at-a-time) |
23
+ | License | MIT -- fully compatible | No restrictions on integration or redistribution |
24
+ | Event bus integration | Ready | `.loki/events/pending/` accepts BMAD artifact events |
25
+ | Memory system | Ready | BMAD artifacts can be stored as episodic memory |
26
+ | CLI integration | Straightforward | `--bmad-project` flag pattern matches existing CLI architecture |
27
+ | Dashboard | Deferred (P1) | Would need new "Elicitation" panel |
28
+
29
+ ## 2. PRD Format Gap Analysis
30
+
31
+ ### BMAD PRD Section Headings vs Loki Analyzer Dimensions
32
+
33
+ | BMAD PRD Section | Loki Dimension | Match Type |
34
+ |---|---|---|
35
+ | `## Executive Summary` | -- | NO MATCH (no heading pattern covers "executive summary") |
36
+ | `## Project Classification` | -- | NO MATCH |
37
+ | `## Success Criteria` | `acceptance_criteria` | PARTIAL (heading pattern matches "criteria" keyword) |
38
+ | `## Product Scope` | `feature_list` | MATCH (heading pattern matches "scope") |
39
+ | `## User Journeys` | `user_stories` | MATCH (heading pattern matches "user.*journey") |
40
+ | `## Domain-Specific Requirements` | -- | NO MATCH |
41
+ | `## Innovation & Novel Patterns` | -- | NO MATCH |
42
+ | `## [ProjectType] Specific Requirements` | `feature_list` | PARTIAL (matches "requirement") |
43
+ | `## Project Scoping & Phased Development` | `feature_list` | PARTIAL (matches "scope") |
44
+ | `## Functional Requirements` | `feature_list` | MATCH (matches "functional" and "requirement") |
45
+ | `## Non-Functional Requirements` | Multiple | MATCH (content patterns for security, deployment, error handling) |
46
+
47
+ ### Content Pattern Matches
48
+
49
+ | BMAD Content Pattern | Loki Content Pattern | Match? |
50
+ |---|---|---|
51
+ | `FR{N}: [Actor] can [capability]` | `user can/should/will` in `user_stories` | YES |
52
+ | `Given/When/Then` (in epics) | `given.*when.*then` in `acceptance_criteria` | YES |
53
+ | `As a {role}, I want {action}` (stories) | `as a \w+` in `user_stories` | YES |
54
+ | Tech stack mentions in architecture.md | Tech keyword patterns in `tech_stack` | YES |
55
+ | `### Performance`, `### Security` (NFRs) | Security/deployment heading patterns | YES |
56
+
57
+ ### Gaps Requiring Adapter Work
58
+
59
+ 1. **Executive Summary** -- BMAD's most prominent section has no matching Loki dimension.
60
+ Adapter should map this to a "project_overview" meta-dimension.
61
+
62
+ 2. **Project Classification** -- BMAD includes project type, domain, complexity.
63
+ No Loki equivalent. Adapter should extract and pass as metadata.
64
+
65
+ 3. **Domain-Specific Requirements** -- Healthcare, fintech, govtech compliance sections.
66
+ No Loki dimension covers domain compliance. Consider adding as optional dimension.
67
+
68
+ 4. **Innovation & Novel Patterns** -- BMAD-specific section.
69
+ Not needed for scoring; pass through as supplementary context.
70
+
71
+ 5. **Frontmatter parsing** -- BMAD documents have YAML frontmatter with `stepsCompleted`,
72
+ `inputDocuments`, `workflowType`. Loki's prd-analyzer.py ignores frontmatter entirely.
73
+ Adapter must strip frontmatter before passing to analyzer OR extend analyzer.
74
+
75
+ ### Scoring Impact
76
+
77
+ A well-formed BMAD PRD would score approximately **7.5-8.5/10** on the current analyzer
78
+ without any changes:
79
+ - `feature_list`: HIGH (## Functional Requirements + bullet lists)
80
+ - `user_stories`: HIGH (## User Journeys + "As a..." stories in epics)
81
+ - `acceptance_criteria`: HIGH (Given/When/Then in epics)
82
+ - `tech_stack`: PARTIAL-HIGH (architecture.md has tech details, PRD may not)
83
+ - `security`: PARTIAL (## Non-Functional Requirements > ### Security)
84
+ - `deployment`: PARTIAL (may be in architecture.md, not PRD)
85
+ - `data_model`: NONE-PARTIAL (usually in architecture.md, not PRD)
86
+ - `api_spec`: NONE-PARTIAL (usually in architecture.md, not PRD)
87
+ - `error_handling`: PARTIAL (## Non-Functional Requirements may cover this)
88
+
89
+ With an adapter that also feeds architecture.md into the analyzer, score would be **9-10/10**.
90
+
91
+ ## 3. Agent Overlap Analysis
92
+
93
+ ### BMAD Agents (8) vs Loki Agent Types (41)
94
+
95
+ | BMAD Agent | Role | Loki Equivalent(s) | Relationship |
96
+ |---|---|---|---|
97
+ | Mary (Analyst) | Business analysis, research | `prod-pm` (partial) | Complementary -- BMAD analyst is pre-development |
98
+ | John (PM) | PRD creation, validation | `prod-pm`, `orch-planner` | Overlapping -- Loki PM focuses on execution planning |
99
+ | Winston (Architect) | Architecture design | `eng-infra`, `orch-planner` | Complementary -- BMAD architect is pre-code |
100
+ | Sally (UX Designer) | UX specification | `prod-design` | Complementary -- BMAD UX is spec, Loki is implementation |
101
+ | Amelia (Developer) | Code implementation | `eng-*` (8 agents) | Superseded -- Loki has specialized dev agents |
102
+ | Bob (Scrum Master) | Sprint planning | `orch-coordinator` | Overlapping -- different abstraction level |
103
+ | Quinn (QA) | E2E test generation | `eng-qa` | Overlapping -- both generate tests |
104
+ | Barry (Quick Flow) | Solo rapid dev | No equivalent | Unique to BMAD |
105
+
106
+ ### Assessment
107
+
108
+ - **Zero conflict.** BMAD agents operate in the pre-development space (requirements, planning,
109
+ architecture). Loki agents operate in the execution space (coding, testing, deploying).
110
+ - **Clear handoff point:** BMAD produces artifacts (PRD, architecture, epics). Loki consumes
111
+ them. The adapter bridges the format gap.
112
+ - **Party Mode** (multi-agent collaboration) is a BMAD concept that could enrich Loki's
113
+ council-based review in future phases.
114
+
115
+ ## 4. Voice Compatibility Assessment
116
+
117
+ ### Current Capabilities (voice.sh)
118
+
119
+ | Capability | Status |
120
+ |---|---|
121
+ | STT (Speech-to-Text) | Whisper API, local Whisper, macOS dictation |
122
+ | TTS (Text-to-Speech) | macOS `say`, Linux espeak/festival |
123
+ | Audio recording | sox, ffmpeg, arecord |
124
+ | Guided dictation | 4-section template only (name, overview, requirements, tech stack) |
125
+ | Structured dialogue | NOT SUPPORTED |
126
+ | Agent handoff | NOT SUPPORTED |
127
+ | Session persistence | NOT SUPPORTED |
128
+ | Technical term correction | NOT SUPPORTED |
129
+
130
+ ### What BMAD Voice Integration (P2) Would Require
131
+
132
+ | Requirement | Effort | Description |
133
+ |---|---|---|
134
+ | Step-file-to-question mapper | Large | Convert BMAD step instructions to conversational prompts |
135
+ | Multi-turn dialogue manager | Large | Track conversation state, handle clarifications, backtracking |
136
+ | Agent persona injection | Medium | Voice TTS uses agent voice characteristics |
137
+ | Technical term correction loop | Medium | Confirm jargon transcription ("Did you say React or Preact?") |
138
+ | Session persistence | Medium | Resume BMAD workflows across voice sessions |
139
+ | Dual-mode interface | Large | Voice for elicitation, visual for review |
140
+
141
+ ### Assessment
142
+
143
+ Voice integration (P2) is the highest-risk phase. The current voice.sh is a thin wrapper
144
+ around STT/TTS tools. Transforming it into a structured dialogue system requires:
145
+ - New conversation state machine (not just record-transcribe-write)
146
+ - BMAD step-file interpreter (convert markdown instructions to conversational flow)
147
+ - Feedback loop for transcription accuracy (critical for technical terms)
148
+
149
+ **Recommendation:** Defer P2 entirely. P0 (artifact pipeline) delivers value without voice.
150
+ Voice integration can be revisited after P0 proves the BMAD artifact format is stable and useful.
151
+
152
+ ## 5. Context Budget Analysis
153
+
154
+ ### Per-Iteration Context Cost (P0 Only)
155
+
156
+ | Component | Tokens | Source |
157
+ |---|---|---|
158
+ | Loki SKILL.md | ~2,750 | Always loaded |
159
+ | RARV instructions | ~1,500 | build_prompt() |
160
+ | SDLC phases + rules | ~1,000 | build_prompt() |
161
+ | Memory context | ~2,000-5,000 | Memory retrieval |
162
+ | PRD content | ~5,000-12,000 | BMAD PRD document |
163
+ | PRD observations | ~500-1,000 | prd-analyzer output |
164
+ | **BMAD adapter metadata** | **~500-1,000** | **Project classification, artifact chain info** |
165
+ | **BMAD architecture summary** | **~2,000-4,000** | **Condensed architecture decisions** |
166
+ | **BMAD epic summary** | **~1,000-3,000** | **Active epic/story context** |
167
+ | Checklist status | ~500-1,000 | verification-results.json |
168
+ | Queue tasks | ~500-2,000 | .loki/queue/ |
169
+ | **TOTAL** | **~17,250-32,250** | **Well under 150K ceiling** |
170
+
171
+ ### Verdict
172
+
173
+ At worst case (~32K tokens), BMAD integration uses ~21% of a 150K context window.
174
+ This leaves ample room for code context, tool outputs, and conversation history.
175
+ No context pressure risk.
176
+
177
+ ## 6. Risk Register
178
+
179
+ | Risk | Severity | Likelihood | Mitigation |
180
+ |---|---|---|---|
181
+ | BMAD output format changes in future versions | Medium | Medium | Adapter uses loose pattern matching, not exact schema; version-pin BMAD reference |
182
+ | Malformed BMAD artifacts (partial workflow state) | Low | Medium | Adapter validates artifact completeness; falls back to freeform PRD path |
183
+ | BMAD `_bmad-output/` not found | Low | Low | Clear error message; `--bmad-project` flag is explicit, not auto-detected |
184
+ | prd-analyzer regression on freeform PRDs | High | Low | Test suite includes both BMAD and freeform PRD fixtures; backward compatibility gate |
185
+ | Context budget exceeded with very large BMAD PRDs | Low | Low | PRD content is truncated at 12K tokens; architecture summary is condensed |
186
+ | BMAD trademark concerns | Low | Low | MIT license permits code use; trademark applies to branding, not API integration |
187
+ | Scope creep into P1/P2 during P0 implementation | Medium | Medium | Strict phase gates; P1/P2 deferred until P0 ships and proves value |
188
+
189
+ ## 7. Integration Architecture (P0)
190
+
191
+ ```
192
+ User's BMAD project
193
+ _bmad-output/
194
+ planning-artifacts/
195
+ product-brief-*.md
196
+ prd-*.md <-- Primary input
197
+ architecture.md <-- Secondary input
198
+ epics.md <-- Story/task source
199
+ implementation-artifacts/
200
+ sprint-status.yaml
201
+ *.story.md
202
+
203
+ |
204
+ v
205
+
206
+ autonomy/bmad-adapter.py
207
+ - Discover _bmad-output/ structure
208
+ - Parse BMAD frontmatter (stepsCompleted, workflowType)
209
+ - Strip frontmatter, normalize headings
210
+ - Extract project classification metadata
211
+ - Feed normalized PRD to prd-analyzer.py
212
+ - Map epics to .loki/queue/ task format
213
+
214
+ |
215
+ v
216
+
217
+ autonomy/prd-analyzer.py (enhanced)
218
+ - New heading patterns for BMAD sections
219
+ - Architecture.md scoring support
220
+ - BMAD quality bonus (structured methodology)
221
+ - Backward-compatible with freeform PRDs
222
+
223
+ |
224
+ v
225
+
226
+ autonomy/loki --bmad-project <path>
227
+ - Discovery: find _bmad-output/ in project
228
+ - Load: run bmad-adapter.py, then prd-analyzer.py
229
+ - Inject: BMAD metadata into build_prompt()
230
+ - Queue: BMAD epics/stories into .loki/queue/
231
+
232
+ |
233
+ v
234
+
235
+ autonomy/run.sh (build_prompt)
236
+ - BMAD context block injected alongside PRD
237
+ - Architecture decisions as supplementary context
238
+ - Epic/story tracking in checklist system
239
+ ```
240
+
241
+ ## 8. Recommendations
242
+
243
+ 1. **Proceed with P0 (Epic 1) only.** BMAD Artifact Pipeline.
244
+ 2. **Do not embed BMAD engine.** Read BMAD outputs, do not execute BMAD workflows.
245
+ 3. **Do not implement voice integration.** Defer to separate initiative.
246
+ 4. **Create adapter as standalone Python module.** `autonomy/bmad-adapter.py` -- stdlib only.
247
+ 5. **Enhance prd-analyzer.py conservatively.** Add patterns, do not restructure.
248
+ 6. **Test with real BMAD output fixtures.** Create test fixtures from BMAD's own templates.
249
+ 7. **Gate P1 on P0 success metrics:** At least 5 real projects use `--bmad-project` flag.
@@ -0,0 +1,61 @@
1
+ # BMAD Method x Loki Mode Voice Agent -- Council Analysis
2
+
3
+ **Date:** 2026-02-25
4
+ **Council:** 3 Opus reviewers (blind review)
5
+ **Verdict:** Unanimous YES with phased approach
6
+
7
+ ## Proposal Summary
8
+
9
+ Integrate the BMAD Method (https://github.com/bmad-code-org/BMAD-METHOD) with Loki Mode
10
+ to create a structured requirements elicitation pipeline. BMAD provides a 4-phase
11
+ workflow (Analysis, Planning, Solutioning, Implementation) with agent personas, step-file
12
+ architecture, and adversarial review -- complementing Loki Mode's autonomous execution engine.
13
+
14
+ ## Council Findings
15
+
16
+ ### Reviewer 1: Architecture Focus
17
+
18
+ **Vote:** YES (phased)
19
+
20
+ - BMAD's step-file architecture aligns with Loki's progressive disclosure model
21
+ - BMAD artifacts (product-brief, PRD, architecture, epics) map cleanly to Loki's SDLC phases
22
+ - Context budget is manageable: BMAD step files load one-at-a-time (~3K tokens each)
23
+ - Integration surface is well-defined: `.loki/queue/`, `build_prompt()`, event bus
24
+ - Risk: BMAD is an external dependency that may change format without notice
25
+
26
+ ### Reviewer 2: Integration Feasibility
27
+
28
+ **Vote:** YES (phased)
29
+
30
+ - BMAD PRD output sections (Functional Requirements, Success Criteria, User Journeys)
31
+ match most of prd-analyzer.py's existing dimension patterns
32
+ - Agent overlap is complementary, not conflicting: BMAD covers pre-development, Loki covers execution
33
+ - Voice.sh needs significant extension for structured dialogue (currently only 4-section dictation)
34
+ - MIT license is fully compatible with Loki Mode's distribution
35
+ - Risk: Voice agent layer (Phase 3) has highest uncertainty; STT reliability for technical terms
36
+
37
+ ### Reviewer 3: Risk and Quality
38
+
39
+ **Vote:** YES (phased, with gates)
40
+
41
+ - Backward compatibility is achievable: BMAD integration is additive (new flag, new adapter)
42
+ - Existing non-BMAD projects are untouched unless `--bmad-project` is explicitly used
43
+ - Quality gates apply to all new code: 3-reviewer blind review, anti-sycophancy, test coverage
44
+ - BMAD's adversarial review methodology strengthens Loki's existing quality gate system
45
+ - Risk: Scope creep from Epic 2 (engine embedding) and Epic 3 (voice agent) -- phase gates essential
46
+
47
+ ## Recommended Phased Approach
48
+
49
+ | Phase | Epic | Priority | Risk |
50
+ |-------|-------|----------|------|
51
+ | P0 | BMAD Artifact Pipeline (parse, score, load) | Must-have | Low |
52
+ | P1 | BMAD Engine Embedding (agent YAML parser, step processor) | Should-have | Medium |
53
+ | P2 | Voice Agent Layer (structured dialogue, BMAD-to-voice) | Nice-to-have | High |
54
+
55
+ ## Key Constraints
56
+
57
+ 1. P0 must ship independently and prove value before P1/P2 begin
58
+ 2. No runtime dependency on BMAD repo -- adapter reads BMAD output artifacts only
59
+ 3. Zero regression on existing non-BMAD workflows
60
+ 4. All code must pass existing 9-gate quality system
61
+ 5. Context budget: BMAD additions must stay under 15K tokens per iteration
package/mcp/__init__.py CHANGED
@@ -57,4 +57,4 @@ try:
57
57
  except ImportError:
58
58
  __all__ = ['mcp']
59
59
 
60
- __version__ = '6.0.0'
60
+ __version__ = '6.1.0'
@@ -1 +1,2 @@
1
1
  mcp>=1.0.0
2
+ chromadb>=1.0.0