@relayflows/core 0.0.1 → 1.0.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 (182) hide show
  1. package/dist/agent-handle.d.ts +27 -0
  2. package/dist/agent-handle.d.ts.map +1 -0
  3. package/dist/agent-handle.js +32 -0
  4. package/dist/agent-handle.js.map +1 -0
  5. package/dist/api-executor.d.ts +16 -0
  6. package/dist/api-executor.d.ts.map +1 -0
  7. package/dist/api-executor.js +94 -0
  8. package/dist/api-executor.js.map +1 -0
  9. package/dist/barrier.d.ts +72 -0
  10. package/dist/barrier.d.ts.map +1 -0
  11. package/dist/barrier.js +162 -0
  12. package/dist/barrier.js.map +1 -0
  13. package/dist/budget-tracker.d.ts +75 -0
  14. package/dist/budget-tracker.d.ts.map +1 -0
  15. package/dist/budget-tracker.js +184 -0
  16. package/dist/budget-tracker.js.map +1 -0
  17. package/dist/builder.d.ts +229 -0
  18. package/dist/builder.d.ts.map +1 -0
  19. package/dist/builder.js +430 -0
  20. package/dist/builder.js.map +1 -0
  21. package/dist/builtin-templates/bug-fix.yaml +139 -0
  22. package/dist/builtin-templates/code-review.yaml +137 -0
  23. package/dist/builtin-templates/competitive.yaml +107 -0
  24. package/dist/builtin-templates/documentation.yaml +128 -0
  25. package/dist/builtin-templates/feature-dev.yaml +146 -0
  26. package/dist/builtin-templates/refactor.yaml +145 -0
  27. package/dist/builtin-templates/review-loop.yaml +227 -0
  28. package/dist/builtin-templates/security-audit.yaml +139 -0
  29. package/dist/channel-messenger.d.ts +28 -0
  30. package/dist/channel-messenger.d.ts.map +1 -0
  31. package/dist/channel-messenger.js +275 -0
  32. package/dist/channel-messenger.js.map +1 -0
  33. package/dist/cli-registry.d.ts +77 -0
  34. package/dist/cli-registry.d.ts.map +1 -0
  35. package/dist/cli-registry.js +268 -0
  36. package/dist/cli-registry.js.map +1 -0
  37. package/dist/cli-session-collector.d.ts +39 -0
  38. package/dist/cli-session-collector.d.ts.map +1 -0
  39. package/dist/cli-session-collector.js +23 -0
  40. package/dist/cli-session-collector.js.map +1 -0
  41. package/dist/cli.d.ts +11 -0
  42. package/dist/cli.d.ts.map +1 -0
  43. package/dist/cli.js +395 -0
  44. package/dist/cli.js.map +1 -0
  45. package/dist/cloud-runner.d.ts +15 -0
  46. package/dist/cloud-runner.d.ts.map +1 -0
  47. package/dist/cloud-runner.js +41 -0
  48. package/dist/cloud-runner.js.map +1 -0
  49. package/dist/cloud-schedules.d.ts +3 -0
  50. package/dist/cloud-schedules.d.ts.map +1 -0
  51. package/dist/cloud-schedules.js +2 -0
  52. package/dist/cloud-schedules.js.map +1 -0
  53. package/dist/collectors/claude.d.ts +6 -0
  54. package/dist/collectors/claude.d.ts.map +1 -0
  55. package/dist/collectors/claude.js +330 -0
  56. package/dist/collectors/claude.js.map +1 -0
  57. package/dist/collectors/codex.d.ts +18 -0
  58. package/dist/collectors/codex.d.ts.map +1 -0
  59. package/dist/collectors/codex.js +265 -0
  60. package/dist/collectors/codex.js.map +1 -0
  61. package/dist/collectors/opencode.d.ts +6 -0
  62. package/dist/collectors/opencode.d.ts.map +1 -0
  63. package/dist/collectors/opencode.js +204 -0
  64. package/dist/collectors/opencode.js.map +1 -0
  65. package/dist/coordinator.d.ts +73 -0
  66. package/dist/coordinator.d.ts.map +1 -0
  67. package/dist/coordinator.js +647 -0
  68. package/dist/coordinator.js.map +1 -0
  69. package/dist/custom-steps.d.ts +73 -0
  70. package/dist/custom-steps.d.ts.map +1 -0
  71. package/dist/custom-steps.js +321 -0
  72. package/dist/custom-steps.js.map +1 -0
  73. package/dist/default-logger.d.ts +9 -0
  74. package/dist/default-logger.d.ts.map +1 -0
  75. package/dist/default-logger.js +104 -0
  76. package/dist/default-logger.js.map +1 -0
  77. package/dist/dry-run-format.d.ts +6 -0
  78. package/dist/dry-run-format.d.ts.map +1 -0
  79. package/dist/dry-run-format.js +79 -0
  80. package/dist/dry-run-format.js.map +1 -0
  81. package/dist/file-db.d.ts +85 -0
  82. package/dist/file-db.d.ts.map +1 -0
  83. package/dist/file-db.js +215 -0
  84. package/dist/file-db.js.map +1 -0
  85. package/dist/index.d.ts +37 -1
  86. package/dist/index.d.ts.map +1 -0
  87. package/dist/index.js +34 -3
  88. package/dist/index.js.map +1 -0
  89. package/dist/integrations/browser.d.ts +99 -0
  90. package/dist/integrations/browser.d.ts.map +1 -0
  91. package/dist/integrations/browser.js +419 -0
  92. package/dist/integrations/browser.js.map +1 -0
  93. package/dist/integrations/github.d.ts +79 -0
  94. package/dist/integrations/github.d.ts.map +1 -0
  95. package/dist/integrations/github.js +459 -0
  96. package/dist/integrations/github.js.map +1 -0
  97. package/dist/integrations/slack.d.ts +80 -0
  98. package/dist/integrations/slack.d.ts.map +1 -0
  99. package/dist/integrations/slack.js +355 -0
  100. package/dist/integrations/slack.js.map +1 -0
  101. package/dist/listr-renderer.d.ts +26 -0
  102. package/dist/listr-renderer.d.ts.map +1 -0
  103. package/dist/listr-renderer.js +230 -0
  104. package/dist/listr-renderer.js.map +1 -0
  105. package/dist/memory-db.d.ts +17 -0
  106. package/dist/memory-db.d.ts.map +1 -0
  107. package/dist/memory-db.js +33 -0
  108. package/dist/memory-db.js.map +1 -0
  109. package/dist/process-backend-executor.d.ts +18 -0
  110. package/dist/process-backend-executor.d.ts.map +1 -0
  111. package/dist/process-backend-executor.js +74 -0
  112. package/dist/process-backend-executor.js.map +1 -0
  113. package/dist/process-spawner.d.ts +35 -0
  114. package/dist/process-spawner.d.ts.map +1 -0
  115. package/dist/process-spawner.js +173 -0
  116. package/dist/process-spawner.js.map +1 -0
  117. package/dist/provisioner.d.ts +64 -0
  118. package/dist/provisioner.d.ts.map +1 -0
  119. package/dist/provisioner.js +269 -0
  120. package/dist/provisioner.js.map +1 -0
  121. package/dist/proxy-env.d.ts +52 -0
  122. package/dist/proxy-env.d.ts.map +1 -0
  123. package/dist/proxy-env.js +92 -0
  124. package/dist/proxy-env.js.map +1 -0
  125. package/dist/run-script.d.ts +82 -0
  126. package/dist/run-script.d.ts.map +1 -0
  127. package/dist/run-script.js +527 -0
  128. package/dist/run-script.js.map +1 -0
  129. package/dist/run-summary-table.d.ts +5 -0
  130. package/dist/run-summary-table.d.ts.map +1 -0
  131. package/dist/run-summary-table.js +132 -0
  132. package/dist/run-summary-table.js.map +1 -0
  133. package/dist/run.d.ts +45 -0
  134. package/dist/run.d.ts.map +1 -0
  135. package/dist/run.js +37 -0
  136. package/dist/run.js.map +1 -0
  137. package/dist/runner.d.ts +528 -0
  138. package/dist/runner.d.ts.map +1 -0
  139. package/dist/runner.js +6269 -0
  140. package/dist/runner.js.map +1 -0
  141. package/dist/schema.d.ts +275 -0
  142. package/dist/schema.d.ts.map +1 -0
  143. package/dist/schema.js +27 -0
  144. package/dist/schema.js.map +1 -0
  145. package/dist/schema.json +940 -0
  146. package/dist/sibling-links.d.ts +100 -0
  147. package/dist/sibling-links.d.ts.map +1 -0
  148. package/dist/sibling-links.js +205 -0
  149. package/dist/sibling-links.js.map +1 -0
  150. package/dist/state.d.ts +77 -0
  151. package/dist/state.d.ts.map +1 -0
  152. package/dist/state.js +140 -0
  153. package/dist/state.js.map +1 -0
  154. package/dist/step-executor.d.ts +95 -0
  155. package/dist/step-executor.d.ts.map +1 -0
  156. package/dist/step-executor.js +393 -0
  157. package/dist/step-executor.js.map +1 -0
  158. package/dist/template-resolver.d.ts +33 -0
  159. package/dist/template-resolver.d.ts.map +1 -0
  160. package/dist/template-resolver.js +144 -0
  161. package/dist/template-resolver.js.map +1 -0
  162. package/dist/templates.d.ts +47 -0
  163. package/dist/templates.d.ts.map +1 -0
  164. package/dist/templates.js +405 -0
  165. package/dist/templates.js.map +1 -0
  166. package/dist/trajectory.d.ts +87 -0
  167. package/dist/trajectory.d.ts.map +1 -0
  168. package/dist/trajectory.js +412 -0
  169. package/dist/trajectory.js.map +1 -0
  170. package/dist/types.d.ts +471 -0
  171. package/dist/types.d.ts.map +1 -0
  172. package/dist/types.js +37 -0
  173. package/dist/types.js.map +1 -0
  174. package/dist/validator.d.ts +11 -0
  175. package/dist/validator.d.ts.map +1 -0
  176. package/dist/validator.js +186 -0
  177. package/dist/validator.js.map +1 -0
  178. package/dist/verification.d.ts +53 -0
  179. package/dist/verification.d.ts.map +1 -0
  180. package/dist/verification.js +238 -0
  181. package/dist/verification.js.map +1 -0
  182. package/package.json +12 -8
