opencode-swarm-plugin 0.62.2 → 0.63.0
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/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/commands/ralph.md +157 -0
- package/claude-plugin/dist/index.js +7 -250
- package/claude-plugin/dist/schemas/ralph.d.ts +622 -0
- package/claude-plugin/dist/schemas/ralph.d.ts.map +1 -0
- package/claude-plugin/skills/always-on-guidance/SKILL.md +4 -10
- package/claude-plugin/skills/ralph-supervisor/SKILL.md +198 -0
- package/claude-plugin/skills/swarm-cli/SKILL.md +4 -2
- package/claude-plugin/skills/swarm-coordination/SKILL.md +96 -11
- package/dist/bin/swarm.js +9 -495
- package/dist/index.js +5 -5
- package/dist/marketplace/index.js +7 -250
- package/dist/plugin.js +5 -5
- package/dist/ralph-supervisor.d.ts +248 -0
- package/dist/ralph-supervisor.d.ts.map +1 -0
- package/dist/schemas/ralph.d.ts +622 -0
- package/dist/schemas/ralph.d.ts.map +1 -0
- package/package.json +3 -3
- package/claude-plugin/skills/release/SKILL.md +0 -101
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ralph-supervisor
|
|
3
|
+
description: |
|
|
4
|
+
Ralph loop pattern - Claude supervises while Codex (gpt-5.3-codex) executes
|
|
5
|
+
implementation work. Use for autonomous coding loops with fresh context per
|
|
6
|
+
iteration, validation gates, and git-backed persistence. Tools: ralph_init,
|
|
7
|
+
ralph_story, ralph_iterate, ralph_loop, ralph_status, ralph_cancel, ralph_review.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Ralph Supervisor Pattern
|
|
11
|
+
|
|
12
|
+
Ralph implements an autonomous coding loop where Claude acts as supervisor and Codex executes implementation work. Named after the pattern from [openclaw-codex-ralph](https://github.com/joelhooks/openclaw-codex-ralph).
|
|
13
|
+
|
|
14
|
+
## Core Philosophy
|
|
15
|
+
|
|
16
|
+
Traditional AI sessions accumulate context and drift. Ralph uses:
|
|
17
|
+
- **Fresh context per iteration** - Each Codex session starts clean
|
|
18
|
+
- **Git-backed persistence** - Completed work lives in commits
|
|
19
|
+
- **Validation gates** - Tests must pass before progression
|
|
20
|
+
- **Progress carryover** - Learnings flow forward (last 2000 chars)
|
|
21
|
+
|
|
22
|
+
## Architecture
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
┌──────────────────────────────────────────────────────────┐
|
|
26
|
+
│ RALPH ARCHITECTURE │
|
|
27
|
+
├──────────────────────────────────────────────────────────┤
|
|
28
|
+
│ │
|
|
29
|
+
│ ┌─────────────┐ ┌─────────────┐ │
|
|
30
|
+
│ │ Claude │ spawns │ Codex │ │
|
|
31
|
+
│ │ (Supervisor)│ ──────► │ (Executor) │ │
|
|
32
|
+
│ └─────────────┘ └─────────────┘ │
|
|
33
|
+
│ │ │ │
|
|
34
|
+
│ │ plans/reviews │ implements │
|
|
35
|
+
│ ▼ ▼ │
|
|
36
|
+
│ ┌─────────────┐ ┌─────────────┐ │
|
|
37
|
+
│ │ prd.json │ │ Code + │ │
|
|
38
|
+
│ │ (stories) │ │ Tests │ │
|
|
39
|
+
│ └─────────────┘ └─────────────┘ │
|
|
40
|
+
│ │ │ │
|
|
41
|
+
│ │ │ validates │
|
|
42
|
+
│ ▼ ▼ │
|
|
43
|
+
│ ┌─────────────┐ ┌─────────────┐ │
|
|
44
|
+
│ │progress.txt │◄────────│ npm test │ │
|
|
45
|
+
│ │ (learnings) │ logs │ typecheck │ │
|
|
46
|
+
│ └─────────────┘ └─────────────┘ │
|
|
47
|
+
│ │ │ │
|
|
48
|
+
│ │ │ on success │
|
|
49
|
+
│ ▼ ▼ │
|
|
50
|
+
│ ┌─────────────┐ ┌─────────────┐ │
|
|
51
|
+
│ │ Hivemind │ │ Git Commit │ │
|
|
52
|
+
│ │ (semantic) │ │ (persist) │ │
|
|
53
|
+
│ └─────────────┘ └─────────────┘ │
|
|
54
|
+
│ │
|
|
55
|
+
└──────────────────────────────────────────────────────────┘
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Iteration Lifecycle
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
1. Read PRD → Find next pending story (by priority)
|
|
62
|
+
2. Load progress.txt + AGENTS.md for context
|
|
63
|
+
3. Build iteration prompt for Codex
|
|
64
|
+
4. Spawn Codex (codex exec --full-auto)
|
|
65
|
+
5. Run validation command
|
|
66
|
+
6. If success:
|
|
67
|
+
- Mark story.status = "passed"
|
|
68
|
+
- Append to progress.txt
|
|
69
|
+
- Git commit
|
|
70
|
+
7. If failure:
|
|
71
|
+
- Log failure details
|
|
72
|
+
- Keep story for retry
|
|
73
|
+
8. Repeat until all stories pass or limits hit
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Story Structure
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"id": "story-1234567890",
|
|
81
|
+
"title": "Add user authentication",
|
|
82
|
+
"description": "Implement login/logout with JWT...",
|
|
83
|
+
"priority": 1,
|
|
84
|
+
"status": "pending",
|
|
85
|
+
"validation_command": "npm test && npm run typecheck",
|
|
86
|
+
"acceptance_criteria": [
|
|
87
|
+
"JWT token generation works",
|
|
88
|
+
"Refresh token flow implemented"
|
|
89
|
+
],
|
|
90
|
+
"attempts": 0,
|
|
91
|
+
"files_touched": [],
|
|
92
|
+
"created_at": "2024-01-15T10:00:00Z",
|
|
93
|
+
"updated_at": "2024-01-15T10:00:00Z"
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## PRD Structure
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"version": "1.0",
|
|
102
|
+
"project_name": "My Feature",
|
|
103
|
+
"description": "Adding OAuth support...",
|
|
104
|
+
"stories": [...],
|
|
105
|
+
"metadata": {
|
|
106
|
+
"created_at": "...",
|
|
107
|
+
"last_iteration": "...",
|
|
108
|
+
"total_iterations": 5,
|
|
109
|
+
"total_stories_completed": 3
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Supervisor Best Practices
|
|
115
|
+
|
|
116
|
+
### Story Design
|
|
117
|
+
|
|
118
|
+
- **Granular scope** - Each story should fit in one Codex context
|
|
119
|
+
- **Clear acceptance criteria** - Specific, testable requirements
|
|
120
|
+
- **Proper validation** - Tests that actually verify the work
|
|
121
|
+
- **Priority ordering** - Dependencies first (lower number = higher priority)
|
|
122
|
+
|
|
123
|
+
### Review Process
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
127
|
+
│ REVIEW CHECKLIST │
|
|
128
|
+
├─────────────────────────────────────────────────────────────┤
|
|
129
|
+
│ │
|
|
130
|
+
│ □ Tests pass (validation_command succeeded) │
|
|
131
|
+
│ □ Acceptance criteria met │
|
|
132
|
+
│ □ Code quality acceptable │
|
|
133
|
+
│ □ No security issues introduced │
|
|
134
|
+
│ □ Integration with existing code correct │
|
|
135
|
+
│ │
|
|
136
|
+
│ If YES to all → ralph_review({ approve: true }) │
|
|
137
|
+
│ If NO to any → ralph_review({ approve: false, │
|
|
138
|
+
│ feedback: "Specific issue"})│
|
|
139
|
+
│ │
|
|
140
|
+
└─────────────────────────────────────────────────────────────┘
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Knowledge Persistence
|
|
144
|
+
|
|
145
|
+
After completing a project, store learnings:
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
hivemind_store({
|
|
149
|
+
information: "OAuth implementation: Used refresh token rotation pattern with 7-day expiry. Key gotcha: must invalidate old refresh token on use.",
|
|
150
|
+
tags: "oauth,auth,tokens,patterns",
|
|
151
|
+
confidence: 0.9
|
|
152
|
+
})
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Configuration
|
|
156
|
+
|
|
157
|
+
| Parameter | Default | Description |
|
|
158
|
+
|-----------|---------|-------------|
|
|
159
|
+
| `model` | `gpt-5.3-codex` | Codex model to use |
|
|
160
|
+
| `sandbox` | `workspace-write` | Sandbox mode |
|
|
161
|
+
| `max_iterations` | `20` | Loop limit |
|
|
162
|
+
| `auto_commit` | `true` | Commit on success |
|
|
163
|
+
| `progress_context_limit` | `2000` | Chars of progress in prompt |
|
|
164
|
+
| `default_validation` | `npm run typecheck; npm test` | Fallback validation |
|
|
165
|
+
|
|
166
|
+
## Events Emitted
|
|
167
|
+
|
|
168
|
+
| Event | When |
|
|
169
|
+
|-------|------|
|
|
170
|
+
| `ralph:init` | Project initialized |
|
|
171
|
+
| `ralph:story:added` | Story added to PRD |
|
|
172
|
+
| `ralph:iteration:start` | Iteration begins |
|
|
173
|
+
| `ralph:iteration:complete` | Iteration ends |
|
|
174
|
+
| `ralph:loop:start` | Loop begins |
|
|
175
|
+
| `ralph:loop:iteration` | Each loop iteration |
|
|
176
|
+
| `ralph:loop:complete` | Loop finishes |
|
|
177
|
+
| `ralph:loop:error` | Loop error |
|
|
178
|
+
| `ralph:review:approved` | Work approved |
|
|
179
|
+
| `ralph:review:rejected` | Work rejected |
|
|
180
|
+
|
|
181
|
+
## Error Handling
|
|
182
|
+
|
|
183
|
+
| Error | Recovery |
|
|
184
|
+
|-------|----------|
|
|
185
|
+
| Codex timeout | Retry with longer timeout |
|
|
186
|
+
| Validation fail | Fix in next iteration |
|
|
187
|
+
| No stories left | All complete, exit |
|
|
188
|
+
| Max iterations | Report remaining work |
|
|
189
|
+
|
|
190
|
+
## Comparison: Ralph vs Swarm
|
|
191
|
+
|
|
192
|
+
| Aspect | Ralph | Swarm |
|
|
193
|
+
|--------|-------|-------|
|
|
194
|
+
| Executor | Codex | Claude workers |
|
|
195
|
+
| Parallelism | Sequential | Parallel |
|
|
196
|
+
| Context | Fresh per iteration | Shared via hivemind |
|
|
197
|
+
| Review | Supervisor reviews each | Coordinator reviews all |
|
|
198
|
+
| Best for | Complex sequential tasks | Independent parallel tasks |
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: swarm-cli
|
|
3
|
-
description:
|
|
4
|
-
|
|
3
|
+
description: |
|
|
4
|
+
Swarm CLI commands for workers - hivemind memory, hive tasks, swarmmail coordination.
|
|
5
|
+
Use when working in a swarm context. Covers: swarm memory (find/store/get/stats),
|
|
6
|
+
swarm cells (query/create/update/close), and coordination commands.
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
# Swarm CLI Quick Reference
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: swarm-coordination
|
|
3
|
-
description:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- coordination
|
|
8
|
-
tools:
|
|
9
|
-
- "*"
|
|
10
|
-
related_skills:
|
|
11
|
-
- testing-patterns
|
|
12
|
-
- system-design
|
|
13
|
-
- cli-builder
|
|
3
|
+
description: |
|
|
4
|
+
Multi-agent coordination patterns for OpenCode swarm workflows. Use when work
|
|
5
|
+
benefits from parallelization or coordination. Covers: decomposition, worker
|
|
6
|
+
spawning, file reservations, progress tracking, and review loops.
|
|
14
7
|
---
|
|
15
8
|
|
|
16
9
|
# Swarm Coordination
|
|
@@ -100,6 +93,98 @@ Coordinators never reserve files.
|
|
|
100
93
|
|
|
101
94
|
Use `swarm_progress` at 25%, 50%, and 75% completion to trigger auto-checkpoints.
|
|
102
95
|
|
|
96
|
+
## Spawning Workers (CRITICAL - Read This)
|
|
97
|
+
|
|
98
|
+
### Step 1: Prepare the subtask with swarm_spawn_subtask
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
const spawnResult = await swarm_spawn_subtask({
|
|
102
|
+
bead_id: "cell-abc123", // The hive cell ID for this subtask
|
|
103
|
+
epic_id: "epic-xyz789", // Parent epic ID
|
|
104
|
+
subtask_title: "Add logging utilities",
|
|
105
|
+
subtask_description: "Create a logger module with structured logging support",
|
|
106
|
+
files: ["src/utils/logger.ts", "src/utils/logger.test.ts"], // Array of strings, NOT a JSON string
|
|
107
|
+
shared_context: "This epic is adding observability. Other workers are adding metrics and tracing.",
|
|
108
|
+
project_path: "/absolute/path/to/project" // Required for tracking
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Step 2: Spawn the worker with Task tool
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
// Parse the result to get the prompt
|
|
116
|
+
const { prompt, recommended_model } = JSON.parse(spawnResult);
|
|
117
|
+
|
|
118
|
+
// Spawn the worker
|
|
119
|
+
await Task({
|
|
120
|
+
subagent_type: "swarm:worker",
|
|
121
|
+
prompt: prompt,
|
|
122
|
+
model: recommended_model // Optional: use the auto-selected model
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Common Mistakes
|
|
127
|
+
|
|
128
|
+
**WRONG - files as JSON string:**
|
|
129
|
+
```typescript
|
|
130
|
+
files: '["src/auth.ts"]' // DON'T do this
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**CORRECT - files as proper array:**
|
|
134
|
+
```typescript
|
|
135
|
+
files: ["src/auth.ts", "src/auth.test.ts"] // Do this
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**WRONG - missing project_path:**
|
|
139
|
+
```typescript
|
|
140
|
+
swarm_spawn_subtask({
|
|
141
|
+
bead_id: "...",
|
|
142
|
+
epic_id: "...",
|
|
143
|
+
// No project_path - worker can't initialize tracking!
|
|
144
|
+
})
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**CORRECT - always include project_path:**
|
|
148
|
+
```typescript
|
|
149
|
+
swarm_spawn_subtask({
|
|
150
|
+
bead_id: "...",
|
|
151
|
+
epic_id: "...",
|
|
152
|
+
project_path: "/Users/joel/myproject" // Required!
|
|
153
|
+
})
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Parallel vs Sequential Spawning
|
|
157
|
+
|
|
158
|
+
### Parallel (independent tasks)
|
|
159
|
+
|
|
160
|
+
Send multiple Task calls in a single message:
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
// All in one message - runs in parallel
|
|
164
|
+
Task({ subagent_type: "swarm:worker", prompt: prompt1 })
|
|
165
|
+
Task({ subagent_type: "swarm:worker", prompt: prompt2 })
|
|
166
|
+
Task({ subagent_type: "swarm:worker", prompt: prompt3 })
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Sequential (dependent tasks)
|
|
170
|
+
|
|
171
|
+
Await each before spawning next:
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
const result1 = await Task({ subagent_type: "swarm:worker", prompt: prompt1 });
|
|
175
|
+
// Review result1...
|
|
176
|
+
const result2 = await Task({ subagent_type: "swarm:worker", prompt: prompt2 });
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Story Status Flow
|
|
180
|
+
|
|
181
|
+
Status transitions should flow:
|
|
182
|
+
1. **Coordinator** sets story to `in_progress` when spawning worker
|
|
183
|
+
2. **Worker** completes work and sets to `ready_for_review`
|
|
184
|
+
3. **Coordinator** reviews and sets to `passed` or `failed`
|
|
185
|
+
|
|
186
|
+
Workers do NOT set final status - that's the coordinator's job after review.
|
|
187
|
+
|
|
103
188
|
## Skill Loading Guidance
|
|
104
189
|
|
|
105
190
|
Workers should load skills based on task type:
|