@ikunin/sprintpilot 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +330 -0
  3. package/_Sprintpilot/.secrets-allowlist +26 -0
  4. package/_Sprintpilot/Sprintpilot.md +216 -0
  5. package/_Sprintpilot/lib/runtime/args.js +77 -0
  6. package/_Sprintpilot/lib/runtime/git.js +24 -0
  7. package/_Sprintpilot/lib/runtime/http.js +96 -0
  8. package/_Sprintpilot/lib/runtime/log.js +30 -0
  9. package/_Sprintpilot/lib/runtime/secrets.js +151 -0
  10. package/_Sprintpilot/lib/runtime/spawn.js +68 -0
  11. package/_Sprintpilot/lib/runtime/text.js +26 -0
  12. package/_Sprintpilot/lib/runtime/yaml-lite.js +160 -0
  13. package/_Sprintpilot/manifest.yaml +26 -0
  14. package/_Sprintpilot/modules/autopilot/config.yaml +20 -0
  15. package/_Sprintpilot/modules/git/branching-and-pr-strategy.md +101 -0
  16. package/_Sprintpilot/modules/git/config.yaml +83 -0
  17. package/_Sprintpilot/modules/git/templates/commit-patch.txt +1 -0
  18. package/_Sprintpilot/modules/git/templates/commit-story.txt +1 -0
  19. package/_Sprintpilot/modules/git/templates/pr-body.md +20 -0
  20. package/_Sprintpilot/modules/ma/config.yaml +9 -0
  21. package/_Sprintpilot/scripts/create-pr.js +284 -0
  22. package/_Sprintpilot/scripts/detect-platform.js +64 -0
  23. package/_Sprintpilot/scripts/health-check.js +98 -0
  24. package/_Sprintpilot/scripts/lint-changed.js +249 -0
  25. package/_Sprintpilot/scripts/lock.js +195 -0
  26. package/_Sprintpilot/scripts/sanitize-branch.js +107 -0
  27. package/_Sprintpilot/scripts/stage-and-commit.js +190 -0
  28. package/_Sprintpilot/scripts/sync-status.js +141 -0
  29. package/_Sprintpilot/skills/sprint-autopilot-off/SKILL.md +6 -0
  30. package/_Sprintpilot/skills/sprint-autopilot-off/workflow.md +154 -0
  31. package/_Sprintpilot/skills/sprint-autopilot-on/SKILL.md +6 -0
  32. package/_Sprintpilot/skills/sprint-autopilot-on/workflow.md +1119 -0
  33. package/_Sprintpilot/skills/sprintpilot-assess/SKILL.md +6 -0
  34. package/_Sprintpilot/skills/sprintpilot-assess/agents/debt-classifier.md +64 -0
  35. package/_Sprintpilot/skills/sprintpilot-assess/agents/dependency-auditor.md +57 -0
  36. package/_Sprintpilot/skills/sprintpilot-assess/agents/migration-analyzer.md +62 -0
  37. package/_Sprintpilot/skills/sprintpilot-assess/workflow.md +114 -0
  38. package/_Sprintpilot/skills/sprintpilot-code-review/SKILL.md +6 -0
  39. package/_Sprintpilot/skills/sprintpilot-code-review/agents/acceptance-auditor.md +51 -0
  40. package/_Sprintpilot/skills/sprintpilot-code-review/agents/blind-hunter.md +39 -0
  41. package/_Sprintpilot/skills/sprintpilot-code-review/agents/edge-case-hunter.md +46 -0
  42. package/_Sprintpilot/skills/sprintpilot-code-review/workflow.md +111 -0
  43. package/_Sprintpilot/skills/sprintpilot-codebase-map/SKILL.md +6 -0
  44. package/_Sprintpilot/skills/sprintpilot-codebase-map/agents/architecture-mapper.md +129 -0
  45. package/_Sprintpilot/skills/sprintpilot-codebase-map/agents/concerns-hunter.md +135 -0
  46. package/_Sprintpilot/skills/sprintpilot-codebase-map/agents/integration-mapper.md +138 -0
  47. package/_Sprintpilot/skills/sprintpilot-codebase-map/agents/quality-assessor.md +143 -0
  48. package/_Sprintpilot/skills/sprintpilot-codebase-map/agents/stack-analyzer.md +133 -0
  49. package/_Sprintpilot/skills/sprintpilot-codebase-map/workflow.md +120 -0
  50. package/_Sprintpilot/skills/sprintpilot-migrate/SKILL.md +6 -0
  51. package/_Sprintpilot/skills/sprintpilot-migrate/agents/dependency-analyzer.md +51 -0
  52. package/_Sprintpilot/skills/sprintpilot-migrate/agents/risk-assessor.md +55 -0
  53. package/_Sprintpilot/skills/sprintpilot-migrate/agents/stack-mapper.md +49 -0
  54. package/_Sprintpilot/skills/sprintpilot-migrate/agents/test-parity-analyzer.md +49 -0
  55. package/_Sprintpilot/skills/sprintpilot-migrate/resources/coexistence-patterns.md +59 -0
  56. package/_Sprintpilot/skills/sprintpilot-migrate/resources/strategies.md +43 -0
  57. package/_Sprintpilot/skills/sprintpilot-migrate/templates/component-card.md +11 -0
  58. package/_Sprintpilot/skills/sprintpilot-migrate/templates/migration-epics.md +35 -0
  59. package/_Sprintpilot/skills/sprintpilot-migrate/templates/migration-plan.md +66 -0
  60. package/_Sprintpilot/skills/sprintpilot-migrate/workflow.md +235 -0
  61. package/_Sprintpilot/skills/sprintpilot-party-mode/SKILL.md +6 -0
  62. package/_Sprintpilot/skills/sprintpilot-party-mode/workflow.md +138 -0
  63. package/_Sprintpilot/skills/sprintpilot-research/SKILL.md +6 -0
  64. package/_Sprintpilot/skills/sprintpilot-research/workflow.md +128 -0
  65. package/_Sprintpilot/skills/sprintpilot-reverse-architect/SKILL.md +6 -0
  66. package/_Sprintpilot/skills/sprintpilot-reverse-architect/agents/component-mapper.md +53 -0
  67. package/_Sprintpilot/skills/sprintpilot-reverse-architect/agents/data-flow-tracer.md +54 -0
  68. package/_Sprintpilot/skills/sprintpilot-reverse-architect/agents/pattern-extractor.md +67 -0
  69. package/_Sprintpilot/skills/sprintpilot-reverse-architect/workflow.md +119 -0
  70. package/_Sprintpilot/skills/sprintpilot-update/SKILL.md +6 -0
  71. package/_Sprintpilot/skills/sprintpilot-update/workflow.md +46 -0
  72. package/_Sprintpilot/templates/agent-rules.md +43 -0
  73. package/bin/sprintpilot.js +95 -0
  74. package/lib/commands/check-update.js +54 -0
  75. package/lib/commands/install.js +876 -0
  76. package/lib/commands/uninstall.js +218 -0
  77. package/lib/core/bmad-config.js +113 -0
  78. package/lib/core/file-ops.js +90 -0
  79. package/lib/core/gitignore.js +54 -0
  80. package/lib/core/markers.js +126 -0
  81. package/lib/core/tool-registry.js +73 -0
  82. package/lib/core/update-check.js +39 -0
  83. package/lib/core/v1-detect.js +86 -0
  84. package/lib/prompts.js +82 -0
  85. package/lib/substitute.js +39 -0
  86. package/package.json +49 -0
