|
1 | 1 | --- |
2 | 2 | name: clawteam-dev |
3 | 3 | description: > |
4 | | - This skill should be used when the user asks to "run e2e test", "test clawteam", |
5 | | - "end-to-end test", "test agent team", "verify clawteam works", "dev test", or wants |
6 | | - to validate the full ClawTeam lifecycle. Runs a complete end-to-end test: cleanup → |
7 | | - create team → create tasks with dependencies → spawn agents → wait for completion → |
8 | | - verify results → cleanup. |
9 | | -version: 0.1.0 |
| 4 | + Use this skill when working inside the ClawTeam repository itself: local development, |
| 5 | + debugging, reviewing, testing, validating multi-agent flows, or checking whether a |
| 6 | + code change actually works end-to-end. Use the repository bootstrap scripts to |
| 7 | + standardize the local `clawteam` command and to wire project-local `.agents` and |
| 8 | + `.claude` skills back to this repository. This skill is repository-development |
| 9 | + oriented, not a general end-user usage guide. |
| 10 | +version: 0.2.0 |
10 | 11 | --- |
11 | 12 |
|
12 | | -# ClawTeam End-to-End Test |
| 13 | +# ClawTeam Local Development |
13 | 14 |
|
14 | | -This skill runs a full lifecycle test of ClawTeam: cleanup residual state, create a team |
15 | | -with tasks and dependency chains, spawn real Claude agents in tmux, wait for all tasks to |
16 | | -complete, verify results, and clean up. |
| 15 | +This skill is for developing and validating ClawTeam inside the ClawTeam repository. |
| 16 | +Use it when the task is about changing ClawTeam itself, testing local behavior, or |
| 17 | +verifying multi-agent workflows against the current checkout. |
17 | 18 |
|
18 | | -## Prerequisites |
19 | | - |
20 | | -- ClawTeam installed (`pip install -e .` from the ClawTeam repo) |
21 | | -- `tmux` available |
22 | | -- `claude` CLI available |
23 | | -- Current directory is the ClawTeam git repo (for worktree isolation) |
24 | | - |
25 | | -## Test Procedure |
| 19 | +## Development Bootstrap |
26 | 20 |
|
27 | | -Follow these steps **exactly in order**. Run each bash block and verify the expected output |
28 | | -before proceeding to the next step. |
29 | | - |
30 | | -### Step 1: Cleanup ALL Previous State |
31 | | - |
32 | | -Remove **all** residual clawteam teams, worktrees, tmux sessions, and branches from any prior runs. |
33 | | -This ensures a clean slate regardless of what team names were used before or if a previous test crashed. |
| 21 | +Standardize the local development environment with the bootstrap script: |
34 | 22 |
|
35 | 23 | ```bash |
36 | | -# 1. Kill ALL clawteam tmux sessions |
37 | | -for sess in $(tmux list-sessions -F '#{session_name}' 2>/dev/null | grep '^clawteam-'); do |
38 | | - tmux kill-session -t "$sess" 2>/dev/null |
39 | | -done |
40 | | -echo "tmux sessions cleaned" |
41 | | - |
42 | | -# 2. Remove ALL clawteam worktrees |
43 | | -for wt in $(git worktree list --porcelain | grep 'worktree.*/\.clawteam/' | awk '{print $2}'); do |
44 | | - git worktree remove --force "$wt" 2>/dev/null |
45 | | -done |
46 | | -echo "worktrees cleaned" |
47 | | - |
48 | | -# 3. Delete ALL clawteam branches |
49 | | -for br in $(git branch --list 'clawteam/*' | tr -d ' +'); do |
50 | | - git branch -D "$br" 2>/dev/null |
51 | | -done |
52 | | -echo "branches cleaned" |
53 | | - |
54 | | -# 4. Remove all team/task/workspace data (preserve config.json) |
55 | | -rm -rf ~/.clawteam/teams/ ~/.clawteam/tasks/ ~/.clawteam/workspaces/ ~/.clawteam/inboxes/ ~/.clawteam/events/ ~/.clawteam/plans/ |
56 | | -echo "data cleaned" |
57 | | - |
58 | | -# 5. Verify clean state |
59 | | -echo "=== Verification ===" |
60 | | -git worktree list |
61 | | -git branch --list 'clawteam/*' | grep . || echo "OK: no clawteam branches" |
62 | | -tmux list-sessions 2>&1 | grep '^clawteam-' || echo "OK: no clawteam tmux sessions" |
63 | | -ls ~/.clawteam/ 2>/dev/null |
| 24 | +bash scripts/bootstrap_clawteam_dev.sh |
64 | 25 | ``` |
65 | 26 |
|
66 | | -**Expected**: Only the main worktree remains, no clawteam branches, no clawteam tmux sessions, |
67 | | -`~/.clawteam/` contains only `config.json`. |
| 27 | +This script lives in `scripts/bootstrap_clawteam_dev.sh` inside this skill folder. |
68 | 28 |
|
69 | | -### Step 2: Set Leader Identity |
70 | | - |
71 | | -```bash |
72 | | -export CLAWTEAM_AGENT_ID="e2e-leader-001" |
73 | | -export CLAWTEAM_AGENT_NAME="leader" |
74 | | -export CLAWTEAM_AGENT_TYPE="leader" |
75 | | -``` |
| 29 | +This script does all of the following: |
76 | 30 |
|
77 | | -These env vars MUST be set for all subsequent commands in this test. |
| 31 | +- Creates a fixed uv environment at `~/.clawteam-venv` |
| 32 | +- Installs the current repository into that environment with dev dependencies |
| 33 | +- Writes `~/.local/bin/clawteam` to point at the fixed environment |
| 34 | +- Adds a `clawteam()` shell function block to `~/.bashrc` |
78 | 35 |
|
79 | | -### Step 3: Create Team |
| 36 | +After it finishes: |
80 | 37 |
|
81 | 38 | ```bash |
82 | | -clawteam team spawn-team e2e-test -d "End-to-end test team" -n leader |
| 39 | +source ~/.bashrc |
| 40 | +clawteam --version |
83 | 41 | ``` |
84 | 42 |
|
85 | | -**Expected**: `OK Team 'e2e-test' created` |
86 | | - |
87 | | -### Step 4: Create Tasks with Dependencies |
| 43 | +Use this bootstrap whenever you want the same `clawteam` command across different |
| 44 | +Python environments on the machine. |
88 | 45 |
|
89 | | -Create 3 tasks: 2 independent tasks and 1 dependent task that is blocked until both complete. |
90 | | - |
91 | | -```bash |
92 | | -T1=$(clawteam --json task create e2e-test "Implement feature A" -o worker1 -d "Add a hello() function to a new file hello.py" | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])") |
93 | | -T2=$(clawteam --json task create e2e-test "Implement feature B" -o worker2 -d "Add a goodbye() function to a new file goodbye.py" | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])") |
94 | | -T3=$(clawteam --json task create e2e-test "Write tests" -o worker3 -d "Write pytest tests for hello.py and goodbye.py" --blocked-by "$T1,$T2" | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])") |
95 | | -echo "Tasks created: T1=$T1 T2=$T2 T3=$T3" |
96 | | -``` |
| 46 | +## Project Skill Wiring |
97 | 47 |
|
98 | | -**Expected**: Three task IDs printed. Then verify: |
| 48 | +To wire another local project so its `./.agents` and `./.claude` directories use |
| 49 | +this repository's local ClawTeam skills directly: |
99 | 50 |
|
100 | 51 | ```bash |
101 | | -clawteam task list e2e-test |
| 52 | +bash scripts/link_local_clawteam_skills.sh /path/to/project |
102 | 53 | ``` |
103 | 54 |
|
104 | | -**Expected**: worker1 and worker2 tasks are `pending`, worker3 task is `blocked`. |
| 55 | +This script lives in `scripts/link_local_clawteam_skills.sh` inside this skill folder. |
105 | 56 |
|
106 | | -### Step 5: Spawn Agents |
| 57 | +This creates these symlinks inside the target project: |
107 | 58 |
|
108 | | -Spawn 3 agents. Each gets its own git worktree and tmux window. |
| 59 | +- `./.agents/skills/clawteam` |
| 60 | +- `./.claude/skills/clawteam` |
109 | 61 |
|
110 | | -```bash |
111 | | -clawteam spawn --team e2e-test --agent-name worker1 \ |
112 | | - --task "Create hello.py with a hello() function that returns 'Hello, World!'. When done, mark your task as completed and send a summary to leader." |
| 62 | +Run the same script again any time you want to refresh or recreate those links. |
113 | 63 |
|
114 | | -clawteam spawn --team e2e-test --agent-name worker2 \ |
115 | | - --task "Create goodbye.py with a goodbye() function that returns 'Goodbye, World!'. When done, mark your task as completed and send a summary to leader." |
| 64 | +## Typical Uses |
116 | 65 |
|
117 | | -clawteam spawn --team e2e-test --agent-name worker3 \ |
118 | | - --task "Write pytest tests in test_all.py for hello.py (hello function) and goodbye.py (goodbye function). When done, mark your task as completed and send a summary to leader." |
119 | | -``` |
| 66 | +- Run targeted local validation after code changes |
| 67 | +- Reproduce a spawn / board / task / inbox / harness bug |
| 68 | +- Smoke-test the real CLI in tmux or subprocess mode |
| 69 | +- Review ClawTeam workflows end-to-end from the current repository checkout |
120 | 70 |
|
121 | | -**Expected**: Each prints `OK Agent '<name>' spawned in tmux (clawteam-e2e-test:<name>)` with a workspace path. |
| 71 | +## Fast Validation |
122 | 72 |
|
123 | | -### Step 6: Verify Team State |
| 73 | +Prefer the smallest validation that proves the change. |
124 | 74 |
|
125 | 75 | ```bash |
126 | | -clawteam team status e2e-test |
127 | | -clawteam board show e2e-test |
128 | | -git worktree list |
129 | | -tmux list-windows -t clawteam-e2e-test |
| 76 | +ruff check clawteam/ tests/ |
| 77 | +pytest tests/<target_file>.py -q |
130 | 78 | ``` |
131 | 79 |
|
132 | | -**Expected**: |
133 | | -- 4 members (leader + 3 workers) |
134 | | -- Board shows 2 pending, 1 blocked tasks |
135 | | -- 3 worktrees under `~/.clawteam/workspaces/e2e-test/` |
136 | | -- 3 tmux windows |
137 | | - |
138 | | -### Step 7: Wait for All Tasks to Complete |
139 | | - |
140 | | -Block until all agents finish. Timeout 10 minutes, poll every 5 seconds. |
| 80 | +Use broader runs only when the change crosses modules: |
141 | 81 |
|
142 | 82 | ```bash |
143 | | -clawteam task wait e2e-test --timeout 600 --poll-interval 5 |
| 83 | +pytest tests/test_cli_commands.py -q |
| 84 | +pytest tests/test_spawn_backends.py -q |
| 85 | +pytest tests/test_harness.py tests/test_event_bus.py -q |
144 | 86 | ``` |
145 | 87 |
|
146 | | -**Expected**: |
147 | | -- Progress updates as tasks complete (e.g., `1/3 tasks completed`) |
148 | | -- Messages from workers displayed as they arrive |
149 | | -- Final line: `All 3 tasks completed!` |
150 | | -- Exit code 0 |
| 88 | +## Prerequisites |
151 | 89 |
|
152 | | -### Step 8: Verify Results |
| 90 | +- `clawteam` command available |
| 91 | +- `tmux` available |
| 92 | +- A supported CLI agent such as `claude` or `codex` if you are spawning real workers |
| 93 | +- Current directory is the ClawTeam git repo when testing worktree isolation or local source changes |
153 | 94 |
|
154 | | -```bash |
155 | | -# All tasks should be completed |
156 | | -clawteam task list e2e-test |
| 95 | +## Local Smoke Test |
157 | 96 |
|
158 | | -# Board should show 3 completed, 0 pending/blocked |
159 | | -clawteam board show e2e-test |
| 97 | +Use this when you need a real multi-agent workflow check instead of unit tests. |
160 | 98 |
|
161 | | -# Read any remaining inbox messages |
162 | | -clawteam inbox receive e2e-test |
| 99 | +```bash |
| 100 | +clawteam team spawn-team dev-smoke -d "Local ClawTeam smoke test" -n leader |
| 101 | +clawteam task create dev-smoke "Smoke test worker" -o worker1 -p high |
| 102 | +clawteam spawn --team dev-smoke --agent-name worker1 --task "Report your status to leader and mark the task completed when done." |
| 103 | +clawteam board show dev-smoke |
| 104 | +clawteam task wait dev-smoke --timeout 300 --poll-interval 5 |
163 | 105 | ``` |
164 | 106 |
|
165 | | -**Expected**: |
166 | | -- All 3 tasks show status `completed` |
167 | | -- Board shows 3 in COMPLETED column |
168 | | -- Messages from workers summarizing their work |
169 | | - |
170 | | -### Step 9: Cleanup |
171 | | - |
172 | | -Reuse the same full cleanup from Step 1 to remove everything created during this test. |
| 107 | +If you are validating harness behavior specifically: |
173 | 108 |
|
174 | 109 | ```bash |
175 | | -# Kill ALL clawteam tmux sessions |
176 | | -for sess in $(tmux list-sessions -F '#{session_name}' 2>/dev/null | grep '^clawteam-'); do |
177 | | - tmux kill-session -t "$sess" 2>/dev/null |
178 | | -done |
179 | | - |
180 | | -# Remove ALL clawteam worktrees |
181 | | -for wt in $(git worktree list --porcelain | grep 'worktree.*/\.clawteam/' | awk '{print $2}'); do |
182 | | - git worktree remove --force "$wt" 2>/dev/null |
183 | | -done |
184 | | - |
185 | | -# Delete ALL clawteam branches |
186 | | -for br in $(git branch --list 'clawteam/*' | tr -d ' +'); do |
187 | | - git branch -D "$br" 2>/dev/null |
188 | | -done |
189 | | - |
190 | | -# Remove all team/task/workspace data (preserve config.json) |
191 | | -rm -rf ~/.clawteam/teams/ ~/.clawteam/tasks/ ~/.clawteam/workspaces/ ~/.clawteam/inboxes/ ~/.clawteam/events/ ~/.clawteam/plans/ |
192 | | - |
193 | | -echo "E2E test cleanup complete" |
| 110 | +clawteam harness conduct dev-harness \ |
| 111 | + --goal "Create a small implementation plan and execute it with one worker" \ |
| 112 | + --cli codex \ |
| 113 | + --agents 1 |
194 | 114 | ``` |
195 | 115 |
|
196 | | -**Expected**: `E2E test cleanup complete` |
| 116 | +## Cleanup |
197 | 117 |
|
198 | | -### Step 10: Final Verification |
| 118 | +Use the real ClawTeam commands instead of ad-hoc directory assumptions whenever possible: |
199 | 119 |
|
200 | 120 | ```bash |
201 | | -git worktree list | grep -v '^\/' | head -1 # should show only main |
202 | | -git branch --list 'clawteam/*' | grep . || echo "OK: no clawteam branches" |
203 | | -tmux list-sessions 2>&1 | grep '^clawteam-' || echo "OK: no clawteam tmux sessions" |
204 | | -ls ~/.clawteam/teams/ 2>&1 | grep -q "No such file" && echo "OK: no team data" |
205 | | -ls ~/.clawteam/tasks/ 2>&1 | grep -q "No such file" && echo "OK: no task data" |
206 | | -ls ~/.clawteam/workspaces/ 2>&1 | grep -q "No such file" && echo "OK: no workspace data" |
| 121 | +clawteam team cleanup dev-smoke |
| 122 | +clawteam team cleanup dev-harness |
207 | 123 | ``` |
208 | 124 |
|
209 | | -**Expected**: All lines start with `OK:`. |
210 | | - |
211 | | -## Test Variants |
212 | | - |
213 | | -### With P2P Transport |
214 | | - |
215 | | -Add `--transport p2p` and `export CLAWTEAM_TRANSPORT=p2p` before Step 3 to test ZeroMQ direct messaging with file fallback. The rest of the steps remain the same. |
216 | | - |
217 | | -### With subprocess Backend |
218 | | - |
219 | | -Replace `clawteam spawn` with `clawteam spawn subprocess claude` to test the subprocess backend instead of tmux. Note: `board attach` and tmux verification steps won't apply. |
| 125 | +If a crashed tmux session or worktree is left behind, clean it up explicitly after inspecting it. |
220 | 126 |
|
221 | | -## What This Test Validates |
| 127 | +## Development Rules |
222 | 128 |
|
223 | | -| Component | Validated | |
224 | | -|-----------|-----------| |
225 | | -| `team spawn-team` | Team creation with leader | |
226 | | -| `task create --blocked-by` | Task dependency chains | |
227 | | -| `spawn` (tmux backend) | Agent process launch with worktree isolation | |
228 | | -| Identity propagation | Env vars passed to sub-agents | |
229 | | -| Agent coordination | Workers update task status and send messages to leader | |
230 | | -| Auto-unblock | Blocked task unblocked when dependencies complete | |
231 | | -| `task wait` | Progress tracking, inbox drain, completion detection | |
232 | | -| `inbox send/receive` | Point-to-point messaging between agents | |
233 | | -| `board show` | Kanban board rendering | |
234 | | -| `workspace` (auto) | Git worktree creation and isolation | |
235 | | -| Cleanup | Worktree removal, branch deletion, data cleanup | |
| 129 | +- Prefer `clawteam` commands over editing state files directly. |
| 130 | +- Prefer targeted tests over broad end-to-end runs unless the change crosses spawn/runtime/workflow boundaries. |
| 131 | +- Use `board`, `task wait`, and `team status` to observe behavior before assuming a bug is in the spawn layer. |
| 132 | +- When testing agent coordination, keep the team small first: one leader and one or two workers. |
| 133 | +- Only escalate to harness or full swarm tests when the lower-level task/spawn/inbox path already works. |
0 commit comments