@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.
Files changed (94) hide show
  1. package/.claude-plugin/plugin.json +8 -8
  2. package/ARCHITECTURE-DIAGRAM.md +7 -4
  3. package/COMMAND-REFERENCE.md +33 -13
  4. package/DOMINION-FLOW-OVERVIEW.md +581 -421
  5. package/QUICK-START.md +3 -3
  6. package/README.md +101 -44
  7. package/TROUBLESHOOTING.md +264 -264
  8. package/agents/fire-executor.md +200 -116
  9. package/agents/fire-fact-checker.md +276 -276
  10. package/agents/fire-phoenix-analyst.md +394 -0
  11. package/agents/fire-planner.md +145 -53
  12. package/agents/fire-project-researcher.md +155 -155
  13. package/agents/fire-research-synthesizer.md +166 -166
  14. package/agents/fire-researcher.md +144 -59
  15. package/agents/fire-roadmapper.md +215 -203
  16. package/agents/fire-verifier.md +247 -65
  17. package/agents/fire-vision-architect.md +381 -0
  18. package/commands/fire-0-orient.md +476 -476
  19. package/commands/fire-1a-new.md +216 -0
  20. package/commands/fire-1b-research.md +210 -0
  21. package/commands/fire-1c-setup.md +254 -0
  22. package/commands/{fire-1a-discuss.md → fire-1d-discuss.md} +35 -7
  23. package/commands/fire-3-execute.md +55 -2
  24. package/commands/fire-4-verify.md +61 -0
  25. package/commands/fire-5-handoff.md +2 -2
  26. package/commands/fire-6-resume.md +37 -2
  27. package/commands/fire-add-new-skill.md +2 -2
  28. package/commands/fire-autonomous.md +20 -3
  29. package/commands/fire-brainstorm.md +1 -1
  30. package/commands/fire-complete-milestone.md +2 -2
  31. package/commands/fire-cost.md +183 -0
  32. package/commands/fire-dashboard.md +2 -2
  33. package/commands/fire-debug.md +663 -663
  34. package/commands/fire-loop-resume.md +2 -2
  35. package/commands/fire-loop-stop.md +1 -1
  36. package/commands/fire-loop.md +1168 -1168
  37. package/commands/fire-map-codebase.md +3 -3
  38. package/commands/fire-new-milestone.md +356 -356
  39. package/commands/fire-phoenix.md +603 -0
  40. package/commands/fire-reflect.md +235 -235
  41. package/commands/fire-research.md +246 -246
  42. package/commands/fire-search.md +1 -1
  43. package/commands/fire-skills-diff.md +3 -3
  44. package/commands/fire-skills-history.md +3 -3
  45. package/commands/fire-skills-rollback.md +7 -7
  46. package/commands/fire-skills-sync.md +5 -5
  47. package/commands/fire-test.md +9 -9
  48. package/commands/fire-todos.md +1 -1
  49. package/commands/fire-update.md +5 -5
  50. package/hooks/hooks.json +16 -16
  51. package/hooks/run-hook.sh +8 -8
  52. package/hooks/run-session-end.sh +7 -7
  53. package/hooks/session-end.sh +90 -90
  54. package/hooks/session-start.sh +1 -1
  55. package/package.json +4 -2
  56. package/plugin.json +7 -7
  57. package/references/metrics-and-trends.md +1 -1
  58. package/skills-library/SKILLS-INDEX.md +588 -588
  59. package/skills-library/_general/methodology/AUTONOMOUS_ORCHESTRATION.md +182 -0
  60. package/skills-library/_general/methodology/BACKWARD_PLANNING_INTERVIEW.md +307 -0
  61. package/skills-library/_general/methodology/CIRCUIT_BREAKER_INTELLIGENCE.md +163 -0
  62. package/skills-library/_general/methodology/CONTEXT_ROTATION.md +151 -0
  63. package/skills-library/_general/methodology/DEAD_ENDS_SHELF.md +188 -0
  64. package/skills-library/_general/methodology/DESIGN_PHILOSOPHY_ENFORCEMENT.md +152 -0
  65. package/skills-library/_general/methodology/INTERNAL_CONSISTENCY_AUDIT.md +212 -0
  66. package/skills-library/_general/methodology/LIVE_BREADCRUMB_PROTOCOL.md +242 -0
  67. package/skills-library/_general/methodology/PHOENIX_REBUILD_METHODOLOGY.md +251 -0
  68. package/skills-library/_general/methodology/QUALITY_GATES_AND_VERIFICATION.md +157 -0
  69. package/skills-library/_general/methodology/RELIABILITY_PREDICTION.md +104 -0
  70. package/skills-library/_general/methodology/REQUIREMENTS_DECOMPOSITION.md +155 -0
  71. package/skills-library/_general/methodology/SELF_TESTING_FEEDBACK_LOOP.md +143 -0
  72. package/skills-library/_general/methodology/STACK_COMPATIBILITY_MATRIX.md +178 -0
  73. package/skills-library/_general/methodology/TIERED_CONTEXT_ARCHITECTURE.md +118 -0
  74. package/skills-library/_general/methodology/ZERO_FRICTION_CLI_SETUP.md +312 -0
  75. package/skills-library/_general/methodology/autonomous-multi-phase-build.md +133 -0
  76. package/skills-library/_general/methodology/claude-md-archival.md +280 -0
  77. package/skills-library/_general/methodology/debug-swarm-researcher-escape-hatch.md +240 -240
  78. package/skills-library/_general/methodology/git-worktrees-parallel.md +232 -0
  79. package/skills-library/_general/methodology/llm-judge-memory-crud.md +241 -0
  80. package/skills-library/_general/methodology/multi-project-autonomous-build.md +360 -0
  81. package/skills-library/_general/methodology/shell-autonomous-loop-fixplan.md +238 -238
  82. package/skills-library/_general/patterns-standards/GOF_DESIGN_PATTERNS_FOR_AI_AGENTS.md +358 -0
  83. package/skills-library/methodology/BREATH_BASED_PARALLEL_EXECUTION.md +1 -1
  84. package/skills-library/methodology/RESEARCH_BACKED_WORKFLOW_UPGRADE.md +1 -1
  85. package/skills-library/methodology/SABBATH_REST_PATTERN.md +1 -1
  86. package/templates/ASSUMPTIONS.md +1 -1
  87. package/templates/BLOCKERS.md +1 -1
  88. package/templates/DECISION_LOG.md +1 -1
  89. package/templates/phase-prompt.md +1 -1
  90. package/templates/phoenix-comparison.md +80 -0
  91. package/version.json +2 -2
  92. package/workflows/handoff-session.md +1 -1
  93. package/workflows/new-project.md +2 -2
  94. package/commands/fire-1-new.md +0 -281