@@ -0,0 +1,137 @@
1
+ version: '1.0'
2
+ name: code-review
3
+ description: 'Blueprint-style parallel code review with deterministic diff capture.'
4
+ swarm:
5
+ pattern: fan-out
6
+ maxConcurrency: 4
7
+ timeoutMs: 2400000
8
+ channel: swarm-code-review
9
+ idleNudge:
10
+ nudgeAfterMs: 120000
11
+ escalateAfterMs: 120000
12
+ maxNudges: 1
13
+ agents:
14
+ - name: lead
15
+ cli: claude
16
+ role: 'Aggregates review output and final recommendations'
17
+ permissions: { access: full }
18
+ - name: reviewer-architecture
19
+ cli: codex
20
+ role: 'Assesses architecture and maintainability'
21
+ permissions: { access: readonly }
22
+ interactive: false
23
+ - name: reviewer-correctness
24
+ cli: claude
25
+ role: 'Assesses correctness and testing'
26
+ permissions: { access: readonly }
27
+ interactive: false
28
+ - name: reviewer-security
29
+ cli: gemini
30
+ role: 'Assesses security posture and abuse resistance'
31
+ permissions: { access: readonly }
32
+ interactive: false
33
+ workflows:
34
+ - name: parallel-review
35
+ description: 'Run focused reviews in parallel and synthesize final guidance.'
36
+ onError: fail
37
+ preflight:
38
+ - command: git diff --stat HEAD~1 2>/dev/null || git diff --stat 2>/dev/null || echo "No diff available"
39
+ description: 'Check there are changes to review'
40
+ steps:
41
+ # Deterministic: Capture diff for review
42
+ - name: capture-diff
43
+ type: deterministic
44
+ command: git diff HEAD~1 2>/dev/null || git diff 2>/dev/null || echo "No changes"
45
+ captureOutput: true
46
+
47
+ # Deterministic: Capture file list
48
+ - name: capture-files
49
+ type: deterministic
50
+ dependsOn: [capture-diff]
51
+ command: git diff --name-only HEAD~1 2>/dev/null || git diff --name-only 2>/dev/null || echo "No files"
52
+
53
+ # Agent: Prepare context
54
+ - name: prepare-context
55
+ type: agent
56
+ agent: lead
57
+ dependsOn: [capture-diff, capture-files]
58
+ task: |
59
+ Summarize change intent, impacted modules, and review priorities:
60
+ {{task}}
61
+
62
+ Changed files: {{steps.capture-files.output}}
63
+ verification:
64
+ type: output_contains
65
+ value: REVIEW_CONTEXT_READY
66
+
67
+ # Agent: Architecture review (parallel)
68
+ - name: architecture-pass
69
+ type: agent
70
+ agent: reviewer-architecture
71
+ dependsOn: [prepare-context]
72
+ task: |
73
+ Review architecture, coupling, and long-term maintainability:
74
+ {{steps.prepare-context.output}}
75
+
76
+ Diff:
77
+ {{steps.capture-diff.output}}
78
+ verification:
79
+ type: output_contains
80
+ value: ARCH_REVIEW_COMPLETE
81
+
82
+ # Agent: Correctness review (parallel)
83
+ - name: correctness-pass
84
+ type: agent
85
+ agent: reviewer-correctness
86
+ dependsOn: [prepare-context]
87
+ task: |
88
+ Review behavior, tests, and likely regression paths:
89
+ {{steps.prepare-context.output}}
90
+
91
+ Diff:
92
+ {{steps.capture-diff.output}}
93
+ verification:
94
+ type: output_contains
95
+ value: CORRECTNESS_REVIEW_COMPLETE
96
+
97
+ # Agent: Security review (parallel)
98
+ - name: security-pass
99
+ type: agent
100
+ agent: reviewer-security
101
+ dependsOn: [prepare-context]
102
+ task: |
103
+ Review attack surface, secret handling, and input validation:
104
+ {{steps.prepare-context.output}}
105
+
106
+ Diff:
107
+ {{steps.capture-diff.output}}
108
+ verification:
109
+ type: output_contains
110
+ value: SECURITY_REVIEW_COMPLETE
111
+
112
+ # Agent: Consolidate findings
113
+ - name: consolidate
114
+ type: agent
115
+ agent: lead
116
+ dependsOn: [architecture-pass, correctness-pass, security-pass]
117
+ task: |
118
+ Produce merged findings, severity levels, and final recommendation.
119
+ Architecture review: {{steps.architecture-pass.output}}
120
+ Correctness review: {{steps.correctness-pass.output}}
121
+ Security review: {{steps.security-pass.output}}
122
+ verification:
123
+ type: output_contains
124
+ value: DONE
125
+ coordination:
126
+ barriers:
127
+ - name: reviews-complete
128
+ waitFor: [architecture-pass, correctness-pass, security-pass]
129
+ timeoutMs: 900000
130
+ consensusStrategy: majority
131
+ state:
132
+ backend: memory
133
+ ttlMs: 21600000
134
+ namespace: code-review
135
+ errorHandling:
136
+ strategy: fail-fast
137
+ notifyChannel: swarm-code-review
@@ -0,0 +1,107 @@
1
+ version: '1.0'
2
+ name: competitive
3
+ description: 'Multiple agents independently implement solutions, then compare and select the best approach.'
4
+ swarm:
5
+ pattern: competitive
6
+ maxConcurrency: 4
7
+ timeoutMs: 5400000
8
+ channel: swarm-competitive
9
+ agents:
10
+ - name: lead
11
+ cli: claude
12
+ role: 'Defines spec, judges implementations, and selects winner'
13
+ permissions: { access: readwrite }
14
+ - name: team-alpha
15
+ cli: claude
16
+ role: 'Independent implementation team A'
17
+ permissions: { access: readwrite }
18
+ - name: team-beta
19
+ cli: codex
20
+ role: 'Independent implementation team B'
21
+ permissions: { access: readwrite }
22
+ - name: team-gamma
23
+ cli: gemini
24
+ role: 'Independent implementation team C'
25
+ permissions: { access: readwrite }
26
+ workflows:
27
+ - name: competitive-build
28
+ description: 'Independent parallel implementations followed by comparison and selection.'
29
+ onError: fail
30
+ steps:
31
+ - name: define-spec
32
+ agent: lead
33
+ task: |
34
+ Define clear requirements, acceptance criteria, and evaluation rubric:
35
+ {{task}}
36
+ verification:
37
+ type: output_contains
38
+ value: SPEC_COMPLETE
39
+ - name: implement-alpha
40
+ agent: team-alpha
41
+ dependsOn: [define-spec]
42
+ task: |
43
+ Implement solution independently based on spec:
44
+ {{steps.define-spec.output}}
45
+
46
+ Do not coordinate with other teams. Focus on your best approach.
47
+ verification:
48
+ type: output_contains
49
+ value: IMPLEMENTATION_COMPLETE
50
+ - name: implement-beta
51
+ agent: team-beta
52
+ dependsOn: [define-spec]
53
+ task: |
54
+ Implement solution independently based on spec:
55
+ {{steps.define-spec.output}}
56
+
57
+ Do not coordinate with other teams. Focus on your best approach.
58
+ verification:
59
+ type: output_contains
60
+ value: IMPLEMENTATION_COMPLETE
61
+ - name: implement-gamma
62
+ agent: team-gamma
63
+ dependsOn: [define-spec]
64
+ task: |
65
+ Implement solution independently based on spec:
66
+ {{steps.define-spec.output}}
67
+
68
+ Do not coordinate with other teams. Focus on your best approach.
69
+ verification:
70
+ type: output_contains
71
+ value: IMPLEMENTATION_COMPLETE
72
+ - name: compare-solutions
73
+ agent: lead
74
+ dependsOn: [implement-alpha, implement-beta, implement-gamma]
75
+ task: |
76
+ Compare all implementations against the evaluation rubric.
77
+
78
+ Team Alpha: {{steps.implement-alpha.output}}
79
+ Team Beta: {{steps.implement-beta.output}}
80
+ Team Gamma: {{steps.implement-gamma.output}}
81
+
82
+ Analyze trade-offs, strengths, and weaknesses of each approach.
83
+ verification:
84
+ type: output_contains
85
+ value: COMPARISON_COMPLETE
86
+ - name: select-winner
87
+ agent: lead
88
+ dependsOn: [compare-solutions]
89
+ task: |
90
+ Select the winning implementation or synthesize the best elements.
91
+ Provide rationale and integration plan.
92
+ verification:
93
+ type: output_contains
94
+ value: DONE
95
+ coordination:
96
+ barriers:
97
+ - name: implementations-complete
98
+ waitFor: [implement-alpha, implement-beta, implement-gamma]
99
+ timeoutMs: 3600000
100
+ consensusStrategy: majority
101
+ state:
102
+ backend: memory
103
+ ttlMs: 21600000
104
+ namespace: competitive
105
+ errorHandling:
106
+ strategy: continue
107
+ notifyChannel: swarm-competitive
@@ -0,0 +1,128 @@
1
+ version: '1.0'
2
+ name: documentation
3
+ description: 'Blueprint-style documentation workflow with deterministic file operations.'
4
+ swarm:
5
+ pattern: handoff
6
+ maxConcurrency: 1
7
+ timeoutMs: 3000000
8
+ channel: swarm-documentation
9
+ idleNudge:
10
+ nudgeAfterMs: 120000
11
+ escalateAfterMs: 120000
12
+ maxNudges: 1
13
+ agents:
14
+ - name: lead
15
+ cli: claude
16
+ role: 'Owns final editorial sign-off'
17
+ - name: researcher
18
+ cli: codex
19
+ role: 'Collects technical context and source details'
20
+ interactive: false
21
+ - name: writer
22
+ cli: codex
23
+ role: 'Drafts user-facing documentation'
24
+ permissions:
25
+ access: readwrite
26
+ files:
27
+ write: ['docs/**', '*.md', 'web/content/**']
28
+ interactive: false
29
+ - name: editor
30
+ cli: claude
31
+ role: 'Edits for accuracy, clarity, and structure'
32
+ permissions:
33
+ access: readwrite
34
+ files:
35
+ write: ['docs/**', '*.md', 'web/content/**']
36
+ workflows:
37
+ - name: docs-production
38
+ description: 'Gather context, draft docs, edit, and publish summary.'
39
+ onError: skip
40
+ preflight:
41
+ - command: git status --porcelain
42
+ failIf: non-empty
43
+ description: 'Ensure working directory is clean'
44
+ steps:
45
+ # Deterministic: List existing docs
46
+ - name: list-docs
47
+ type: deterministic
48
+ command: find . -name "*.md" -o -name "*.mdx" 2>/dev/null | head -50 || echo "No docs found"
49
+
50
+ # Agent: Gather context
51
+ - name: gather-context
52
+ type: agent
53
+ agent: researcher
54
+ dependsOn: [list-docs]
55
+ task: |
56
+ Collect source context and required updates:
57
+ {{task}}
58
+
59
+ Existing documentation files:
60
+ {{steps.list-docs.output}}
61
+ verification:
62
+ type: output_contains
63
+ value: CONTEXT_COMPLETE
64
+
65
+ # Deterministic: Create docs branch
66
+ - name: create-branch
67
+ type: deterministic
68
+ dependsOn: [gather-context]
69
+ command: git checkout -b docs/{{branch-name}}
70
+
71
+ # Agent: Draft documentation
72
+ - name: draft
73
+ type: agent
74
+ agent: writer
75
+ dependsOn: [create-branch]
76
+ task: |
77
+ Draft documentation updates based on gathered context:
78
+ {{steps.gather-context.output}}
79
+ verification:
80
+ type: output_contains
81
+ value: DRAFT_COMPLETE
82
+
83
+ # Agent: Edit draft
84
+ - name: edit
85
+ type: agent
86
+ agent: editor
87
+ dependsOn: [draft]
88
+ task: |
89
+ Edit the draft for technical accuracy and readability:
90
+ {{steps.draft.output}}
91
+ verification:
92
+ type: output_contains
93
+ value: EDIT_COMPLETE
94
+
95
+ # Deterministic: Commit docs
96
+ - name: commit
97
+ type: deterministic
98
+ dependsOn: [edit]
99
+ command: 'git add -A && git commit -m "docs: {{steps.gather-context.output | first-line}}"'
100
+
101
+ # Deterministic: Push
102
+ - name: push
103
+ type: deterministic
104
+ dependsOn: [commit]
105
+ command: git push origin docs/{{branch-name}}
106
+
107
+ # Agent: Publish summary
108
+ - name: publish-summary
109
+ type: agent
110
+ agent: lead
111
+ dependsOn: [push]
112
+ task: |
113
+ Publish a final summary of documentation changes and open items.
114
+ verification:
115
+ type: output_contains
116
+ value: DONE
117
+ coordination:
118
+ barriers:
119
+ - name: docs-ready
120
+ waitFor: [gather-context, draft, edit]
121
+ timeoutMs: 600000
122
+ state:
123
+ backend: memory
124
+ ttlMs: 259200000
125
+ namespace: documentation
126
+ errorHandling:
127
+ strategy: continue
128
+ notifyChannel: swarm-documentation
@@ -0,0 +1,146 @@
1
+ version: '1.0'
2
+ name: feature-dev
3
+ description: 'Blueprint-style feature development with deterministic quality gates.'
4
+ swarm:
5
+ pattern: hub-spoke
6
+ maxConcurrency: 2
7
+ timeoutMs: 3600000
8
+ channel: swarm-feature-dev
9
+ idleNudge:
10
+ nudgeAfterMs: 120000
11
+ escalateAfterMs: 120000
12
+ maxNudges: 1
13
+ agents:
14
+ - name: lead
15
+ cli: claude
16
+ role: 'Lead engineer coordinating delivery'
17
+ permissions: { access: full }
18
+ - name: planner
19
+ cli: codex
20
+ role: 'Plans implementation and acceptance criteria'
21
+ permissions: { access: readonly }
22
+ interactive: false
23
+ - name: developer
24
+ cli: codex
25
+ role: 'Implements planned changes'
26
+ permissions: { access: readwrite }
27
+ interactive: false
28
+ - name: reviewer
29
+ cli: claude
30
+ role: 'Reviews code quality and release risk'
31
+ permissions: { access: readonly }
32
+ workflows:
33
+ - name: feature-delivery
34
+ description: 'Plan, implement, review, and finalize a feature request with quality gates.'
35
+ onError: retry
36
+ preflight:
37
+ - command: git status --porcelain
38
+ failIf: non-empty
39
+ description: 'Ensure working directory is clean'
40
+ - command: npm run type-check 2>/dev/null || echo "skip"
41
+ description: 'Run type checking if available'
42
+ steps:
43
+ # Agent: Planning
44
+ - name: plan
45
+ type: agent
46
+ agent: planner
47
+ task: |
48
+ Analyze the feature request and produce a concrete implementation plan:
49
+ {{task}}
50
+ retries: 1
51
+ verification:
52
+ type: output_contains
53
+ value: PLAN_COMPLETE
54
+
55
+ # Deterministic: Create feature branch
56
+ - name: create-branch
57
+ type: deterministic
58
+ dependsOn: [plan]
59
+ command: git checkout -b feature/{{branch-name}}
60
+
61
+ # Agent: Implementation
62
+ - name: implement
63
+ type: agent
64
+ agent: developer
65
+ dependsOn: [create-branch]
66
+ task: |
67
+ Implement the approved plan:
68
+ {{steps.plan.output}}
69
+ retries: 1
70
+ verification:
71
+ type: output_contains
72
+ value: IMPLEMENTATION_COMPLETE
73
+
74
+ # Deterministic: Lint
75
+ - name: lint
76
+ type: deterministic
77
+ dependsOn: [implement]
78
+ command: npm run lint:fix 2>/dev/null || npm run lint 2>/dev/null || echo "No lint configured"
79
+
80
+ # Deterministic: Run tests
81
+ - name: test
82
+ type: deterministic
83
+ dependsOn: [lint]
84
+ command: npm test 2>/dev/null || echo "No tests configured"
85
+
86
+ # Agent: Fix any failures (with iteration limit)
87
+ - name: fix-failures
88
+ type: agent
89
+ agent: developer
90
+ dependsOn: [test]
91
+ task: |
92
+ Review test results and fix any failures. If all tests passed, output TESTS_PASSED.
93
+ Test output: {{steps.test.output}}
94
+ maxIterations: 2
95
+ verification:
96
+ type: output_contains
97
+ value: TESTS_PASSED
98
+
99
+ # Deterministic: Stage and commit
100
+ - name: commit
101
+ type: deterministic
102
+ dependsOn: [fix-failures]
103
+ command: 'git add -A && git commit -m "feat: {{steps.plan.output | first-line}}"'
104
+
105
+ # Agent: Code review
106
+ - name: review
107
+ type: agent
108
+ agent: reviewer
109
+ dependsOn: [commit]
110
+ task: |
111
+ Review implementation quality, correctness, and test coverage:
112
+ {{steps.implement.output}}
113
+ verification:
114
+ type: output_contains
115
+ value: REVIEW_COMPLETE
116
+
117
+ # Deterministic: Push to remote
118
+ - name: push
119
+ type: deterministic
120
+ dependsOn: [review]
121
+ command: git push origin feature/{{branch-name}}
122
+
123
+ # Agent: Finalize
124
+ - name: finalize
125
+ type: agent
126
+ agent: lead
127
+ dependsOn: [push]
128
+ task: |
129
+ Summarize decisions and ship readiness for the feature.
130
+ verification:
131
+ type: output_contains
132
+ value: DONE
133
+ coordination:
134
+ barriers:
135
+ - name: delivery-ready
136
+ waitFor: [plan, implement, review]
137
+ timeoutMs: 900000
138
+ state:
139
+ backend: memory
140
+ ttlMs: 86400000
141
+ namespace: feature-dev
142
+ errorHandling:
143
+ strategy: retry
144
+ maxRetries: 2
145
+ retryDelayMs: 5000
146
+ notifyChannel: swarm-feature-dev
@@ -0,0 +1,145 @@
1
+ version: '1.0'
2
+ name: refactor
3
+ description: 'Blueprint-style refactor workflow with deterministic quality gates.'
4
+ swarm:
5
+ pattern: hierarchical
6
+ maxConcurrency: 2
7
+ timeoutMs: 4500000
8
+ channel: swarm-refactor
9
+ idleNudge:
10
+ nudgeAfterMs: 120000
11
+ escalateAfterMs: 120000
12
+ maxNudges: 1
13
+ agents:
14
+ - name: lead
15
+ cli: claude
16
+ role: 'Owns scope, sequencing, and acceptance'
17
+ permissions: { access: full }
18
+ - name: architect
19
+ cli: codex
20
+ role: 'Designs target architecture and migration plan'
21
+ permissions: { access: readwrite }
22
+ interactive: false
23
+ - name: refactorer
24
+ cli: codex
25
+ role: 'Executes scoped refactor changes'
26
+ permissions: { access: readwrite }
27
+ interactive: false
28
+ - name: tester
29
+ cli: claude
30
+ role: 'Validates behavior parity and risk'
31
+ permissions: { access: readonly }
32
+ workflows:
33
+ - name: refactor-execution
34
+ description: 'Analyze current system, design approach, refactor, and validate.'
35
+ onError: retry
36
+ preflight:
37
+ - command: git status --porcelain
38
+ failIf: non-empty
39
+ description: 'Ensure working directory is clean'
40
+ - command: npm test 2>/dev/null || echo "baseline"
41
+ description: 'Capture baseline test results'
42
+ steps:
43
+ # Agent: Analyze current design
44
+ - name: analyze
45
+ type: agent
46
+ agent: architect
47
+ task: |
48
+ Analyze current design and identify refactor opportunities:
49
+ {{task}}
50
+ verification:
51
+ type: output_contains
52
+ value: ANALYSIS_COMPLETE
53
+
54
+ # Agent: Design refactor plan
55
+ - name: design
56
+ type: agent
57
+ agent: architect
58
+ dependsOn: [analyze]
59
+ task: |
60
+ Provide incremental refactor plan with rollback notes:
61
+ {{steps.analyze.output}}
62
+ verification:
63
+ type: output_contains
64
+ value: PLAN_COMPLETE
65
+
66
+ # Deterministic: Create refactor branch
67
+ - name: create-branch
68
+ type: deterministic
69
+ dependsOn: [design]
70
+ command: git checkout -b refactor/{{branch-name}}
71
+
72
+ # Agent: Execute refactor
73
+ - name: refactor-code
74
+ type: agent
75
+ agent: refactorer
76
+ dependsOn: [create-branch]
77
+ task: |
78
+ Execute the refactor plan while preserving behavior:
79
+ {{steps.design.output}}
80
+ retries: 2
81
+ verification:
82
+ type: output_contains
83
+ value: REFACTOR_COMPLETE
84
+
85
+ # Deterministic: Run linting
86
+ - name: lint
87
+ type: deterministic
88
+ dependsOn: [refactor-code]
89
+ command: npm run lint:fix 2>/dev/null || npm run lint 2>/dev/null || echo "No lint configured"
90
+
91
+ # Deterministic: Run tests
92
+ - name: test
93
+ type: deterministic
94
+ dependsOn: [lint]
95
+ command: npm test
96
+
97
+ # Agent: Validate behavior parity
98
+ - name: validate
99
+ type: agent
100
+ agent: tester
101
+ dependsOn: [test]
102
+ task: |
103
+ Validate no regressions and ensure tests/quality checks pass:
104
+ {{steps.refactor-code.output}}
105
+ Test results: {{steps.test.output}}
106
+ verification:
107
+ type: output_contains
108
+ value: VALIDATION_COMPLETE
109
+
110
+ # Deterministic: Commit
111
+ - name: commit
112
+ type: deterministic
113
+ dependsOn: [validate]
114
+ command: 'git add -A && git commit -m "refactor: {{steps.design.output | first-line}}"'
115
+
116
+ # Deterministic: Push
117
+ - name: push
118
+ type: deterministic
119
+ dependsOn: [commit]
120
+ command: git push origin refactor/{{branch-name}}
121
+
122
+ # Agent: Handoff
123
+ - name: handoff
124
+ type: agent
125
+ agent: lead
126
+ dependsOn: [push]
127
+ task: |
128
+ Produce final refactor summary and open follow-up items.
129
+ verification:
130
+ type: output_contains
131
+ value: DONE
132
+ coordination:
133
+ barriers:
134
+ - name: refactor-ready
135
+ waitFor: [analyze, design, refactor-code, validate]
136
+ timeoutMs: 900000
137
+ state:
138
+ backend: memory
139
+ ttlMs: 604800000
140
+ namespace: refactor
141
+ errorHandling:
142
+ strategy: retry
143
+ maxRetries: 2
144
+ retryDelayMs: 5000
145
+ notifyChannel: swarm-refactor