@thierrynakoa/fire-flow 10.0.0 → 12.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +8 -8
- package/ARCHITECTURE-DIAGRAM.md +7 -4
- package/COMMAND-REFERENCE.md +33 -13
- package/DOMINION-FLOW-OVERVIEW.md +581 -421
- package/QUICK-START.md +3 -3
- package/README.md +101 -44
- package/TROUBLESHOOTING.md +264 -264
- package/agents/fire-executor.md +200 -116
- package/agents/fire-fact-checker.md +276 -276
- package/agents/fire-phoenix-analyst.md +394 -0
- package/agents/fire-planner.md +145 -53
- package/agents/fire-project-researcher.md +155 -155
- package/agents/fire-research-synthesizer.md +166 -166
- package/agents/fire-researcher.md +144 -59
- package/agents/fire-roadmapper.md +215 -203
- package/agents/fire-verifier.md +247 -65
- package/agents/fire-vision-architect.md +381 -0
- package/commands/fire-0-orient.md +476 -476
- package/commands/fire-1a-new.md +216 -0
- package/commands/fire-1b-research.md +210 -0
- package/commands/fire-1c-setup.md +254 -0
- package/commands/{fire-1a-discuss.md → fire-1d-discuss.md} +35 -7
- package/commands/fire-3-execute.md +55 -2
- package/commands/fire-4-verify.md +61 -0
- package/commands/fire-5-handoff.md +2 -2
- package/commands/fire-6-resume.md +37 -2
- package/commands/fire-add-new-skill.md +2 -2
- package/commands/fire-autonomous.md +20 -3
- package/commands/fire-brainstorm.md +1 -1
- package/commands/fire-complete-milestone.md +2 -2
- package/commands/fire-cost.md +183 -0
- package/commands/fire-dashboard.md +2 -2
- package/commands/fire-debug.md +663 -663
- package/commands/fire-loop-resume.md +2 -2
- package/commands/fire-loop-stop.md +1 -1
- package/commands/fire-loop.md +1168 -1168
- package/commands/fire-map-codebase.md +3 -3
- package/commands/fire-new-milestone.md +356 -356
- package/commands/fire-phoenix.md +603 -0
- package/commands/fire-reflect.md +235 -235
- package/commands/fire-research.md +246 -246
- package/commands/fire-search.md +1 -1
- package/commands/fire-skills-diff.md +3 -3
- package/commands/fire-skills-history.md +3 -3
- package/commands/fire-skills-rollback.md +7 -7
- package/commands/fire-skills-sync.md +5 -5
- package/commands/fire-test.md +9 -9
- package/commands/fire-todos.md +1 -1
- package/commands/fire-update.md +5 -5
- package/hooks/hooks.json +16 -16
- package/hooks/run-hook.sh +8 -8
- package/hooks/run-session-end.sh +7 -7
- package/hooks/session-end.sh +90 -90
- package/hooks/session-start.sh +1 -1
- package/package.json +4 -2
- package/plugin.json +7 -7
- package/references/metrics-and-trends.md +1 -1
- package/skills-library/SKILLS-INDEX.md +588 -588
- package/skills-library/_general/methodology/AUTONOMOUS_ORCHESTRATION.md +182 -0
- package/skills-library/_general/methodology/BACKWARD_PLANNING_INTERVIEW.md +307 -0
- package/skills-library/_general/methodology/CIRCUIT_BREAKER_INTELLIGENCE.md +163 -0
- package/skills-library/_general/methodology/CONTEXT_ROTATION.md +151 -0
- package/skills-library/_general/methodology/DEAD_ENDS_SHELF.md +188 -0
- package/skills-library/_general/methodology/DESIGN_PHILOSOPHY_ENFORCEMENT.md +152 -0
- package/skills-library/_general/methodology/INTERNAL_CONSISTENCY_AUDIT.md +212 -0
- package/skills-library/_general/methodology/LIVE_BREADCRUMB_PROTOCOL.md +242 -0
- package/skills-library/_general/methodology/PHOENIX_REBUILD_METHODOLOGY.md +251 -0
- package/skills-library/_general/methodology/QUALITY_GATES_AND_VERIFICATION.md +157 -0
- package/skills-library/_general/methodology/RELIABILITY_PREDICTION.md +104 -0
- package/skills-library/_general/methodology/REQUIREMENTS_DECOMPOSITION.md +155 -0
- package/skills-library/_general/methodology/SELF_TESTING_FEEDBACK_LOOP.md +143 -0
- package/skills-library/_general/methodology/STACK_COMPATIBILITY_MATRIX.md +178 -0
- package/skills-library/_general/methodology/TIERED_CONTEXT_ARCHITECTURE.md +118 -0
- package/skills-library/_general/methodology/ZERO_FRICTION_CLI_SETUP.md +312 -0
- package/skills-library/_general/methodology/autonomous-multi-phase-build.md +133 -0
- package/skills-library/_general/methodology/claude-md-archival.md +280 -0
- package/skills-library/_general/methodology/debug-swarm-researcher-escape-hatch.md +240 -240
- package/skills-library/_general/methodology/git-worktrees-parallel.md +232 -0
- package/skills-library/_general/methodology/llm-judge-memory-crud.md +241 -0
- package/skills-library/_general/methodology/multi-project-autonomous-build.md +360 -0
- package/skills-library/_general/methodology/shell-autonomous-loop-fixplan.md +238 -238
- package/skills-library/_general/patterns-standards/GOF_DESIGN_PATTERNS_FOR_AI_AGENTS.md +358 -0
- package/skills-library/methodology/BREATH_BASED_PARALLEL_EXECUTION.md +1 -1
- package/skills-library/methodology/RESEARCH_BACKED_WORKFLOW_UPGRADE.md +1 -1
- package/skills-library/methodology/SABBATH_REST_PATTERN.md +1 -1
- package/templates/ASSUMPTIONS.md +1 -1
- package/templates/BLOCKERS.md +1 -1
- package/templates/DECISION_LOG.md +1 -1
- package/templates/phase-prompt.md +1 -1
- package/templates/phoenix-comparison.md +80 -0
- package/version.json +2 -2
- package/workflows/handoff-session.md +1 -1
- package/workflows/new-project.md +2 -2
- package/commands/fire-1-new.md +0 -281
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Autonomous Phoenix Rebuild — reverse-engineer intent from messy code, then rebuild clean from scratch
|
|
3
|
+
argument-hint: "--source <path> [--target <path>] [--migrate] [--dry-run] [--focus <subsystem>]"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /fire-phoenix
|
|
7
|
+
|
|
8
|
+
> Burn the Frankenstein. Rise production-ready. Reverse-engineer INTENT from messy code, ask clarifying questions, then rebuild clean in a new folder.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Purpose
|
|
13
|
+
|
|
14
|
+
Take a messy "vibe coded" project and autonomously rebuild it into a clean, production-quality application. The source folder is **never modified** — the rebuild happens in a new target folder using the full Dominion Flow pipeline.
|
|
15
|
+
|
|
16
|
+
**What makes this different from refactoring:** Refactoring improves code incrementally. Phoenix burns the old code entirely and rebuilds from extracted INTENT. The result carries the knowledge but none of the accidental complexity.
|
|
17
|
+
|
|
18
|
+
> **Reference:** @skills-library/_general/methodology/PHOENIX_REBUILD_METHODOLOGY.md
|
|
19
|
+
|
|
20
|
+
**Core pipeline:**
|
|
21
|
+
```
|
|
22
|
+
AUTOPSY → INTENT → CLARIFY → VISION → REBUILD → COMPARISON
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Arguments
|
|
28
|
+
|
|
29
|
+
```yaml
|
|
30
|
+
arguments:
|
|
31
|
+
--source:
|
|
32
|
+
type: path
|
|
33
|
+
required: true
|
|
34
|
+
description: "Path to the messy source project"
|
|
35
|
+
example: "/fire-phoenix --source C:/Projects/my-app"
|
|
36
|
+
|
|
37
|
+
--target:
|
|
38
|
+
type: path
|
|
39
|
+
required: false
|
|
40
|
+
default: "{source}-phoenix"
|
|
41
|
+
description: "Path for the clean rebuild output"
|
|
42
|
+
example: "/fire-phoenix --source ./app --target ./app-v2"
|
|
43
|
+
|
|
44
|
+
--migrate:
|
|
45
|
+
type: boolean
|
|
46
|
+
default: false
|
|
47
|
+
description: "Enable stack migration mode (propose alternative tech stacks)"
|
|
48
|
+
|
|
49
|
+
--dry-run:
|
|
50
|
+
type: boolean
|
|
51
|
+
default: false
|
|
52
|
+
description: "Run Phase 1-3 only (analyze + clarify). No rebuild."
|
|
53
|
+
|
|
54
|
+
--focus:
|
|
55
|
+
type: string
|
|
56
|
+
required: false
|
|
57
|
+
description: "Limit analysis to a specific subsystem"
|
|
58
|
+
example: "/fire-phoenix --source ./app --focus auth"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Process
|
|
64
|
+
|
|
65
|
+
### Step 0: Path Verification Gate (MANDATORY)
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
Validate ALL paths before any work:
|
|
69
|
+
|
|
70
|
+
1. --source path EXISTS and is a directory
|
|
71
|
+
2. --source contains code files (not empty)
|
|
72
|
+
3. --target path does NOT exist (prevent overwrite)
|
|
73
|
+
4. --source ≠ --target (prevent self-overwrite)
|
|
74
|
+
5. --source is not inside --target or vice versa
|
|
75
|
+
6. Working directory matches expected project context
|
|
76
|
+
|
|
77
|
+
IF any check fails:
|
|
78
|
+
Display error with specific violation
|
|
79
|
+
STOP — do not proceed
|
|
80
|
+
|
|
81
|
+
SAFETY RULE: Source folder is READ-ONLY for the entire pipeline.
|
|
82
|
+
- Autopsy documents write to {source}/.phoenix/ (metadata only)
|
|
83
|
+
- All code writes go to {target}/
|
|
84
|
+
- No file in {source}/ outside .phoenix/ is ever modified
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Step 1: Display Phoenix Banner
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
+--------------------------------------------------------------+
|
|
91
|
+
| PHOENIX REBUILD |
|
|
92
|
+
+--------------------------------------------------------------+
|
|
93
|
+
| |
|
|
94
|
+
| Source: {source_path} |
|
|
95
|
+
| Target: {target_path} |
|
|
96
|
+
| Mode: {same-stack | migration} |
|
|
97
|
+
| Focus: {all | subsystem} |
|
|
98
|
+
| |
|
|
99
|
+
| Pipeline: |
|
|
100
|
+
| Phase 1: AUTOPSY — Map the mess |
|
|
101
|
+
| Phase 2: INTENT — Extract what it was trying to do |
|
|
102
|
+
| Phase 3: CLARIFY — Ask user about ambiguities |
|
|
103
|
+
| Phase 4: VISION — Design the clean architecture |
|
|
104
|
+
| Phase 5: REBUILD — Build it right |
|
|
105
|
+
| Phase 6: COMPARISON — Prove it's better |
|
|
106
|
+
| |
|
|
107
|
+
| Safety: Source is READ-ONLY. All writes go to target. |
|
|
108
|
+
| |
|
|
109
|
+
+--------------------------------------------------------------+
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
IF `--dry-run`:
|
|
113
|
+
```
|
|
114
|
+
DRY RUN — will execute Phases 1-3 only (Autopsy + Intent + Clarify).
|
|
115
|
+
No rebuild will occur. Remove --dry-run to execute full pipeline.
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
### Phase 1: AUTOPSY — Map the Mess
|
|
121
|
+
|
|
122
|
+
> Understand the source codebase structure, stack, and problems.
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
Create directory: {source}/.phoenix/autopsy/
|
|
126
|
+
|
|
127
|
+
Reuse /fire-map-codebase infrastructure:
|
|
128
|
+
Spawn 4 parallel mapper agents targeting {source}/:
|
|
129
|
+
|
|
130
|
+
Agent 1 (tech):
|
|
131
|
+
Focus: Technology stack, frameworks, libraries, versions
|
|
132
|
+
Output: {source}/.phoenix/autopsy/STACK.md
|
|
133
|
+
|
|
134
|
+
Agent 2 (arch):
|
|
135
|
+
Focus: Architecture patterns, data flow, entry points
|
|
136
|
+
Output: {source}/.phoenix/autopsy/ARCHITECTURE.md
|
|
137
|
+
|
|
138
|
+
Agent 3 (quality):
|
|
139
|
+
Focus: Code quality, anti-patterns, test coverage, error handling
|
|
140
|
+
Output: {source}/.phoenix/autopsy/CONCERNS.md
|
|
141
|
+
|
|
142
|
+
Agent 4 (concerns):
|
|
143
|
+
Focus: External integrations, APIs, services, databases
|
|
144
|
+
Output: {source}/.phoenix/autopsy/INTEGRATIONS.md
|
|
145
|
+
|
|
146
|
+
Additionally, the orchestrator produces:
|
|
147
|
+
|
|
148
|
+
{source}/.phoenix/autopsy/STRUCTURE.md:
|
|
149
|
+
- Full directory tree (2 levels deep)
|
|
150
|
+
- Entry point files identified
|
|
151
|
+
- Config files listed
|
|
152
|
+
|
|
153
|
+
{source}/.phoenix/autopsy/SOURCE-METRICS.md:
|
|
154
|
+
- Total files by extension
|
|
155
|
+
- LOC per file (sorted descending)
|
|
156
|
+
- Dependency list from package.json / requirements.txt / etc.
|
|
157
|
+
- Largest files flagged (>300 LOC)
|
|
158
|
+
|
|
159
|
+
IF git history available:
|
|
160
|
+
{source}/.phoenix/autopsy/GIT-HISTORY.md:
|
|
161
|
+
- Last 20 commits with messages
|
|
162
|
+
- Most-changed files (hotspots)
|
|
163
|
+
- Contributors
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Completion gate:** All 7 autopsy documents exist and are non-empty.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
### Phase 2: INTENT EXTRACTION — What Was It Trying to Do?
|
|
171
|
+
|
|
172
|
+
> **Reference:** @agents/fire-phoenix-analyst.md
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
Spawn 2 fire-phoenix-analyst instances:
|
|
176
|
+
|
|
177
|
+
Instance 1 — Feature Analyst:
|
|
178
|
+
Input: All autopsy documents + source code access
|
|
179
|
+
Process: Steps 1-5 from fire-phoenix-analyst.md
|
|
180
|
+
Output: {source}/.phoenix/INTENT.md
|
|
181
|
+
- Project-level intent
|
|
182
|
+
- Technology stack table
|
|
183
|
+
- Feature inventory (per-feature: intent, uniqueness, quality,
|
|
184
|
+
classification, confidence, edge cases, dependencies)
|
|
185
|
+
- Data model intent
|
|
186
|
+
- Business rules catalog
|
|
187
|
+
- Accidental vs essential complexity
|
|
188
|
+
- Items needing clarification
|
|
189
|
+
|
|
190
|
+
Instance 2 — Architecture Analyst:
|
|
191
|
+
Input: All autopsy documents + source code access
|
|
192
|
+
Process: Step 6 from fire-phoenix-analyst.md
|
|
193
|
+
Output: {source}/.phoenix/INTENT-GRAPH.md
|
|
194
|
+
- Code → Intent → Clean mapping for all major features
|
|
195
|
+
- Anti-pattern replacement map
|
|
196
|
+
- Current vs target architecture
|
|
197
|
+
- Migration notes
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**Honesty Protocol:** Both instances apply the Three Questions before analysis. LOW confidence items are flagged, not fabricated.
|
|
201
|
+
|
|
202
|
+
**Completion gate:** Both INTENT.md and INTENT-GRAPH.md exist with non-empty feature inventories.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
### Phase 3: CLARIFICATION — Resolve Ambiguities
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
Read {source}/.phoenix/INTENT.md
|
|
210
|
+
|
|
211
|
+
Collect items needing clarification:
|
|
212
|
+
1. Features with confidence: LOW
|
|
213
|
+
2. Features with classification: UNKNOWN
|
|
214
|
+
3. Edge cases with uncertain KEEP/KILL
|
|
215
|
+
4. Items in the "Items Needing Clarification" section
|
|
216
|
+
|
|
217
|
+
Additionally, ask:
|
|
218
|
+
"Which features do you NOT want in the rebuild?"
|
|
219
|
+
"Are there any new features or changes you want added?"
|
|
220
|
+
|
|
221
|
+
Batch questions into rounds (max 3 rounds, 3-4 questions each):
|
|
222
|
+
|
|
223
|
+
Round 1: Critical ambiguities (HIGH uniqueness features with LOW confidence)
|
|
224
|
+
Round 2: Feature scope (what to keep, what to drop, what to add)
|
|
225
|
+
Round 3: Remaining clarifications (MEDIUM uniqueness features)
|
|
226
|
+
|
|
227
|
+
Use AskUserQuestion for each round.
|
|
228
|
+
|
|
229
|
+
After each round:
|
|
230
|
+
Update {source}/.phoenix/INTENT.md with answers
|
|
231
|
+
Mark clarified items with confidence: HIGH (CLARIFIED)
|
|
232
|
+
|
|
233
|
+
IF --focus specified:
|
|
234
|
+
Only ask about features in the focused subsystem
|
|
235
|
+
Mark out-of-focus features as "DEFERRED — out of scope for this rebuild"
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Completion gate:** No HIGH-uniqueness features remain at confidence: LOW.
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
### Phase 4: VISION — Design the Clean Architecture
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
IF --migrate:
|
|
246
|
+
Spawn fire-vision-architect (if available) with:
|
|
247
|
+
Input: INTENT.md, INTENT-GRAPH.md
|
|
248
|
+
Task: Propose 2-3 technology stack alternatives
|
|
249
|
+
Output: {target}/.planning/VISION.md with stack branches
|
|
250
|
+
|
|
251
|
+
Present branches to user via AskUserQuestion:
|
|
252
|
+
"Which technology stack for the rebuild?"
|
|
253
|
+
Options: [branch summaries with trade-offs]
|
|
254
|
+
|
|
255
|
+
ELSE (same-stack rebuild — default):
|
|
256
|
+
Auto-generate {target}/.planning/VISION.md:
|
|
257
|
+
- Same technology stack as source (from STACK.md)
|
|
258
|
+
- Clean architecture based on INTENT-GRAPH.md target architecture
|
|
259
|
+
- Phase breakdown derived from INTENT.md feature inventory
|
|
260
|
+
|
|
261
|
+
Phase breakdown strategy (from PHOENIX_REBUILD_METHODOLOGY):
|
|
262
|
+
Phase 1: FOUNDATION
|
|
263
|
+
- Project scaffold, config, types/interfaces, database schema
|
|
264
|
+
- Environment setup, CI/CD skeleton
|
|
265
|
+
Phase 2: CORE
|
|
266
|
+
- Features with uniqueness CRITICAL and HIGH
|
|
267
|
+
- Ordered by dependency (foundations first)
|
|
268
|
+
Phase 3: SUPPORT
|
|
269
|
+
- Features with uniqueness MEDIUM
|
|
270
|
+
- Ordered by dependency on CORE features
|
|
271
|
+
Phase 4: STANDARD
|
|
272
|
+
- Features with uniqueness LOW and BOILERPLATE
|
|
273
|
+
- Often auto-generated or minimal effort
|
|
274
|
+
Phase 5: INTEGRATION
|
|
275
|
+
- Wire everything together
|
|
276
|
+
- Cross-module flows, API contracts
|
|
277
|
+
Phase 6: HARDENING
|
|
278
|
+
- Error handling, logging, security, edge cases
|
|
279
|
+
- All "KEEP" edge cases from INTENT.md
|
|
280
|
+
Phase 7: TESTING
|
|
281
|
+
- Tests written from INTENT.md assertions
|
|
282
|
+
- Feature parity verification
|
|
283
|
+
Phase 8: DOCUMENTATION
|
|
284
|
+
- README, API docs, deployment guide
|
|
285
|
+
|
|
286
|
+
Write {target}/.planning/VISION.md with:
|
|
287
|
+
- Project metadata (name, description, stack)
|
|
288
|
+
- Architecture description
|
|
289
|
+
- Phase list with descriptions
|
|
290
|
+
- Success criteria per phase
|
|
291
|
+
- Phoenix verification checks (PX-1 through PX-5)
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**Initialize target project:**
|
|
295
|
+
```
|
|
296
|
+
Create {target}/ directory
|
|
297
|
+
Create {target}/.planning/ structure:
|
|
298
|
+
.planning/
|
|
299
|
+
VISION.md (just created)
|
|
300
|
+
CONSCIENCE.md (initialized empty)
|
|
301
|
+
MEMORY.md (populated from INTENT.md context)
|
|
302
|
+
phases/ (empty — fire-2-plan creates phase dirs)
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**Completion gate:** VISION.md exists with phases. Target directory initialized.
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
### Phase 5: REBUILD — Build It Right
|
|
310
|
+
|
|
311
|
+
> Standard Dominion Flow pipeline, with INTENT.md as the requirements source.
|
|
312
|
+
|
|
313
|
+
```
|
|
314
|
+
FOR each phase in VISION.md (Phase 1 through Phase 8):
|
|
315
|
+
|
|
316
|
+
Display:
|
|
317
|
+
"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
318
|
+
" PHOENIX REBUILD: Phase {N} — {phase_name}"
|
|
319
|
+
"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
320
|
+
|
|
321
|
+
Working directory: {target}/
|
|
322
|
+
|
|
323
|
+
// ── PLAN ──
|
|
324
|
+
Run /fire-2-plan {N}
|
|
325
|
+
Planner reads INTENT.md as requirements source (via MEMORY.md reference)
|
|
326
|
+
Planner reads INTENT-GRAPH.md for clean implementation guidance
|
|
327
|
+
BLUEPRINT frontmatter includes:
|
|
328
|
+
phoenix_source: "{source_path}"
|
|
329
|
+
phoenix_intent: "{source}/.phoenix/INTENT.md"
|
|
330
|
+
phoenix_checks: [PX-1, PX-2, PX-3, PX-4, PX-5]
|
|
331
|
+
scope_manifest:
|
|
332
|
+
read_allowed: ["{source}/"] # read-only reference
|
|
333
|
+
write_allowed: ["{target}/"]
|
|
334
|
+
forbidden: ["modify {source}/ files"]
|
|
335
|
+
|
|
336
|
+
// ── EXECUTE ──
|
|
337
|
+
Run /fire-3-execute {N} --auto-continue
|
|
338
|
+
Executor follows BLUEPRINT tasks
|
|
339
|
+
Source folder referenced as READ-ONLY for code patterns
|
|
340
|
+
All writes go to {target}/
|
|
341
|
+
|
|
342
|
+
// ── VERIFY ──
|
|
343
|
+
Run /fire-4-verify {N}
|
|
344
|
+
Standard verification PLUS Phoenix-specific checks:
|
|
345
|
+
|
|
346
|
+
PX-1: Feature Parity (weight: 30%)
|
|
347
|
+
FOR each feature in INTENT.md:
|
|
348
|
+
Check: is it implemented in {target}/ OR explicitly marked as dropped?
|
|
349
|
+
Score: implemented_count / total_features * 100
|
|
350
|
+
|
|
351
|
+
PX-2: Edge Case Coverage (weight: 25%)
|
|
352
|
+
FOR each edge case marked "KEEP" in INTENT.md:
|
|
353
|
+
Check: is it handled in {target}/ code?
|
|
354
|
+
Score: handled_count / keep_count * 100
|
|
355
|
+
|
|
356
|
+
PX-3: Dependency Compatibility (weight: 20%)
|
|
357
|
+
FOR each external integration in INTEGRATIONS.md:
|
|
358
|
+
Check: is the connection configured in {target}/?
|
|
359
|
+
Score: connected_count / total_integrations * 100
|
|
360
|
+
|
|
361
|
+
PX-4: Accidental Complexity Removal (weight: 15%)
|
|
362
|
+
FOR each anti-pattern in INTENT-GRAPH.md:
|
|
363
|
+
Check: is the anti-pattern ABSENT from {target}/?
|
|
364
|
+
Score: absent_count / total_antipatterns * 100
|
|
365
|
+
|
|
366
|
+
PX-5: Architecture Improvement (weight: 10%)
|
|
367
|
+
Compare: target file structure vs source
|
|
368
|
+
Check: smaller avg file size, proper separation, consistent naming
|
|
369
|
+
Score: qualitative assessment 0-100
|
|
370
|
+
|
|
371
|
+
Phoenix Score = (PX-1 * 0.30) + (PX-2 * 0.25) + (PX-3 * 0.20)
|
|
372
|
+
+ (PX-4 * 0.15) + (PX-5 * 0.10)
|
|
373
|
+
|
|
374
|
+
// ── EVALUATE ──
|
|
375
|
+
IF verifier_verdict == APPROVED or CONDITIONAL:
|
|
376
|
+
Advance to next phase
|
|
377
|
+
git add -A && git commit -m "phoenix: Phase {N} - {phase_name} complete"
|
|
378
|
+
|
|
379
|
+
ELSE (REJECTED):
|
|
380
|
+
attempt += 1
|
|
381
|
+
IF attempt < 3:
|
|
382
|
+
Re-plan with --gaps flag, re-execute
|
|
383
|
+
ELSE:
|
|
384
|
+
Display blocker, STOP with escalation options
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
**Safety during rebuild:**
|
|
388
|
+
```
|
|
389
|
+
ENFORCED throughout Phase 5:
|
|
390
|
+
- Source folder is READ-ONLY (scope manifest forbidden list)
|
|
391
|
+
- Circuit breaker active (CIRCUIT_BREAKER_INTELLIGENCE thresholds)
|
|
392
|
+
- HAC enforcement active
|
|
393
|
+
- Path verification on every phase
|
|
394
|
+
- Kill conditions checked before retries
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
**Completion gate:** All rebuild phases reach APPROVED or CONDITIONAL verdict.
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
### Phase 6: COMPARISON — Prove It's Better
|
|
402
|
+
|
|
403
|
+
> **Reference:** @templates/phoenix-comparison.md
|
|
404
|
+
|
|
405
|
+
```
|
|
406
|
+
Gather metrics from both projects:
|
|
407
|
+
|
|
408
|
+
Source metrics:
|
|
409
|
+
- Total files, LOC, avg/max file size
|
|
410
|
+
- Dependency count (from package.json / requirements.txt)
|
|
411
|
+
- Test file count, coverage estimate
|
|
412
|
+
- Anti-pattern count (from INTENT-GRAPH.md)
|
|
413
|
+
|
|
414
|
+
Target metrics:
|
|
415
|
+
- Same measurements from {target}/
|
|
416
|
+
- Phoenix verification scores (PX-1 through PX-5)
|
|
417
|
+
|
|
418
|
+
Write {target}/.planning/PHOENIX-COMPARISON.md using template:
|
|
419
|
+
@templates/phoenix-comparison.md
|
|
420
|
+
|
|
421
|
+
Calculate final Phoenix Score:
|
|
422
|
+
90%+ = APPROVED — Rebuild is production-ready
|
|
423
|
+
75-89% = CONDITIONAL — Minor fixes needed
|
|
424
|
+
<75% = REJECTED — Significant gaps, review INTENT.md coverage
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
**Display completion banner:**
|
|
428
|
+
```
|
|
429
|
+
+--------------------------------------------------------------+
|
|
430
|
+
| PHOENIX REBUILD COMPLETE |
|
|
431
|
+
+--------------------------------------------------------------+
|
|
432
|
+
| |
|
|
433
|
+
| Source: {source_path} |
|
|
434
|
+
| Target: {target_path} |
|
|
435
|
+
| |
|
|
436
|
+
| Before → After: |
|
|
437
|
+
| Files: {N} → {N} ({change}) |
|
|
438
|
+
| Lines of Code: {N} → {N} ({change}) |
|
|
439
|
+
| Dependencies: {N} → {N} ({change}) |
|
|
440
|
+
| Test Files: {N} → {N} ({change}) |
|
|
441
|
+
| Max File Size: {N} → {N} ({change}) |
|
|
442
|
+
| |
|
|
443
|
+
| Phoenix Score: {score}% — {verdict} |
|
|
444
|
+
| PX-1 Feature Parity: {score}% |
|
|
445
|
+
| PX-2 Edge Case Coverage: {score}% |
|
|
446
|
+
| PX-3 Dependency Compat: {score}% |
|
|
447
|
+
| PX-4 Complexity Removal: {score}% |
|
|
448
|
+
| PX-5 Architecture: {score}% |
|
|
449
|
+
| |
|
|
450
|
+
| Reports: |
|
|
451
|
+
| {source}/.phoenix/INTENT.md |
|
|
452
|
+
| {source}/.phoenix/INTENT-GRAPH.md |
|
|
453
|
+
| {target}/.planning/PHOENIX-COMPARISON.md |
|
|
454
|
+
| |
|
|
455
|
+
+--------------------------------------------------------------+
|
|
456
|
+
| NEXT STEPS |
|
|
457
|
+
+--------------------------------------------------------------+
|
|
458
|
+
| |
|
|
459
|
+
| /fire-dashboard — View project status |
|
|
460
|
+
| /fire-4-verify {N} — Detailed phase verification |
|
|
461
|
+
| /fire-phoenix --dry-run — Re-analyze without rebuilding |
|
|
462
|
+
| |
|
|
463
|
+
+--------------------------------------------------------------+
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
IF `--dry-run`:
|
|
467
|
+
```
|
|
468
|
+
+--------------------------------------------------------------+
|
|
469
|
+
| PHOENIX DRY RUN COMPLETE |
|
|
470
|
+
+--------------------------------------------------------------+
|
|
471
|
+
| |
|
|
472
|
+
| Analysis produced: |
|
|
473
|
+
| {source}/.phoenix/autopsy/ (7 documents) |
|
|
474
|
+
| {source}/.phoenix/INTENT.md |
|
|
475
|
+
| {source}/.phoenix/INTENT-GRAPH.md |
|
|
476
|
+
| |
|
|
477
|
+
| Features found: {N} ({N unique, {N ambiguous}) |
|
|
478
|
+
| Edge cases cataloged: {N} ({N keep, {N kill}) |
|
|
479
|
+
| Anti-patterns detected: {N} |
|
|
480
|
+
| Clarifications resolved: {N} |
|
|
481
|
+
| |
|
|
482
|
+
| To proceed with rebuild: |
|
|
483
|
+
| /fire-phoenix --source {source} |
|
|
484
|
+
| |
|
|
485
|
+
+--------------------------------------------------------------+
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
---
|
|
489
|
+
|
|
490
|
+
## Blocker Handling
|
|
491
|
+
|
|
492
|
+
```
|
|
493
|
+
IF any phase fails after max attempts:
|
|
494
|
+
|
|
495
|
+
+--------------------------------------------------------------+
|
|
496
|
+
| PHOENIX REBUILD STOPPED — BLOCKER |
|
|
497
|
+
+--------------------------------------------------------------+
|
|
498
|
+
| |
|
|
499
|
+
| Completed phases: {list} |
|
|
500
|
+
| Blocked at: Rebuild Phase {N} — {name} |
|
|
501
|
+
| |
|
|
502
|
+
| Blocker: {description} |
|
|
503
|
+
| |
|
|
504
|
+
| What was tried: |
|
|
505
|
+
| Attempt 1: {verdict} ({score}/70) |
|
|
506
|
+
| Attempt 2: {verdict} ({score}/70) |
|
|
507
|
+
| Attempt 3: {verdict} ({score}/70) |
|
|
508
|
+
| |
|
|
509
|
+
| Options: |
|
|
510
|
+
| A) /fire-debug — Investigate the blocker |
|
|
511
|
+
| B) /fire-3-execute {N} — Manual execution |
|
|
512
|
+
| C) /fire-phoenix --source {source} — Restart |
|
|
513
|
+
| D) /fire-dashboard — Review current state |
|
|
514
|
+
| |
|
|
515
|
+
+--------------------------------------------------------------+
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
---
|
|
519
|
+
|
|
520
|
+
## Safety Guarantees
|
|
521
|
+
|
|
522
|
+
```
|
|
523
|
+
NEVER DISABLED during Phoenix Rebuild:
|
|
524
|
+
|
|
525
|
+
1. Source READ-ONLY — No file in {source}/ (except .phoenix/) is ever modified
|
|
526
|
+
2. Path Verification — Source ≠ target, no nesting, paths exist
|
|
527
|
+
3. Scope Manifests — Every rebuild phase has explicit read/write boundaries
|
|
528
|
+
4. Circuit Breaker — CIRCUIT_BREAKER_INTELLIGENCE thresholds active
|
|
529
|
+
5. HAC Enforcement — Known-bad actions blocked before execution
|
|
530
|
+
6. Verification — fire-verifier + Phoenix checks (PX-1 through PX-5)
|
|
531
|
+
|
|
532
|
+
WHAT .phoenix/ CONTAINS (only metadata written to source):
|
|
533
|
+
.phoenix/
|
|
534
|
+
autopsy/ — 7 analysis documents (stack, arch, concerns, etc.)
|
|
535
|
+
INTENT.md — Extracted feature intent
|
|
536
|
+
INTENT-GRAPH.md — Code → Intent → Clean mapping
|
|
537
|
+
|
|
538
|
+
ALL CODE writes go to {target}/ exclusively.
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
---
|
|
542
|
+
|
|
543
|
+
## Examples
|
|
544
|
+
|
|
545
|
+
```bash
|
|
546
|
+
# Basic same-stack rebuild
|
|
547
|
+
/fire-phoenix --source C:/Projects/my-messy-app
|
|
548
|
+
|
|
549
|
+
# Custom target path
|
|
550
|
+
/fire-phoenix --source ./old-app --target ./old-app-v2
|
|
551
|
+
|
|
552
|
+
# Analyze only (no rebuild)
|
|
553
|
+
/fire-phoenix --source ./app --dry-run
|
|
554
|
+
|
|
555
|
+
# Focus on auth subsystem
|
|
556
|
+
/fire-phoenix --source ./app --focus auth
|
|
557
|
+
|
|
558
|
+
# Stack migration (propose new tech)
|
|
559
|
+
/fire-phoenix --source ./express-app --migrate
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
---
|
|
563
|
+
|
|
564
|
+
## Agent & Skill References
|
|
565
|
+
|
|
566
|
+
| Component | Role in Pipeline |
|
|
567
|
+
|-----------|-----------------|
|
|
568
|
+
| **fire-phoenix-analyst** (agent) | Phase 2 — Extracts INTENT.md and INTENT-GRAPH.md |
|
|
569
|
+
| **fire-codebase-mapper** (agent) | Phase 1 — Reused for autopsy mapping |
|
|
570
|
+
| **fire-planner** (agent) | Phase 5 — Plans each rebuild phase from INTENT.md |
|
|
571
|
+
| **fire-executor** (agent) | Phase 5 — Executes rebuild tasks |
|
|
572
|
+
| **fire-verifier** (agent) | Phase 5 — Verifies + Phoenix checks (PX-1 to PX-5) |
|
|
573
|
+
| **PHOENIX_REBUILD_METHODOLOGY** (skill) | Knowledge base — intent extraction, anti-patterns, edge cases |
|
|
574
|
+
| **GOF_DESIGN_PATTERNS_FOR_AI_AGENTS** (skill) | Architecture reference for clean rebuild |
|
|
575
|
+
| **CIRCUIT_BREAKER_INTELLIGENCE** (skill) | Stuck-state handling during rebuild |
|
|
576
|
+
| **phoenix-comparison** (template) | Phase 6 — Before/after metrics report |
|
|
577
|
+
|
|
578
|
+
---
|
|
579
|
+
|
|
580
|
+
## Success Criteria
|
|
581
|
+
|
|
582
|
+
```
|
|
583
|
+
- [ ] Path verification gate validates source/target paths
|
|
584
|
+
- [ ] Source folder is never modified (except .phoenix/ metadata)
|
|
585
|
+
- [ ] Phase 1 produces 7 autopsy documents
|
|
586
|
+
- [ ] Phase 2 produces INTENT.md + INTENT-GRAPH.md
|
|
587
|
+
- [ ] Phase 2 applies Honesty Protocol (LOW confidence items flagged, not fabricated)
|
|
588
|
+
- [ ] Phase 3 resolves ambiguities via user questions (max 3 rounds)
|
|
589
|
+
- [ ] Phase 4 generates VISION.md with rebuild phases
|
|
590
|
+
- [ ] Phase 5 runs full Dominion Flow pipeline per rebuild phase
|
|
591
|
+
- [ ] Phase 5 includes Phoenix verification checks (PX-1 through PX-5)
|
|
592
|
+
- [ ] Phase 6 produces PHOENIX-COMPARISON.md with before/after metrics
|
|
593
|
+
- [ ] Phoenix Score calculated: 90%+ APPROVED, 75-89% CONDITIONAL, <75% REJECTED
|
|
594
|
+
- [ ] --dry-run stops after Phase 3 (analysis only)
|
|
595
|
+
- [ ] --migrate presents stack alternatives in Phase 4
|
|
596
|
+
- [ ] --focus limits analysis to specified subsystem
|
|
597
|
+
- [ ] Circuit breaker, HAC, scope manifests all active during rebuild
|
|
598
|
+
- [ ] Blocker escalation with clear options when max attempts exceeded
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
---
|
|
602
|
+
|
|
603
|
+
*Dominion Flow v12.2 — Phoenix Rebuild: burn the mess, rise production-ready.*
|