beads-orchestration 2.0.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/LICENSE +21 -0
- package/README.md +214 -0
- package/SKILL.md +263 -0
- package/bootstrap.py +928 -0
- package/package.json +37 -0
- package/scripts/cli.js +64 -0
- package/scripts/postinstall.js +71 -0
- package/skills/create-beads-orchestration/SKILL.md +263 -0
- package/skills/subagents-discipline/SKILL.md +158 -0
- package/templates/CLAUDE.md +326 -0
- package/templates/agents/architect.md +121 -0
- package/templates/agents/code-reviewer.md +248 -0
- package/templates/agents/detective.md +101 -0
- package/templates/agents/discovery.md +492 -0
- package/templates/agents/merge-supervisor.md +119 -0
- package/templates/agents/scout.md +100 -0
- package/templates/agents/scribe.md +96 -0
- package/templates/beads-workflow-injection-api.md +116 -0
- package/templates/beads-workflow-injection-git.md +108 -0
- package/templates/beads-workflow-injection.md +111 -0
- package/templates/frontend-reviews-requirement.md +61 -0
- package/templates/hooks/block-orchestrator-tools.sh +98 -0
- package/templates/hooks/clarify-vague-request.sh +39 -0
- package/templates/hooks/enforce-bead-for-supervisor.sh +32 -0
- package/templates/hooks/enforce-branch-before-edit.sh +47 -0
- package/templates/hooks/enforce-concise-response.sh +41 -0
- package/templates/hooks/enforce-sequential-dispatch.sh +63 -0
- package/templates/hooks/inject-discipline-reminder.sh +28 -0
- package/templates/hooks/log-dispatch-prompt.sh +39 -0
- package/templates/hooks/memory-capture.sh +104 -0
- package/templates/hooks/remind-inprogress.sh +14 -0
- package/templates/hooks/session-start.sh +121 -0
- package/templates/hooks/validate-completion.sh +131 -0
- package/templates/hooks/validate-epic-close.sh +84 -0
- package/templates/mcp.json.template +12 -0
- package/templates/memory/recall.sh +121 -0
- package/templates/settings.json +74 -0
- package/templates/skills/react-best-practices/SKILL.md +487 -0
- package/templates/skills/subagents-discipline/SKILL.md +127 -0
- package/templates/ui-constraints.md +76 -0
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "beads-orchestration",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Multi-agent orchestration for Claude Code with automatic task management",
|
|
5
|
+
"author": "Aviv Kaplan",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/AvivK5498/Claude-Code-Beads-Orchestration"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"claude",
|
|
13
|
+
"claude-code",
|
|
14
|
+
"orchestration",
|
|
15
|
+
"ai-agents",
|
|
16
|
+
"task-management",
|
|
17
|
+
"beads"
|
|
18
|
+
],
|
|
19
|
+
"os": [
|
|
20
|
+
"darwin",
|
|
21
|
+
"linux"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"postinstall": "node scripts/postinstall.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"scripts/",
|
|
28
|
+
"skills/",
|
|
29
|
+
"templates/",
|
|
30
|
+
"bootstrap.py",
|
|
31
|
+
"SKILL.md",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
"bin": {
|
|
35
|
+
"beads-orchestration": "./scripts/cli.js"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/scripts/cli.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
const command = args[0];
|
|
9
|
+
|
|
10
|
+
const packageDir = path.dirname(__dirname);
|
|
11
|
+
const bootstrapScript = path.join(packageDir, 'bootstrap.py');
|
|
12
|
+
|
|
13
|
+
function showHelp() {
|
|
14
|
+
console.log(`
|
|
15
|
+
beads-orchestration - Multi-agent orchestration for Claude Code
|
|
16
|
+
|
|
17
|
+
Usage:
|
|
18
|
+
beads-orchestration <command> [options]
|
|
19
|
+
|
|
20
|
+
Commands:
|
|
21
|
+
install Run postinstall to copy skill to ~/.claude/
|
|
22
|
+
bootstrap Run bootstrap.py directly (advanced)
|
|
23
|
+
help Show this help message
|
|
24
|
+
|
|
25
|
+
Examples:
|
|
26
|
+
beads-orchestration install
|
|
27
|
+
beads-orchestration bootstrap --project-dir /path/to/project --claude-only
|
|
28
|
+
|
|
29
|
+
After installing, use /create-beads-orchestration in Claude Code.
|
|
30
|
+
`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function runInstall() {
|
|
34
|
+
const postinstall = path.join(__dirname, 'postinstall.js');
|
|
35
|
+
require(postinstall);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function runBootstrap() {
|
|
39
|
+
const bootstrapArgs = args.slice(1).join(' ');
|
|
40
|
+
try {
|
|
41
|
+
execSync(`python3 "${bootstrapScript}" ${bootstrapArgs}`, { stdio: 'inherit' });
|
|
42
|
+
} catch (err) {
|
|
43
|
+
process.exit(err.status || 1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
switch (command) {
|
|
48
|
+
case 'install':
|
|
49
|
+
runInstall();
|
|
50
|
+
break;
|
|
51
|
+
case 'bootstrap':
|
|
52
|
+
runBootstrap();
|
|
53
|
+
break;
|
|
54
|
+
case 'help':
|
|
55
|
+
case '--help':
|
|
56
|
+
case '-h':
|
|
57
|
+
case undefined:
|
|
58
|
+
showHelp();
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
console.error(`Unknown command: ${command}`);
|
|
62
|
+
showHelp();
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
const SKILL_NAME = 'create-beads-orchestration';
|
|
8
|
+
|
|
9
|
+
// Get paths
|
|
10
|
+
const homeDir = os.homedir();
|
|
11
|
+
const claudeDir = path.join(homeDir, '.claude');
|
|
12
|
+
const claudeSkillsDir = path.join(claudeDir, 'skills', SKILL_NAME);
|
|
13
|
+
const packageDir = path.dirname(__dirname);
|
|
14
|
+
const sourceSkillDir = path.join(packageDir, 'skills', SKILL_NAME);
|
|
15
|
+
|
|
16
|
+
console.log('\n📦 Installing beads-orchestration skill...\n');
|
|
17
|
+
|
|
18
|
+
// Check OS
|
|
19
|
+
if (process.platform === 'win32') {
|
|
20
|
+
console.log('⚠️ Windows is not supported. Use WSL or macOS/Linux.');
|
|
21
|
+
process.exit(0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Create ~/.claude/skills/create-beads-orchestration/
|
|
25
|
+
try {
|
|
26
|
+
fs.mkdirSync(claudeSkillsDir, { recursive: true });
|
|
27
|
+
} catch (err) {
|
|
28
|
+
console.error(`❌ Failed to create directory: ${claudeSkillsDir}`);
|
|
29
|
+
console.error(err.message);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Copy SKILL.md
|
|
34
|
+
const sourceFile = path.join(sourceSkillDir, 'SKILL.md');
|
|
35
|
+
const destFile = path.join(claudeSkillsDir, 'SKILL.md');
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
if (!fs.existsSync(sourceFile)) {
|
|
39
|
+
console.error(`❌ Source skill not found: ${sourceFile}`);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
fs.copyFileSync(sourceFile, destFile);
|
|
44
|
+
console.log(`✅ Installed skill to: ${claudeSkillsDir}`);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.error(`❌ Failed to copy skill: ${err.message}`);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Save package location for bootstrap.py
|
|
51
|
+
const configFile = path.join(claudeDir, 'beads-orchestration-path.txt');
|
|
52
|
+
try {
|
|
53
|
+
fs.writeFileSync(configFile, packageDir);
|
|
54
|
+
console.log(`✅ Saved package path to: ${configFile}`);
|
|
55
|
+
} catch (err) {
|
|
56
|
+
console.error(`⚠️ Could not save package path: ${err.message}`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
console.log(`
|
|
60
|
+
🎉 Installation complete!
|
|
61
|
+
|
|
62
|
+
Package location: ${packageDir}
|
|
63
|
+
|
|
64
|
+
Usage:
|
|
65
|
+
In any Claude Code session, run:
|
|
66
|
+
|
|
67
|
+
/create-beads-orchestration
|
|
68
|
+
|
|
69
|
+
The skill will guide you through setting up orchestration for your project.
|
|
70
|
+
|
|
71
|
+
`);
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-beads-orchestration
|
|
3
|
+
description: Bootstrap lean multi-agent orchestration with beads task tracking. Use for projects needing agent delegation without heavy MCP overhead.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Create Beads Orchestration
|
|
8
|
+
|
|
9
|
+
Set up lightweight multi-agent orchestration with git-native task tracking for Claude Code.
|
|
10
|
+
|
|
11
|
+
## What This Skill Does
|
|
12
|
+
|
|
13
|
+
This skill bootstraps a complete multi-agent workflow where:
|
|
14
|
+
|
|
15
|
+
- **Orchestrator** (you) investigates issues, manages tasks, delegates implementation
|
|
16
|
+
- **Supervisors** (specialized agents) execute fixes in isolated worktrees
|
|
17
|
+
- **Beads CLI** tracks all work with git-native task management
|
|
18
|
+
- **Hooks** enforce workflow discipline automatically
|
|
19
|
+
|
|
20
|
+
Each task gets its own worktree at `.worktrees/bd-{BEAD_ID}/`, keeping main clean and enabling parallel work.
|
|
21
|
+
|
|
22
|
+
## Beads Kanban UI
|
|
23
|
+
|
|
24
|
+
The setup will auto-detect [Beads Kanban UI](https://github.com/AvivK5498/Beads-Kanban-UI) and configure accordingly. If not found, you'll be offered to install it.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Step 0: Detect Setup State (ALWAYS RUN FIRST)
|
|
29
|
+
|
|
30
|
+
<detection-phase>
|
|
31
|
+
**Before doing anything else, detect if this is a fresh setup or a resume after restart.**
|
|
32
|
+
|
|
33
|
+
Check for bootstrap artifacts:
|
|
34
|
+
```bash
|
|
35
|
+
ls .claude/agents/scout.md 2>/dev/null && echo "BOOTSTRAP_COMPLETE" || echo "FRESH_SETUP"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**If `BOOTSTRAP_COMPLETE`:**
|
|
39
|
+
- Bootstrap already ran in a previous session
|
|
40
|
+
- Skip directly to **Step 4: Run Discovery**
|
|
41
|
+
- Do NOT ask for project info or run bootstrap again
|
|
42
|
+
|
|
43
|
+
**If `FRESH_SETUP`:**
|
|
44
|
+
- This is a new installation
|
|
45
|
+
- Proceed to **Step 1: Get Project Info**
|
|
46
|
+
</detection-phase>
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Workflow Overview
|
|
51
|
+
|
|
52
|
+
<mandatory-workflow>
|
|
53
|
+
| Step | Action | When to Run |
|
|
54
|
+
|------|--------|-------------|
|
|
55
|
+
| 0 | Detect setup state | **ALWAYS** (determines path) |
|
|
56
|
+
| 1 | Get project info from user | Fresh setup only |
|
|
57
|
+
| 2 | Run bootstrap | Fresh setup only |
|
|
58
|
+
| 3 | **STOP** - Instruct user to restart | Fresh setup only |
|
|
59
|
+
| 4 | Run discovery agent | After restart OR if bootstrap already complete |
|
|
60
|
+
|
|
61
|
+
**The setup is NOT complete until Step 4 (discovery) has run.**
|
|
62
|
+
</mandatory-workflow>
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Step 1: Get Project Info (Fresh Setup Only)
|
|
67
|
+
|
|
68
|
+
<critical-step1>
|
|
69
|
+
**YOU MUST GET PROJECT INFO AND DETECT/ASK ABOUT KANBAN UI BEFORE PROCEEDING TO STEP 2.**
|
|
70
|
+
|
|
71
|
+
1. **Project directory**: Where to install (default: current working directory)
|
|
72
|
+
2. **Project name**: For agent templates (will auto-infer from package.json/pyproject.toml if not provided)
|
|
73
|
+
3. **Kanban UI**: Auto-detect, or ask the user to install
|
|
74
|
+
</critical-step1>
|
|
75
|
+
|
|
76
|
+
### 1.1 Get Project Directory and Name
|
|
77
|
+
|
|
78
|
+
Ask the user or auto-detect from package.json/pyproject.toml.
|
|
79
|
+
|
|
80
|
+
### 1.2 Detect or Install Kanban UI
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
which bead-kanban 2>/dev/null && echo "KANBAN_FOUND" || echo "KANBAN_NOT_FOUND"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**If KANBAN_FOUND** → Use `--with-kanban-ui` flag. Tell the user:
|
|
87
|
+
> Detected Beads Kanban UI. Configuring worktree management via API.
|
|
88
|
+
|
|
89
|
+
**If KANBAN_NOT_FOUND** → Ask:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
AskUserQuestion(
|
|
93
|
+
questions=[
|
|
94
|
+
{
|
|
95
|
+
"question": "Beads Kanban UI not detected. It adds a visual kanban board with dependency graphs and API-driven worktree management. Install it?",
|
|
96
|
+
"header": "Kanban UI",
|
|
97
|
+
"options": [
|
|
98
|
+
{"label": "Yes, install it (Recommended)", "description": "Runs: npm install -g beads-kanban-ui"},
|
|
99
|
+
{"label": "Skip", "description": "Use git worktrees directly. You can install later."}
|
|
100
|
+
],
|
|
101
|
+
"multiSelect": false
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- If "Yes" → Run `npm install -g beads-kanban-ui`, then use `--with-kanban-ui` flag
|
|
108
|
+
- If "Skip" → do NOT use `--with-kanban-ui` flag
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Step 2: Run Bootstrap
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# With Kanban UI:
|
|
116
|
+
npx beads-orchestration@latest bootstrap \
|
|
117
|
+
--project-name "{{PROJECT_NAME}}" \
|
|
118
|
+
--project-dir "{{PROJECT_DIR}}" \
|
|
119
|
+
--with-kanban-ui
|
|
120
|
+
|
|
121
|
+
# Without Kanban UI (git worktrees only):
|
|
122
|
+
npx beads-orchestration@latest bootstrap \
|
|
123
|
+
--project-name "{{PROJECT_NAME}}" \
|
|
124
|
+
--project-dir "{{PROJECT_DIR}}"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The bootstrap script will:
|
|
128
|
+
1. Install beads CLI (via brew, npm, or go)
|
|
129
|
+
2. Initialize `.beads/` directory
|
|
130
|
+
3. Copy agent templates to `.claude/agents/`
|
|
131
|
+
4. Copy hooks to `.claude/hooks/`
|
|
132
|
+
5. Configure `.claude/settings.json`
|
|
133
|
+
6. Create `CLAUDE.md` with orchestrator instructions
|
|
134
|
+
7. Update `.gitignore`
|
|
135
|
+
|
|
136
|
+
**Verify bootstrap completed successfully before proceeding.**
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Step 3: STOP - User Must Restart
|
|
141
|
+
|
|
142
|
+
<critical>
|
|
143
|
+
**YOU MUST STOP HERE AND INSTRUCT THE USER TO RESTART CLAUDE CODE.**
|
|
144
|
+
|
|
145
|
+
Tell the user:
|
|
146
|
+
|
|
147
|
+
> **Setup phase complete. You MUST restart Claude Code now.**
|
|
148
|
+
>
|
|
149
|
+
> The new hooks and MCP configuration will only load after restart.
|
|
150
|
+
>
|
|
151
|
+
> After restarting:
|
|
152
|
+
> 1. Open this same project directory
|
|
153
|
+
> 2. Tell me "Continue orchestration setup" or run `/create-beads-orchestration` again
|
|
154
|
+
> 3. I will run the discovery agent to complete setup
|
|
155
|
+
>
|
|
156
|
+
> **Do not skip this restart - the orchestration will not work without it.**
|
|
157
|
+
|
|
158
|
+
**DO NOT proceed to Step 4 in this session. The restart is mandatory.**
|
|
159
|
+
</critical>
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Step 4: Run Discovery (After Restart OR Detection)
|
|
164
|
+
|
|
165
|
+
<post-restart>
|
|
166
|
+
**Run this step if:**
|
|
167
|
+
- Step 0 detected `BOOTSTRAP_COMPLETE`, OR
|
|
168
|
+
- User returned after restart and said "continue setup" or ran `/create-beads-orchestration` again
|
|
169
|
+
|
|
170
|
+
1. Verify bootstrap completed (check for `.claude/agents/scout.md`) - already done in Step 0
|
|
171
|
+
2. Run the discovery agent:
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
Task(
|
|
175
|
+
subagent_type="discovery",
|
|
176
|
+
prompt="Detect tech stack and create supervisors for this project"
|
|
177
|
+
)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Discovery will:
|
|
181
|
+
- Scan package.json, requirements.txt, Dockerfile, etc.
|
|
182
|
+
- Fetch specialist agents from external directory
|
|
183
|
+
- Inject beads workflow into each supervisor
|
|
184
|
+
- Write supervisors to `.claude/agents/`
|
|
185
|
+
|
|
186
|
+
3. After discovery completes, tell the user:
|
|
187
|
+
|
|
188
|
+
> **Orchestration setup complete!**
|
|
189
|
+
>
|
|
190
|
+
> Created supervisors: [list what discovery created]
|
|
191
|
+
>
|
|
192
|
+
> You can now use the orchestration workflow:
|
|
193
|
+
> - Create tasks with `bd create "Task name" -d "Description"`
|
|
194
|
+
> - The orchestrator will delegate to appropriate supervisors
|
|
195
|
+
> - All work requires code review before completion
|
|
196
|
+
</post-restart>
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## What This Creates
|
|
201
|
+
|
|
202
|
+
- **Beads CLI** for git-native task tracking (one bead = one worktree = one task)
|
|
203
|
+
- **Core agents**: scout, detective, architect, scribe, code-reviewer (all run via Claude Task)
|
|
204
|
+
- **Discovery agent**: Auto-detects tech stack and creates specialized supervisors
|
|
205
|
+
- **Hooks**: Enforce orchestrator discipline, code review gates, concise responses
|
|
206
|
+
- **Worktree-per-task workflow**: Isolated development in `.worktrees/bd-{BEAD_ID}/`
|
|
207
|
+
|
|
208
|
+
**With `--with-kanban-ui`:**
|
|
209
|
+
- Worktrees created via API (localhost:3008) with git fallback
|
|
210
|
+
- Requires [Beads Kanban UI](https://github.com/AvivK5498/Beads-Kanban-UI) running
|
|
211
|
+
|
|
212
|
+
**Without `--with-kanban-ui`:**
|
|
213
|
+
- Worktrees created via raw git commands
|
|
214
|
+
|
|
215
|
+
## Epic Workflow (Cross-Domain Features)
|
|
216
|
+
|
|
217
|
+
For features requiring multiple supervisors (e.g., DB + API + Frontend), use the **epic workflow**:
|
|
218
|
+
|
|
219
|
+
### When to Use Epics
|
|
220
|
+
|
|
221
|
+
| Task Type | Workflow |
|
|
222
|
+
|-----------|----------|
|
|
223
|
+
| Single-domain (one supervisor) | Standalone bead |
|
|
224
|
+
| Cross-domain (multiple supervisors) | Epic with children |
|
|
225
|
+
|
|
226
|
+
### Epic Workflow Steps
|
|
227
|
+
|
|
228
|
+
1. **Create epic**: `bd create "Feature name" -d "Description" --type epic`
|
|
229
|
+
2. **Create design doc** (if needed): Dispatch architect to create `.designs/{EPIC_ID}.md`
|
|
230
|
+
3. **Link design**: `bd update {EPIC_ID} --design ".designs/{EPIC_ID}.md"`
|
|
231
|
+
4. **Create children with dependencies**:
|
|
232
|
+
```bash
|
|
233
|
+
bd create "DB schema" -d "..." --parent {EPIC_ID} # BD-001.1
|
|
234
|
+
bd create "API endpoints" -d "..." --parent {EPIC_ID} --deps BD-001.1 # BD-001.2
|
|
235
|
+
bd create "Frontend" -d "..." --parent {EPIC_ID} --deps BD-001.2 # BD-001.3
|
|
236
|
+
```
|
|
237
|
+
5. **Dispatch sequentially**: Use `bd ready` to find unblocked tasks (each child gets own worktree)
|
|
238
|
+
6. **User merges each PR**: Wait for child's PR to merge before dispatching next
|
|
239
|
+
7. **Close epic**: `bd close {EPIC_ID}` after all children merged
|
|
240
|
+
|
|
241
|
+
### Design Docs
|
|
242
|
+
|
|
243
|
+
Design docs ensure consistency across epic children:
|
|
244
|
+
- Schema definitions (exact column names, types)
|
|
245
|
+
- API contracts (endpoints, request/response shapes)
|
|
246
|
+
- Shared constants/enums
|
|
247
|
+
- Data flow between layers
|
|
248
|
+
|
|
249
|
+
**Key rule**: Orchestrator dispatches architect to create design docs. Orchestrator never writes design docs directly.
|
|
250
|
+
|
|
251
|
+
### Hooks Enforce Epic Workflow
|
|
252
|
+
|
|
253
|
+
- **enforce-sequential-dispatch.sh**: Blocks dispatch if task has unresolved blockers
|
|
254
|
+
- **enforce-bead-for-supervisor.sh**: Requires BEAD_ID for all supervisors
|
|
255
|
+
- **validate-completion.sh**: Verifies worktree, push, bead status before supervisor completes
|
|
256
|
+
|
|
257
|
+
## Requirements
|
|
258
|
+
|
|
259
|
+
- **beads CLI**: Installed automatically by bootstrap (via brew, npm, or go)
|
|
260
|
+
|
|
261
|
+
## More Information
|
|
262
|
+
|
|
263
|
+
See the full documentation: https://github.com/AvivK5498/Claude-Code-Beads-Orchestration
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: subagents-discipline
|
|
3
|
+
description: Invoke at the start of any implementation task to enforce verification-first development
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Implementation Discipline
|
|
7
|
+
|
|
8
|
+
**Core principle:** Test the FEATURE, not just the component you built.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Three Rules
|
|
13
|
+
|
|
14
|
+
### Rule 1: Look Before You Code
|
|
15
|
+
|
|
16
|
+
Before writing code that touches external data (API, database, file, config):
|
|
17
|
+
|
|
18
|
+
1. **Fetch/read the ACTUAL data** - run the command, see the output
|
|
19
|
+
2. **Note exact field names, types, formats** - not what docs say, what you SEE
|
|
20
|
+
3. **Code against what you observed** - not what you assumed
|
|
21
|
+
|
|
22
|
+
This catches: field name mismatches, wrong data shapes, missing fields, format differences.
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
WITHOUT looking first:
|
|
26
|
+
Assumed: column is "reference_images"
|
|
27
|
+
Reality: column is "reference_image_url"
|
|
28
|
+
Result: Query fails
|
|
29
|
+
|
|
30
|
+
WITH looking first:
|
|
31
|
+
Ran: SELECT column_name FROM information_schema.columns WHERE table_name = 'assets';
|
|
32
|
+
Saw: reference_image_url
|
|
33
|
+
Coded against: reference_image_url
|
|
34
|
+
Result: Works
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Rule 2: Test Both Levels
|
|
38
|
+
|
|
39
|
+
**Component test** catches: logic bugs, edge cases, type errors
|
|
40
|
+
**Feature test** catches: integration bugs, auth issues, data flow problems
|
|
41
|
+
|
|
42
|
+
Both are required. Component test alone is NOT sufficient.
|
|
43
|
+
|
|
44
|
+
| You built | Component test | Feature test |
|
|
45
|
+
|-----------|----------------|--------------|
|
|
46
|
+
| API endpoint | curl returns 200 | UI calls API, displays result |
|
|
47
|
+
| Database change | Migration runs | App reads/writes correctly |
|
|
48
|
+
| Frontend component | Renders, no errors | User can see and interact |
|
|
49
|
+
| Full-stack feature | Each piece works alone | End-to-end flow works |
|
|
50
|
+
|
|
51
|
+
**The pattern:**
|
|
52
|
+
1. Build the thing
|
|
53
|
+
2. Component test - verify your piece works in isolation
|
|
54
|
+
3. Feature test - verify the integrated feature works end-to-end
|
|
55
|
+
4. Only then claim done
|
|
56
|
+
|
|
57
|
+
### Rule 3: Use Your Tools
|
|
58
|
+
|
|
59
|
+
Before claiming you can't fully test:
|
|
60
|
+
|
|
61
|
+
1. **Check what MCP servers you have access to** - list available tools
|
|
62
|
+
2. **If any tool can help verify the feature works**, use it
|
|
63
|
+
3. **Be resourceful** - browser automation, database inspection, API testing tools
|
|
64
|
+
|
|
65
|
+
"I couldn't test the feature" is only valid after exhausting available options.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## DEMO Block (Required)
|
|
70
|
+
|
|
71
|
+
Every completion must include evidence. Code reviewer will verify this.
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
DEMO:
|
|
75
|
+
COMPONENT:
|
|
76
|
+
Command: [what you ran to test the component]
|
|
77
|
+
Result: [what you observed]
|
|
78
|
+
|
|
79
|
+
FEATURE:
|
|
80
|
+
Steps: [how you tested the integrated feature]
|
|
81
|
+
Result: [what you observed - screenshot, output, etc.]
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### When Full Feature Test Isn't Possible
|
|
85
|
+
|
|
86
|
+
If you genuinely cannot test end-to-end (long-running job, external service, no browser tools):
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
DEMO:
|
|
90
|
+
COMPONENT:
|
|
91
|
+
Command: curl localhost:3008/api/endpoint
|
|
92
|
+
Result: 200, returns expected data
|
|
93
|
+
|
|
94
|
+
FEATURE: PARTIAL
|
|
95
|
+
Verified: [what you could test]
|
|
96
|
+
Needs human check: [what still needs verification]
|
|
97
|
+
Why: [specific reason - no browser MCP, takes 10+ minutes, requires external service]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Not acceptable reasons for PARTIAL:**
|
|
101
|
+
- "Server wasn't running" → start it
|
|
102
|
+
- "Didn't have test data" → create it
|
|
103
|
+
- "Would take too long" → if < 2 minutes, do it
|
|
104
|
+
|
|
105
|
+
**Acceptable reasons:**
|
|
106
|
+
- No browser/UI automation tools available
|
|
107
|
+
- External API with rate limits or costs
|
|
108
|
+
- Job takes > 5 minutes to complete
|
|
109
|
+
- Requires production data that can't be mocked
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## For Epic Children
|
|
114
|
+
|
|
115
|
+
If your BEAD_ID contains a dot (e.g., BD-001.2), you're implementing part of a larger feature:
|
|
116
|
+
|
|
117
|
+
1. **Check for design doc**: `bd show {EPIC_ID} --json | jq -r '.[0].design'`
|
|
118
|
+
2. **Read it if it exists** - this is your contract
|
|
119
|
+
3. **Match it exactly** - same field names, same types, same shapes
|
|
120
|
+
|
|
121
|
+
Design docs ensure all pieces fit together. If you deviate, integration fails.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Completion Checklist
|
|
126
|
+
|
|
127
|
+
Before marking done:
|
|
128
|
+
|
|
129
|
+
- [ ] Looked at actual data/interfaces before coding (not assumed)
|
|
130
|
+
- [ ] Component test passes (your piece works in isolation)
|
|
131
|
+
- [ ] Feature test passes OR documented as PARTIAL with valid reason
|
|
132
|
+
- [ ] DEMO block included with evidence
|
|
133
|
+
- [ ] Used available tools to test (checked MCP servers, used what helps)
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Red Flags - Stop and Verify
|
|
138
|
+
|
|
139
|
+
When you catch yourself thinking:
|
|
140
|
+
- "This should work..." → run it and see
|
|
141
|
+
- "I assume the field is..." → look at the actual data
|
|
142
|
+
- "I'll test it later..." → test it now
|
|
143
|
+
- "It's too simple to break..." → verify anyway
|
|
144
|
+
|
|
145
|
+
When you're about to say:
|
|
146
|
+
- "Done!" / "Fixed!" / "Should work now!" → show the DEMO first
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## The Bottom Line
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
Component test passing ≠ feature works
|
|
154
|
+
Curl returning 200 ≠ UI displays correctly
|
|
155
|
+
TypeScript compiles ≠ user can use it
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Test the feature like a user would use it. Then show evidence. Then claim done.
|