sisyphi 0.1.2 → 0.1.4

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 (74) hide show
  1. package/README.md +103 -33
  2. package/dist/{chunk-FWHTKXN5.js → chunk-N2BPQOO2.js} +23 -3
  3. package/dist/chunk-N2BPQOO2.js.map +1 -0
  4. package/dist/cli.js +85 -162
  5. package/dist/cli.js.map +1 -1
  6. package/dist/daemon.js +603 -186
  7. package/dist/daemon.js.map +1 -1
  8. package/dist/templates/CLAUDE.md +50 -0
  9. package/dist/templates/agent-plugin/.claude/agents/debug.md +39 -0
  10. package/dist/templates/agent-plugin/.claude/agents/plan.md +101 -0
  11. package/dist/templates/agent-plugin/.claude/agents/review-plan.md +81 -0
  12. package/dist/templates/agent-plugin/.claude/agents/review.md +56 -0
  13. package/dist/templates/agent-plugin/.claude/agents/spec-draft.md +73 -0
  14. package/dist/templates/agent-plugin/.claude/agents/test-spec.md +56 -0
  15. package/dist/templates/agent-plugin/.claude-plugin/plugin.json +5 -0
  16. package/dist/templates/agent-plugin/agents/CLAUDE.md +52 -0
  17. package/dist/templates/agent-plugin/agents/debug.md +39 -0
  18. package/dist/templates/agent-plugin/agents/operator.md +56 -0
  19. package/dist/templates/agent-plugin/agents/plan.md +101 -0
  20. package/dist/templates/agent-plugin/agents/review-plan.md +81 -0
  21. package/dist/templates/agent-plugin/agents/review.md +56 -0
  22. package/dist/templates/agent-plugin/agents/spec-draft.md +73 -0
  23. package/dist/templates/agent-plugin/agents/test-spec.md +56 -0
  24. package/dist/templates/agent-suffix.md +3 -1
  25. package/dist/templates/banner.txt +24 -6
  26. package/dist/templates/orchestrator-plugin/.claude/commands/begin.md +62 -0
  27. package/dist/templates/orchestrator-plugin/.claude/skills/orchestration/SKILL.md +40 -0
  28. package/dist/templates/orchestrator-plugin/.claude/skills/orchestration/task-patterns.md +222 -0
  29. package/dist/templates/orchestrator-plugin/.claude/skills/orchestration/workflow-examples.md +208 -0
  30. package/dist/templates/orchestrator-plugin/.claude-plugin/plugin.json +5 -0
  31. package/dist/templates/orchestrator-plugin/hooks/hooks.json +25 -0
  32. package/dist/templates/orchestrator-plugin/scripts/block-task.sh +4 -0
  33. package/dist/templates/orchestrator-plugin/scripts/stop-suggest.sh +4 -0
  34. package/dist/templates/orchestrator-plugin/skills/git-management/SKILL.md +111 -0
  35. package/dist/templates/orchestrator-plugin/skills/orchestration/SKILL.md +40 -0
  36. package/dist/templates/orchestrator-plugin/skills/orchestration/task-patterns.md +248 -0
  37. package/dist/templates/orchestrator-plugin/skills/orchestration/workflow-examples.md +237 -0
  38. package/dist/templates/orchestrator-settings.json +2 -0
  39. package/dist/templates/orchestrator.md +56 -49
  40. package/dist/templates/resources/.claude/agents/debug.md +39 -0
  41. package/dist/templates/resources/.claude/agents/plan.md +101 -0
  42. package/dist/templates/resources/.claude/agents/review-plan.md +81 -0
  43. package/dist/templates/resources/.claude/agents/review.md +56 -0
  44. package/dist/templates/resources/.claude/agents/spec-draft.md +73 -0
  45. package/dist/templates/resources/.claude/agents/test-spec.md +56 -0
  46. package/dist/templates/resources/.claude/commands/begin.md +62 -0
  47. package/dist/templates/resources/.claude/skills/orchestration/SKILL.md +40 -0
  48. package/dist/templates/resources/.claude/skills/orchestration/task-patterns.md +222 -0
  49. package/dist/templates/resources/.claude/skills/orchestration/workflow-examples.md +208 -0
  50. package/dist/templates/resources/.claude-plugin/plugin.json +8 -0
  51. package/package.json +2 -2
  52. package/templates/CLAUDE.md +50 -0
  53. package/templates/agent-plugin/.claude-plugin/plugin.json +5 -0
  54. package/templates/agent-plugin/agents/CLAUDE.md +52 -0
  55. package/templates/agent-plugin/agents/debug.md +39 -0
  56. package/templates/agent-plugin/agents/operator.md +56 -0
  57. package/templates/agent-plugin/agents/plan.md +101 -0
  58. package/templates/agent-plugin/agents/review-plan.md +81 -0
  59. package/templates/agent-plugin/agents/review.md +56 -0
  60. package/templates/agent-plugin/agents/spec-draft.md +73 -0
  61. package/templates/agent-plugin/agents/test-spec.md +56 -0
  62. package/templates/agent-suffix.md +3 -1
  63. package/templates/banner.txt +24 -6
  64. package/templates/orchestrator-plugin/.claude-plugin/plugin.json +5 -0
  65. package/templates/orchestrator-plugin/hooks/hooks.json +25 -0
  66. package/templates/orchestrator-plugin/scripts/block-task.sh +4 -0
  67. package/templates/orchestrator-plugin/scripts/stop-suggest.sh +4 -0
  68. package/templates/orchestrator-plugin/skills/git-management/SKILL.md +111 -0
  69. package/templates/orchestrator-plugin/skills/orchestration/SKILL.md +40 -0
  70. package/templates/orchestrator-plugin/skills/orchestration/task-patterns.md +248 -0
  71. package/templates/orchestrator-plugin/skills/orchestration/workflow-examples.md +237 -0
  72. package/templates/orchestrator-settings.json +2 -0
  73. package/templates/orchestrator.md +56 -49
  74. package/dist/chunk-FWHTKXN5.js.map +0 -1
