@pjmendonca/devflow 1.9.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 (124) hide show
  1. package/CHANGELOG.md +526 -0
  2. package/LICENSE +21 -0
  3. package/README.md +620 -0
  4. package/bin/devflow-checkpoint.js +10 -0
  5. package/bin/devflow-collab.js +10 -0
  6. package/bin/devflow-cost.js +10 -0
  7. package/bin/devflow-create-persona.js +10 -0
  8. package/bin/devflow-init.js +10 -0
  9. package/bin/devflow-memory.js +10 -0
  10. package/bin/devflow-new-doc.js +10 -0
  11. package/bin/devflow-personalize.js +10 -0
  12. package/bin/devflow-setup-checkpoint.js +10 -0
  13. package/bin/devflow-story.js +10 -0
  14. package/bin/devflow-tech-debt.js +10 -0
  15. package/bin/devflow-validate-overrides.js +10 -0
  16. package/bin/devflow-validate.js +10 -0
  17. package/bin/devflow-version.js +10 -0
  18. package/lib/constants.js +30 -0
  19. package/lib/exec-python.js +78 -0
  20. package/lib/python-check.js +178 -0
  21. package/package.json +64 -0
  22. package/tooling/.automation/agents/architect.md +135 -0
  23. package/tooling/.automation/agents/ba.md +70 -0
  24. package/tooling/.automation/agents/dev.md +79 -0
  25. package/tooling/.automation/agents/maintainer.md +97 -0
  26. package/tooling/.automation/agents/pm.md +116 -0
  27. package/tooling/.automation/agents/reviewer.md +141 -0
  28. package/tooling/.automation/agents/sm.md +61 -0
  29. package/tooling/.automation/agents/writer.md +193 -0
  30. package/tooling/.automation/config.ps1.template +61 -0
  31. package/tooling/.automation/config.sh.template +48 -0
  32. package/tooling/.automation/memory/.gitkeep +6 -0
  33. package/tooling/.automation/memory/knowledge/kg_integration-test.json +94 -0
  34. package/tooling/.automation/memory/knowledge/kg_test-story.json +300 -0
  35. package/tooling/.automation/memory/shared/shared_integration-test.json +30 -0
  36. package/tooling/.automation/memory/shared/shared_test-story.json +78 -0
  37. package/tooling/.automation/overrides/templates/README.md +113 -0
  38. package/tooling/.automation/overrides/templates/architect/README.md +27 -0
  39. package/tooling/.automation/overrides/templates/architect/cloud-native.yaml +92 -0
  40. package/tooling/.automation/overrides/templates/architect/enterprise-architect.yaml +85 -0
  41. package/tooling/.automation/overrides/templates/architect/pragmatic-minimalist.yaml +88 -0
  42. package/tooling/.automation/overrides/templates/ba/README.md +27 -0
  43. package/tooling/.automation/overrides/templates/ba/agile-storyteller.yaml +86 -0
  44. package/tooling/.automation/overrides/templates/ba/domain-expert.yaml +91 -0
  45. package/tooling/.automation/overrides/templates/ba/requirements-engineer.yaml +89 -0
  46. package/tooling/.automation/overrides/templates/dev/README.md +32 -0
  47. package/tooling/.automation/overrides/templates/dev/junior-mentored.yaml +39 -0
  48. package/tooling/.automation/overrides/templates/dev/performance-engineer.yaml +43 -0
  49. package/tooling/.automation/overrides/templates/dev/rapid-prototyper.yaml +52 -0
  50. package/tooling/.automation/overrides/templates/dev/security-focused.yaml +43 -0
  51. package/tooling/.automation/overrides/templates/dev/senior-fullstack.yaml +39 -0
  52. package/tooling/.automation/overrides/templates/maintainer/README.md +27 -0
  53. package/tooling/.automation/overrides/templates/maintainer/devops-maintainer.yaml +113 -0
  54. package/tooling/.automation/overrides/templates/maintainer/legacy-steward.yaml +94 -0
  55. package/tooling/.automation/overrides/templates/maintainer/oss-maintainer.yaml +94 -0
  56. package/tooling/.automation/overrides/templates/pm/README.md +27 -0
  57. package/tooling/.automation/overrides/templates/pm/agile-pm.yaml +91 -0
  58. package/tooling/.automation/overrides/templates/pm/hybrid-delivery.yaml +87 -0
  59. package/tooling/.automation/overrides/templates/pm/traditional-pm.yaml +91 -0
  60. package/tooling/.automation/overrides/templates/reviewer/README.md +11 -0
  61. package/tooling/.automation/overrides/templates/reviewer/mentoring-reviewer.yaml +45 -0
  62. package/tooling/.automation/overrides/templates/reviewer/quick-sanity.yaml +50 -0
  63. package/tooling/.automation/overrides/templates/reviewer/thorough-critic.yaml +48 -0
  64. package/tooling/.automation/overrides/templates/sm/README.md +11 -0
  65. package/tooling/.automation/overrides/templates/sm/agile-coach.yaml +52 -0
  66. package/tooling/.automation/overrides/templates/sm/startup-pm.yaml +50 -0
  67. package/tooling/.automation/overrides/templates/sm/technical-lead.yaml +47 -0
  68. package/tooling/.automation/overrides/templates/user-profile.template.yaml +62 -0
  69. package/tooling/.automation/overrides/templates/writer/README.md +27 -0
  70. package/tooling/.automation/overrides/templates/writer/api-documentarian.yaml +99 -0
  71. package/tooling/.automation/overrides/templates/writer/docs-as-code.yaml +108 -0
  72. package/tooling/.automation/overrides/templates/writer/user-guide-author.yaml +100 -0
  73. package/tooling/completions/DevflowCompletion.ps1 +213 -0
  74. package/tooling/completions/_run-story +116 -0
  75. package/tooling/completions/run-story-completion.bash +136 -0
  76. package/tooling/docs/DOC-STANDARD.md +717 -0
  77. package/tooling/docs/sprint-status.yaml.template +24 -0
  78. package/tooling/docs/templates/bug-report.md +234 -0
  79. package/tooling/docs/templates/migration-spec.md +274 -0
  80. package/tooling/docs/templates/refactor-spec.md +86 -0
  81. package/tooling/docs/templates/tech-debt.md +86 -0
  82. package/tooling/scripts/context_checkpoint.py +556 -0
  83. package/tooling/scripts/cost_dashboard.py +617 -0
  84. package/tooling/scripts/create-persona.py +690 -0
  85. package/tooling/scripts/create-persona.sh +435 -0
  86. package/tooling/scripts/init-project-workflow.ps1 +651 -0
  87. package/tooling/scripts/init-project-workflow.py +70 -0
  88. package/tooling/scripts/init-project-workflow.sh +746 -0
  89. package/tooling/scripts/lib/__init__.py +35 -0
  90. package/tooling/scripts/lib/agent_handoff.py +526 -0
  91. package/tooling/scripts/lib/agent_router.py +698 -0
  92. package/tooling/scripts/lib/checkpoint-integration.ps1 +245 -0
  93. package/tooling/scripts/lib/checkpoint-integration.sh +191 -0
  94. package/tooling/scripts/lib/claude-cli.ps1 +952 -0
  95. package/tooling/scripts/lib/claude-cli.sh +1293 -0
  96. package/tooling/scripts/lib/cost_config.py +222 -0
  97. package/tooling/scripts/lib/cost_display.py +443 -0
  98. package/tooling/scripts/lib/cost_tracker.py +710 -0
  99. package/tooling/scripts/lib/currency_converter.py +328 -0
  100. package/tooling/scripts/lib/errors.py +438 -0
  101. package/tooling/scripts/lib/override-loader.sh +286 -0
  102. package/tooling/scripts/lib/pair_programming.py +589 -0
  103. package/tooling/scripts/lib/shared_memory.py +637 -0
  104. package/tooling/scripts/lib/swarm_orchestrator.py +689 -0
  105. package/tooling/scripts/memory_summarize.py +324 -0
  106. package/tooling/scripts/new-doc.ps1 +405 -0
  107. package/tooling/scripts/new-doc.py +93 -0
  108. package/tooling/scripts/new-doc.sh +534 -0
  109. package/tooling/scripts/personalize_agent.py +385 -0
  110. package/tooling/scripts/rollback-migration.sh +540 -0
  111. package/tooling/scripts/run-collab.ps1 +251 -0
  112. package/tooling/scripts/run-collab.py +605 -0
  113. package/tooling/scripts/run-collab.sh +110 -0
  114. package/tooling/scripts/run-story.ps1 +490 -0
  115. package/tooling/scripts/run-story.py +387 -0
  116. package/tooling/scripts/run-story.sh +467 -0
  117. package/tooling/scripts/setup-checkpoint-service.ps1 +219 -0
  118. package/tooling/scripts/setup-checkpoint-service.py +87 -0
  119. package/tooling/scripts/setup-checkpoint-service.sh +236 -0
  120. package/tooling/scripts/tech-debt-tracker.py +608 -0
  121. package/tooling/scripts/update_version.py +244 -0
  122. package/tooling/scripts/validate-overrides.py +511 -0
  123. package/tooling/scripts/validate-overrides.sh +432 -0
  124. package/tooling/scripts/validate_setup.py +539 -0
