wogiflow 1.0.21 → 1.0.22

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 (121) hide show
  1. package/.claude/commands/wogi-bug.md +43 -0
  2. package/.claude/commands/wogi-bulk.md +144 -0
  3. package/.claude/commands/wogi-changelog.md +36 -0
  4. package/.claude/commands/wogi-compact.md +99 -0
  5. package/.claude/commands/wogi-config.md +50 -0
  6. package/.claude/commands/wogi-context.md +68 -0
  7. package/.claude/commands/wogi-correction.md +73 -0
  8. package/.claude/commands/wogi-debt.md +128 -0
  9. package/.claude/commands/wogi-deps.md +32 -0
  10. package/.claude/commands/wogi-epics.md +145 -0
  11. package/.claude/commands/wogi-export.md +100 -0
  12. package/.claude/commands/wogi-feature.md +149 -0
  13. package/.claude/commands/wogi-guided-edit.md +83 -0
  14. package/.claude/commands/wogi-health.md +43 -0
  15. package/.claude/commands/wogi-help.md +96 -0
  16. package/.claude/commands/wogi-hybrid-edit.md +36 -0
  17. package/.claude/commands/wogi-hybrid-off.md +24 -0
  18. package/.claude/commands/wogi-hybrid-setup.md +79 -0
  19. package/.claude/commands/wogi-hybrid-status.md +45 -0
  20. package/.claude/commands/wogi-hybrid.md +54 -0
  21. package/.claude/commands/wogi-import.md +44 -0
  22. package/.claude/commands/wogi-init.md +618 -0
  23. package/.claude/commands/wogi-log.md +38 -0
  24. package/.claude/commands/wogi-map-add.md +29 -0
  25. package/.claude/commands/wogi-map-check.md +35 -0
  26. package/.claude/commands/wogi-map-index.md +98 -0
  27. package/.claude/commands/wogi-map-scan.md +38 -0
  28. package/.claude/commands/wogi-map-sync.md +91 -0
  29. package/.claude/commands/wogi-map.md +33 -0
  30. package/.claude/commands/wogi-morning.md +65 -0
  31. package/.claude/commands/wogi-onboard.md +99 -0
  32. package/.claude/commands/wogi-plan.md +173 -0
  33. package/.claude/commands/wogi-ready.md +84 -0
  34. package/.claude/commands/wogi-resume.md +95 -0
  35. package/.claude/commands/wogi-review.md +636 -0
  36. package/.claude/commands/wogi-roadmap.md +241 -0
  37. package/.claude/commands/wogi-rules.md +104 -0
  38. package/.claude/commands/wogi-search.md +33 -0
  39. package/.claude/commands/wogi-session-end.md +49 -0
  40. package/.claude/commands/wogi-setup-stack.md +151 -0
  41. package/.claude/commands/wogi-skill-learn.md +66 -0
  42. package/.claude/commands/wogi-skills.md +87 -0
  43. package/.claude/commands/wogi-standup.md +28 -0
  44. package/.claude/commands/wogi-start.md +465 -0
  45. package/.claude/commands/wogi-status.md +41 -0
  46. package/.claude/commands/wogi-statusline-setup/skill.md +109 -0
  47. package/.claude/commands/wogi-story.md +98 -0
  48. package/.claude/commands/wogi-suspend.md +87 -0
  49. package/.claude/commands/wogi-test-browser.md +43 -0
  50. package/.claude/commands/wogi-trace.md +198 -0
  51. package/.claude/docs/architecture.md +37 -0
  52. package/.claude/docs/commands.md +343 -0
  53. package/.claude/docs/knowledge-base/01-setup-onboarding/README.md +177 -0
  54. package/.claude/docs/knowledge-base/01-setup-onboarding/component-indexing.md +341 -0
  55. package/.claude/docs/knowledge-base/01-setup-onboarding/framework-detection.md +269 -0
  56. package/.claude/docs/knowledge-base/01-setup-onboarding/installation.md +146 -0
  57. package/.claude/docs/knowledge-base/01-setup-onboarding/onboarding-existing.md +317 -0
  58. package/.claude/docs/knowledge-base/01-setup-onboarding/team-setup.md +346 -0
  59. package/.claude/docs/knowledge-base/02-task-execution/01-task-planning.md +259 -0
  60. package/.claude/docs/knowledge-base/02-task-execution/02-execution-loop.md +443 -0
  61. package/.claude/docs/knowledge-base/02-task-execution/03-verification.md +417 -0
  62. package/.claude/docs/knowledge-base/02-task-execution/04-completion.md +374 -0
  63. package/.claude/docs/knowledge-base/02-task-execution/05-session-review.md +170 -0
  64. package/.claude/docs/knowledge-base/02-task-execution/README.md +173 -0
  65. package/.claude/docs/knowledge-base/02-task-execution/external-integrations.md +133 -0
  66. package/.claude/docs/knowledge-base/02-task-execution/model-management.md +202 -0
  67. package/.claude/docs/knowledge-base/02-task-execution/specification-mode.md +292 -0
  68. package/.claude/docs/knowledge-base/02-task-execution/sync-daemon.md +96 -0
  69. package/.claude/docs/knowledge-base/02-task-execution/trade-offs.md +345 -0
  70. package/.claude/docs/knowledge-base/02-task-execution/workflow-steps.md +357 -0
  71. package/.claude/docs/knowledge-base/03-self-improvement/README.md +199 -0
  72. package/.claude/docs/knowledge-base/03-self-improvement/long-input-processing.md +160 -0
  73. package/.claude/docs/knowledge-base/03-self-improvement/model-learning.md +334 -0
  74. package/.claude/docs/knowledge-base/03-self-improvement/project-learning.md +301 -0
  75. package/.claude/docs/knowledge-base/03-self-improvement/skill-learning.md +372 -0
  76. package/.claude/docs/knowledge-base/03-self-improvement/skill-matching.md +304 -0
  77. package/.claude/docs/knowledge-base/03-self-improvement/team-learning.md +342 -0
  78. package/.claude/docs/knowledge-base/04-memory-context/README.md +189 -0
  79. package/.claude/docs/knowledge-base/04-memory-context/context-management.md +308 -0
  80. package/.claude/docs/knowledge-base/04-memory-context/memory-commands.md +176 -0
  81. package/.claude/docs/knowledge-base/04-memory-context/memory-systems.md +359 -0
  82. package/.claude/docs/knowledge-base/04-memory-context/prd-management.md +115 -0
  83. package/.claude/docs/knowledge-base/04-memory-context/session-persistence.md +359 -0
  84. package/.claude/docs/knowledge-base/04-memory-context/team-history.md +317 -0
  85. package/.claude/docs/knowledge-base/05-development-tools/README.md +84 -0
  86. package/.claude/docs/knowledge-base/05-development-tools/code-traces.md +278 -0
  87. package/.claude/docs/knowledge-base/05-development-tools/figma-analyzer.md +253 -0
  88. package/.claude/docs/knowledge-base/05-development-tools/guided-edit.md +173 -0
  89. package/.claude/docs/knowledge-base/05-development-tools/mcp-integrations.md +286 -0
  90. package/.claude/docs/knowledge-base/06-safety-guardrails/README.md +153 -0
  91. package/.claude/docs/knowledge-base/06-safety-guardrails/checkpoint-rollback.md +302 -0
  92. package/.claude/docs/knowledge-base/06-safety-guardrails/commit-gates.md +309 -0
  93. package/.claude/docs/knowledge-base/06-safety-guardrails/damage-control.md +292 -0
  94. package/.claude/docs/knowledge-base/06-safety-guardrails/security-scanning.md +291 -0
  95. package/.claude/docs/knowledge-base/README.md +92 -0
  96. package/.claude/docs/knowledge-base/configuration/README.md +228 -0
  97. package/.claude/docs/knowledge-base/configuration/all-options.md +1632 -0
  98. package/.claude/docs/knowledge-base/future-features.md +277 -0
  99. package/.claude/docs/stack.md +25 -0
  100. package/.claude/docs/testing.md +71 -0
  101. package/.claude/rules/README.md +60 -0
  102. package/.claude/rules/architecture/component-reuse.md +38 -0
  103. package/.claude/rules/architecture/document-structure.md +76 -0
  104. package/.claude/rules/architecture/feature-refactoring-cleanup.md +87 -0
  105. package/.claude/rules/architecture/model-management.md +35 -0
  106. package/.claude/rules/code-style/naming-conventions.md +55 -0
  107. package/.claude/rules/security/security-patterns.md +116 -0
  108. package/.claude/skills/.gitkeep +0 -0
  109. package/.claude/skills/README.md +131 -0
  110. package/.claude/skills/_template/commands/.gitkeep +0 -0
  111. package/.claude/skills/_template/knowledge/anti-patterns.md +49 -0
  112. package/.claude/skills/_template/knowledge/learnings.md +60 -0
  113. package/.claude/skills/_template/knowledge/patterns.md +45 -0
  114. package/.claude/skills/_template/rules/.gitkeep +0 -0
  115. package/.claude/skills/_template/skill.md +99 -0
  116. package/.claude/skills/_template/templates/.gitkeep +0 -0
  117. package/.claude/skills/figma-analyzer/knowledge/anti-patterns.md +216 -0
  118. package/.claude/skills/figma-analyzer/knowledge/patterns.md +144 -0
  119. package/.claude/skills/figma-analyzer/skill.md +236 -0
  120. package/lib/installer.js +59 -19
  121. package/package.json +5 -1