@@ -2,7 +2,7 @@
2
2
  description: Gather implementation context through adaptive questioning before planning
3
3
  ---
4
4
 
5
- # /fire-1a-discuss
5
+ # /fire-1d-discuss
6
6
 
7
7
  > Think before you plan
8
8
 
@@ -24,7 +24,7 @@ arguments:
24
24
  required: true
25
25
  type: integer
26
26
  description: "Phase number to discuss"
27
- example: "/fire-1a-discuss 3"
27
+ example: "/fire-1d-discuss 3"
28
28
 
29
29
  --quick:
30
30
  required: false
@@ -195,6 +195,34 @@ Before presenting gray areas, validate that captured decisions reach FILE-LEVEL
195
195
  **IF score >= 8:**
196
196
  Proceed to Step 4 with high-specificity plan.
197
197
 
198
+ ### Step 3.7: Requirements Decomposition Check (v12.0)
199
+
200
+ > **Source:** REQUIREMENTS_DECOMPOSITION skill — utility tree decomposition
201
+
202
+ Before presenting gray areas, verify that requirements are decomposed to actionable depth:
203
+
204
+ ```
205
+ FOR each requirement discussed so far:
206
+ CLASSIFY decomposition level:
207
+ Level 1: Quality attribute ("good performance") → TOO VAGUE
208
+ Level 2: Sub-factor ("fast page loads") → STILL VAGUE
209
+ Level 3: Refined sub-factor ("< 2s initial load") → GETTING THERE
210
+ Level 4: Requirement ("Lazy-load images, code-split routes") → ACTIONABLE
211
+
212
+ IF requirement is Level 1 or Level 2:
213
+ → Generate follow-up question to decompose further
214
+ → "You mentioned '{requirement}' — what specifically does that mean?
215
+ For example: {suggest 2-3 Level 4 decompositions}"
216
+
217
+ IF requirement is Level 3:
218
+ → Accept but flag for planner to decompose to Level 4
219
+
220
+ IF requirement is Level 4:
221
+ → Accept as-is
222
+ ```
223
+
224
+ **Goal:** No Level 1/2 requirements should survive the discuss phase. The planner receives Level 3+ requirements only.
225
+
198
226
  ### Step 4: Present Gray Areas