@@ -0,0 +1,208 @@
1
+ # Workflow Examples
2
+
3
+ End-to-end examples showing how the orchestrator structures cycles for real scenarios.
4
+
5
+ ---
6
+
7
+ ## Example 1: Fix a Race Condition in WebSocket Reconnection
8
+
9
+ **Starting task**: "WebSocket connections sometimes drop messages during reconnection"
10
+
11
+ ### Cycle 1 — Diagnosis
12
+ ```
13
+ Tasks added:
14
+ t1: Diagnose message loss during WebSocket reconnection
15
+ t2: Fix root cause
16
+ t3: Validate fix under concurrent load
17
+ t4: Review fix
18
+
19
+ Agents spawned:
20
+ debug agent → t1: "Diagnose why WebSocket messages are lost during reconnection.
21
+ Focus on src/ws/client.ts and src/ws/reconnect.ts.
22
+ Check for race conditions between disconnect handler and message queue.
23
+ Look at git blame for recent changes to reconnection logic."
24
+ ```
25
+
26
+ ### Cycle 2 — Read diagnosis, plan fix
27
+ ```
28
+ Agent report: "Root cause: reconnect() clears the message queue before the new socket
29
+ is ready. Messages sent between disconnect and reconnect are dropped.
30
+ Line 47 of src/ws/reconnect.ts — queue.clear() is called in onDisconnect
31
+ but should be deferred until onReconnect confirms the new socket is live.
32
+ Confidence: High."
33
+
34
+ Tasks updated:
35
+ t1: complete
36
+
37
+ Agents spawned:
38
+ implement agent → t2: "Fix race condition in src/ws/reconnect.ts.
39
+ Root cause: queue.clear() at line 47 runs on disconnect, dropping pending messages.
40
+ Fix: defer queue drain until reconnect confirms new socket. Buffer messages during
41
+ reconnection window. See existing buffer pattern in src/ws/buffer.ts."
42
+ ```
43
+
44
+ ### Cycle 3 — Validate
45
+ ```
46
+ Agent report: "Fixed. Moved queue.clear() to onReconnect callback after socket.readyState
47
+ confirms OPEN. Added message buffer during reconnection window. 2 files changed."
48
+
49
+ Tasks updated:
50
+ t2: complete
51
+
52
+ Agents spawned:
53
+ validate agent → t3: "Verify WebSocket reconnection fix. Run existing tests in
54
+ src/__tests__/ws/. Manually verify: disconnect simulation should not lose queued
55
+ messages. Check that buffer drains correctly on reconnect."
56
+ ```
57
+
58
+ ### Cycle 4 — Review and complete
59
+ ```
60
+ Validation: PASS. Existing tests pass, reconnection preserves messages.
61
+
62
+ Tasks updated:
63
+ t3: complete
64
+
65
+ Agents spawned:
66
+ review agent → t4: "Review changes in src/ws/reconnect.ts and src/ws/buffer.ts.
67
+ Focus on: thread safety of the new buffer, memory leak potential if reconnect
68
+ never succeeds, edge case of rapid disconnect/reconnect cycles."
69
+ ```
70
+
71
+ ### Cycle 5 — Complete
72
+ ```
73
+ Review: Clean. One medium finding — buffer should have a max size to prevent
74
+ memory issues if reconnect fails indefinitely. Not blocking.
75
+
76
+ Tasks updated:
77
+ t4: complete
78
+
79
+ Action: complete — "Fixed WebSocket message loss during reconnection. Messages now
80
+ buffered during reconnection window and drained on successful reconnect."
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Example 2: Add API Rate Limiting
86
+
87
+ **Starting task**: "Add rate limiting to the REST API — per-user, configurable limits"
88
+
89
+ ### Cycle 1 — Spec
90
+ ```
91
+ Tasks added:
92
+ t1: Draft spec for API rate limiting
93
+ t2: Plan implementation
94
+ t3: Review plan
95
+ t4: Implement rate limiting middleware
96
+ t5: Implement rate limit configuration
97
+ t6: Implement rate limit headers and error responses
98
+ t7: Validate implementation
99
+ t8: Review implementation
100
+
101
+ Agents spawned:
102
+ spec-draft agent → t1: "Investigate codebase and draft spec for per-user API rate
103
+ limiting. Check existing middleware patterns in src/api/middleware/.
104
+ Questions to resolve: storage backend (Redis vs in-memory), limit granularity
105
+ (per-endpoint vs global), response format for rate-limited requests."
106
+ ```
107
+
108
+ ### Cycle 2 — Plan (after human reviews spec)
109
+ ```
110
+ Agent report: "Spec saved to context/spec-rate-limiting.md.
111
+ Approach: Redis-backed sliding window. Per-user with endpoint-specific overrides.
112
+ Standard 429 response with Retry-After header. Config via environment variables.
113
+ Open questions resolved with user: Redis is already in stack, use it."
114
+
115
+ Tasks updated:
116
+ t1: complete
117
+
118
+ Agents spawned:
119
+ plan agent → t2: "Create implementation plan from spec at context/spec-rate-limiting.md"
120
+ test-spec agent → (new task): "Define behavioral properties for rate limiting from spec"
121
+ ```
122
+
123
+ ### Cycle 3 — Review plan
124
+ ```
125
+ Both agents complete. Plan at context/plan-rate-limiting.md.
126
+ Plan has 3 phases: middleware (t4), config (t5), response format (t6).
127
+
128
+ Agents spawned:
129
+ review-plan agent → t3: "Validate plan at context/plan-rate-limiting.md
130
+ against spec at context/spec-rate-limiting.md"
131
+ ```
132
+
133
+ ### Cycle 4 — Implement (phases 1+2 parallel)
134
+ ```
135
+ Plan review: PASS.
136
+
137
+ Tasks updated:
138
+ t3: complete
139
+
140
+ Agents spawned:
141
+ implement agent → t4: "Implement Phase 1 from context/plan-rate-limiting.md —
142
+ rate limiting middleware in src/api/middleware/rate-limit.ts"
143
+ implement agent → t5: "Implement Phase 2 from context/plan-rate-limiting.md —
144
+ rate limit configuration in src/config/rate-limits.ts"
145
+ ```
146
+
147
+ ### Cycle 5-7 — Continue phases, validate, review, complete
148
+
149
+ ---
150
+
151
+ ## Example 3: Refactor Authentication Module
152
+
153
+ **Starting task**: "Refactor auth — extract token logic from route handlers into dedicated service"
154
+
155
+ ### Cycle 1 — Plan + baseline
156
+ ```
157
+ Tasks added:
158
+ t1: Plan auth refactor — extract token service
159
+ t2: Capture behavioral baseline (run all auth tests)
160
+ t3: Create TokenService class with extracted logic
161
+ t4: Update route handlers to use TokenService
162
+ t5: Update tests to use new service interface
163
+ t6: Validate all auth tests still pass
164
+ t7: Review for dead code and missed references
165
+
166
+ Agents spawned (parallel):
167
+ plan agent → t1: "Plan refactor: extract token creation, validation, and refresh
168
+ logic from src/api/routes/auth.ts into a new src/services/token-service.ts.
169
+ Map all token-related functions, their callers, and the extraction plan."
170
+ validate agent → t2: "Run all tests in src/__tests__/auth/ and record results.
171
+ This is the behavioral baseline — these must all pass after refactor."
172
+ ```
173
+
174
+ ### Cycle 2 — Extract (serial — must happen before consumer updates)
175
+ ```
176
+ Plan complete, baseline captured (47 tests passing).
177
+
178
+ Agents spawned:
179
+ implement agent → t3: "Execute Phase 1 of refactor plan: create TokenService class
180
+ at src/services/token-service.ts. Extract validateToken, createToken, refreshToken
181
+ from src/api/routes/auth.ts. Export the class. Do NOT modify route handlers yet."
182
+ ```
183
+
184
+ ### Cycle 3 — Update consumers (parallel where possible)
185
+ ```
186
+ TokenService created.
187
+
188
+ Agents spawned:
189
+ implement agent → t4: "Update route handlers in src/api/routes/auth.ts to import
190
+ and use TokenService instead of inline token logic. Remove extracted functions."
191
+ implement agent → t5: "Update tests in src/__tests__/auth/ to use TokenService
192
+ where they directly tested extracted functions."
193
+ ```
194
+
195
+ ### Cycle 4 — Validate + review
196
+ ```
197
+ Agents spawned (parallel):
198
+ validate agent → t6: "Run all auth tests. Compare against baseline of 47 passing.
199
+ Every test must still pass."
200
+ review agent → t7: "Review src/api/routes/auth.ts and src/services/token-service.ts.
201
+ Check for: dead code left behind, missed references to old functions, broken imports."
202
+ ```
203
+
204
+ ### Cycle 5 — Complete
205
+ ```
206
+ All 47 tests passing. Review clean.
207
+ Complete — "Extracted token logic into TokenService. All existing tests pass."
208
+ ```
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "sisyphus-orchestrator",
3
+ "version": "1.0.0",
4
+ "description": "Skills and commands for the sisyphus orchestrator"
5
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "Task",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "\"${CLAUDE_PLUGIN_ROOT}/scripts/block-task.sh\""
10
+ }
11
+ ]
12
+ }
13
+ ],
14
+ "Stop": [
15
+ {
16
+ "hooks": [
17
+ {
18
+ "type": "command",
19
+ "command": "\"${CLAUDE_PLUGIN_ROOT}/scripts/stop-suggest.sh\""
20
+ }
21
+ ]
22
+ }
23
+ ]
24
+ }
25
+ }
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+ cat <<'EOF'
3
+ {"decision":"block","reason":"Do not use the Task tool. Use `sisyphus spawn` to spawn agents in tmux panes instead."}
4
+ EOF
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+ cat <<'EOF'
3
+ {"decision":"block","reason":"Before stopping, consider: use `sisyphus yield` to end this cycle and let the daemon respawn you with updated state, or use AskUserQuestion if you need clarification from the user."}
4
+ EOF
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: git-management
3
+ description: >
4
+ Set up and manage git worktree isolation for parallel agents. How to analyze a project for worktree config, create .sisyphus/worktree.json, handle merge conflicts surfaced by the daemon, and decide when to use --worktree vs not.
5
+ ---
6
+
7
+ # Git Worktree Management
8
+
9
+ ## Setting Up Worktree Config
10
+
11
+ Analyze the project to determine what gitignored files/directories agents need. Create `.sisyphus/worktree.json`:
12
+
13
+ ### Config Format
14
+
15
+ ```json
16
+ {
17
+ "copy": [],
18
+ "clone": [],
19
+ "symlink": [],
20
+ "init": ""
21
+ }
22
+ ```
23
+
24
+ **Fields:**
25
+ - `copy` — Files/dirs to copy from main worktree (e.g., `.env`, `.env.local`). Use for small files that may need per-worktree modifications.
26
+ - `clone` — Files/dirs to APFS copy-on-write clone (e.g., `node_modules`, `vendor`, `target`). Near-zero cost on macOS. Falls back to regular copy on other systems. Use for large directories.
27
+ - `symlink` — Files/dirs to symlink from main worktree. Use for things that should stay in sync across all worktrees.
28
+ - `init` — Shell command to run after worktree setup (e.g., `npm install`, `pip install -e .`, `cargo build`). Runs with cwd set to the worktree. Failures are logged but don't block agent startup.
29
+
30
+ **Note:** `.sisyphus` and `.claude` directories are ALWAYS symlinked automatically — you don't need to include them.
31
+
32
+ ### Analysis Checklist
33
+
34
+ Scan the project root for gitignored files that agents will need:
35
+
36
+ 1. **Environment files**: `.env`, `.env.local`, `.env.development` — usually `copy` (agents may need different ports)
37
+ 2. **Dependencies**: `node_modules`, `vendor`, `target`, `.venv`, `__pycache__` — use `clone` for large dirs
38
+ 3. **Build artifacts**: `dist`, `.next`, `build`, `.turbo` — usually `clone` for warm cache, or skip and let `init` rebuild
39
+ 4. **Tool config**: `.eslintcache`, `.pretterircache`, `.tsbuildinfo` — usually skip, tools regenerate
40
+ 5. **Other dotfiles**: Check what exists at root. Err on the side of including too much rather than too little.
41
+
42
+ ### Example Configs
43
+
44
+ **Node.js (npm/yarn):**
45
+ ```json
46
+ {
47
+ "copy": [".env", ".env.local"],
48
+ "clone": ["node_modules"],
49
+ "init": "npm install --prefer-offline"
50
+ }
51
+ ```
52
+
53
+ **Node.js (pnpm):**
54
+ ```json
55
+ {
56
+ "copy": [".env"],
57
+ "clone": [],
58
+ "init": "pnpm install --frozen-lockfile"
59
+ }
60
+ ```
61
+
62
+ **Python:**
63
+ ```json
64
+ {
65
+ "copy": [".env"],
66
+ "clone": [".venv"],
67
+ "init": "source .venv/bin/activate && pip install -e ."
68
+ }
69
+ ```
70
+
71
+ **Rust:**
72
+ ```json
73
+ {
74
+ "clone": ["target"],
75
+ "init": "cargo build"
76
+ }
77
+ ```
78
+
79
+ **No dependencies (simple project):**
80
+ ```json
81
+ {
82
+ "copy": [".env"]
83
+ }
84
+ ```
85
+
86
+ ## Handling Merge Conflicts
87
+
88
+ When the daemon merges agent branches back, conflicts appear in the `## Worktrees` section of your state block. For each conflicting agent you'll see:
89
+ - The branch name (still exists, unmerged)
90
+ - The worktree path (still exists on disk)
91
+ - The conflict details (git merge stderr output)
92
+
93
+ **Resolution approaches:**
94
+ 1. **Spawn a resolution agent** in the conflicting worktree to manually resolve and commit
95
+ 2. **Rebase the branch** onto current HEAD and resolve conflicts
96
+ 3. **Cherry-pick specific commits** instead of merging the whole branch
97
+ 4. **Discard the branch** if the work can be redone more cleanly
98
+
99
+ After resolution, the branch can be merged manually or left for the next cycle's automatic merge attempt.
100
+
101
+ ## When to Use Worktrees
102
+
103
+ **Use `--worktree`** when:
104
+ - Multiple agents will work on different features that touch overlapping files
105
+ - Agents need to make structural changes (renames, moves, deletes)
106
+ - The task involves feature branches that should be independently testable
107
+
108
+ **Skip `--worktree`** when:
109
+ - Agents work on completely separate files with no overlap
110
+ - Quick fixes or single-file changes
111
+ - Agents only read code (exploration, review)
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: orchestration
3
+ description: >
4
+ Task breakdown patterns for sisyphus orchestrator sessions. How to structure tasks, sequence agents, and manage cycles for debugging, feature builds, refactors, and other common workflows. Use when planning orchestration strategy or structuring a multi-agent session.
5
+ ---
6
+
7
+ # Orchestration Patterns
8
+
9
+ How to structure sisyphus sessions for common task types. This skill helps the orchestrator break work into tasks, choose agent types, sequence cycles, and handle failures.
10
+
11
+ ## Core Principles
12
+
13
+ 1. **plan.md is the orchestrator's memory.** plan.md and agent reports persist across cycles — they're all you have. Keep plan.md current and specific enough that a fresh orchestrator can pick up where you left off.
14
+
15
+ 2. **Agents are disposable.** Each agent gets one focused instruction. If it fails or the scope changes, spawn a new one — don't try to redirect a running agent.
16
+
17
+ 3. **Parallelize when independent.** If two tasks don't share files or depend on each other's output, spawn agents for both in the same cycle.
18
+
19
+ 4. **Validate at boundaries.** After each logical phase completes, spawn a validation agent before moving on. Catching problems early prevents cascading rework.
20
+
21
+ 5. **Reports are handoffs.** Agent reports should contain everything the next cycle's orchestrator needs — what was done, what was found, what's unresolved, where artifacts were saved.
22
+
23
+ ## Agent Types Quick Reference
24
+
25
+ | Agent | Model | Use For |
26
+ |-------|-------|---------|
27
+ | `sisyphus:general` | sonnet | Ad-hoc tasks, summarization, simple questions |
28
+ | `sisyphus:debug` | opus | Bug diagnosis and root cause analysis |
29
+ | `sisyphus:spec-draft` | opus | Feature investigation and spec drafting |
30
+ | `sisyphus:plan` | opus | Implementation planning from spec |
31
+ | `sisyphus:review-plan` | opus | Validate plan covers spec completely |
32
+ | `sisyphus:test-spec` | opus | Define behavioral properties to verify |
33
+ | `sisyphus:implement` | sonnet | Execute plan phases, write code |
34
+ | `sisyphus:validate` | opus | Verify implementation matches plan |
35
+ | `sisyphus:review` | opus | Code review with parallel concern subagents |
36
+ | `sisyphus:tactician` | opus | Track plan progress, dispatch next task |
37
+ | `sisyphus:triage` | sonnet | Classify tickets by type/size |
38
+
39
+ For task breakdown patterns per workflow type, see [task-patterns.md](task-patterns.md).
40
+ For end-to-end workflow examples, see [workflow-examples.md](workflow-examples.md).
@@ -0,0 +1,248 @@
1
+ # Work Breakdown Patterns
2
+
3
+ Patterns for how the orchestrator should structure plan.md for common workflow types. Each pattern shows the plan structure, agent assignments, cycle sequencing, and failure handling.
4
+
5
+ ---
6
+
7
+ ## Bug Fix
8
+
9
+ ### When to use
10
+ Something is broken. User reports a bug, test is failing, behavior is wrong.
11
+
12
+ ### Plan structure
13
+ ```
14
+ ## Bug Fix: [description]
15
+
16
+ - [ ] Diagnose root cause of [bug description]
17
+ - [ ] Implement fix for [root cause]
18
+ - [ ] Validate fix — regression tests pass, bug is resolved
19
+ - [ ] Review fix for unintended side effects
20
+ ```
21
+
22
+ ### Cycle plan
23
+ - **Cycle 1**: Spawn `sisyphus:debug` for diagnosis. Yield.
24
+ - **Cycle 2**: Read diagnosis report. If confident root cause found, spawn `sisyphus:implement` for fix with the diagnosis as context. Yield.
25
+ - **Cycle 3**: Spawn `sisyphus:validate` for validation. Yield.
26
+ - **Cycle 4**: If validation passes, spawn `sisyphus:review` for review. If fails, update plan with failure context and respawn implement. Yield.
27
+ - **Cycle 5**: Review results. Complete or address review findings.
28
+
29
+ ### Failure modes
30
+ - **Debug inconclusive**: Add more context to plan, respawn debug with narrower scope or different focus areas.
31
+ - **Fix breaks other things**: Validation catches this. Feed validation failures back into a new implement cycle.
32
+ - **Root cause was wrong**: Update plan with what was learned, respawn debug.
33
+
34
+ ### Parallelization
35
+ Usually serial — diagnosis must complete before fix, fix before validation. Exception: if the bug affects multiple independent areas, spawn multiple debug agents in parallel.
36
+
37
+ ---
38
+
39
+ ## Feature Build (Small — 1-3 files)
40
+
41
+ ### When to use
42
+ Clear requirements, small scope, no spec needed.
43
+
44
+ ### Plan structure
45
+ ```
46
+ ## Feature: [description]
47
+
48
+ - [ ] Plan implementation for [feature]
49
+ - [ ] Implement [feature]
50
+ - [ ] Validate implementation
51
+ ```
52
+
53
+ ### Cycle plan
54
+ - **Cycle 1**: Spawn `sisyphus:plan` for planning. Yield.
55
+ - **Cycle 2**: Spawn `sisyphus:implement` with plan path. Yield.
56
+ - **Cycle 3**: Spawn `sisyphus:validate` for validation. Yield.
57
+ - **Cycle 4**: Complete or fix issues.
58
+
59
+ ### Parallelization
60
+ Serial. Too small to benefit from parallel agents.
61
+
62
+ ---
63
+
64
+ ## Feature Build (Medium — 4-10 files)
65
+
66
+ ### When to use
67
+ Feature with moderate complexity. Requirements may need clarification. Multiple files across a few modules.
68
+
69
+ ### Plan structure
70
+ ```
71
+ ## Feature: [description]
72
+
73
+ ### Spec & Planning
74
+ - [ ] Draft spec — investigate codebase, propose approach
75
+ - [ ] Create implementation plan from spec
76
+ - [ ] Review plan against spec
77
+
78
+ ### Implementation
79
+ - [ ] Phase 1 — [foundation/types/interfaces]
80
+ - [ ] Phase 2 — [core logic]
81
+ - [ ] Phase 3 — [integration/wiring]
82
+
83
+ ### Validation
84
+ - [ ] Validate full implementation
85
+ - [ ] Review implementation
86
+ ```
87
+
88
+ ### Cycle plan
89
+ - **Cycle 1**: Spawn `sisyphus:spec-draft` for spec. Yield. (Human iterates on spec between cycles.)
90
+ - **Cycle 2**: Spawn `sisyphus:plan` for plan. Yield.
91
+ - **Cycle 3**: Spawn `sisyphus:review-plan` for review. If fail, respawn plan with issues. Yield.
92
+ - **Cycle 4**: Spawn `sisyphus:implement` for Phase 1. Yield.
93
+ - **Cycle 5**: Spawn `sisyphus:implement` for Phase 2 + `sisyphus:validate` for Phase 1 (parallel if independent). Yield.
94
+ - **Cycle 6-8**: Continue phases, validate, review.
95
+
96
+ ### Failure modes
97
+ - **Spec needs human input**: Mark session as needing human review. Orchestrator notes open questions.
98
+ - **Plan fails review**: Feed review issues back, respawn planner.
99
+ - **Phase fails validation**: Feed specifics back to implement agent for that phase only.
100
+
101
+ ### Parallelization
102
+ Phases without dependencies can run in parallel. Types/interfaces (Phase 1) must complete before implementation phases that consume them.
103
+
104
+ ---
105
+
106
+ ## Feature Build (Large — 10+ files)
107
+
108
+ ### When to use
109
+ Cross-cutting feature, multiple domains, needs team coordination.
110
+
111
+ ### Plan structure
112
+ ```
113
+ ## Feature: [description]
114
+
115
+ ### Spec & Planning
116
+ - [ ] Draft spec
117
+ - [ ] Create master implementation plan
118
+ - [ ] Review plan against spec
119
+ - [ ] Define behavioral test properties
120
+
121
+ ### Implementation
122
+ - [ ] Phase 1 — [domain A foundation]
123
+ - [ ] Phase 2 — [domain B foundation]
124
+ - [ ] Phase 3 — [domain A implementation]
125
+ - [ ] Phase 4 — [domain B implementation]
126
+ - [ ] Phase 5 — [integration layer]
127
+
128
+ ### Validation
129
+ - [ ] Validate full implementation
130
+ - [ ] Review implementation
131
+ - [ ] Adversarial validation against test spec
132
+ ```
133
+
134
+ ### Cycle plan
135
+ - **Cycle 1**: Spawn `sisyphus:spec-draft` for spec. Yield.
136
+ - **Cycle 2**: Spawn `sisyphus:plan` for plan + `sisyphus:test-spec` for test properties (parallel). Yield.
137
+ - **Cycle 3**: Spawn `sisyphus:review-plan` for review. Yield.
138
+ - **Cycle 4**: Spawn `sisyphus:implement` for Phase 1 + Phase 2 (parallel — independent domains). Yield.
139
+ - **Cycle 5**: Validate Phase 1 + Phase 2, then spawn Phase 3 + Phase 4 (parallel). Yield.
140
+ - **Cycle 6+**: Integration, validation, review.
141
+
142
+ ### Failure modes
143
+ - **Integration failures**: Often means contracts between domains don't match. Spawn debug agent targeting the integration seam.
144
+ - **Test spec violations**: Feed specific property failures back to implement.
145
+
146
+ ### Parallelization
147
+ Maximize. Independent domains run in parallel. Foundation phases complete before implementation phases in the same domain. Integration waits for all domain implementations.
148
+
149
+ ---
150
+
151
+ ## Refactor
152
+
153
+ ### When to use
154
+ Restructure code without changing behavior. Move files, rename abstractions, consolidate patterns.
155
+
156
+ ### Plan structure
157
+ ```
158
+ ## Refactor: [description]
159
+
160
+ - [ ] Analyze current structure and plan refactor
161
+ - [ ] Capture behavioral snapshot (existing tests + manual checks)
162
+ - [ ] Execute refactor phase 1 — [structural changes]
163
+ - [ ] Execute refactor phase 2 — [update consumers]
164
+ - [ ] Validate behavior preserved — all original tests pass
165
+ - [ ] Review for missed references, dead code, broken imports
166
+ ```
167
+
168
+ ### Cycle plan
169
+ - **Cycle 1**: Spawn `sisyphus:plan` for analysis + `sisyphus:validate` to capture baseline (parallel). Yield.
170
+ - **Cycle 2**: Spawn `sisyphus:implement` for phase 1. Yield.
171
+ - **Cycle 3**: Spawn `sisyphus:implement` for phase 2 + `sisyphus:validate` for phase 1 (parallel). Yield.
172
+ - **Cycle 4**: Spawn `sisyphus:validate` for full validation. Yield.
173
+ - **Cycle 5**: Spawn `sisyphus:review` for final review. Complete.
174
+
175
+ ### Key principle
176
+ **Behavior preservation is the only metric.** The refactor is correct if and only if all existing tests pass and externally observable behavior is unchanged.
177
+
178
+ ### Parallelization
179
+ Limited. Refactor phases are often sequential (move before update consumers). Validation can run in parallel with the next phase if they touch different files.
180
+
181
+ ---
182
+
183
+ ## Code Review
184
+
185
+ ### When to use
186
+ PR review, pre-merge check, or periodic quality audit.
187
+
188
+ ### Plan structure
189
+ ```
190
+ ## Review: [scope]
191
+
192
+ - [ ] Review [scope] for issues
193
+ - [ ] (conditional) Fix critical/high issues found
194
+ - [ ] (conditional) Re-review fixes
195
+ ```
196
+
197
+ ### Cycle plan
198
+ - **Cycle 1**: Spawn `sisyphus:review` for review. Yield.
199
+ - **Cycle 2**: If critical/high issues, spawn `sisyphus:implement` for fixes. If clean, complete.
200
+ - **Cycle 3**: Spawn `sisyphus:review` for re-review (targeted at fixes only). Complete.
201
+
202
+ ### Parallelization
203
+ Review itself parallelizes internally (subagents per concern). Fix cycle is usually serial.
204
+
205
+ ---
206
+
207
+ ## Investigation / Spike
208
+
209
+ ### When to use
210
+ Need to understand something before committing to an approach. Prototype, explore, or answer a technical question.
211
+
212
+ ### Plan structure
213
+ ```
214
+ ## Investigation: [question/area]
215
+
216
+ - [ ] Investigate [question/area]
217
+ - [ ] Summarize findings and recommendation
218
+ ```
219
+
220
+ ### Cycle plan
221
+ - **Cycle 1**: Spawn `sisyphus:debug` (for code investigation) or `sisyphus:general` (for broader research). Yield.
222
+ - **Cycle 2**: Spawn `sisyphus:general` to synthesize findings. Complete.
223
+
224
+ ### Parallelization
225
+ If investigating multiple independent areas, spawn parallel agents each exploring a different angle.
226
+
227
+ ---
228
+
229
+ ## Tactician-Driven Implementation
230
+
231
+ ### When to use
232
+ The plan exists and you want automated cycle-by-cycle execution without manual orchestrator decisions. The tactician reads the plan, dispatches one phase at a time, and tracks progress.
233
+
234
+ ### Plan structure
235
+ ```
236
+ ## Tactician Execution
237
+
238
+ - [ ] Execute implementation plan at [path] using tactician loop
239
+ ```
240
+
241
+ ### Cycle plan
242
+ This is a single-item pattern. The orchestrator spawns the tactician once:
243
+ - **Cycle 1**: Spawn `sisyphus:tactician` with plan path. The tactician internally dispatches implement/validate agents via submit tool actions. The orchestrator's role is minimal — just monitor the tactician's completion report.
244
+
245
+ ### When NOT to use
246
+ - When you need human checkpoints between phases
247
+ - When phases have external dependencies (waiting on API access, design review, etc.)
248
+ - When the task requires creative decisions the tactician shouldn't make alone