@@ -0,0 +1,345 @@
1
+ # Trade-offs
2
+
3
+ Every configuration decision in WogiFlow involves trade-offs. Understanding these helps you tune the system for your specific needs.
4
+
5
+ ---
6
+
7
+ ## The Fundamental Trade-off
8
+
9
+ ```
10
+ ┌─────────────────────────────────────────────────────────────┐
11
+ │ │
12
+ │ THOROUGHNESS ◀──────────────────────▶ SPEED/COST │
13
+ │ │
14
+ │ More loops Fewer loops │
15
+ │ Stricter gates Looser gates │
16
+ │ Full Claude Hybrid mode │
17
+ │ All verifications Manual verification │
18
+ │ │
19
+ │ = Higher quality = Lower cost │
20
+ │ = More tokens = Faster │
21
+ │ = Slower = More risk │
22
+ │ │
23
+ └─────────────────────────────────────────────────────────────┘
24
+ ```
25
+
26
+ ---
27
+
28
+ ## Loop Configuration Trade-offs
29
+
30
+ ### `loops.enforced`
31
+
32
+ | Value | Pros | Cons |
33
+ |-------|------|------|
34
+ | `true` | Guaranteed completion of all criteria | Can get stuck on edge cases |
35
+ | `false` | Manual control over exit | May exit prematurely |
36
+
37
+ **Recommendation**: Keep `true` for production work. Set `false` only for exploration.
38
+
39
+ ### `loops.maxRetries`
40
+
41
+ | Value | Pros | Cons |
42
+ |-------|------|------|
43
+ | Higher (10+) | More attempts = higher success rate | More tokens if stuck |
44
+ | Lower (3-5) | Fails fast on impossible criteria | May miss fixable issues |
45
+
46
+ **Recommendation**: 5 is a good balance. Increase for complex verification.
47
+
48
+ ### `loops.maxIterations`
49
+
50
+ | Value | Pros | Cons |
51
+ |-------|------|------|
52
+ | Higher (30+) | Handles complex multi-step tasks | Can consume many tokens |
53
+ | Lower (10-15) | Bounded cost | May not complete complex tasks |
54
+
55
+ **Recommendation**: 20 for most tasks. Increase for decomposed stories.
56
+
57
+ ---
58
+
59
+ ## Enforcement Trade-offs
60
+
61
+ ### `enforcement.strictMode`
62
+
63
+ | Value | Pros | Cons |
64
+ |-------|------|------|
65
+ | `true` | Every task is planned and tracked | Overhead for simple changes |
66
+ | `false` | Quick ad-hoc changes possible | May lose track of work |
67
+
68
+ **Recommendation**: Keep `true`. The planning overhead prevents costly rework.
69
+
70
+ ### `enforcement.requireStoryForMediumTasks`
71
+
72
+ | Value | Pros | Cons |
73
+ |-------|------|------|
74
+ | `true` | Forces upfront planning | Slower to start |
75
+ | `false` | Can dive into medium tasks | May miss edge cases |
76
+
77
+ **Recommendation**: Keep `true`. Stories catch scope issues early.
78
+
79
+ ### `enforcement.requirePatternCitation`
80
+
81
+ | Value | Pros | Cons |
82
+ |-------|------|------|
83
+ | `true` | Ensures consistency with decisions.md | More overhead per file |
84
+ | `false` | Faster implementation | May deviate from patterns |
85
+
86
+ **Recommendation**: Enable for large teams. Optional for solo work.
87
+
88
+ ---
89
+
90
+ ## Hybrid Mode Trade-offs
91
+
92
+ ### Token Savings vs Quality
93
+
94
+ | Mode | Token Cost | Quality | Speed |
95
+ |------|-----------|---------|-------|
96
+ | Claude Only | 100% | Highest | Fast |
97
+ | Hybrid (Local) | 5-15% | Good* | Depends on hardware |
98
+ | Hybrid (Cloud) | 20-40% | Good | Fast |
99
+
100
+ *Quality varies significantly by local model.
101
+
102
+ ### When to Use Hybrid
103
+
104
+ **Use Hybrid:**
105
+ - Boilerplate code (CRUD, forms, tests)
106
+ - Well-defined patterns
107
+ - Component variants
108
+ - Documentation
109
+
110
+ **Use Claude:**
111
+ - Complex logic
112
+ - Architecture decisions
113
+ - Debugging
114
+ - Novel implementations
115
+
116
+ ### `hybrid.settings.autoExecute`
117
+
118
+ | Value | Pros | Cons |
119
+ |-------|------|------|
120
+ | `true` | Faster execution | No review before changes |
121
+ | `false` | Review each step | Slower, more involvement |
122
+
123
+ **Recommendation**: Start with `false`. Enable `true` once confident.
124
+
125
+ ---
126
+
127
+ ## Quality Gate Trade-offs
128
+
129
+ ### Required Gates
130
+
131
+ | More Gates | Fewer Gates |
132
+ |------------|-------------|
133
+ | Higher quality output | Faster completion |
134
+ | Catches more issues | More manual checking needed |
135
+ | Slower feedback loop | Quicker iteration |
136
+
137
+ ### Example Configurations
138
+
139
+ **High Quality (Production):**
140
+ ```json
141
+ {
142
+ "qualityGates": {
143
+ "feature": {
144
+ "require": ["tests", "lint", "typecheck", "appMapUpdate", "requestLogEntry", "review"]
145
+ }
146
+ }
147
+ }
148
+ ```
149
+
150
+ **Fast Iteration (Prototyping):**
151
+ ```json
152
+ {
153
+ "qualityGates": {
154
+ "feature": {
155
+ "require": ["lint"],
156
+ "optional": ["tests", "review"]
157
+ }
158
+ }
159
+ }
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Verification Trade-offs
165
+
166
+ ### `loops.autoInferVerification`
167
+
168
+ | Value | Pros | Cons |
169
+ |-------|------|------|
170
+ | `true` | Automatic verification | May miss nuanced criteria |
171
+ | `false` | Human verification | Slower, manual work |
172
+
173
+ **Recommendation**: Keep `true`. Falls back to manual for complex criteria.
174
+
175
+ ### `loops.fallbackToManual`
176
+
177
+ | Value | Pros | Cons |
178
+ |-------|------|------|
179
+ | `true` | Never blocks on unverifiable criteria | Requires human input |
180
+ | `false` | Fully automated | May fail on valid work |
181
+
182
+ **Recommendation**: Keep `true` unless fully automated pipeline.
183
+
184
+ ---
185
+
186
+ ## Regression Testing Trade-offs
187
+
188
+ ### `regressionTesting.sampleSize`
189
+
190
+ | Value | Pros | Cons |
191
+ |-------|------|------|
192
+ | Higher (10+) | More confidence in stability | Slower completion |
193
+ | Lower (3-5) | Faster feedback | May miss regressions |
194
+
195
+ **Recommendation**: 3-5 for normal work. Increase before releases.
196
+
197
+ ### `regressionTesting.onFailure`
198
+
199
+ | Value | Behavior | Use Case |
200
+ |-------|----------|----------|
201
+ | `warn` | Shows warning, continues | Development |
202
+ | `block` | Blocks completion | Pre-release |
203
+ | `fix` | Attempts fix automatically | CI/CD |
204
+
205
+ ---
206
+
207
+ ## Durable Session Trade-offs
208
+
209
+ ### `durableSteps.enabled`
210
+
211
+ | Value | Pros | Cons |
212
+ |-------|------|------|
213
+ | `true` | Crash recovery, progress tracking | Slight overhead |
214
+ | `false` | Simpler execution | Lost progress on crash |
215
+
216
+ **Recommendation**: Always `true`. The overhead is minimal.
217
+
218
+ ### `suspension.pollIntervalSeconds`
219
+
220
+ | Value | Pros | Cons |
221
+ |-------|------|------|
222
+ | Lower (30) | Faster resume when condition met | More polling overhead |
223
+ | Higher (300) | Less overhead | Slower to detect condition |
224
+
225
+ **Recommendation**: 60 seconds is a good balance.
226
+
227
+ ---
228
+
229
+ ## Parallel Execution Trade-offs
230
+
231
+ ### `parallel.autoExecute`
232
+
233
+ | Value | Pros | Cons |
234
+ |-------|------|------|
235
+ | `true` | Automatic parallelization | Complex merge conflicts |
236
+ | `false` | Review before parallel | Slower to start |
237
+
238
+ **Recommendation**: Keep `false` until comfortable with worktree workflow.
239
+
240
+ ### `parallel.maxConcurrent`
241
+
242
+ | Value | Pros | Cons |
243
+ |-------|------|------|
244
+ | Higher (5+) | Maximum throughput | Harder to review |
245
+ | Lower (2-3) | Manageable review | Less parallelization |
246
+
247
+ **Recommendation**: Start with 2-3. Increase as you learn the workflow.
248
+
249
+ ---
250
+
251
+ ## Configuration Profiles
252
+
253
+ ### Maximum Quality
254
+
255
+ ```json
256
+ {
257
+ "enforcement": { "strictMode": true, "requirePatternCitation": true },
258
+ "loops": { "enforced": true, "maxRetries": 10, "maxIterations": 30 },
259
+ "qualityGates": {
260
+ "feature": { "require": ["tests", "lint", "typecheck", "review"] }
261
+ },
262
+ "regressionTesting": { "sampleSize": 10, "onFailure": "block" },
263
+ "hybrid": { "enabled": false }
264
+ }
265
+ ```
266
+
267
+ ### Maximum Speed
268
+
269
+ ```json
270
+ {
271
+ "enforcement": { "strictMode": false },
272
+ "loops": { "enforced": false, "maxRetries": 3 },
273
+ "qualityGates": {
274
+ "feature": { "require": ["lint"] }
275
+ },
276
+ "regressionTesting": { "enabled": false },
277
+ "hybrid": { "enabled": true, "settings": { "autoExecute": true } }
278
+ }
279
+ ```
280
+
281
+ ### Balanced (Recommended)
282
+
283
+ ```json
284
+ {
285
+ "enforcement": { "strictMode": true },
286
+ "loops": { "enforced": true, "maxRetries": 5, "maxIterations": 20 },
287
+ "qualityGates": {
288
+ "feature": { "require": ["tests", "lint", "typecheck"] }
289
+ },
290
+ "regressionTesting": { "sampleSize": 3, "onFailure": "warn" },
291
+ "hybrid": { "enabled": true, "settings": { "autoExecute": false } }
292
+ }
293
+ ```
294
+
295
+ ---
296
+
297
+ ## Cost Estimation
298
+
299
+ ### Token Usage by Configuration
300
+
301
+ | Configuration | Tokens per Task | Cost (Claude Opus) |
302
+ |--------------|-----------------|-------------------|
303
+ | Maximum Quality | 50-100k | ~$1.50-3.00 |
304
+ | Balanced | 20-50k | ~$0.60-1.50 |
305
+ | Maximum Speed | 5-15k | ~$0.15-0.45 |
306
+ | Hybrid + Balanced | 5-10k | ~$0.15-0.30 |
307
+
308
+ *Estimates based on typical medium-complexity tasks.*
309
+
310
+ ### Monthly Projections
311
+
312
+ | Tasks/Day | Max Quality | Balanced | Hybrid |
313
+ |-----------|-------------|----------|--------|
314
+ | 5 | $225-450/mo | $90-225/mo | $22-45/mo |
315
+ | 10 | $450-900/mo | $180-450/mo | $45-90/mo |
316
+ | 20 | $900-1800/mo | $360-900/mo | $90-180/mo |
317
+
318
+ ---
319
+
320
+ ## Decision Framework
321
+
322
+ ### Questions to Ask
323
+
324
+ 1. **What's the cost of a bug?** High cost → More thoroughness
325
+ 2. **How often do you iterate?** Rapid iteration → Fewer gates
326
+ 3. **How experienced is the team?** New team → More enforcement
327
+ 4. **Is this greenfield or legacy?** Legacy → More regression testing
328
+ 5. **What's your token budget?** Limited → Consider hybrid
329
+
330
+ ### Quick Reference
331
+
332
+ | Priority | Configuration |
333
+ |----------|--------------|
334
+ | Quality over speed | Max enforcement, more loops |
335
+ | Speed over quality | Fewer gates, hybrid mode |
336
+ | Cost efficiency | Hybrid mode, fewer retries |
337
+ | Team consistency | Pattern citation, more gates |
338
+
339
+ ---
340
+
341
+ ## Related
342
+
343
+ - [Execution Loop](./02-execution-loop.md) - How loops work
344
+ - [Verification](./03-verification.md) - Quality gate details
345
+ - [Configuration Reference](../configuration/all-options.md) - All options
@@ -0,0 +1,357 @@
1
+ # Workflow Steps
2
+
3
+ Modular workflow engine with declarative YAML-based step definitions, conditional routing, and bounded loops.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ Workflow steps provide a declarative way to define automated workflows. Define steps in YAML, and the engine handles execution, conditions, loops, and error handling.
10
+
11
+ ---
12
+
13
+ ## Step Types
14
+
15
+ ```
16
+ ┌─────────────────────────────────────────────────────────────────────┐
17
+ │ STEP TYPES │
18
+ ├─────────────────────────────────────────────────────────────────────┤
19
+ │ │
20
+ │ COMMAND Execute shell command │
21
+ │ ─────── npm run build, git push │
22
+ │ │
23
+ │ SCRIPT Run a script file │
24
+ │ ────── ./scripts/deploy.sh │
25
+ │ │
26
+ │ GATE Require condition before proceeding │
27
+ │ ──── tests must pass, approval required │
28
+ │ │
29
+ │ LOOP Repeat steps until condition │
30
+ │ ──── retry up to 5 times │
31
+ │ │
32
+ │ PARALLEL Execute steps concurrently │
33
+ │ ──────── run tests and lint in parallel │
34
+ │ │
35
+ │ CONDITIONAL Branch based on condition │
36
+ │ ─────────── if staging then... else... │
37
+ │ │
38
+ └─────────────────────────────────────────────────────────────────────┘
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Workflow Definition
44
+
45
+ Workflows are defined in `.workflow/workflows/`:
46
+
47
+ ```yaml
48
+ # .workflow/workflows/deploy.yaml
49
+ name: deploy
50
+ description: Deploy to production
51
+ version: 1.0.0
52
+
53
+ steps:
54
+ - id: build
55
+ type: command
56
+ command: npm run build
57
+
58
+ - id: test
59
+ type: command
60
+ command: npm test
61
+ depends: [build]
62
+
63
+ - id: deploy
64
+ type: script
65
+ script: ./scripts/deploy.sh
66
+ depends: [test]
67
+ condition: "env.CI === 'true'"
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Step Properties
73
+
74
+ | Property | Required | Description |
75
+ |----------|----------|-------------|
76
+ | `id` | Yes | Unique step identifier |
77
+ | `type` | Yes | Step type (command, script, gate, etc.) |
78
+ | `depends` | No | Array of step IDs that must complete first |
79
+ | `condition` | No | Expression that must be true to run |
80
+ | `timeout` | No | Max execution time in milliseconds |
81
+ | `retries` | No | Number of retry attempts on failure |
82
+
83
+ ---
84
+
85
+ ## Command Steps
86
+
87
+ Execute shell commands:
88
+
89
+ ```yaml
90
+ - id: install
91
+ type: command
92
+ command: npm install
93
+
94
+ - id: build
95
+ type: command
96
+ command: npm run build
97
+ timeout: 120000 # 2 minutes
98
+ retries: 2
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Script Steps
104
+
105
+ Run script files:
106
+
107
+ ```yaml
108
+ - id: migrate
109
+ type: script
110
+ script: ./scripts/migrate.sh
111
+ env:
112
+ DATABASE_URL: ${DATABASE_URL}
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Gate Steps
118
+
119
+ Require a condition before proceeding:
120
+
121
+ ```yaml
122
+ - id: approval
123
+ type: gate
124
+ gate:
125
+ type: manual
126
+ prompt: "Deploy to production?"
127
+
128
+ - id: tests-pass
129
+ type: gate
130
+ gate:
131
+ type: check
132
+ command: npm test
133
+ expect: "exit 0"
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Loop Steps
139
+
140
+ Repeat until condition is met:
141
+
142
+ ```yaml
143
+ - id: retry-deploy
144
+ type: loop
145
+ maxIterations: 5
146
+ steps:
147
+ - id: deploy-attempt
148
+ type: command
149
+ command: ./deploy.sh
150
+ until: "result.exitCode === 0"
151
+ ```
152
+
153
+ ---
154
+
155
+ ## Parallel Steps
156
+
157
+ Execute concurrently:
158
+
159
+ ```yaml
160
+ - id: quality-checks
161
+ type: parallel
162
+ steps:
163
+ - id: lint
164
+ type: command
165
+ command: npm run lint
166
+ - id: typecheck
167
+ type: command
168
+ command: npm run typecheck
169
+ - id: test
170
+ type: command
171
+ command: npm test
172
+ ```
173
+
174
+ ---
175
+
176
+ ## Conditional Steps
177
+
178
+ Branch based on conditions:
179
+
180
+ ```yaml
181
+ - id: deploy-target
182
+ type: conditional
183
+ condition: "env.ENVIRONMENT"
184
+ branches:
185
+ staging:
186
+ - id: deploy-staging
187
+ type: command
188
+ command: ./deploy.sh staging
189
+ production:
190
+ - id: deploy-prod
191
+ type: command
192
+ command: ./deploy.sh production
193
+ default:
194
+ - id: deploy-dev
195
+ type: command
196
+ command: ./deploy.sh dev
197
+ ```
198
+
199
+ ---
200
+
201
+ ## Configuration
202
+
203
+ ```json
204
+ {
205
+ "workflows": {
206
+ "enabled": true,
207
+ "directory": ".workflow/workflows",
208
+ "maxIterations": 100, // Loop iteration limit
209
+ "defaultTimeout": 120000, // 2 minutes
210
+ "validateOnLoad": true, // Validate workflow syntax
211
+ "allowUnsafeCommands": false // Block dangerous commands
212
+ }
213
+ }
214
+ ```
215
+
216
+ ---
217
+
218
+ ## CLI Commands
219
+
220
+ ```bash
221
+ # List available workflows
222
+ flow workflow list
223
+
224
+ # Run a workflow
225
+ flow workflow run deploy
226
+
227
+ # Run with environment variables
228
+ flow workflow run deploy --env ENVIRONMENT=staging
229
+
230
+ # Validate workflow syntax
231
+ flow workflow validate deploy
232
+
233
+ # Create new workflow from template
234
+ flow workflow create my-workflow
235
+ ```
236
+
237
+ ---
238
+
239
+ ## Context Variables
240
+
241
+ Available in conditions and templates:
242
+
243
+ | Variable | Description |
244
+ |----------|-------------|
245
+ | `env.*` | Environment variables |
246
+ | `result.*` | Previous step result |
247
+ | `workflow.*` | Workflow metadata |
248
+ | `project.*` | Project info |
249
+
250
+ Example:
251
+ ```yaml
252
+ condition: "env.CI === 'true' && result.build.exitCode === 0"
253
+ ```
254
+
255
+ ---
256
+
257
+ ## Step Dependencies
258
+
259
+ Steps can depend on other steps:
260
+
261
+ ```yaml
262
+ steps:
263
+ - id: install
264
+ type: command
265
+ command: npm install
266
+
267
+ - id: build
268
+ type: command
269
+ command: npm run build
270
+ depends: [install] # Waits for install
271
+
272
+ - id: test
273
+ type: command
274
+ command: npm test
275
+ depends: [build] # Waits for build
276
+ ```
277
+
278
+ ---
279
+
280
+ ## Error Handling
281
+
282
+ ### Retries
283
+
284
+ ```yaml
285
+ - id: flaky-step
286
+ type: command
287
+ command: ./flaky-operation.sh
288
+ retries: 3
289
+ retryDelay: 5000 # 5 seconds between retries
290
+ ```
291
+
292
+ ### On Failure
293
+
294
+ ```yaml
295
+ - id: deploy
296
+ type: command
297
+ command: ./deploy.sh
298
+ onFailure:
299
+ - id: rollback
300
+ type: command
301
+ command: ./rollback.sh
302
+ - id: notify
303
+ type: command
304
+ command: ./notify-failure.sh
305
+ ```
306
+
307
+ ---
308
+
309
+ ## Built-in Workflows
310
+
311
+ | Workflow | Purpose |
312
+ |----------|---------|
313
+ | `task-complete` | Quality gates on task completion |
314
+ | `pre-commit` | Pre-commit checks |
315
+ | `deploy-staging` | Deploy to staging environment |
316
+
317
+ ---
318
+
319
+ ## Creating Custom Workflows
320
+
321
+ ```bash
322
+ # Create from template
323
+ flow workflow create my-workflow
324
+
325
+ # This creates:
326
+ # .workflow/workflows/my-workflow.yaml
327
+ ```
328
+
329
+ Template structure:
330
+ ```yaml
331
+ name: my-workflow
332
+ description: Description of what this workflow does
333
+ version: 1.0.0
334
+
335
+ steps:
336
+ - id: step-1
337
+ type: command
338
+ command: echo "Step 1"
339
+ ```
340
+
341
+ ---
342
+
343
+ ## Best Practices
344
+
345
+ 1. **Use meaningful step IDs** - `build` not `step1`
346
+ 2. **Set appropriate timeouts** - Prevent hanging steps
347
+ 3. **Use retries for flaky operations** - Network calls, deployments
348
+ 4. **Keep workflows focused** - One workflow per concern
349
+ 5. **Validate before running** - `flow workflow validate`
350
+
351
+ ---
352
+
353
+ ## Related
354
+
355
+ - [Execution Loop](./02-execution-loop.md) - Task execution flow
356
+ - [Quality Gates](./03-verification.md) - Verification steps
357
+ - [Configuration](../configuration/all-options.md) - Workflow settings