sisyphi 1.0.2 → 1.0.5
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.
- package/README.md +6 -4
- package/dist/chunk-DBR33QHM.js +185 -0
- package/dist/chunk-DBR33QHM.js.map +1 -0
- package/dist/cli.js +159 -22
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +61 -6
- package/dist/daemon.js.map +1 -1
- package/dist/templates/CLAUDE.md +1 -0
- package/dist/templates/agent-plugin/agents/operator.md +1 -0
- package/dist/templates/agent-plugin/agents/plan.md +68 -4
- package/dist/templates/agent-plugin/agents/review-plan.md +1 -1
- package/dist/templates/agent-plugin/agents/review.md +1 -0
- package/dist/templates/agent-plugin/agents/spec-draft.md +32 -4
- package/dist/templates/agent-plugin/agents/test-spec.md +1 -0
- package/dist/templates/companion-plugin/.claude-plugin/plugin.json +1 -0
- package/dist/templates/companion-plugin/hooks/hooks.json +12 -0
- package/dist/templates/companion-plugin/hooks/user-prompt-context.sh +3 -0
- package/dist/templates/dashboard-claude.md +1 -1
- package/dist/templates/orchestrator-base.md +5 -9
- package/dist/templates/orchestrator-planning.md +5 -49
- package/dist/tui.js +341 -184
- package/dist/tui.js.map +1 -1
- package/package.json +1 -1
- package/templates/CLAUDE.md +1 -0
- package/templates/agent-plugin/agents/operator.md +1 -0
- package/templates/agent-plugin/agents/plan.md +68 -4
- package/templates/agent-plugin/agents/review-plan.md +1 -1
- package/templates/agent-plugin/agents/review.md +1 -0
- package/templates/agent-plugin/agents/spec-draft.md +32 -4
- package/templates/agent-plugin/agents/test-spec.md +1 -0
- package/templates/companion-plugin/.claude-plugin/plugin.json +1 -0
- package/templates/companion-plugin/hooks/hooks.json +12 -0
- package/templates/companion-plugin/hooks/user-prompt-context.sh +3 -0
- package/templates/dashboard-claude.md +1 -1
- package/templates/orchestrator-base.md +5 -9
- package/templates/orchestrator-planning.md +5 -49
- package/dist/chunk-ZE2SKB4B.js +0 -35
- package/dist/chunk-ZE2SKB4B.js.map +0 -1
- package/dist/templates/agent-plugin/.claude/agents/debug.md +0 -39
- package/dist/templates/agent-plugin/.claude/agents/plan.md +0 -101
- package/dist/templates/agent-plugin/.claude/agents/review-plan.md +0 -81
- package/dist/templates/agent-plugin/.claude/agents/review.md +0 -56
- package/dist/templates/agent-plugin/.claude/agents/spec-draft.md +0 -73
- package/dist/templates/agent-plugin/.claude/agents/test-spec.md +0 -56
- package/dist/templates/orchestrator-plugin/.claude/commands/begin.md +0 -62
- package/dist/templates/orchestrator-plugin/.claude/skills/orchestration/SKILL.md +0 -40
- package/dist/templates/orchestrator-plugin/.claude/skills/orchestration/task-patterns.md +0 -222
- package/dist/templates/orchestrator-plugin/.claude/skills/orchestration/workflow-examples.md +0 -208
- package/dist/templates/resources/.claude/agents/debug.md +0 -39
- package/dist/templates/resources/.claude/agents/plan.md +0 -101
- package/dist/templates/resources/.claude/agents/review-plan.md +0 -81
- package/dist/templates/resources/.claude/agents/review.md +0 -56
- package/dist/templates/resources/.claude/agents/spec-draft.md +0 -73
- package/dist/templates/resources/.claude/agents/test-spec.md +0 -56
- package/dist/templates/resources/.claude/commands/begin.md +0 -62
- package/dist/templates/resources/.claude/skills/orchestration/SKILL.md +0 -40
- package/dist/templates/resources/.claude/skills/orchestration/task-patterns.md +0 -222
- package/dist/templates/resources/.claude/skills/orchestration/workflow-examples.md +0 -208
- package/dist/templates/resources/.claude-plugin/plugin.json +0 -8
|
@@ -1,40 +0,0 @@
|
|
|
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. **Tasks are the orchestrator's memory.** State.json persists across cycles — tasks and agent reports are all you have. Make task descriptions 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).
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
# Task Breakdown Patterns
|
|
2
|
-
|
|
3
|
-
Patterns for how the orchestrator should structure tasks for common workflow types. Each pattern shows the task list 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
|
-
### Task structure
|
|
13
|
-
```
|
|
14
|
-
t1: Diagnose root cause of [bug description]
|
|
15
|
-
t2: Implement fix for [root cause]
|
|
16
|
-
t3: Validate fix — regression tests pass, bug is resolved
|
|
17
|
-
t4: Review fix for unintended side effects
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Cycle plan
|
|
21
|
-
- **Cycle 1**: Spawn `sisyphus:debug` for t1. Yield.
|
|
22
|
-
- **Cycle 2**: Read diagnosis report. If confident root cause found, spawn `sisyphus:implement` for t2 with the diagnosis as context. Yield.
|
|
23
|
-
- **Cycle 3**: Spawn `sisyphus:validate` for t3. Yield.
|
|
24
|
-
- **Cycle 4**: If validation passes, spawn `sisyphus:review` for t4. If fails, update t2 with failure context and respawn implement. Yield.
|
|
25
|
-
- **Cycle 5**: Review results. Complete or address review findings.
|
|
26
|
-
|
|
27
|
-
### Failure modes
|
|
28
|
-
- **Debug inconclusive**: Add more context to t1, respawn debug with narrower scope or different focus areas.
|
|
29
|
-
- **Fix breaks other things**: t3 catches this. Feed validation failures back into a new implement cycle.
|
|
30
|
-
- **Root cause was wrong**: Create new t1 variant with what was learned, respawn debug.
|
|
31
|
-
|
|
32
|
-
### Parallelization
|
|
33
|
-
Usually serial — diagnosis must complete before fix, fix before validation. Exception: if the bug affects multiple independent areas, spawn multiple debug agents in parallel.
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
## Feature Build (Small — 1-3 files)
|
|
38
|
-
|
|
39
|
-
### When to use
|
|
40
|
-
Clear requirements, small scope, no spec needed.
|
|
41
|
-
|
|
42
|
-
### Task structure
|
|
43
|
-
```
|
|
44
|
-
t1: Plan implementation for [feature]
|
|
45
|
-
t2: Implement [feature]
|
|
46
|
-
t3: Validate implementation
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### Cycle plan
|
|
50
|
-
- **Cycle 1**: Spawn `sisyphus:plan` for t1. Yield.
|
|
51
|
-
- **Cycle 2**: Spawn `sisyphus:implement` for t2 with plan path. Yield.
|
|
52
|
-
- **Cycle 3**: Spawn `sisyphus:validate` for t3. Yield.
|
|
53
|
-
- **Cycle 4**: Complete or fix issues.
|
|
54
|
-
|
|
55
|
-
### Parallelization
|
|
56
|
-
Serial. Too small to benefit from parallel agents.
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## Feature Build (Medium — 4-10 files)
|
|
61
|
-
|
|
62
|
-
### When to use
|
|
63
|
-
Feature with moderate complexity. Requirements may need clarification. Multiple files across a few modules.
|
|
64
|
-
|
|
65
|
-
### Task structure
|
|
66
|
-
```
|
|
67
|
-
t1: Draft spec for [feature] — investigate codebase, propose approach
|
|
68
|
-
t2: Create implementation plan from spec
|
|
69
|
-
t3: Review plan against spec
|
|
70
|
-
t4: Phase 1 — [foundation/types/interfaces]
|
|
71
|
-
t5: Phase 2 — [core logic]
|
|
72
|
-
t6: Phase 3 — [integration/wiring]
|
|
73
|
-
t7: Validate full implementation
|
|
74
|
-
t8: Review implementation
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Cycle plan
|
|
78
|
-
- **Cycle 1**: Spawn `sisyphus:spec-draft` for t1. Yield. (Human iterates on spec between cycles.)
|
|
79
|
-
- **Cycle 2**: Spawn `sisyphus:plan` for t2. Yield.
|
|
80
|
-
- **Cycle 3**: Spawn `sisyphus:review-plan` for t3. If fail, respawn plan with issues. Yield.
|
|
81
|
-
- **Cycle 4**: Spawn `sisyphus:implement` for t4. Yield.
|
|
82
|
-
- **Cycle 5**: Spawn `sisyphus:implement` for t5 + `sisyphus:validate` for t4 (parallel if t5 doesn't depend on t4 output). Yield.
|
|
83
|
-
- **Cycle 6-8**: Continue phases, validate, review.
|
|
84
|
-
|
|
85
|
-
### Failure modes
|
|
86
|
-
- **Spec needs human input**: Mark session as needing human review. Orchestrator notes open questions.
|
|
87
|
-
- **Plan fails review**: Feed review issues back, respawn planner.
|
|
88
|
-
- **Phase fails validation**: Feed specifics back to implement agent for that phase only.
|
|
89
|
-
|
|
90
|
-
### Parallelization
|
|
91
|
-
Phases without dependencies can run in parallel. Types/interfaces (t4) must complete before implementation phases that consume them.
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## Feature Build (Large — 10+ files)
|
|
96
|
-
|
|
97
|
-
### When to use
|
|
98
|
-
Cross-cutting feature, multiple domains, needs team coordination.
|
|
99
|
-
|
|
100
|
-
### Task structure
|
|
101
|
-
```
|
|
102
|
-
t1: Draft spec for [feature]
|
|
103
|
-
t2: Create master implementation plan
|
|
104
|
-
t3: Review plan against spec
|
|
105
|
-
t4: Define behavioral test properties
|
|
106
|
-
t5: Phase 1 — [domain A foundation]
|
|
107
|
-
t6: Phase 2 — [domain B foundation]
|
|
108
|
-
t7: Phase 3 — [domain A implementation]
|
|
109
|
-
t8: Phase 4 — [domain B implementation]
|
|
110
|
-
t9: Phase 5 — [integration layer]
|
|
111
|
-
t10: Validate full implementation
|
|
112
|
-
t11: Review implementation
|
|
113
|
-
t12: Adversarial validation against test spec
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### Cycle plan
|
|
117
|
-
- **Cycle 1**: Spawn `sisyphus:spec-draft` for t1. Yield.
|
|
118
|
-
- **Cycle 2**: Spawn `sisyphus:plan` for t2 + `sisyphus:test-spec` for t4 (parallel). Yield.
|
|
119
|
-
- **Cycle 3**: Spawn `sisyphus:review-plan` for t3. Yield.
|
|
120
|
-
- **Cycle 4**: Spawn `sisyphus:implement` for t5 + t6 (parallel — independent domains). Yield.
|
|
121
|
-
- **Cycle 5**: Validate t5 + t6, then spawn t7 + t8 (parallel). Yield.
|
|
122
|
-
- **Cycle 6+**: Integration, validation, review.
|
|
123
|
-
|
|
124
|
-
### Failure modes
|
|
125
|
-
- **Integration failures**: Often means contracts between domains don't match. Spawn debug agent targeting the integration seam.
|
|
126
|
-
- **Test spec violations**: Feed specific property failures back to implement.
|
|
127
|
-
|
|
128
|
-
### Parallelization
|
|
129
|
-
Maximize. Independent domains run in parallel. Foundation phases complete before implementation phases in the same domain. Integration waits for all domain implementations.
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## Refactor
|
|
134
|
-
|
|
135
|
-
### When to use
|
|
136
|
-
Restructure code without changing behavior. Move files, rename abstractions, consolidate patterns.
|
|
137
|
-
|
|
138
|
-
### Task structure
|
|
139
|
-
```
|
|
140
|
-
t1: Analyze current structure and plan refactor
|
|
141
|
-
t2: Capture behavioral snapshot (existing tests + manual checks)
|
|
142
|
-
t3: Execute refactor phase 1 — [structural changes]
|
|
143
|
-
t4: Execute refactor phase 2 — [update consumers]
|
|
144
|
-
t5: Validate behavior preserved — all original tests pass
|
|
145
|
-
t6: Review for missed references, dead code, broken imports
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### Cycle plan
|
|
149
|
-
- **Cycle 1**: Spawn `sisyphus:plan` for t1 + `sisyphus:validate` for t2 (capture baseline). Yield.
|
|
150
|
-
- **Cycle 2**: Spawn `sisyphus:implement` for t3. Yield.
|
|
151
|
-
- **Cycle 3**: Spawn `sisyphus:implement` for t4 + `sisyphus:validate` for t3 (parallel). Yield.
|
|
152
|
-
- **Cycle 4**: Spawn `sisyphus:validate` for t5. Yield.
|
|
153
|
-
- **Cycle 5**: Spawn `sisyphus:review` for t6. Complete.
|
|
154
|
-
|
|
155
|
-
### Key principle
|
|
156
|
-
**Behavior preservation is the only metric.** The refactor is correct if and only if all existing tests pass and externally observable behavior is unchanged.
|
|
157
|
-
|
|
158
|
-
### Parallelization
|
|
159
|
-
Limited. Refactor phases are often sequential (move before update consumers). Validation can run in parallel with the next phase if they touch different files.
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
## Code Review
|
|
164
|
-
|
|
165
|
-
### When to use
|
|
166
|
-
PR review, pre-merge check, or periodic quality audit.
|
|
167
|
-
|
|
168
|
-
### Task structure
|
|
169
|
-
```
|
|
170
|
-
t1: Review [scope] for issues
|
|
171
|
-
t2: (conditional) Fix critical/high issues found
|
|
172
|
-
t3: (conditional) Re-review fixes
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
### Cycle plan
|
|
176
|
-
- **Cycle 1**: Spawn `sisyphus:review` for t1. Yield.
|
|
177
|
-
- **Cycle 2**: If critical/high issues, spawn `sisyphus:implement` for t2. If clean, complete.
|
|
178
|
-
- **Cycle 3**: Spawn `sisyphus:review` for t3 (targeted at fixes only). Complete.
|
|
179
|
-
|
|
180
|
-
### Parallelization
|
|
181
|
-
Review itself parallelizes internally (subagents per concern). Fix cycle is usually serial.
|
|
182
|
-
|
|
183
|
-
---
|
|
184
|
-
|
|
185
|
-
## Investigation / Spike
|
|
186
|
-
|
|
187
|
-
### When to use
|
|
188
|
-
Need to understand something before committing to an approach. Prototype, explore, or answer a technical question.
|
|
189
|
-
|
|
190
|
-
### Task structure
|
|
191
|
-
```
|
|
192
|
-
t1: Investigate [question/area]
|
|
193
|
-
t2: Summarize findings and recommendation
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Cycle plan
|
|
197
|
-
- **Cycle 1**: Spawn `sisyphus:debug` (for code investigation) or `sisyphus:general` (for broader research) for t1. Yield.
|
|
198
|
-
- **Cycle 2**: Spawn `sisyphus:general` for t2 to synthesize. Complete.
|
|
199
|
-
|
|
200
|
-
### Parallelization
|
|
201
|
-
If investigating multiple independent areas, spawn parallel agents each exploring a different angle.
|
|
202
|
-
|
|
203
|
-
---
|
|
204
|
-
|
|
205
|
-
## Tactician-Driven Implementation
|
|
206
|
-
|
|
207
|
-
### When to use
|
|
208
|
-
The plan exists and you want automated cycle-by-cycle execution without manual orchestrator decisions. The tactician reads the plan, dispatches one task at a time, and tracks progress.
|
|
209
|
-
|
|
210
|
-
### Task structure
|
|
211
|
-
```
|
|
212
|
-
t1: Execute implementation plan at [path] using tactician loop
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
### Cycle plan
|
|
216
|
-
This is a single-task pattern. The orchestrator spawns the tactician once:
|
|
217
|
-
- **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.
|
|
218
|
-
|
|
219
|
-
### When NOT to use
|
|
220
|
-
- When you need human checkpoints between phases
|
|
221
|
-
- When phases have external dependencies (waiting on API access, design review, etc.)
|
|
222
|
-
- When the task requires creative decisions the tactician shouldn't make alone
|
|
@@ -1,208 +0,0 @@
|
|
|
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
|
-
```
|