sisyphi 1.2.2 → 1.2.11

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 (85) hide show
  1. package/README.md +20 -20
  2. package/dist/cli.js +12450 -11255
  3. package/dist/cli.js.map +1 -1
  4. package/dist/daemon.js +1112 -564
  5. package/dist/daemon.js.map +1 -1
  6. package/dist/templates/agent-plugin/agents/CLAUDE.md +2 -2
  7. package/dist/templates/agent-plugin/agents/operator.md +3 -4
  8. package/dist/templates/agent-plugin/agents/plan.md +1 -1
  9. package/dist/templates/agent-plugin/agents/problem.md +20 -20
  10. package/dist/templates/agent-plugin/agents/research-lead.md +1 -1
  11. package/dist/templates/agent-plugin/agents/spec/engineer.md +9 -7
  12. package/dist/templates/agent-plugin/agents/spec/requirements-writer.md +1 -1
  13. package/dist/templates/agent-plugin/agents/spec.md +31 -25
  14. package/dist/templates/agent-plugin/hooks/CLAUDE.md +0 -1
  15. package/dist/templates/agent-plugin/hooks/ask-background-guard.sh +11 -11
  16. package/dist/templates/agent-plugin/hooks/intercept-send-message.sh +1 -1
  17. package/dist/templates/agent-plugin/hooks/operator-user-prompt.sh +2 -2
  18. package/dist/templates/agent-plugin/hooks/plan-validate.sh +3 -3
  19. package/dist/templates/agent-plugin/hooks/require-submit.sh +1 -1
  20. package/dist/templates/agent-plugin/skills/operator/SKILL.md +1 -1
  21. package/dist/templates/agent-suffix.md +4 -18
  22. package/dist/templates/companion-plugin/hooks/user-prompt-context.sh +1 -1
  23. package/dist/templates/dashboard-claude.md +15 -13
  24. package/dist/templates/orchestrator-base.md +44 -78
  25. package/dist/templates/orchestrator-completion.md +9 -11
  26. package/dist/templates/orchestrator-discovery.md +8 -8
  27. package/dist/templates/orchestrator-impl.md +6 -7
  28. package/dist/templates/orchestrator-planning.md +2 -2
  29. package/dist/templates/orchestrator-plugin/commands/sisyphus/scratch.md +1 -1
  30. package/dist/templates/orchestrator-plugin/commands/sisyphus/strategize.md +2 -2
  31. package/dist/templates/orchestrator-validation.md +1 -3
  32. package/dist/templates/termrender-haiku-system.md +5 -3
  33. package/dist/tui.js +1817 -1400
  34. package/dist/tui.js.map +1 -1
  35. package/native/build-notify.sh +2 -2
  36. package/package.json +3 -3
  37. package/templates/agent-plugin/agents/CLAUDE.md +2 -2
  38. package/templates/agent-plugin/agents/operator.md +3 -4
  39. package/templates/agent-plugin/agents/plan.md +1 -1
  40. package/templates/agent-plugin/agents/problem.md +20 -20
  41. package/templates/agent-plugin/agents/research-lead.md +1 -1
  42. package/templates/agent-plugin/agents/spec/engineer.md +9 -7
  43. package/templates/agent-plugin/agents/spec/requirements-writer.md +1 -1
  44. package/templates/agent-plugin/agents/spec.md +31 -25
  45. package/templates/agent-plugin/hooks/CLAUDE.md +0 -1
  46. package/templates/agent-plugin/hooks/ask-background-guard.sh +11 -11
  47. package/templates/agent-plugin/hooks/intercept-send-message.sh +1 -1
  48. package/templates/agent-plugin/hooks/operator-user-prompt.sh +2 -2
  49. package/templates/agent-plugin/hooks/plan-validate.sh +3 -3
  50. package/templates/agent-plugin/hooks/require-submit.sh +1 -1
  51. package/templates/agent-plugin/skills/operator/SKILL.md +1 -1
  52. package/templates/agent-suffix.md +4 -18
  53. package/templates/companion-plugin/hooks/user-prompt-context.sh +1 -1
  54. package/templates/dashboard-claude.md +15 -13
  55. package/templates/orchestrator-base.md +44 -78
  56. package/templates/orchestrator-completion.md +9 -11
  57. package/templates/orchestrator-discovery.md +8 -8
  58. package/templates/orchestrator-impl.md +6 -7
  59. package/templates/orchestrator-planning.md +2 -2
  60. package/templates/orchestrator-plugin/commands/sisyphus/scratch.md +1 -1
  61. package/templates/orchestrator-plugin/commands/sisyphus/strategize.md +2 -2
  62. package/templates/orchestrator-validation.md +1 -3
  63. package/templates/termrender-haiku-system.md +5 -3
  64. package/dist/templates/agent-plugin/skills/humanloop/SKILL.md +0 -148
  65. package/dist/templates/agent-plugin/skills/operator-memory/SKILL.md +0 -64
  66. package/dist/templates/agent-plugin/skills/perspective-fanout/SKILL.md +0 -115
  67. package/dist/templates/agent-plugin/skills/problem-document/SKILL.md +0 -105
  68. package/dist/templates/agent-plugin/skills/problem-plateau-breakers/SKILL.md +0 -83
  69. package/dist/templates/orchestrator-plugin/skills/humanloop/SKILL.md +0 -150
  70. package/dist/templates/orchestrator-plugin/skills/orchestration/CLAUDE.md +0 -1
  71. package/dist/templates/orchestrator-plugin/skills/orchestration/SKILL.md +0 -29
  72. package/dist/templates/orchestrator-plugin/skills/orchestration/strategy.md +0 -160
  73. package/dist/templates/orchestrator-plugin/skills/orchestration/task-patterns.md +0 -266
  74. package/dist/templates/orchestrator-plugin/skills/orchestration/workflow-examples.md +0 -428
  75. package/templates/agent-plugin/skills/humanloop/SKILL.md +0 -148
  76. package/templates/agent-plugin/skills/operator-memory/SKILL.md +0 -64
  77. package/templates/agent-plugin/skills/perspective-fanout/SKILL.md +0 -115
  78. package/templates/agent-plugin/skills/problem-document/SKILL.md +0 -105
  79. package/templates/agent-plugin/skills/problem-plateau-breakers/SKILL.md +0 -83
  80. package/templates/orchestrator-plugin/skills/humanloop/SKILL.md +0 -150
  81. package/templates/orchestrator-plugin/skills/orchestration/CLAUDE.md +0 -1
  82. package/templates/orchestrator-plugin/skills/orchestration/SKILL.md +0 -29
  83. package/templates/orchestrator-plugin/skills/orchestration/strategy.md +0 -160
  84. package/templates/orchestrator-plugin/skills/orchestration/task-patterns.md +0 -266
  85. package/templates/orchestrator-plugin/skills/orchestration/workflow-examples.md +0 -428