@@ -0,0 +1,235 @@
1
+ # Multi-Agent Migration Planning
2
+
3
+ ## Purpose
4
+
5
+ Plan a full-lifecycle migration from current stack to a target stack. Produces a phased roadmap, BMAD-compatible epics, and tracking artifacts.
6
+
7
+ ## Prerequisites
8
+
9
+ - `sprintpilot-codebase-map` outputs in `{output_folder}/codebase-analysis/`
10
+ - `sprintpilot-assess` output (`brownfield-assessment.md`) — recommended but not required
11
+
12
+ ## Outputs
13
+
14
+ | File | Location | Purpose |
15
+ |------|----------|---------|
16
+ | `migration-plan.md` | `{planning_artifacts}/` | Full plan — human reference |
17
+ | `migration-epics.md` | `{planning_artifacts}/` | BMAD-compatible epics for sprint planning |
18
+ | `migration-tracking.yaml` | `{implementation_artifacts}/` | Progress tracking |
19
+
20
+ ---
21
+
22
+ ## Step 1 — Validate Prerequisites and Get Target
23
+
24
+ <action>Verify codebase analysis exists. Read stack-analysis.md, architecture-analysis.md, concerns-analysis.md.</action>
25
+ <action>Read brownfield-assessment.md if available.</action>
26
+ <action>Ask user for:
27
+ - **Target stack** (required): what to migrate to
28
+ - **Constraints** (required): timeline, downtime tolerance, budget
29
+ - **Risk tolerance** (required): conservative / moderate / aggressive
30
+ If running under autopilot and these aren't derivable from existing artifacts → TRUE BLOCKER.
31
+ </action>
32
+
33
+ ---
34
+
35
+ ## Step 2 — Strategy Selection
36
+
37
+ <action>Based on analysis, recommend a migration strategy:
38
+
39
+ | Strategy | When | Risk | Duration |
40
+ |----------|------|------|----------|
41
+ | Strangler Fig | Monolith with clear routing; zero-downtime required | Low | Long |
42
+ | Branch by Abstraction | Internal components; need to swap implementations | Low-Med | Medium |
43
+ | Big Bang | Small codebase, good test coverage | High | Short |
44
+ | Parallel Run | Critical systems requiring verified equivalence | Medium | Long |
45
+
46
+ Present recommendation with rationale. User confirms or overrides.
47
+ </action>
48
+
49
+ ---
50
+
51
+ ## Step 3 — Compatibility Analysis (PARALLEL: 2 agents)
52
+
53
+ <critical>Launch both agents in a single message.</critical>
54
+
55
+ ### Agent 1: Stack Mapper
56
+ ```
57
+ Agent(
58
+ description: "Stack compatibility mapping",
59
+ prompt: <read ./agents/stack-mapper.md, append stack-analysis.md + architecture-analysis.md + target spec>
60
+ )
61
+ ```
62
+ Output: old→new component mapping, direct replacements vs rewrites needed.
63
+
64
+ ### Agent 2: Dependency Analyzer
65
+ ```
66
+ Agent(
67
+ description: "Dependency graph and migration order",
68
+ prompt: <read ./agents/dependency-analyzer.md, append brownfield-assessment.md + concerns-analysis.md>
69
+ )
70
+ ```
71
+ Output: dependency graph, migration order, critical path.
72
+
73
+ <action>Collect results. Merge into compatibility matrix.</action>
74
+
75
+ ---
76
+
77
+ ## Step 4 — Coexistence Design
78
+
79
+ <action>Based on strategy (step 2) and compatibility (step 3), design how old + new code run together:
80
+ - Proxy/router configuration
81
+ - Adapter/anti-corruption layer design
82
+ - Feature flag strategy
83
+ - Data dual-write approach (if needed)
84
+ - Rollback triggers and mechanism
85
+ </action>
86
+
87
+ ---
88
+
89
+ ## Step 5 — Phased Roadmap
90
+
91
+ <action>Create ordered phases, each delivering verifiable value:
92
+ ```
93
+ Phase 0: Foundation — pipeline, coexistence infra, dual-deploy, test infra
94
+ Phase 1-N: Component migrations — ordered by dependency graph
95
+ Phase N+1: Decommission — remove old code, adapters, coexistence infra
96
+ ```
97
+ Each phase has: scope, deliverable, verification criteria, rollback plan.
98
+ </action>
99
+
100
+ ---
101
+
102
+ ## Step 6 — Per-Component Migration Cards
103
+
104
+ <action>For each component to migrate:
105
+ ```markdown
106
+ ### [Component Name]: old → new
107
+ - **Strategy**: strangler / rewrite / adapt
108
+ - **Effort**: S/M/L/XL
109
+ - **Risk**: Low/Medium/High
110
+ - **Dependencies**: [components that must migrate first]
111
+ - **Data migration**: yes/no — approach: ...
112
+ - **Test strategy**: ...
113
+ - **Rollback**: ...
114
+ - **Phase**: N
115
+ ```
116
+ </action>
117
+
118
+ ---
119
+
120
+ ## Step 7 — Data Migration Plan
121
+
122
+ <action>If schema changes or data store migration is needed:
123
+ - Schema diff (old vs new)
124
+ - Transform logic
125
+ - Dual-write period design
126
+ - Backfill strategy
127
+ - Rollback plan for data
128
+ - Zero-downtime migration sequence
129
+ </action>
130
+
131
+ ---
132
+
133
+ ## Step 8 — API Compatibility
134
+
135
+ <action>If APIs change:
136
+ - Versioning strategy (URL path / header / query param)
137
+ - Backward compatibility period
138
+ - Deprecation timeline
139
+ - Client migration guide
140
+ </action>
141
+
142
+ ---
143
+
144
+ ## Step 9 — Test Parity (PARALLEL: 1 agent)
145
+
146
+ ### Agent 3: Test Parity Analyzer
147
+ ```
148
+ Agent(
149
+ description: "Test parity analysis for migration",
150
+ prompt: <read ./agents/test-parity-analyzer.md, append quality-analysis.md + target test framework>
151
+ )
152
+ ```
153
+ Output: old test → new test mapping, gaps, comparison testing strategy.
154
+
155
+ ---
156
+
157
+ ## Step 10 — Risk Assessment (PARALLEL: 1 agent)
158
+
159
+ ### Agent 4: Risk Assessor
160
+ ```
161
+ Agent(
162
+ description: "Migration risk assessment",
163
+ prompt: <read ./agents/risk-assessor.md, append full plan draft + concerns-analysis.md>
164
+ )
165
+ ```
166
+ Output: per-phase risk matrix, mitigation strategies, rollback triggers, canary deployment plan.
167
+
168
+ ---
169
+
170
+ ## Step 11 — Generate BMAD Epics
171
+
172
+ <action>Transform the migration plan into BMAD-compatible epics:
173
+ ```markdown
174
+ # Migration Epics
175
+
176
+ ## Epic 0: Migration Foundation
177
+ - Story 0-1: Set up coexistence infrastructure
178
+ - Story 0-2: Configure dual deployment pipeline
179
+ - Story 0-3: Create migration test harness
180
+
181
+ ## Epic 1: [Phase 1 Name]
182
+ - Story 1-1: [Component] migration
183
+ - Story 1-2: ...
184
+
185
+ ## Epic N+1: Decommission
186
+ - Story N+1-1: Remove old [component]
187
+ - Story N+1-2: Remove adapters and feature flags
188
+ - Story N+1-3: Final validation and cleanup
189
+ ```
190
+
191
+ Each story includes: acceptance criteria, estimated effort, dependencies.
192
+ </action>
193
+
194
+ <action>Write to `{planning_artifacts}/migration-epics.md`</action>
195
+
196
+ ---
197
+
198
+ ## Step 12 — Finalize
199
+
200
+ <action>Compile everything into `{planning_artifacts}/migration-plan.md`:
201
+ - Executive summary
202
+ - Strategy and rationale
203
+ - Compatibility matrix
204
+ - Coexistence design
205
+ - Phased roadmap
206
+ - Component migration cards
207
+ - Data migration plan
208
+ - API compatibility plan
209
+ - Test parity analysis
210
+ - Risk matrix
211
+ - Epic summary with links
212
+ </action>
213
+
214
+ <action>Create `{implementation_artifacts}/migration-tracking.yaml`:
215
+ ```yaml
216
+ migration:
217
+ strategy: strangler-fig
218
+ target_stack: ...
219
+ started: null
220
+ phases:
221
+ phase-0:
222
+ name: Foundation
223
+ status: pending
224
+ stories: [0-1, 0-2, 0-3]
225
+ phase-1:
226
+ name: ...
227
+ status: pending
228
+ stories: [...]
229
+ ```
230
+ </action>
231
+
232
+ <action>Report summary and suggest next steps:
233
+ - `bmad-sprint-planning` — plan sprints from migration epics
234
+ - `bmad-create-story` — detail individual migration stories
235
+ </action>
@@ -0,0 +1,6 @@
1
+ ---
2
+ name: sprintpilot-party-mode
3
+ description: 'Real parallel multi-agent discussions. Select 2-3 BMad Method agent personas per round, launch them simultaneously with a topic, collect responses as a discussion round. Supports multiple rounds. Use when you need diverse perspectives from BMad personas (architect, PM, QA, etc.) debating in parallel rather than sequentially.'
4
+ ---
5
+
6
+ Follow the instructions in ./workflow.md.
@@ -0,0 +1,138 @@
1
+ # Multi-Agent Party Mode
2
+
3
+ ## Purpose
4
+
5
+ Run real parallel multi-persona discussions. Instead of sequentially role-playing each persona (as stock `bmad-party-mode` does), this launches 2-3 Agent subagents simultaneously, each embodying a different BMAD persona. Results are collected and presented as a discussion round.
6
+
7
+ ---
8
+
9
+ ## Step 1 — Setup
10
+
11
+ <action>Get from user or context:
12
+ - **Topic/Question**: what to discuss
13
+ - **Personas**: which BMAD personas to include (2-3 per round)
14
+ Available: analyst, architect, pm, dev, qa, ux-designer, tech-writer, sm
15
+ - **Context files**: any project artifacts to provide as context (PRD, architecture, etc.)
16
+ - **Rounds**: how many discussion rounds (default: 2)
17
+
18
+ If not specified, recommend a relevant set based on the topic:
19
+ - Architecture decisions → architect, dev, qa
20
+ - Product direction → pm, analyst, ux-designer
21
+ - Implementation approach → dev, architect, qa
22
+ - Process/workflow → sm, pm, dev
23
+ </action>
24
+
25
+ ---
26
+
27
+ ## Step 2 — Load Persona Definitions
28
+
29
+ <action>For each selected persona, read the agent definition from BMAD:
30
+ - `{project-root}/_bmad/_config/agents/` — look for persona YAML files
31
+ - Or look in the installed skills directory for `bmad-agent-{persona}/SKILL.md`
32
+
33
+ Extract the persona's:
34
+ - Role description
35
+ - Expertise areas
36
+ - Communication style
37
+ - Key concerns/priorities
38
+ </action>
39
+
40
+ ---
41
+
42
+ ## Step 3 — Run Discussion Rounds
43
+
44
+ For each round (1 to {{num_rounds}}):
45
+
46
+ <critical>Launch ALL persona agents for this round in a single message.</critical>
47
+
48
+ For each persona in this round:
49
+ ```
50
+ Agent(
51
+ description: "{persona_name} perspective on {topic}",
52
+ prompt: "You are the {persona_name} on a BMAD development team.
53
+
54
+ ## Your Role
55
+ {persona_description}
56
+
57
+ ## Your Priorities
58
+ {persona_priorities}
59
+
60
+ ## Discussion Topic
61
+ {topic}
62
+
63
+ ## Context
64
+ {project_context_files_content}
65
+
66
+ ## Previous Round Discussion
67
+ {previous_round_responses — empty for round 1}
68
+
69
+ ## Instructions
70
+
71
+ Respond to the topic from your persona's perspective.
72
+ - State your position clearly
73
+ - Raise concerns specific to your role
74
+ - Propose concrete actions
75
+ - If responding to previous round: agree, disagree, or build on other personas' points
76
+ - Be direct and specific, not generic
77
+
78
+ Cap response at 1000 tokens."
79
+ )
80
+ ```
81
+
82
+ <action>Collect all responses for this round.</action>
83
+
84
+ <action>Present the round:
85
+
86
+ ```markdown
87
+ ## Round {{round_number}}
88
+
89
+ ### {Persona 1 Name} ({role})
90
+ {response}
91
+
92
+ ### {Persona 2 Name} ({role})
93
+ {response}
94
+
95
+ ### {Persona 3 Name} ({role})
96
+ {response}
97
+ ```
98
+ </action>
99
+
100
+ <action>For subsequent rounds, include previous round responses as context so personas can respond to each other.</action>
101
+
102
+ ---
103
+
104
+ ## Step 4 — Synthesis
105
+
106
+ After all rounds complete:
107
+
108
+ <action>Produce a synthesis:
109
+
110
+ ```markdown
111
+ ## Discussion Summary
112
+
113
+ ### Topic
114
+ {topic}
115
+
116
+ ### Participants
117
+ {persona list with roles}
118
+
119
+ ### Points of Agreement
120
+ - ...
121
+
122
+ ### Points of Disagreement
123
+ - {persona A} vs {persona B}: ...
124
+ Resolution suggestion: ...
125
+
126
+ ### Action Items
127
+ 1. [Owner: {persona}] {action}
128
+ 2. ...
129
+
130
+ ### Open Questions
131
+ - ...
132
+
133
+ ### Recommendation
134
+ [Based on the discussion, what is the recommended path forward?]
135
+ ```
136
+ </action>
137
+
138
+ <action>Ask user: "Continue with another topic, or apply these insights to the current workflow?"</action>
@@ -0,0 +1,6 @@
1
+ ---
2
+ name: sprintpilot-research
3
+ description: 'Multi-agent research fan-out. Launch parallel research agents for technical, domain, and market topics simultaneously. Each agent uses WebSearch/WebFetch for live research. Collects and synthesizes results into a unified research report. Use when you need to research multiple topics quickly.'
4
+ ---
5
+
6
+ Follow the instructions in ./workflow.md.
@@ -0,0 +1,128 @@
1
+ # Multi-Agent Research
2
+
3
+ ## Purpose
4
+
5
+ Fan out research across multiple topics in parallel. Each research agent gets a topic and type (technical/domain/market), uses WebSearch and WebFetch, and returns structured findings. Results are collected and synthesized.
6
+
7
+ ---
8
+
9
+ ## Step 1 — Gather Research Topics
10
+
11
+ <action>Get research topics from user or from the current workflow context.
12
+
13
+ Expected input format:
14
+ ```
15
+ Topics:
16
+ 1. [type: technical] How does Prisma handle migrations compared to TypeORM?
17
+ 2. [type: domain] Healthcare HIPAA compliance requirements for SaaS
18
+ 3. [type: market] Competitor analysis for API gateway products
19
+ ```
20
+
21
+ If no topics provided, ask the user. Each topic needs:
22
+ - **Topic text** — what to research
23
+ - **Type** — `technical` (implementation approaches), `domain` (industry knowledge), or `market` (competitive landscape)
24
+ </action>
25
+
26
+ <action>Set `{{topics}}` = list of topics with types</action>
27
+
28
+ ---
29
+
30
+ ## Step 2 — Launch Research Agents in Parallel
31
+
32
+ <critical>
33
+ Launch ALL agents in a single message.
34
+ Max parallel agents: 3 (from config). If more than 3 topics, batch into rounds.
35
+ Each agent gets the topic, type, and instructions for that research type.
36
+ </critical>
37
+
38
+ For each topic, launch:
39
+ ```
40
+ Agent(
41
+ description: "Research: {topic_summary}",
42
+ prompt: "You are a research agent. Your task:
43
+
44
+ **Topic**: {topic_text}
45
+ **Type**: {type}
46
+
47
+ ## Instructions
48
+
49
+ Use WebSearch to find current, authoritative information.
50
+ Use WebFetch to read promising results in detail.
51
+
52
+ ### For 'technical' topics:
53
+ - Find official documentation, blog posts, benchmarks
54
+ - Compare approaches with pros/cons
55
+ - Include code examples if relevant
56
+ - Cite sources with URLs
57
+
58
+ ### For 'domain' topics:
59
+ - Find regulatory documents, industry standards, expert analyses
60
+ - Identify key terminology and requirements
61
+ - Note recent changes or trends
62
+ - Cite authoritative sources
63
+
64
+ ### For 'market' topics:
65
+ - Identify competitors and alternatives
66
+ - Compare features, pricing, market position
67
+ - Note trends and market direction
68
+ - Cite data sources
69
+
70
+ ## Output Format
71
+
72
+ ```markdown
73
+ ## Research: {topic_summary}
74
+
75
+ ### Key Findings
76
+ 1. ...
77
+ 2. ...
78
+ 3. ...
79
+
80
+ ### Details
81
+ [Structured analysis based on type]
82
+
83
+ ### Sources
84
+ - [Title](URL) — brief note on relevance
85
+ ```
86
+
87
+ Cap response at 2000 tokens. Be concise and factual."
88
+ )
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Step 3 — Collect and Synthesize
94
+
95
+ <action>Collect all agent results.</action>
96
+
97
+ <action>Produce unified research report:
98
+
99
+ ```markdown
100
+ # Research Report
101
+
102
+ ## Topics Researched
103
+ | # | Type | Topic | Status |
104
+ |---|------|-------|--------|
105
+ | 1 | technical | ... | complete |
106
+ | 2 | domain | ... | complete |
107
+ | 3 | market | ... | complete |
108
+
109
+ ## Findings
110
+
111
+ ### Topic 1: {title}
112
+ [Agent 1's findings]
113
+
114
+ ### Topic 2: {title}
115
+ [Agent 2's findings]
116
+
117
+ ### Topic 3: {title}
118
+ [Agent 3's findings]
119
+
120
+ ## Cross-Topic Insights
121
+ [Any connections or conflicts between findings across topics]
122
+
123
+ ## Sources
124
+ [Consolidated list of all sources cited]
125
+ ```
126
+ </action>
127
+
128
+ <action>If this was triggered by a BMAD workflow (e.g., during architecture or PRD creation), save to `{planning_artifacts}/research-{topic-slug}.md`</action>
@@ -0,0 +1,6 @@
1
+ ---
2
+ name: sprintpilot-reverse-architect
3
+ description: 'Extract architecture from existing code (bottom-up) via 3 parallel agents. Produces BMad Method-compatible architecture document from Component Mapper, Data Flow Tracer, and Pattern Extractor. Use on brownfield projects where no architecture doc exists. Run after sprintpilot-codebase-map.'
4
+ ---
5
+
6
+ Follow the instructions in ./workflow.md.
@@ -0,0 +1,53 @@
1
+ # Component Mapper Agent
2
+
3
+ You are extracting module boundaries and component contracts from an existing codebase.
4
+
5
+ ## Task
6
+
7
+ Using the architecture-analysis.md analysis as a starting point, go deeper: trace actual imports, identify public APIs, and map the internal dependency graph.
8
+
9
+ ## Method
10
+
11
+ 1. For each module/directory identified in architecture-analysis.md:
12
+ - Read index/barrel files (index.ts, __init__.py, mod.rs, etc.)
13
+ - Identify exported symbols (public API)
14
+ - Grep for imports of this module from other modules
15
+ - Map which modules depend on which
16
+
17
+ 2. For each component:
18
+ - Identify its responsibility (from code, not guessing)
19
+ - List its public interface (functions, classes, routes, events)
20
+ - List what it depends on
21
+ - Note any circular dependencies
22
+
23
+ ## Output Format
24
+
25
+ ```markdown
26
+ ## Components
27
+
28
+ ### [Component Name]
29
+ - **Path**: src/components/auth/
30
+ - **Responsibility**: Authentication and session management
31
+ - **Public API**:
32
+ - `authenticate(credentials) → Session`
33
+ - `validateToken(token) → User`
34
+ - **Internal dependencies**: Database, Config
35
+ - **Depended on by**: API Routes, Middleware
36
+ - **Evidence**: src/components/auth/index.ts:1-15
37
+
38
+ ## Dependency Graph
39
+ ```
40
+ [Component A] → [Component B] → [Component C]
41
+ → [Component D]
42
+ [Component E] → [Component B]
43
+ ```
44
+
45
+ ## Circular Dependencies
46
+ - [list any found, or "None detected"]
47
+
48
+ ## Boundary Assessment
49
+ - Clean boundaries: [list well-encapsulated components]
50
+ - Leaky boundaries: [list components with tight coupling]
51
+ ```
52
+
53
+ ## Context (architecture-analysis.md)
@@ -0,0 +1,54 @@
1
+ # Data Flow Tracer Agent
2
+
3
+ You are tracing how data flows through the system — from entry points to storage and back.
4
+
5
+ ## Task
6
+
7
+ Using architecture-analysis.md and integrations-analysis.md as context, trace the actual request/data paths through the code.
8
+
9
+ ## Method
10
+
11
+ 1. Start from entry points (routes, CLI handlers, event listeners)
12
+ 2. Follow the call chain: handler → service → repository → database
13
+ 3. Track data transformations at each step
14
+ 4. Identify async flows (queues, events, callbacks, promises)
15
+ 5. Map state management patterns
16
+
17
+ ## Output Format
18
+
19
+ ```markdown
20
+ ## Primary Data Flows
21
+
22
+ ### Flow 1: [Name] (e.g., "User Authentication")
23
+ ```
24
+ Entry: POST /api/auth/login (routes/auth.ts:15)
25
+ → AuthController.login (controllers/auth.ts:30)
26
+ → AuthService.authenticate (services/auth.ts:45)
27
+ → UserRepository.findByEmail (repos/user.ts:20)
28
+ → Database query
29
+ ← User record
30
+ → TokenService.generate (services/token.ts:10)
31
+ ← { token, user }
32
+ ← 200 { token, user }
33
+ ```
34
+
35
+ ### Flow 2: [Name]
36
+ ...
37
+
38
+ ## State Management
39
+ - Pattern: [Redux/Zustand/Context/MobX/server-side sessions/...]
40
+ - Store location: ...
41
+ - Key state shapes: ...
42
+
43
+ ## Async Flows
44
+ | Trigger | Queue/Event | Handler | Side Effects |
45
+ |---------|------------|---------|-------------|
46
+ | ... | ... | ... | ... |
47
+
48
+ ## Data Transformation Points
49
+ | Location | Input Shape | Output Shape | Validation |
50
+ |----------|------------|-------------|------------|
51
+ | ... | ... | ... | yes/no |
52
+ ```
53
+
54
+ ## Context (architecture-analysis.md + integrations-analysis.md)
@@ -0,0 +1,67 @@
1
+ # Pattern Extractor Agent
2
+
3
+ You are identifying design patterns, conventions, and architectural decisions embedded in the code.
4
+
5
+ ## Task
6
+
7
+ Using architecture-analysis.md and stack-analysis.md as context, identify the actual patterns the codebase follows (not what it claims to follow).
8
+
9
+ ## Method
10
+
11
+ 1. Look for structural patterns: Factory, Repository, Observer, Middleware, Decorator
12
+ 2. Check naming conventions across files (camelCase, snake_case, kebab-case)
13
+ 3. Analyze error handling: try/catch strategy, error types, error propagation
14
+ 4. Check testing patterns: arrange-act-assert, given-when-then, mocking strategy
15
+ 5. Look for logging patterns: structured logging, log levels, what gets logged
16
+ 6. Check configuration patterns: env vars, config objects, feature flags
17
+
18
+ ## Output Format
19
+
20
+ ```markdown
21
+ ## Design Patterns
22
+
23
+ ### Structural Patterns
24
+ | Pattern | Where | Example |
25
+ |---------|-------|---------|
26
+ | Repository | Data access layer | `UserRepository` at repos/user.ts |
27
+ | Factory | ... | ... |
28
+ | Middleware | Request pipeline | Express middleware at middleware/ |
29
+
30
+ ### Naming Conventions
31
+ | Context | Convention | Example | Consistency |
32
+ |---------|-----------|---------|-------------|
33
+ | Files | kebab-case | user-service.ts | 95% consistent |
34
+ | Classes | PascalCase | UserService | 100% |
35
+ | Functions | camelCase | getUserById | 90% |
36
+ | DB columns | snake_case | created_at | 100% |
37
+
38
+ ### Error Handling Strategy
39
+ - Pattern: [custom error classes / error codes / HTTP status mapping]
40
+ - Propagation: [throw/catch at boundaries / result types / error events]
41
+ - Logging: [errors are logged at: ...]
42
+ - Gaps: [where error handling is missing or inconsistent]
43
+
44
+ ### Testing Patterns
45
+ - Framework: ...
46
+ - Style: [unit + integration / mostly e2e / mixed]
47
+ - Mocking: [jest mocks / dependency injection / test doubles]
48
+ - Fixtures: [factory functions / JSON fixtures / database seeds]
49
+
50
+ ### Logging & Observability
51
+ - Logger: [winston / pino / built-in / console]
52
+ - Structure: [structured JSON / plain text]
53
+ - Levels used: [info, warn, error — debug?]
54
+
55
+ ### Configuration Pattern
56
+ - Method: [env vars / config files / both]
57
+ - Validation: [validated at startup? / no validation?]
58
+ - Secrets: [how are secrets handled?]
59
+
60
+ ## Architectural Decisions (Inferred)
61
+ | # | Decision | Evidence | Likely Rationale |
62
+ |---|----------|----------|-----------------|
63
+ | 1 | Use TypeScript strict mode | tsconfig.json:3 | Type safety |
64
+ | 2 | ... | ... | ... |
65
+ ```
66
+
67
+ ## Context (architecture-analysis.md + stack-analysis.md)