package/README.md ADDED
@@ -0,0 +1,620 @@
1
+ # Claude Code Workflow Template
2
+
3
+ > Automated development workflow powered by Claude Code CLI - A complete agent-based development system with smart model usage, context preservation, and multi-persona automation.
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Claude Code](https://img.shields.io/badge/Claude-Code-5A67D8)](https://claude.com/claude-code)
7
+
8
+ ## 🚀 What is This?
9
+
10
+ A production-ready, portable workflow automation system that uses Claude Code CLI to implement user stories with minimal human intervention. Think "CI/CD for development" - but instead of deploying code, it writes code.
11
+
12
+ ### Key Features
13
+
14
+ - **Multi-Persona Agent System** - 8 specialized AI agents (SM, DEV, BA, ARCHITECT, PM, WRITER, MAINTAINER, REVIEWER)
15
+ - **Smart Model Usage** - Opus for development, Sonnet for planning (40-60% cost savings)
16
+ - **Context Preservation** - Automatic checkpoints prevent work loss from context limits
17
+ - **Full Automation** - Context → Development → Testing → Review → Commit pipeline
18
+ - **Greenfield + Brownfield** - Supports both new features AND existing codebase maintenance
19
+ - **Agent Personalization** - Agent overrides and persistent agent memory
20
+ - **Claude Code Integration** - Native slash commands (`/story`, `/swarm`, `/pair`, `/route`, etc.)
21
+ - **Multi-Agent Collaboration** - Swarm mode, pair programming, and auto-routing
22
+ - **Knowledge Graph** - Queryable database of all architectural decisions and design choices
23
+ - **Shared Memory** - Cross-agent memory pool for context sharing and learnings
24
+ - **Agent Handoff System** - Structured context preservation between agent transitions
25
+ - **Multi-Currency Cost Tracking** - Customizable currency display with budget controls and alerts
26
+ - **Project Agnostic** - Works with Flutter, Node.js, Python, Rust, Go, Ruby, etc.
27
+ - **Guided Setup** - Interactive wizard guides you through installation
28
+
29
+ ## 📦 Quick Start
30
+
31
+ ### Prerequisites
32
+
33
+ **macOS/Linux:**
34
+ - [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) - See [installation guide](https://docs.anthropic.com/en/docs/claude-code/getting-started)
35
+ - Python 3.9+
36
+ - Git
37
+ - Bash or Zsh shell
38
+
39
+ **Windows:**
40
+ - [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) - See [installation guide](https://docs.anthropic.com/en/docs/claude-code/getting-started)
41
+ - Python 3.9+ (from python.org or Microsoft Store)
42
+ - Git for Windows
43
+ - PowerShell 5.1+ (included with Windows 10/11)
44
+
45
+ ### Installation
46
+
47
+ **Option 1: npm (Easiest - All Platforms)**
48
+
49
+ ```bash
50
+ # Install globally via npm
51
+ npm install -g @pjmendonca/devflow
52
+
53
+ # Verify installation
54
+ devflow-validate
55
+
56
+ # Start using
57
+ devflow-init
58
+ ```
59
+
60
+ **Requirements:** Python 3.9+ and Node.js 14+
61
+
62
+ See [NPM Installation Guide](docs/NPM_INSTALLATION.md) for detailed instructions and troubleshooting.
63
+
64
+ **Option 2: pip (Python Ecosystem)**
65
+
66
+ ```bash
67
+ # Clone the repository
68
+ git clone https://github.com/Pedro-Jose-da-Rocha-Mendonca/Devflow.git
69
+ cd Devflow
70
+
71
+ # Install via pip
72
+ pip install .
73
+
74
+ # Verify installation
75
+ devflow-validate
76
+ ```
77
+
78
+ **Option 3: Manual Installation (macOS/Linux)**
79
+
80
+ Clone and Setup (Recommended):
81
+
82
+ ```bash
83
+ # Clone this repository
84
+ git clone https://github.com/Pedro-Jose-da-Rocha-Mendonca/Devflow.git
85
+ cd Devflow
86
+
87
+ # Copy to your project
88
+ cp -r tooling /path/to/your/project/
89
+
90
+ # Run setup wizard
91
+ cd /path/to/your/project/tooling/scripts
92
+ ./init-project-workflow.sh
93
+ ```
94
+
95
+ Direct Copy:
96
+
97
+ ```bash
98
+ # Download latest release
99
+ curl -L https://github.com/Pedro-Jose-da-Rocha-Mendonca/Devflow/archive/main.tar.gz | tar xz
100
+
101
+ # Move to your project
102
+ mv Devflow-main/tooling /path/to/your/project/
103
+
104
+ # Manual config
105
+ cd /path/to/your/project/tooling/.automation
106
+ cp config.sh.template config.sh
107
+ vim config.sh
108
+ ```
109
+
110
+ **Option 4: Manual Installation (Windows)**
111
+
112
+ Clone and Setup (Recommended):
113
+
114
+ ```powershell
115
+ # Clone this repository
116
+ git clone https://github.com/Pedro-Jose-da-Rocha-Mendonca/Devflow.git
117
+ cd Devflow
118
+
119
+ # Copy to your project
120
+ Copy-Item -Recurse tooling C:\path\to\your\project\
121
+
122
+ # Set execution policy (first time only, run as Admin)
123
+ Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
124
+
125
+ # Run setup wizard
126
+ cd C:\path\to\your\project\tooling\scripts
127
+ .\init-project-workflow.ps1
128
+ ```
129
+
130
+ Direct Copy:
131
+
132
+ ```powershell
133
+ # Download latest release
134
+ Invoke-WebRequest -Uri "https://github.com/Pedro-Jose-da-Rocha-Mendonca/Devflow/archive/main.zip" -OutFile main.zip
135
+ Expand-Archive main.zip -DestinationPath .
136
+
137
+ # Move to your project
138
+ Move-Item Devflow-main\tooling C:\path\to\your\project\
139
+
140
+ # Manual config
141
+ cd C:\path\to\your\project\tooling\.automation
142
+ Copy-Item config.ps1.template config.ps1
143
+ notepad config.ps1
144
+ ```
145
+
146
+ **Running Stories on Windows:**
147
+
148
+ ```powershell
149
+ # Full pipeline with live monitoring
150
+ .\run-story.ps1 -StoryKey "3-5"
151
+
152
+ # Development only
153
+ .\run-story.ps1 -StoryKey "3-5" -Develop
154
+
155
+ # With specific model
156
+ .\run-story.ps1 -StoryKey "3-5" -Model opus
157
+
158
+ # Disable auto-commit
159
+ .\run-story.ps1 -StoryKey "3-5" -NoCommit
160
+ ```
161
+
162
+ ### Agent Personas
163
+
164
+ | Agent | Model | Cost | Use Case |
165
+ |-------|-------|------|----------|
166
+ | **SM** (Scrum Master) | Sonnet | Low | Context, planning, review |
167
+ | **DEV** (Developer) | Opus | High | Code implementation |
168
+ | **BA** (Business Analyst) | Sonnet | Low | Requirements |
169
+ | **ARCHITECT** | Sonnet | Low | Design specs |
170
+ | **PM** (Product Manager) | Sonnet | Low | Epic planning |
171
+ | **WRITER** | Sonnet | Low | Documentation |
172
+ | **MAINTAINER** | Opus/Sonnet | Varies | Bug fixes, refactoring, tech debt |
173
+ | **REVIEWER** (Adversarial) | Opus | High | Critical code review, finds problems |
174
+
175
+ ## 💻 Claude Slash Commands
176
+
177
+ Devflow provides native slash commands for Claude Code:
178
+
179
+ ### Core Commands
180
+
181
+ | Command | Description |
182
+ |---------|-------------|
183
+ | `/story <key>` | Run full story pipeline (context + dev + review) |
184
+ | `/develop <key>` | Run development phase only |
185
+ | `/review <key>` | Run code review phase |
186
+ | `/agent <name>` | Invoke a specific agent |
187
+ | `/adversarial <key>` | Critical review with Opus |
188
+
189
+ ### Collaboration Commands (NEW!)
190
+
191
+ | Command | Description |
192
+ |---------|-------------|
193
+ | `/swarm <key>` | Multi-agent debate/consensus mode |
194
+ | `/pair <key>` | DEV + REVIEWER pair programming |
195
+ | `/route <task>` | Auto-route to best agents |
196
+ | `/collab <key>` | Unified collaboration CLI |
197
+
198
+ ### Utility Commands
199
+
200
+ | Command | Description |
201
+ |---------|-------------|
202
+ | `/memory <key>` | View/query shared agent memory |
203
+ | `/handoff <key>` | View handoff summaries between agents |
204
+ | `/checkpoint` | Create/restore context checkpoints |
205
+ | `/costs` | View cost dashboard and analytics |
206
+ | `/personalize` | Agent personalization wizard |
207
+ | `/devflow <cmd>` | Run any Devflow command |
208
+
209
+ **Examples:**
210
+ ```bash
211
+ /swarm 3-5 # Run swarm with default agents
212
+ /swarm 3-5 --agents ARCHITECT,DEV # Custom agents
213
+ /pair 3-5 # Pair programming mode
214
+ /route "fix login bug" # Auto-route to specialists
215
+ /memory 3-5 --query "auth decisions" # Query knowledge graph
216
+ ```
217
+
218
+ ## 🧠 Knowledge Graph & Shared Memory
219
+
220
+ Devflow features a sophisticated memory system that enables agents to share context, track decisions, and maintain institutional knowledge across the entire development workflow.
221
+
222
+ ### Knowledge Graph
223
+
224
+ The Knowledge Graph is a queryable database of all architectural decisions, design choices, and key learnings made during development.
225
+
226
+ **Features:**
227
+ - **Decision Tracking** - All major decisions are recorded with context, rationale, and timestamps
228
+ - **Semantic Queries** - Ask natural language questions about past decisions
229
+ - **Decision Supersession** - Track when decisions are updated or replaced
230
+ - **Agent Attribution** - Know which agent made each decision
231
+
232
+ ```bash
233
+ # Query the knowledge graph
234
+ python tooling/scripts/run-collab.py 3-5 --query "What authentication approach was decided?"
235
+
236
+ # View all decisions for a story
237
+ python tooling/scripts/run-collab.py 3-5 --decisions
238
+
239
+ # Add a decision programmatically
240
+ python -c "
241
+ from tooling.scripts.lib.shared_memory import get_knowledge_graph
242
+ kg = get_knowledge_graph('3-5')
243
+ kg.add_decision('ARCHITECT', 'auth-approach', 'Use JWT with refresh tokens',
244
+ context={'reason': 'Stateless, scalable'})
245
+ "
246
+ ```
247
+
248
+ **Decision Structure:**
249
+ - `id` - Unique identifier
250
+ - `topic` - Decision category (e.g., "auth-approach", "database-choice")
251
+ - `decision` - The actual decision text
252
+ - `context` - Supporting rationale and metadata
253
+ - `status` - active, superseded, or revoked
254
+
255
+ ### Shared Memory Pool
256
+
257
+ The Shared Memory system allows all agents to contribute and access shared context, learnings, and notes throughout the workflow.
258
+
259
+ **Features:**
260
+ - **Cross-Agent Sharing** - Any agent can add entries, all agents can read
261
+ - **Tagging System** - Organize entries with searchable tags
262
+ - **References** - Link related memory entries together
263
+ - **Persistent Storage** - Memory persists across sessions
264
+
265
+ ```bash
266
+ # View shared memory for a story
267
+ python tooling/scripts/run-collab.py 3-5 --memory
268
+
269
+ # Search memory entries
270
+ python tooling/scripts/run-collab.py 3-5 --memory --search "database"
271
+
272
+ # Add to shared memory programmatically
273
+ python -c "
274
+ from tooling.scripts.lib.shared_memory import get_shared_memory
275
+ memory = get_shared_memory('3-5')
276
+ memory.add('DEV', 'Decided to use PostgreSQL for user data', tags=['database', 'decision'])
277
+ "
278
+ ```
279
+
280
+ **Memory Entry Structure:**
281
+ - `agent` - Which agent contributed the entry
282
+ - `content` - The actual memory content
283
+ - `tags` - Searchable categorization tags
284
+ - `references` - Links to related entries
285
+
286
+ ## 🤝 Agent Handoff System
287
+
288
+ The Agent Handoff System ensures seamless transitions between agents with structured context preservation. When one agent finishes their work, a comprehensive handoff summary is automatically generated for the next agent.
289
+
290
+ **Features:**
291
+ - **Automatic Context Extraction** - Key decisions, files changed, and blockers are auto-detected
292
+ - **Git Diff Analysis** - Changed files are analyzed and summarized
293
+ - **Warning/Blocker Identification** - Critical issues are highlighted for the next agent
294
+ - **Structured Templates** - Each agent transition has specific focus areas
295
+
296
+ ```bash
297
+ # View handoff summaries between agents
298
+ python tooling/scripts/run-collab.py 3-5 --handoffs
299
+
300
+ # Generate a manual handoff
301
+ python -c "
302
+ from tooling.scripts.lib.agent_handoff import create_handoff
303
+ handoff = create_handoff(
304
+ story_key='3-5',
305
+ from_agent='SM',
306
+ to_agent='DEV',
307
+ work_summary='Created story context with all acceptance criteria'
308
+ )
309
+ print(handoff)
310
+ "
311
+ ```
312
+
313
+ **Handoff Contents:**
314
+ - **Summary** - What was accomplished
315
+ - **Key Decisions** - Important choices made
316
+ - **Blockers Resolved** - Issues that were addressed
317
+ - **Watch Out For** - Warnings and concerns
318
+ - **Files Modified** - List of changed files
319
+ - **Next Steps** - Recommended actions for the next agent
320
+
321
+ **Standard Handoff Transitions:**
322
+
323
+ | From | To | Focus Areas |
324
+ |------|-----|-------------|
325
+ | SM → DEV | Acceptance criteria, technical context, patterns to follow |
326
+ | SM → ARCHITECT | High-level requirements, system constraints, scale requirements |
327
+ | ARCHITECT → DEV | Architecture decisions, design patterns, interface definitions |
328
+ | DEV → REVIEWER | Implementation approach, key decisions, test coverage |
329
+ | REVIEWER → DEV | Issues found, required changes, approval status |
330
+ | BA → DEV | Refined requirements, acceptance criteria, edge cases |
331
+
332
+ ## 🐝 Multi-Agent Collaboration
333
+
334
+ Devflow supports advanced multi-agent collaboration modes for complex development tasks.
335
+
336
+ ### Swarm Mode (Multi-Agent Debate)
337
+
338
+ Multiple agents work together, debating and iterating until consensus:
339
+
340
+ ```bash
341
+ # Run swarm with default agents (ARCHITECT, DEV, REVIEWER)
342
+ ./run-story.sh 3-5 --swarm
343
+
344
+ # Custom agent selection
345
+ ./run-story.sh 3-5 --swarm --agents ARCHITECT,DEV,REVIEWER,SECURITY
346
+
347
+ # Control iterations
348
+ ./run-story.sh 3-5 --swarm --max-iter 5
349
+
350
+ # Set budget limits
351
+ ./run-story.sh 3-5 --swarm --budget 20.00
352
+ ```
353
+
354
+ **Swarm Configuration Options:**
355
+ - `max_iterations` - Maximum debate rounds (default: 3)
356
+ - `consensus_type` - unanimous, majority, quorum, or reviewer_approval
357
+ - `parallel_execution` - Run independent agents simultaneously
358
+ - `auto_fix_enabled` - DEV automatically addresses REVIEWER issues
359
+ - `budget_limit_usd` - Maximum cost for the swarm session
360
+
361
+ **Consensus Types:**
362
+ | Type | Description |
363
+ |------|-------------|
364
+ | `unanimous` | All agents must agree |
365
+ | `majority` | >50% of agents agree |
366
+ | `quorum` | N of M agents agree |
367
+ | `reviewer_approval` | REVIEWER must approve (default) |
368
+
369
+ **How it works:**
370
+ 1. All agents analyze the task
371
+ 2. Agents provide feedback on each other's work
372
+ 3. Issues are addressed iteratively
373
+ 4. Continues until consensus or max iterations
374
+
375
+ ### Pair Programming Mode
376
+
377
+ DEV and REVIEWER work together in real-time:
378
+
379
+ ```bash
380
+ ./run-story.sh 3-5 --pair
381
+ ```
382
+
383
+ **How it works:**
384
+ 1. DEV implements code in small chunks
385
+ 2. REVIEWER provides immediate feedback
386
+ 3. DEV addresses issues before continuing
387
+ 4. Higher quality code with fewer late-stage revisions
388
+
389
+ ### Auto-Route Mode (Intelligent Agent Selection)
390
+
391
+ Let Devflow automatically select the best agents:
392
+
393
+ ```bash
394
+ # Auto-detect task type and select appropriate agents
395
+ ./run-story.sh "fix authentication bug" --auto-route
396
+
397
+ # Works with any task description
398
+ ./run-story.sh "add user profile feature" --auto-route
399
+ ```
400
+
401
+ **How it works:**
402
+ - Analyzes task description for keywords
403
+ - Considers file types and complexity
404
+ - Routes to appropriate specialists (e.g., security → SECURITY agent)
405
+
406
+ ## 💰 Cost Tracking & Currency Configuration
407
+
408
+ Devflow includes a comprehensive cost tracking system with multi-currency support and budget controls.
409
+
410
+ ### Currency Selection
411
+
412
+ During setup, the initialization wizard prompts you to select your preferred currency for cost display. Supported currencies include:
413
+
414
+ | Currency | Symbol | Name |
415
+ |----------|--------|------|
416
+ | USD | $ | US Dollar |
417
+ | EUR | € | Euro |
418
+ | GBP | £ | British Pound |
419
+ | BRL | R$ | Brazilian Real |
420
+ | CAD | C$ | Canadian Dollar |
421
+ | AUD | A$ | Australian Dollar |
422
+ | JPY | ¥ | Japanese Yen |
423
+ | CNY | ¥ | Chinese Yuan |
424
+ | INR | ₹ | Indian Rupee |
425
+ | MXN | $ | Mexican Peso |
426
+
427
+ **Setting currency in setup wizard:**
428
+ ```bash
429
+ ./init-project-workflow.sh
430
+ # or
431
+ .\init-project-workflow.ps1
432
+ ```
433
+
434
+ **Setting currency manually:**
435
+ ```bash
436
+ # In your config file or environment
437
+ export COST_DISPLAY_CURRENCY="EUR"
438
+
439
+ # Set custom exchange rates (optional)
440
+ export CURRENCY_RATE_EUR=0.92
441
+ export CURRENCY_RATE_GBP=0.79
442
+ export CURRENCY_RATE_BRL=6.10
443
+ ```
444
+
445
+ ### Budget Controls
446
+
447
+ Set spending limits for different phases of the workflow:
448
+
449
+ ```bash
450
+ export MAX_BUDGET_CONTEXT=3.00 # Context creation: $3 max
451
+ export MAX_BUDGET_DEV=15.00 # Development: $15 max
452
+ export MAX_BUDGET_REVIEW=5.00 # Code review: $5 max
453
+ ```
454
+
455
+ ### Budget Alerts
456
+
457
+ The system provides automatic alerts at configurable thresholds:
458
+
459
+ ```bash
460
+ export COST_WARNING_PERCENT=75 # Yellow warning at 75%
461
+ export COST_CRITICAL_PERCENT=90 # Red warning at 90%
462
+ export COST_AUTO_STOP="true" # Auto-stop at 100%
463
+ ```
464
+
465
+ ### Cost Dashboard
466
+
467
+ View detailed cost information with the cost dashboard:
468
+
469
+ ```bash
470
+ # Show current/latest session
471
+ python tooling/scripts/cost_dashboard.py
472
+
473
+ # Show last 10 sessions
474
+ python tooling/scripts/cost_dashboard.py --history 10
475
+
476
+ # Show costs for a specific story
477
+ python tooling/scripts/cost_dashboard.py --story 3-5
478
+
479
+ # Export to CSV
480
+ python tooling/scripts/cost_dashboard.py --export costs.csv
481
+
482
+ # Show aggregate summary
483
+ python tooling/scripts/cost_dashboard.py --summary
484
+ ```
485
+
486
+ **Dashboard Features:**
487
+ - Real-time cost display during runs
488
+ - Multi-currency display (shows all selected currencies)
489
+ - Token usage breakdown (input/output)
490
+ - Cost by agent breakdown
491
+ - Budget utilization tracking
492
+ - Session history and analytics
493
+
494
+ ### Cost Optimization Tips
495
+
496
+ - **Use Opus sparingly** - Reserve for development and critical reviews
497
+ - **Use Sonnet for planning** - Context creation, documentation, and summaries
498
+ - **Set budget limits** - Prevent runaway costs with phase-specific limits
499
+ - **Monitor the dashboard** - Track spending patterns across stories
500
+
501
+ ## ⌨️ Shell Completion
502
+
503
+ Enable tab-completion for faster command entry.
504
+
505
+ ### Zsh (macOS/Linux)
506
+
507
+ ```bash
508
+ # Option 1: Add to fpath (recommended)
509
+ mkdir -p ~/.zsh/completions
510
+ cp tooling/completions/_run-story ~/.zsh/completions/
511
+
512
+ # Add to ~/.zshrc:
513
+ fpath=(~/.zsh/completions $fpath)
514
+ autoload -Uz compinit && compinit
515
+
516
+ # Reload shell
517
+ source ~/.zshrc
518
+ ```
519
+
520
+ ```bash
521
+ # Option 2: Direct source
522
+ # Add to ~/.zshrc:
523
+ source /path/to/devflow/tooling/completions/_run-story
524
+ ```
525
+
526
+ ### Bash (Linux)
527
+
528
+ ```bash
529
+ # Option 1: System-wide (requires sudo)
530
+ sudo cp tooling/completions/run-story-completion.bash /etc/bash_completion.d/devflow
531
+
532
+ # Option 2: User only - add to ~/.bashrc:
533
+ source /path/to/devflow/tooling/completions/run-story-completion.bash
534
+ ```
535
+
536
+ ### PowerShell (Windows)
537
+
538
+ ```powershell
539
+ # Add to your PowerShell profile ($PROFILE):
540
+ . C:\path\to\devflow\tooling\completions\DevflowCompletion.ps1
541
+
542
+ # Or import as module:
543
+ Import-Module C:\path\to\devflow\tooling\completions\DevflowCompletion.ps1
544
+
545
+ # View available commands
546
+ devflow-help
547
+ ```
548
+
549
+ ### What Gets Completed
550
+
551
+ - **Modes**: `--swarm`, `--pair`, `--auto-route`, `--sequential`
552
+ - **Agents**: `SM`, `DEV`, `BA`, `ARCHITECT`, `PM`, `WRITER`, `MAINTAINER`, `REVIEWER`
553
+ - **Models**: `opus`, `sonnet`, `haiku`
554
+ - **Options**: `--budget`, `--max-iterations`, `--quiet`, etc.
555
+
556
+ **Example usage:**
557
+
558
+ ```bash
559
+ # Type and press Tab:
560
+ ./run-story.sh 3-5 --sw<TAB> # Completes to --swarm
561
+ ./run-story.sh 3-5 --agents AR<TAB> # Completes to ARCHITECT
562
+ ```
563
+
564
+ ## � Security Considerations
565
+
566
+ ### API Key Management
567
+
568
+ Devflow relies on the Claude Code CLI for API authentication. The CLI handles API keys securely:
569
+
570
+ - **API keys are managed by Claude Code CLI** - Devflow never directly handles or stores API keys
571
+ - **Keys are stored in the Claude CLI's secure configuration**, not in Devflow's project files
572
+ - **Never commit API keys** - The `.gitignore` should exclude any files containing sensitive data
573
+
574
+ **Best practices:**
575
+
576
+ 1. **Use Claude CLI's built-in authentication**:
577
+ ```bash
578
+ claude login # Authenticate via the CLI
579
+ ```
580
+
581
+ 2. **For CI/CD environments**, use environment variables:
582
+ ```bash
583
+ export ANTHROPIC_API_KEY="your-key-here"
584
+ ```
585
+
586
+ 3. **Verify your `.gitignore` includes**:
587
+ ```
588
+ .env
589
+ .env.local
590
+ *.pem
591
+ *.key
592
+ tooling/.automation/config.sh # Contains environment-specific settings
593
+ ```
594
+
595
+ 4. **Review logs before sharing** - Cost tracking logs in `tooling/.automation/logs/` may contain session metadata
596
+
597
+ ### Data Privacy
598
+
599
+ - Session cost data is stored locally in `tooling/.automation/costs/`
600
+ - No data is sent to external servers by Devflow (only to Anthropic's API via Claude CLI)
601
+ - Context checkpoints may contain code snippets - review before sharing
602
+
603
+ ## �📜 License
604
+
605
+ MIT License - see [LICENSE](LICENSE) for details.
606
+
607
+ Free to use in commercial and personal projects.
608
+
609
+ ## 🙏 Acknowledgments
610
+
611
+ - Built for [Claude Code CLI](https://claude.com/claude-code)
612
+ - Agent override system inspired by [BMAD-METHOD](https://github.com/bmad-code-org/BMAD-METHOD)
613
+ - Agent-based architecture influenced by AutoGPT, CrewAI
614
+
615
+
616
+ <!-- VERSION_START - Auto-updated by update_version.py -->
617
+ **Version**: 1.9.0
618
+ **Status**: Production Ready
619
+ **Last Updated**: 2025-12-22
620
+ <!-- VERSION_END -->
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path');
4
+ const { execPythonScript, getScriptsDir } = require('../lib/exec-python');
5
+
6
+ const scriptPath = path.join(getScriptsDir(), 'context_checkpoint.py');
7
+ const args = process.argv.slice(2);
8
+
9
+ const exitCode = execPythonScript(scriptPath, args);
10
+ process.exit(exitCode);
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path');
4
+ const { execPythonScript, getScriptsDir } = require('../lib/exec-python');
5
+
6
+ const scriptPath = path.join(getScriptsDir(), 'run-collab.py');
7
+ const args = process.argv.slice(2);
8
+
9
+ const exitCode = execPythonScript(scriptPath, args);
10
+ process.exit(exitCode);
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path');
4
+ const { execPythonScript, getScriptsDir } = require('../lib/exec-python');
5
+
6
+ const scriptPath = path.join(getScriptsDir(), 'cost_dashboard.py');
7
+ const args = process.argv.slice(2);
8
+
9
+ const exitCode = execPythonScript(scriptPath, args);
10
+ process.exit(exitCode);
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path');
4
+ const { execPythonScript, getScriptsDir } = require('../lib/exec-python');
5
+
6
+ const scriptPath = path.join(getScriptsDir(), 'create-persona.py');
7
+ const args = process.argv.slice(2);
8
+
9
+ const exitCode = execPythonScript(scriptPath, args);
10
+ process.exit(exitCode);
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path');
4
+ const { execPythonScript, getScriptsDir } = require('../lib/exec-python');
5
+
6
+ const scriptPath = path.join(getScriptsDir(), 'init-project-workflow.py');
7
+ const args = process.argv.slice(2);
8
+
9
+ const exitCode = execPythonScript(scriptPath, args);
10
+ process.exit(exitCode);
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path');
4
+ const { execPythonScript, getScriptsDir } = require('../lib/exec-python');
5
+
6
+ const scriptPath = path.join(getScriptsDir(), 'memory_summarize.py');
7
+ const args = process.argv.slice(2);
8
+
9
+ const exitCode = execPythonScript(scriptPath, args);
10
+ process.exit(exitCode);
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path');
4
+ const { execPythonScript, getScriptsDir } = require('../lib/exec-python');
5
+
6
+ const scriptPath = path.join(getScriptsDir(), 'new-doc.py');
7
+ const args = process.argv.slice(2);
8
+
9
+ const exitCode = execPythonScript(scriptPath, args);
10
+ process.exit(exitCode);