@@ -1,266 +0,0 @@
1
- # Work Breakdown Patterns
2
-
3
- Patterns for how the orchestrator should structure roadmap.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 formal requirements document 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
- ### Requirements & Design
74
- - [ ] (conditional) Problem exploration — if goal is nebulous, explore before spec
75
- - [ ] Requirements — define acceptance criteria
76
- - [ ] Design — architecture, component boundaries, data models
77
- - [ ] Create implementation plan from requirements + design
78
- - [ ] Review plan against requirements + design
79
-
80
- ### Implementation
81
- - [ ] Phase 1 — [foundation/types/interfaces]
82
- - [ ] Phase 2 — [core logic]
83
- - [ ] Critique phases 1-2
84
- - [ ] Phase 3 — [integration/wiring]
85
- - [ ] Validate — smoketest full feature e2e
86
- - [ ] Review implementation
87
- ```
88
-
89
- Note: critique and validation are embedded between implementation phases, not deferred to the end. Phase 1 (types) is low-risk and doesn't need its own review, but critique catches issues before Phase 3 builds on them. Validation happens after integration, when all the pieces come together.
90
-
91
- ### Cycle plan
92
- - **Cycle 0** (conditional): If the problem is nebulous — multiple valid framings, unclear what "done" looks like — spawn `sisyphus:problem` for interactive exploration. Yield `--mode discovery`. Skip if goal is clear and acceptance criteria are obvious.
93
- - **Cycle 1**: Spawn `sisyphus:spec` for combined design + requirements. Yield. (Human iterates inside the spec session.)
94
- - **Cycle 2**: Spawn `sisyphus:plan` for plan. Yield.
95
- - **Cycle 3**: Spawn `sisyphus:review-plan` for review. If fail, respawn plan with issues. Yield.
96
- - **Cycle 4**: Spawn `sisyphus:implement` for Phase 1. Yield.
97
- - **Cycle 5**: Spawn `sisyphus:implement` for Phase 2. Phase 1 is types — low risk, doesn't need its own validation. Yield.
98
- - **Cycle 6**: Spawn `sisyphus:review` for critique of phases 1-2. This is the checkpoint before integration builds on top. Yield.
99
- - **Cycle 7**: Address critique findings + spawn `sisyphus:implement` for Phase 3. Yield.
100
- - **Cycle 8**: `sis orch yield --mode validation` for e2e smoketest. Validation mode proves the feature works — operator for UI, evidence for every claim.
101
- - **Cycle 9**: Address validation failures (back to `--mode implementation`) or complete.
102
-
103
- ### Failure modes
104
- - **Spec needs human input**: Mark session as needing human review. Orchestrator notes open questions.
105
- - **Plan fails review**: Feed review issues back, respawn planner.
106
- - **Critique finds issues in foundation**: Fix before starting integration — don't build on shaky ground.
107
- - **Validation fails**: Feed specifics back to implement agent for the failing area.
108
-
109
- ### Parallelization
110
- Phases without dependencies can run in parallel. Types/interfaces (Phase 1) must complete before implementation phases that consume them. Critique can run alongside detail-planning for the next phase.
111
-
112
- ---
113
-
114
- ## Feature Build (Large — 10+ files)
115
-
116
- ### When to use
117
- Cross-cutting feature, multiple domains, needs team coordination. Uses **progressive planning** — high-level outline first, then detail-plan each stage as it's reached.
118
-
119
- ### Plan structure
120
- ```
121
- ## Feature: [description]
122
-
123
- ### Requirements & Design
124
- - [ ] (conditional) Problem exploration — if goal is nebulous
125
- - [ ] Requirements
126
- - [ ] Design
127
-
128
- ### Stage Outline (high-level only — no file-level detail yet)
129
- 1. [domain A foundation] — no deps — ~N cycles
130
- 2. [domain B foundation] — no deps — ~N cycles
131
- → critique stages 1-2 (foundation is low-risk individually, but review before building on it)
132
- 3. [domain A implementation] — depends on 1 — ~N cycles
133
- 4. [domain B implementation] — depends on 2 — ~N cycles
134
- → critique + validate stages 3-4 (core logic, high risk — verify before integration)
135
- 5. [integration layer] — depends on 3, 4 — ~N cycles
136
- → validate end-to-end (integration is where accumulated assumptions break)
137
- 6. [final review] — depends on all
138
-
139
- ### Current Stage: [whichever is active]
140
- See context/{plan-lead-agent-id}/plan-stage-N-{name}.md for detail plan. (Path comes from the plan lead's submission report.)
141
- - [ ] [task-level items from detail plan]
142
- ```
143
-
144
- Note: verification checkpoints are embedded in the stage outline, not deferred to a final phase. The level of rigor varies — foundation stages get a light critique, core logic gets critique + validation, integration gets full e2e validation. This is judgment, not formula.
145
-
146
- ### Cycle plan
147
- - **Cycle 0** (conditional): If the problem is nebulous, spawn explore agents for technical landscape (yield `--mode discovery`), then spawn `sisyphus:problem` for interactive problem exploration (yield `--mode discovery`). May take 1-3 discovery cycles. Skip if the goal and scope are already clear.
148
- - **Cycle 1**: Spawn `sisyphus:spec` for combined design + requirements. Yield. (Human iterates inside the spec session.)
149
- - **Cycle 2**: Spawn `sisyphus:plan` for **high-level stage outline only**. Instruction: "Outline stages, dependencies, one-sentence descriptions, cycle estimates. Include verification checkpoints between stages based on risk." If the user's initial prompt or goal.md explicitly requested tests, also spawn `sisyphus:test-spec` for test properties in parallel; otherwise skip. Yield.
150
- - **Cycle 4**: Review outline. Spawn `sisyphus:plan` to **detail-plan stage 1 only** (provide outline as context). The plan agent saves under its own subdir and reports the full path — carry that path forward for the implement cycle. Yield.
151
- - **Cycle 5**: Spawn `sisyphus:implement` for stage 1. If stage 2 is independent, spawn `sisyphus:plan` to detail-plan stage 2 in parallel. Yield.
152
- - **Cycle 6**: Spawn `sisyphus:implement` for stage 2 (if detail-planned). Spawn `sisyphus:review` to critique stages 1-2 in parallel — foundation review before core logic builds on it. Detail-plan stage 3 in parallel. Yield.
153
- - **Cycle 7**: Address critique findings. Spawn `sisyphus:implement` for stage 3. Yield.
154
- - **Cycle 8**: Spawn `sisyphus:implement` for stage 4. Spawn `sisyphus:review` to critique stage 3 in parallel. Yield.
155
- - **Cycle 9**: Spawn `sisyphus:validate` for stages 3-4 — core logic checkpoint before integration. Address stage 3 critique. Yield.
156
- - **Cycle 10+**: Implement integration stage. Final review. Then `sis orch yield --mode validation` for comprehensive e2e proof.
157
-
158
- ### Failure modes
159
- - **Detail-plan agent can't produce quality output**: The stage is still too large. Break it into sub-stages in the outline and detail-plan each sub-stage individually.
160
- - **Integration failures**: Often means contracts between domains don't match. Spawn debug agent targeting the integration seam.
161
- - **Stage N implementation invalidates stage N+1 outline**: Update the high-level outline. This is expected — it's why you don't detail-plan everything upfront.
162
- - **Critique finds issues after multiple stages built on top**: This is the scenario verification checkpoints exist to prevent. If it happens, you waited too long to review — add earlier checkpoints to the roadmap going forward.
163
-
164
- ### Parallelization
165
- Maximize within the progressive pattern. Independent stages run in parallel. Detail-planning the next stage runs alongside implementing the current one. Critique and validation agents run alongside the next stage's planning or implementation. Foundation stages complete before dependent stages. Integration waits for all domain implementations.
166
-
167
- ---
168
-
169
- ## Refactor
170
-
171
- ### When to use
172
- Restructure code without changing behavior. Move files, rename abstractions, consolidate patterns.
173
-
174
- ### Plan structure
175
- ```
176
- ## Refactor: [description]
177
-
178
- - [ ] Analyze current structure and plan refactor
179
- - [ ] Capture behavioral snapshot (existing tests + manual checks)
180
- - [ ] Execute refactor phase 1 — [structural changes]
181
- - [ ] Execute refactor phase 2 — [update consumers]
182
- - [ ] Validate behavior preserved — all original tests pass
183
- - [ ] Review for missed references, dead code, broken imports
184
- ```
185
-
186
- ### Cycle plan
187
- - **Cycle 1**: Spawn `sisyphus:plan` for analysis + `sisyphus:validate` to capture baseline (parallel). Yield.
188
- - **Cycle 2**: Spawn `sisyphus:implement` for phase 1. Yield.
189
- - **Cycle 3**: Spawn `sisyphus:implement` for phase 2 + `sisyphus:validate` for phase 1 (parallel). Yield.
190
- - **Cycle 4**: Spawn `sisyphus:validate` for full validation. Yield.
191
- - **Cycle 5**: Spawn `sisyphus:review` for final review. Complete.
192
-
193
- ### Key principle
194
- **Behavior preservation is the only metric.** The refactor is correct if and only if all existing tests pass and externally observable behavior is unchanged.
195
-
196
- ### Parallelization
197
- Limited. Refactor phases are often sequential (move before update consumers). Validation can run in parallel with the next phase if they touch different files.
198
-
199
- ---
200
-
201
- ## Code Review
202
-
203
- ### When to use
204
- PR review, pre-merge check, or periodic quality audit.
205
-
206
- ### Plan structure
207
- ```
208
- ## Review: [scope]
209
-
210
- - [ ] Review [scope] for issues
211
- - [ ] (conditional) Fix critical/high issues found
212
- - [ ] Verify fixes landed (type-check, tests pass)
213
- ```
214
-
215
- ### Cycle plan
216
- - **Cycle 1**: Spawn `sisyphus:review` for review. Yield.
217
- - **Cycle 2**: If critical/high issues, spawn `sisyphus:implement` for fixes. If clean, complete.
218
- - **Cycle 3**: Verify fixes landed by reading fix-agent reports + running type-check/tests. Complete. Do **not** spawn a second review pass — review runs once, validation catches regressions.
219
-
220
- ### Parallelization
221
- Review itself parallelizes internally (subagents per concern). Fix cycle is usually serial.
222
-
223
- ---
224
-
225
- ## Investigation / Spike
226
-
227
- ### When to use
228
- Need to understand something before committing to an approach. Prototype, explore, or answer a technical question.
229
-
230
- ### Plan structure
231
- ```
232
- ## Investigation: [question/area]
233
-
234
- - [ ] Investigate [question/area]
235
- - [ ] Summarize findings and recommendation
236
- ```
237
-
238
- ### Cycle plan
239
- - **Cycle 1**: Spawn `sisyphus:debug` (for code investigation) or `sisyphus:general` (for broader research). Yield.
240
- - **Cycle 2**: Spawn `sisyphus:general` to synthesize findings. Complete.
241
-
242
- ### Parallelization
243
- If investigating multiple independent areas, spawn parallel agents each exploring a different angle.
244
-
245
- ---
246
-
247
- ## Tactician-Driven Implementation
248
-
249
- ### When to use
250
- 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.
251
-
252
- ### Plan structure
253
- ```
254
- ## Tactician Execution
255
-
256
- - [ ] Execute implementation plan at [path] using tactician loop
257
- ```
258
-
259
- ### Cycle plan
260
- This is a single-item pattern. The orchestrator spawns the tactician once:
261
- - **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.
262
-
263
- ### When NOT to use
264
- - When you need human checkpoints between phases
265
- - When phases have external dependencies (waiting on API access, design review, etc.)
266
- - When the task requires creative decisions the tactician shouldn't make alone
@@ -1,428 +0,0 @@
1
- # Workflow Examples
2
-
3
- End-to-end examples showing how the orchestrator structures cycles for real scenarios.
4
-
5
- ### Path conventions in these examples
6
-
7
- Plan files live under per-plan-lead subdirectories: `context/{plan-lead-agent-id}/plan-*.md`. These examples elide the subdir (showing `context/plan-rate-limiting.md`) for readability. In a real cycle, the orchestrator reads the exact path from the plan lead's submission report and carries it verbatim into downstream implement, review-plan, and validate agent prompts.
8
-
9
- ---
10
-
11
- ## Example 4: Wrapper-Shaped Config Migration (LOW effort — 5 files, mechanical)
12
-
13
- **Starting task**: "All config access goes through `process.env` directly — migrate to a `getConfig()` wrapper already defined in `src/config.ts`"
14
-
15
- **Effort tier**: LOW. Every change is a call-site swap onto an existing handler. No new behavior.
16
-
17
- ### Cycle 1 — Plan
18
- ```
19
- roadmap.md:
20
- ## Refactor: Migrate env access to getConfig()
21
-
22
- - [ ] Plan migration — enumerate all process.env call sites
23
- - [ ] Update call sites to use getConfig()
24
- - [ ] Validate — no direct process.env access remains; tests pass
25
-
26
- Agents spawned:
27
- plan agent → "Enumerate every direct process.env access in src/. Map each call site
28
- to the matching getConfig() key. Output a migration checklist. Files expected:
29
- src/api/server.ts, src/db/connection.ts, src/queue/worker.ts,
30
- src/cli/commands/start.ts, src/config.ts (source of truth — do not modify)."
31
- ```
32
-
33
- ### Cycle 2 — Implement
34
- ```
35
- Plan complete. 23 call sites across 4 files.
36
-
37
- Agents spawned:
38
- implement agent → "Execute migration plan at context/{plan-agent-id}/plan-config-migration.md.
39
- Replace every process.env.X access with getConfig('X'). Do not modify src/config.ts.
40
- Do not add error handling — getConfig() already throws on missing keys."
41
- ```
42
-
43
- ### Cycle 3 — Validate + complete
44
- ```
45
- Implementation complete.
46
-
47
- Agents spawned:
48
- validate agent → "Verify migration: grep for remaining process.env access in src/ (excluding
49
- src/config.ts). Run existing tests. Confirm zero direct env reads outside config.ts."
50
-
51
- Validation: PASS. Complete — "All env access routed through getConfig()."
52
- ```
53
-
54
- **Pipeline shape**: `plan → implement → validate`. 3 cycles. No `sisyphus:spec`, no `sisyphus:test-spec`, no `sisyphus:review-plan`.
55
-
56
- ---
57
-
58
- ## Example 5: New Subsystem — Distributed Task Queue (HIGH effort)
59
-
60
- **Starting task**: "Add a persistent task queue so long-running jobs survive server restarts. Include test coverage of the survival, retry, and concurrency invariants."
61
-
62
- **Effort tier**: HIGH. New subsystem, new protocol (worker ↔ queue contract), cross-domain orchestration (API + storage + worker process). The prompt explicitly asks for test coverage — `sisyphus:test-spec` is justified at Cycle 2.
63
-
64
- ### Cycle 0 — Problem exploration
65
- ```
66
- roadmap.md:
67
- ## Feature: Persistent Task Queue
68
-
69
- - [ ] Explore current job execution patterns and constraints
70
- - [ ] Spec — requirements + architecture
71
- - [ ] Plan implementation (staged outline)
72
- - [ ] Spec behavioral properties (test-spec) — user asked for tests in the prompt
73
- ...
74
-
75
- Agents spawned:
76
- explore agent → "Map current job execution in src/jobs/. Identify what needs to survive
77
- restarts, current storage backends, worker process lifecycle."
78
- problem agent → "Explore design space for persistent task queue. Questions: push vs pull
79
- worker model, at-least-once vs exactly-once semantics, failure/retry policy, storage
80
- backend options (Redis, Postgres, SQLite)."
81
- ```
82
-
83
- ### Cycle 1 — Spec (human iterates)
84
- ```
85
- Agents spawned:
86
- sisyphus:spec → "Run spec session for persistent task queue.
87
- Context in context/problem-task-queue.md and context/explore-task-queue.md."
88
-
89
- Human iterates. Spec outputs:
90
- context/requirements-task-queue.md — acceptance criteria, failure semantics
91
- context/design-task-queue.md — Redis-backed queue, pull workers, at-least-once delivery
92
- ```
93
-
94
- ### Cycle 2 — High-level plan + test-spec (parallel)
95
- ```
96
- Agents spawned (parallel):
97
- plan agent → "Create high-level stage outline from context/requirements-task-queue.md
98
- and context/design-task-queue.md. Stages: (1) queue storage layer, (2) producer API,
99
- (3) worker consumer, (4) integration + retry logic. Cycle estimates per stage."
100
- test-spec agent → "Define behavioral properties: job survives server restart, failed
101
- jobs retry up to N times, concurrent workers don't double-execute the same job."
102
- ```
103
-
104
- If the original prompt had been silent on tests, the test-spec spawn would be omitted and Cycle 2 would be plan-only — Cycle 3 would then proceed straight to detail-planning stage 1.
105
-
106
- ### Cycles 3–9 — Staged implementation with critique + validation checkpoints
107
- ```
108
- Follows Feature Build Large pattern:
109
- Cycle 3: detail-plan stage 1 + implement stage 1
110
- Cycle 4: implement stage 2; detail-plan stage 3 in parallel
111
- Cycle 5: critique stages 1-2 (foundation review before worker builds on it)
112
- Cycle 6: address critique + implement stage 3
113
- Cycle 7: implement stage 4 (integration + retry); validate stages 3-4
114
- Cycle 8: sis orch yield --mode validation — e2e: enqueue job, kill server, restart,
115
- confirm job ran exactly once
116
- Cycle 9: final review agent; complete
117
- ```
118
-
119
- **Pipeline shape**: Full HIGH pipeline — `problem → spec → plan (+ test-spec because the prompt asked for tests) → staged implement → critique → validate → review`. 9+ cycles. Without an explicit test request in the prompt, the parallel `test-spec` would be omitted and Cycle 2 would be plan-only.
120
-
121
- ---
122
-
123
- ## Example 1: Fix a Race Condition in WebSocket Reconnection
124
-
125
- **Starting task**: "WebSocket connections sometimes drop messages during reconnection"
126
-
127
- ### Cycle 1 — Diagnosis
128
- ```
129
- roadmap.md:
130
- ## Bug Fix: WebSocket message loss during reconnection
131
-
132
- - [ ] Diagnose message loss during WebSocket reconnection
133
- - [ ] Fix root cause
134
- - [ ] Validate fix under concurrent load
135
- - [ ] Review fix
136
-
137
- Agents spawned:
138
- debug agent → "Diagnose why WebSocket messages are lost during reconnection.
139
- Focus on src/ws/client.ts and src/ws/reconnect.ts.
140
- Check for race conditions between disconnect handler and message queue.
141
- Look at git blame for recent changes to reconnection logic."
142
- ```
143
-
144
- ### Cycle 2 — Read diagnosis, plan fix
145
- ```
146
- Agent report: "Root cause: reconnect() clears the message queue before the new socket
147
- is ready. Messages sent between disconnect and reconnect are dropped.
148
- Line 47 of src/ws/reconnect.ts — queue.clear() is called in onDisconnect
149
- but should be deferred until onReconnect confirms the new socket is live.
150
- Confidence: High."
151
-
152
- roadmap.md updated:
153
- - [x] ~~Diagnose message loss during WebSocket reconnection~~
154
- - [ ] Fix root cause — queue.clear() at L47 of reconnect.ts runs too early
155
- - [ ] Validate fix under concurrent load
156
- - [ ] Review fix
157
-
158
- Agents spawned:
159
- implement agent → "Fix race condition in src/ws/reconnect.ts.
160
- Root cause: queue.clear() at line 47 runs on disconnect, dropping pending messages.
161
- Fix: defer queue drain until reconnect confirms new socket. Buffer messages during
162
- reconnection window. See existing buffer pattern in src/ws/buffer.ts."
163
- ```
164
-
165
- ### Cycle 3 — Validate
166
- ```
167
- Agent report: "Fixed. Moved queue.clear() to onReconnect callback after socket.readyState
168
- confirms OPEN. Added message buffer during reconnection window. 2 files changed."
169
-
170
- roadmap.md updated:
171
- - [x] ~~Diagnose message loss~~
172
- - [x] ~~Fix root cause~~
173
- - [ ] Validate fix under concurrent load
174
- - [ ] Review fix
175
-
176
- Agents spawned:
177
- validate agent → "Verify WebSocket reconnection fix. Run existing tests in
178
- src/__tests__/ws/. Manually verify: disconnect simulation should not lose queued
179
- messages. Check that buffer drains correctly on reconnect."
180
- ```
181
-
182
- ### Cycle 4 — Review and complete
183
- ```
184
- Validation: PASS. Existing tests pass, reconnection preserves messages.
185
-
186
- roadmap.md updated:
187
- - [x] ~~Diagnose~~, [x] ~~Fix~~, [x] ~~Validate~~
188
- - [ ] Review fix
189
-
190
- Agents spawned:
191
- review agent → "Review changes in src/ws/reconnect.ts and src/ws/buffer.ts.
192
- Focus on: thread safety of the new buffer, memory leak potential if reconnect
193
- never succeeds, edge case of rapid disconnect/reconnect cycles."
194
- ```
195
-
196
- ### Cycle 5 — Complete
197
- ```
198
- Review: Clean. One medium finding — buffer should have a max size to prevent
199
- memory issues if reconnect fails indefinitely. Not blocking.
200
-
201
- All roadmap.md items complete.
202
-
203
- Action: complete — "Fixed WebSocket message loss during reconnection. Messages now
204
- buffered during reconnection window and drained on successful reconnect."
205
- ```
206
-
207
- ---
208
-
209
- ## Example 2: Add API Rate Limiting
210
-
211
- **Starting task**: "Add rate limiting to the REST API — per-user, configurable limits, with tests for the limit-enforcement and 429 response behavior"
212
-
213
- ### Cycle 1 — Problem exploration
214
- ```
215
- roadmap.md:
216
- ## Feature: API Rate Limiting
217
-
218
- ### Requirements & Design
219
- - [ ] Problem exploration — understand rate limiting needs
220
- - [ ] Requirements — define acceptance criteria
221
- - [ ] Design — architecture for rate limiting
222
- - [ ] Plan implementation
223
- - [ ] Review plan
224
-
225
- ### Implementation
226
- - [ ] Implement rate limiting middleware
227
- - [ ] Implement rate limit configuration
228
- - [ ] Implement rate limit headers and error responses
229
-
230
- ### Validation
231
- - [ ] Validate implementation
232
- - [ ] Review implementation
233
-
234
- Agents spawned:
235
- problem agent → "Explore the codebase and understand the API rate limiting landscape.
236
- Check existing middleware patterns in src/api/middleware/.
237
- Questions to explore: current request handling, existing auth/middleware chain,
238
- what storage backends are available (Redis?), user identification mechanisms."
239
- ```
240
-
241
- ### Cycle 2 — Spec (after human iterates on problem)
242
- ```
243
- Agent report: "Problem document saved to context/problem-rate-limiting.md.
244
- Current middleware chain uses Express middleware pattern. Redis is already in stack.
245
- Users are identified by JWT sub claim. No existing rate limiting."
246
-
247
- roadmap.md updated:
248
- - [x] ~~Problem exploration~~
249
- - [ ] Spec — define acceptance criteria and architecture
250
- ...
251
-
252
- Agents spawned:
253
- sisyphus:spec → "Run a spec session for per-user API rate limiting. Read context/problem-rate-limiting.md for context."
254
-
255
- Later report: "Spec completed.
256
- Requirements saved to context/requirements-rate-limiting.md.
257
- Design saved to context/design-rate-limiting.md.
258
- Covers: per-user limits, endpoint-specific overrides, 429 response format,
259
- Retry-After headers, and a Redis-backed sliding window approach."
260
- ```
261
-
262
- ### Cycle 3 — Plan (after human reviews spec)
263
- ```
264
- Agent report: "Spec outputs approved.
265
- Approach: Redis-backed sliding window middleware. Per-user with endpoint-specific
266
- overrides. Standard 429 response with Retry-After header. Config via environment variables."
267
-
268
- roadmap.md updated:
269
- - [x] ~~Problem exploration~~, [x] ~~Spec~~
270
- - [ ] Plan implementation
271
- ...
272
-
273
- Agents spawned:
274
- plan agent → "Create implementation plan from context/requirements-rate-limiting.md
275
- and context/design-rate-limiting.md"
276
- test-spec agent → "Define behavioral properties for rate limiting from
277
- context/requirements-rate-limiting.md"
278
- ```
279
-
280
- ### Cycle 4 — Review plan
281
- ```
282
- Both agents complete. Plan at context/plan-rate-limiting.md.
283
- Plan has 3 phases: middleware, config, response format.
284
-
285
- Agents spawned:
286
- review-plan agent → "Validate plan at context/plan-rate-limiting.md
287
- against context/requirements-rate-limiting.md and context/design-rate-limiting.md"
288
- ```
289
-
290
- ### Cycle 5 — Implement phases 1+2 (parallel, low-risk foundation)
291
- ```
292
- Plan review: PASS.
293
-
294
- roadmap.md updated (plan review done, starting implementation):
295
- - [x] ~~Spec~~, [x] ~~Plan~~, [x] ~~Review plan~~
296
- - [ ] Implement rate limiting middleware
297
- - [ ] Implement rate limit configuration
298
- - [ ] Critique phases 1-2 — review before integration phase
299
- - [ ] Implement rate limit headers and error responses
300
- - [ ] Validate — smoketest rate limiting end-to-end
301
- - [ ] Final review
302
-
303
- Agents spawned (parallel — phases touch different files):
304
- implement agent → "Implement Phase 1 from context/plan-rate-limiting.md —
305
- rate limiting middleware in src/api/middleware/rate-limit.ts"
306
- implement agent → "Implement Phase 2 from context/plan-rate-limiting.md —
307
- rate limit configuration in src/config/rate-limits.ts"
308
- ```
309
-
310
- ### Cycle 6 — Critique before integration builds on top
311
- ```
312
- Both implementation agents complete.
313
-
314
- Why critique now: Phase 3 (headers/error responses) integrates the middleware and
315
- config — if the foundation has issues, they'll cascade. Cheaper to catch now.
316
-
317
- roadmap.md updated:
318
- - [x] ~~Implement middleware~~, [x] ~~Implement config~~
319
- - [ ] Critique phases 1-2
320
- ...
321
-
322
- Agents spawned:
323
- review agent → "Review rate limiting middleware and config implementation.
324
- Focus on: Redis connection handling, sliding window correctness,
325
- config schema matches what middleware expects."
326
- ```
327
-
328
- ### Cycle 7 — Implement phase 3 + address critique
329
- ```
330
- Review: 2 findings — middleware doesn't handle Redis connection failure gracefully,
331
- config schema allows negative rate limits.
332
-
333
- Agents spawned (parallel):
334
- implement agent → "Fix review findings in reports/agent-008-final.md for
335
- rate limiting middleware and config."
336
- implement agent → "Implement Phase 3 from context/plan-rate-limiting.md —
337
- rate limit headers and 429 error responses in src/api/middleware/rate-limit.ts"
338
- ```
339
-
340
- ### Cycle 8 — Validate end-to-end
341
- ```
342
- Phase 3 and fixes complete.
343
-
344
- Why validate now: all three phases are done and integrated. This is the checkpoint
345
- before calling it complete — verify it actually works, not just compiles.
346
-
347
- Agents spawned:
348
- validate agent → "Verify rate limiting end-to-end: start server, send requests
349
- exceeding limits, confirm 429 responses with correct Retry-After headers.
350
- Test per-user isolation, endpoint-specific overrides, Redis failover behavior."
351
- ```
352
-
353
- ### Cycle 10 — Complete
354
- ```
355
- Validation: PASS. Final review agent confirms no issues.
356
- Complete — "Added per-user API rate limiting with Redis-backed sliding window,
357
- configurable per-endpoint limits, and graceful Redis failover."
358
- ```
359
-
360
- ---
361
-
362
- ## Example 3: Refactor Authentication Module
363
-
364
- **Starting task**: "Refactor auth — extract token logic from route handlers into dedicated service"
365
-
366
- ### Cycle 1 — Plan + baseline
367
- ```
368
- roadmap.md:
369
- ## Refactor: Extract Token Service
370
-
371
- - [ ] Plan auth refactor — extract token service
372
- - [ ] Capture behavioral baseline (run all auth tests)
373
- - [ ] Create TokenService class with extracted logic
374
- - [ ] Update route handlers to use TokenService
375
- - [ ] Update tests to use new service interface
376
- - [ ] Validate all auth tests still pass
377
- - [ ] Review for dead code and missed references
378
-
379
- Agents spawned (parallel):
380
- plan agent → "Plan refactor: extract token creation, validation, and refresh
381
- logic from src/api/routes/auth.ts into a new src/services/token-service.ts.
382
- Map all token-related functions, their callers, and the extraction plan."
383
- validate agent → "Run all tests in src/__tests__/auth/ and record results.
384
- This is the behavioral baseline — these must all pass after refactor."
385
- ```
386
-
387
- ### Cycle 2 — Extract (serial — must happen before consumer updates)
388
- ```
389
- Plan complete, baseline captured (47 tests passing).
390
-
391
- roadmap.md updated:
392
- - [x] ~~Plan auth refactor~~
393
- - [x] ~~Capture behavioral baseline~~ (47 tests passing)
394
- - [ ] Create TokenService class with extracted logic
395
- ...
396
-
397
- Agents spawned:
398
- implement agent → "Execute Phase 1 of refactor plan: create TokenService class
399
- at src/services/token-service.ts. Extract validateToken, createToken, refreshToken
400
- from src/api/routes/auth.ts. Export the class. Do NOT modify route handlers yet."
401
- ```
402
-
403
- ### Cycle 3 — Update consumers (parallel where possible)
404
- ```
405
- TokenService created.
406
-
407
- Agents spawned:
408
- implement agent → "Update route handlers in src/api/routes/auth.ts to import
409
- and use TokenService instead of inline token logic. Remove extracted functions."
410
- implement agent → "Update tests in src/__tests__/auth/ to use TokenService
411
- where they directly tested extracted functions."
412
- ```
413
-
414
- ### Cycle 4 — Validate + review
415
- ```
416
- Agents spawned (parallel):
417
- validate agent → "Run all auth tests. Compare against baseline of 47 passing.
418
- Every test must still pass."
419
- review agent → "Review src/api/routes/auth.ts and src/services/token-service.ts.
420
- Check for: dead code left behind, missed references to old functions, broken imports."
421
- ```
422
-
423
- ### Cycle 5 — Complete
424
- ```
425
- All 47 tests passing. Review clean.
426
- All roadmap.md items complete.
427
- Complete — "Extracted token logic into TokenService. All existing tests pass."
428
- ```