199
227
 
200
228
  ```
@@ -337,7 +365,7 @@ Track deferred ideas internally.
337
365
 
338
366
  > *Like humans need sleep to reset, AI agents need state files to resume after context resets.*
339
367
 
340
- **Create/Update:** `.claude/dominion-flow.local.md`
368
+ **Create/Update:** `.claude/fire-flow.local.md`
341
369
 
342
370
  ```markdown
343
371
  ---
@@ -428,16 +456,16 @@ When reasonable, let user delegate to Claude's judgment.
428
456
 
429
457
  ```bash
430
458
  # Discuss phase 3 before planning
431
- /fire-1a-discuss 3
459
+ /fire-1d-discuss 3
432
460
 
433
461
  # Quick discussion (2 questions per area)
434
- /fire-1a-discuss 5 --quick
462
+ /fire-1d-discuss 5 --quick
435
463
 
436
464
  # Focus on specific areas only
437
- /fire-1a-discuss 2 --areas "layout,behavior"
465
+ /fire-1d-discuss 2 --areas "layout,behavior"
438
466
 
439
467
  # Skip if already discussed
440
- /fire-1a-discuss 4 --skip-existing
468
+ /fire-1d-discuss 4 --skip-existing
441
469
  ```
442
470
 
443
471
  ---
@@ -555,10 +555,12 @@ MEDIUM (50-80%): Proceed with extra validation
555
555
  → Run Self-Judge before AND after
556
556
  → Log uncertainty reason in RECORD.md
557
557
 
558
- LOW (<50%): Pause and escalate
558
+ LOW (<50%): Research first, then proceed
559
559
  → Search Context7 for current library docs
560
+ → Search skills library: /fire-search "{gap}"
560
561
  → Check if this is outside trained domain
561
- Ask user for guidance before proceeding
562
+ IF < 30%: Spawn fire-researcher with the specific gap — get alternatives
563
+ → Only escalate to user if research returns no actionable path
562
564
  → Create checkpoint before attempting
563
565
 
564
566
  **Log confidence in RECORD.md:**
@@ -737,6 +739,57 @@ key_decisions:
737
739
  - Pause execution
738
740
  - Display error and recovery instructions
739
741
 
742
+ ### Step 7.1: Error Classification Health Check (v10.1)
743
+
744
+ > **Research basis (v10.1):** Microsoft "AutoGen StateFlow" (ICML 2024) — formal error
745
+ > classification at execution boundaries reduces repeat failures by 28%. This integrates
746
+ > the existing `references/error-classification.md` into breath-level execution flow.
747
+ > Previously, error classification existed as a reference but was not wired into
748
+ > the execution pipeline.
749
+
750
+ **After each breath completes (success OR failure), classify execution health:**
751
+
752
+ ```
753
+ INPUTS for classification:
754
+ - files_changed: count of files in breath RECORD.md key_files
755
+ - error_hash: normalized hash of any error message from breath
756
+ - previous_errors: error hashes from previous breaths in this phase
757
+ - output_volume: total lines of code produced vs. baseline
758
+ - error_type: classification of error (if any)
759
+
760
+ CLASSIFY using references/error-classification.md algorithm:
761
+
762
+ 1. BLOCKED? → External dependency, permission, or service error
763
+ Action: Stop execution. Create BLOCKERS.md entry. Save state.
764
+ Display: EXECUTION BLOCKED banner (see error-classification.md)
765
+
766
+ 2. SPINNING? → Same error hash seen in 3+ breaths
767
+ Action: Force approach rotation. Inject anti-patterns list.
768
+ Display: "Same error for {N} breaths. You MUST try a different approach."
769
+
770
+ 3. DEGRADED? → Output volume declined 50%+ from first breath
771
+ Action: Trigger /fire-cost context check. If ORANGE+, compact.
772
+ Display: "Output quality declining. Consider /fire-5-handoff."
773
+
774
+ 4. STALLED? → No file changes AND no new errors
775
+ Action: Inject urgency. Search skills for alternative approach.
776
+ Display: "No progress detected. Pick ONE concrete change."
777
+
778
+ 5. PROGRESS → Files changed, errors are new/different
779
+ Action: Continue to next breath normally.
780
+
781
+ RECORD health state in CONSCIENCE.md:
782
+ | Breath | Health | Trigger | Action |
783
+ | {W} | {state} | {trigger} | {action_taken} |
784
+ ```
785
+
786
+ **Circuit breaker integration:**
787
+ - If health is SPINNING for 2 consecutive breaths → trigger circuit breaker
788
+ - If health is DEGRADED → check `/fire-cost` context tier. If RED+, force handoff.
789
+ - If health is BLOCKED → do NOT retry. Save state and surface blocker to user.
790
+
791
+ **Skip condition:** If breath completed successfully with no errors, mark PROGRESS and continue.
792
+
740
793
  ### Step 7.4: Post-Feature Config Sync (v10.0)
741
794
 
742
795
  After breath completion, check if new features need config file updates.
@@ -487,6 +487,67 @@ IF reviewer was spawned (--quick NOT set):
487
487
  → "Code is clean but doesn't work."
488
488
  ```
489
489
 
490
+ ### Step 5.6: FaR Confidence Calibration (v10.1)
491
+
492
+ > **Research basis (v10.1):** Xiong et al. "Can LLMs Express Their Uncertainty?" (ACL 2024) —
493
+ > Fact-and-Reflection (FaR) prompting reduces Expected Calibration Error by 23.5%.
494
+ > Agents that first enumerate known facts, then reflect on uncertainty, produce
495
+ > dramatically more accurate confidence scores than agents that just guess a number.
496
+ > Applied: Added mandatory FaR step before final verification verdict.
497
+
498
+ Before assigning the final verdict, the verifier MUST perform a two-phase confidence assessment:
499
+
500
+ ```
501
+ ═══════════════════════════════════════════════════════
502
+ FaR CONFIDENCE CALIBRATION
503
+ ═══════════════════════════════════════════════════════
504
+
505
+ PHASE 1: FACT ELICITATION
506
+ List every concrete, observable fact about this phase's correctness:
507
+
508
+ Facts FOR correctness (evidence it works):
509
+ 1. {fact} — source: {test output / manual check / code review}
510
+ 2. {fact} — source: {specific evidence}
511
+ 3. ...
512
+
513
+ Facts AGAINST correctness (evidence of problems):
514
+ 1. {fact} — source: {test failure / gap / uncertainty}
515
+ 2. {fact} — source: {specific evidence}
516
+ 3. ...
517
+
518
+ Unknown / Untestable:
519
+ 1. {thing we cannot verify} — why: {reason}
520
+ 2. ...
521
+
522
+ PHASE 2: REFLECTION
523
+ Given the facts above, reflect on overall confidence:
524
+
525
+ - How many critical paths have direct evidence? {N}/{total}
526
+ - Are the "against" facts blockers or minor gaps?
527
+ - What is the worst plausible failure mode?
528
+ - If this shipped to production right now, what breaks?
529
+
530
+ CALIBRATED CONFIDENCE: {0-100}%
531
+
532
+ Interpretation:
533
+ 90-100% — High confidence. Ship it.
534
+ 70-89% — Moderate confidence. Acceptable with noted gaps.
535
+ 50-69% — Low confidence. Significant unknowns remain.
536
+ <50% — Very low. Do not approve without more evidence.
537
+
538
+ ═══════════════════════════════════════════════════════
539
+ ```
540
+
541
+ **Integration with verdict:**
542
+ - FaR confidence is INFORMATIONAL — it does not override the 70-point checklist
543
+ - BUT if FaR confidence < 50% AND checklist score ≥ 70%, flag a WARNING:
544
+ "Checklist passes but verifier confidence is low. Review the 'Unknown/Untestable'
545
+ list before approving."
546
+ - Include FaR confidence in the verification report under a "Confidence Assessment" section
547
+ - Track FaR confidence across phases to detect calibration drift
548
+
549
+ **Skip condition:** If `--quick` flag is set, skip FaR and use raw checklist score only.
550
+
490
551
  ### Step 5.75: Dual-Verification — Read from Authoritative Source (v11.0)
491
552
 
492
553
  > **Research basis (v11.0):** Failure pattern mining (8 instances of silent persistence
@@ -176,7 +176,7 @@ next_action: "{what to do next}"
176
176
  ### Important Paths:
177
177
  - **Project Root:** {path}
178
178
  - **Planning Docs:** {path}/.planning/
179
- - **Skills Library:** ~/.claude/plugins/dominion-flow/skills-library/
179
+ - **Skills Library:** ~/.claude/plugins/fire-flow/skills-library/
180
180
 
181
181
  ---
182
182
 
@@ -470,7 +470,7 @@ This command does NOT spawn agents. It compiles information from existing docume
470
470
  â•‘ â•‘
471
471
  â•‘ No .planning/CONSCIENCE.md found. â•‘
472
472
  â•‘ â•‘
473
- â•‘ Action: Run `/fire-1-new` to initialize project first. â•‘
473
+ â•‘ Action: Run `/fire-1a-new` to initialize project first. â•‘
474
474
  â•‘ â•‘
475
475
  ╚══════════════════════════════════════════════════════════════════════════════╝
476
476
  ```
@@ -201,6 +201,41 @@ Use AskUserQuestion:
201
201
 
202
202
  **Skip condition:** If `--quick` flag is set, still load directives (they're tiny and high-value).
203
203
 
204
+ ### Step 2.9: Dead Ends Review (v11.3)
205
+
206
+ > **Philosophy:** A fresh Claude instance with clean context is the best solver for problems that burned a previous instance. Check for dead ends FIRST — you might solve in 30 seconds what the last instance couldn't in 15 minutes.
207
+
208
+ **Read `.planning/breadcrumbs/FAILURES.md`** — if it exists, look for entries tagged `[DEAD-END]`:
209
+
210
+ ```
211
+ ┌─────────────────────────────────────────────────────────────────────────────┐
212
+ │ DEAD ENDS — {N} unsolved problem(s) from previous sessions │
213
+ ├─────────────────────────────────────────────────────────────────────────────┤
214
+ │ │
215
+ │ 1. [{priority}] {title} │
216
+ │ Shelved: {date} by {agent} — Attempts: {N} │
217
+ │ Untested hypotheses: {N} │
218
+ │ │
219
+ └─────────────────────────────────────────────────────────────────────────────┘
220
+ ```
221
+
222
+ **For the highest-priority `[DEAD-END]` entry:**
223
+
224
+ 1. Read the full entry (problem, prior attempts, untested hypotheses, relevant files)
225
+ 2. With your fresh context, **attempt the top untested hypothesis**
226
+ 3. **If solved:**
227
+ - Move the entry to `breadcrumbs/LESSONS.md` with `[DEAD-END-SOLVED]` tag
228
+ - Remove the `[DEAD-END]` tag from `FAILURES.md`
229
+ - Log the solution approach for future reference
230
+ 4. **If still stuck after one focused attempt:**
231
+ - Update the entry with your new attempt
232
+ - Don't burn more tokens — move on to normal work
233
+ - The NEXT fresh instance will try again
234
+
235
+ **Time budget:** Max 5 minutes on dead-end problems. This is a bonus attempt, not the main work.
236
+
237
+ **Skip condition:** If `--quick` flag or no `FAILURES.md` exists, skip.
238
+
204
239
  ### Step 3: Display Project Status Summary
205
240
 
206
241
  ```
@@ -426,7 +461,7 @@ This command does NOT spawn agents. It loads context and provides routing recomm
426
461
  ║ ║
427
462
  ║ Options: ║
428
463
  ║ A) Check if project exists: look for .planning/CONSCIENCE.md ║
429
- ║ B) Initialize new project: /fire-1-new ║
464
+ ║ B) Initialize new project: /fire-1a-new ║
430
465
  ║ C) Check handoff directory: ls ~/.claude/warrior-handoffs/ ║
431
466
  ║ ║
432
467
  ╚══════════════════════════════════════════════════════════════════════════════╝
@@ -486,7 +521,7 @@ This command does NOT spawn agents. It loads context and provides routing recomm
486
521
  ║ Options: ║
487
522
  ║ A) Create CONSCIENCE.md from handoff context ║
488
523
  ║ B) Navigate to correct project directory ║
489
- ║ C) Initialize fresh: /fire-1-new ║
524
+ ║ C) Initialize fresh: /fire-1a-new ║
490
525
  ║ ║
491
526
  ╚══════════════════════════════════════════════════════════════════════════════╝
492
527
  ```
@@ -407,7 +407,7 @@ Unlike the security scan (Step 4.5) which allows "save anyway" for suspicious co
407
407
  ### Save and Update Index
408
408
 
409
409
  1. Save skill file:
410
- - Path: `~/.claude/plugins/dominion-flow/skills-library/{category}/{skill-name}.md`
410
+ - Path: `~/.claude/plugins/fire-flow/skills-library/{category}/{skill-name}.md`
411
411
 
412
412
  2. Update SKILLS-INDEX.md:
413
413
  - Add entry to category section
@@ -416,7 +416,7 @@ Unlike the security scan (Step 4.5) which allows "save anyway" for suspicious co
416
416
 
417
417
  3. Git commit (if skills library is versioned):
418
418
  ```bash
419
- cd ~/.claude/plugins/dominion-flow/skills-library
419
+ cd ~/.claude/plugins/fire-flow/skills-library
420
420
  git add {category}/{skill-name}.md SKILLS-INDEX.md
421
421
  git commit -m "feat(skills): add {category}/{skill-name}"
422
422
  ```
@@ -180,7 +180,7 @@ FOR phase_number in range(from_phase, to_phase + 1):
180
180
 
181
181
  Run /fire-3-execute {phase_number} --auto-continue --autonomous
182
182
  // --auto-continue: no breath-boundary interrupts
183
- // --autonomous: merge gate auto-routes verdicts (v9.0)
183
+ // --autonomous: merge gate auto-routes verdicts (v9.0, enhanced v12.0)
184
184
 
185
185
  // ──────────────────────────────────────────────────────
186
186
  // Step 3.3: AUTO-VERIFY (read results)
@@ -312,6 +312,23 @@ Write .planning/autonomous-log.md:
312
312
 
313
313
  ### Behavioral Directive Proposals
314
314
  {Any HIGH/CRITICAL findings from reviewer that should become rules}
315
+
316
+ ### DORA Metrics (v12.0 — AUTONOMOUS_ORCHESTRATION skill)
317
+
318
+ | Metric | Value | Notes |
319
+ |--------|-------|-------|
320
+ | Deployment Frequency | {phases_completed}/{elapsed_time} | Phases per hour |
321
+ | Change Lead Time | {avg time from plan to verified} | Plan→Execute→Verify avg |
322
+ | Change Failure Rate | {failed_attempts}/{total_attempts} | Lower = better quality plans |
323
+ | Recovery Time | {avg time from NEEDS FIX to next PASS} | Re-plan + re-execute avg |
324
+
325
+ ### Supervised Autonomy Assessment (v12.0)
326
+
327
+ | Tier | Description | This Session |
328
+ |------|-------------|-------------|
329
+ | Human-in-the-loop | Every decision approved | Not used |
330
+ | Human-on-the-loop | Monitoring, intervenes on blockers | Active (via circuit breaker) |
331
+ | Human-out-of-loop | Full autonomy with instrumentation | {if no blockers: "Achieved"} |
315
332
  ```
316
333
 
317
334
  ### Step 6: Completion Banner
@@ -402,7 +419,7 @@ forward-looking context that the memory system doesn't capture.
402
419
  ### Step 8: Sabbath Rest — Session State
403
420
 
404
421
  ```
405
- Update .claude/dominion-flow.local.md:
422
+ Update .claude/fire-flow.local.md:
406
423
 
407
424
  ---
408
425
  last_session: {timestamp}
@@ -524,5 +541,5 @@ WHAT IS DISABLED in autonomous mode:
524
541
 
525
542
  ---
526
543
 
527
- *Dominion Flow v9.0 — Full autopilot with instrumentation over restriction*
544
+ *Dominion Flow v12.0 — Full autopilot with instrumentation over restriction*
528
545
  *Boris Cherny principle: "You don't trust; you instrument."*
@@ -361,7 +361,7 @@ This ensures:
361
361
  ```bash
362
362
  /fire-brainstorm "project architecture for {idea}"
363
363
  # Then
364
- /fire-1-new
364
+ /fire-1a-new
365
365
  ```
366
366
 
367
367
  ### Before Planning Phase
@@ -157,7 +157,7 @@ Key accomplishments:
157
157
  - {accomplishment 2}
158
158
 
159
159
  ## Next Milestone Goals
160
- <!-- Defined by /fire-1-new or /fire-new-milestone -->
160
+ <!-- Defined by /fire-1a-new or /fire-new-milestone -->
161
161
  ```
162
162
 
163
163
  ### Step 7: Commit and Tag
@@ -197,7 +197,7 @@ Use AskUserQuestion:
197
197
  Update persistent state:
198
198
 
199
199
  ```markdown
200
- ## .claude/dominion-flow.local.md
200
+ ## .claude/fire-flow.local.md
201
201
 
202
202
  ### Milestone Completion
203
203
  - Version: v{version}
@@ -0,0 +1,183 @@
1
+ # /fire-cost — Token & Cost Intelligence
2
+
3
+ > Track context usage, estimate session costs, and trigger strategic compaction before hitting limits.
4
+
5
+ ---
6
+
7
+ ## Purpose
8
+
9
+ Provide real-time visibility into context window consumption and session costs. Prevents the silent failure mode where agents hit context limits mid-task with no recovery path.
10
+
11
+ > **Research basis (v10.1):** Spotify "Honk" Architecture (2024) — tiered context management reduces context-related failures by 40%. Google DeepMind "Cost-Aware Agent Planning" (NeurIPS 2024) — agents that track resource consumption make 31% fewer wasteful API calls.
12
+ > Applied: Added explicit context/cost monitoring as a first-class command.
13
+
14
+ ---
15
+
16
+ ## Arguments
17
+
18
+ | Argument | Required | Description |
19
+ |----------|----------|-------------|
20
+ | `--detail` | No | Show per-file and per-agent breakdown |
21
+ | `--warn` | No | Only show if above 60% context usage |
22
+ | `--budget <amount>` | No | Set a session cost budget (e.g., `--budget $5.00`) |
23
+
24
+ ---
25
+
26
+ ## Process
27
+
28
+ <step number="1">
29
+ ### Measure Current Context State
30
+
31
+ Assess the current session's context consumption:
32
+
33
+ **Context Window Tiers:**
34
+ | Tier | Usage | Status | Action |
35
+ |------|-------|--------|--------|
36
+ | GREEN | 0-50% | Healthy | No action needed |
37
+ | YELLOW | 50-70% | Caution | Consider compaction soon |
38
+ | ORANGE | 70-85% | Warning | Compact non-essential context NOW |
39
+ | RED | 85-95% | Critical | Emergency compaction — preserve only active task |
40
+ | BLACK | 95%+ | Terminal | Save state immediately, prepare handoff |
41
+
42
+ Estimate context usage from:
43
+ - Number of files read in session
44
+ - Conversation turn count
45
+ - Agent spawns and their responses
46
+ - Skills loaded
47
+ - Tool call results accumulated
48
+ </step>
49
+
50
+ <step number="2">
51
+ ### Token Cost Estimation
52
+
53
+ Estimate session costs based on model usage:
54
+
55
+ **Claude Opus 4 Pricing:**
56
+ - Input: $15 / 1M tokens
57
+ - Output: $5 / 1M tokens
58
+
59
+ **Claude Sonnet 4 Pricing:**
60
+ - Input: $3 / 1M tokens
61
+ - Output: $15 / 1M tokens
62
+
63
+ **Estimation heuristics:**
64
+ - Average file read: ~2,000 tokens
65
+ - Average tool call result: ~500 tokens
66
+ - Average agent spawn (round-trip): ~8,000 tokens
67
+ - Average user message: ~200 tokens
68
+ - Average assistant response: ~1,500 tokens
69
+
70
+ Track cumulative estimates across the session.
71
+ </step>
72
+
73
+ <step number="3">
74
+ ### Strategic Compaction Recommendations
75
+
76
+ When context usage exceeds YELLOW tier, recommend specific compaction strategies:
77
+
78
+ **Priority 1 — Drop stale context:**
79
+ - Files read >10 turns ago that aren't referenced in active task
80
+ - Completed agent results (keep summary, drop details)
81
+ - Resolved error messages and their debug traces
82
+
83
+ **Priority 2 — Compress active context:**
84
+ - Replace full file contents with relevant excerpts
85
+ - Summarize long tool outputs
86
+ - Collapse completed task details into one-line summaries
87
+
88
+ **Priority 3 — Archive and handoff:**
89
+ - Run `/fire-5-handoff` to save state
90
+ - Use `/compact Focus on [active task]` for targeted compaction
91
+ - Split remaining work into a new session
92
+
93
+ </step>
94
+
95
+ <step number="4">
96
+ ### Display Dashboard
97
+
98
+ ```
99
+ =============================================================
100
+ COST & CONTEXT INTELLIGENCE
101
+ =============================================================
102
+
103
+ Session Duration: {hours}h {minutes}m
104
+ Conversation Turns: {N}
105
+
106
+ -------------------------------------------------------------
107
+ CONTEXT WINDOW
108
+ -------------------------------------------------------------
109
+
110
+ Usage: [████████████░░░░░░░░] 62% — YELLOW ⚠️
111
+
112
+ Files read: {N} (~{tokens} tokens)
113
+ Agent spawns: {N} (~{tokens} tokens)
114
+ Tool calls: {N} (~{tokens} tokens)
115
+ Conversation: {N} turns (~{tokens} tokens)
116
+
117
+ Estimated total: ~{tokens} tokens
118
+
119
+ -------------------------------------------------------------
120
+ COST ESTIMATE
121
+ -------------------------------------------------------------
122
+
123
+ Input tokens: ~{N} × ${rate} = ${amount}
124
+ Output tokens: ~{N} × ${rate} = ${amount}
125
+ ─────────
126
+ Estimated session cost: ${total}
127
+ Budget remaining: ${remaining} (if --budget set)
128
+
129
+ -------------------------------------------------------------
130
+ RECOMMENDATIONS
131
+ -------------------------------------------------------------
132
+
133
+ {If GREEN: "Context is healthy. No action needed."}
134
+ {If YELLOW: "Consider running /compact soon. N files from early session could be dropped."}
135
+ {If ORANGE+: "COMPACT NOW. Specific recommendations:
136
+ - Drop: [file1, file2] (read >10 turns ago, not in active task)
137
+ - Compress: [agent results] (keep summaries only)
138
+ - Archive: Run /fire-5-handoff to save state before continuing"}
139
+
140
+ =============================================================
141
+ ```
142
+ </step>
143
+
144
+ ---
145
+
146
+ ## Budget Alerts
147
+
148
+ When `--budget` is set, display warnings at these thresholds:
149
+
150
+ | Threshold | Alert |
151
+ |-----------|-------|
152
+ | 50% of budget | "Half your budget spent. {N} tokens remaining at current rate." |
153
+ | 75% of budget | "Budget warning: ${remaining} left. Consider wrapping up current task." |
154
+ | 90% of budget | "Budget critical: ${remaining} left. Save state with /fire-5-handoff." |
155
+ | 100% of budget | "Budget exceeded. Recommend ending session after current task." |
156
+
157
+ ---
158
+
159
+ ## Integration Points
160
+
161
+ - **`/fire-3-execute`** — Check context tier before each breath. If ORANGE+, compact before continuing.
162
+ - **`/fire-autonomous`** — Auto-check after every 3 phases. If ORANGE+, trigger handoff.
163
+ - **`/fire-loop`** — Include cost check in each loop iteration status.
164
+ - **`/fire-5-handoff`** — Include final cost summary in handoff document.
165
+
166
+ ---
167
+
168
+ ## Success Criteria
169
+
170
+ - [ ] Context tier accurately assessed (GREEN/YELLOW/ORANGE/RED/BLACK)
171
+ - [ ] Token estimates within reasonable range
172
+ - [ ] Cost estimates calculated with current model pricing
173
+ - [ ] Compaction recommendations specific and actionable
174
+ - [ ] Budget tracking functional when --budget flag used
175
+ - [ ] Dashboard displays cleanly
176
+
177
+ ---
178
+
179
+ ## Related Commands
180
+
181
+ - `/fire-dashboard` — Project overview (includes cost widget)
182
+ - `/fire-5-handoff` — Save session state
183
+ - `/fire-autonomous` — Uses cost checks for auto-pause decisions
@@ -34,7 +34,7 @@ Read current project state from .planning/CONSCIENCE.md and related files.
34
34
  ```bash
35
35
  # Check for required state files
36
36
  if [ ! -f ".planning/CONSCIENCE.md" ]; then
37
- echo "Error: No .planning/CONSCIENCE.md found. Run /fire-1-new first."
37
+ echo "Error: No .planning/CONSCIENCE.md found. Run /fire-1a-new first."
38
38
  exit 1
39
39
  fi
40
40
  ```
@@ -316,7 +316,7 @@ Categories:
316
316
  ║ Could not find .planning/CONSCIENCE.md in current directory. ║
317
317
  ║ ║
318
318
  ║ To initialize a new project: ║
319
- ║ /fire-1-new ║
319
+ ║ /fire-1a-new ║
320
320
  ║ ║
321
321
  ║ To resume an existing project: ║
322
322
  ║ /fire-6-resume ║