Skip to content

Commit 770d23d

Browse files
committed
feat(skill): add todo-based tracking to manager-worker-dispatch
- refactor manager-worker-dispatch to use todo.json as the dispatch source of truth - add start-tracking/stop-tracking workflow for sequential task dispatch - bump default manager image to ghcr.io/russellluo/picoclaw:2026.4.8.1
1 parent d46a875 commit 770d23d

7 files changed

Lines changed: 492 additions & 126 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ GOFMT ?= gofmt
1515
ONBOARD_BASE_URL ?= http://127.0.0.1:4000
1616
ONBOARD_API_KEY ?= sk-1234567890
1717
ONBOARD_MODEL_ID ?= minimax-m2.7
18-
ONBOARD_MANAGER_IMAGE ?= ghcr.io/russellluo/picoclaw:2026.4.6
18+
ONBOARD_MANAGER_IMAGE ?= ghcr.io/russellluo/picoclaw:2026.4.8.1
1919

2020
IMAGE ?= ghcr.io/russellluo/picoclaw
2121
TAG ?= 2025.3.25

docs/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ ok
7474
"status": "running",
7575
"created_at": "2026-03-28T12:00:03Z",
7676
"model_id": "gpt-4o-mini",
77-
"image": "ghcr.io/russellluo/picoclaw:2026.4.6"
77+
"image": "ghcr.io/russellluo/picoclaw:2026.4.8.1"
7878
}
7979
```
8080

docs/usage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ csgclaw onboard \
2828
--base-url http://127.0.0.1:4000 \
2929
--api-key sk-please-change-me \
3030
--model-id gpt-4o-mini \
31-
--manager-image ghcr.io/russellluo/picoclaw:2026.4.6
31+
--manager-image ghcr.io/russellluo/picoclaw:2026.4.8.1
3232
```
3333

3434
参数含义:
@@ -221,7 +221,7 @@ api_key = "sk-please-change-me"
221221
model_id = "gpt-4o-mini"
222222

223223
[bootstrap]
224-
manager_image = "ghcr.io/russellluo/picoclaw:2026.4.6"
224+
manager_image = "ghcr.io/russellluo/picoclaw:2026.4.8.1"
225225

226226
[picoclaw]
227227
access_token = "your-shared-token"

internal/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const (
4949
DefaultLLMAPIKey = "sk-1234567890"
5050
DefaultLLMModelID = "minimax-m2.7"
5151
DefaultPicoClawAccessToken = "your_access_token"
52-
DefaultManagerImage = "ghcr.io/russellluo/picoclaw:2026.4.6"
52+
DefaultManagerImage = "ghcr.io/russellluo/picoclaw:2026.4.8.1"
5353
)
5454

5555
func DefaultDir() (string, error) {
Lines changed: 77 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,104 @@
11
---
22
name: manager-worker-dispatch
3-
description: Use this skill to manage and dispatch tasks to workers. Triggers include: any request to break a task into subtasks and assign them to workers or bots; listing, creating, or selecting workers via the manager_worker_api; sending @-mention messages to workers inside a room; coordinating sequential or parallel multi-worker execution pipelines; dispatching frontend, backend, or QA work to the right worker by capability. Do NOT use for generic project planning, single-agent tasks.
3+
description: Use this skill to break an admin request into capability-aligned subtasks, provision or reuse workers through manager_worker_api, write the dispatch plan to todo.json, and start sequential task tracking. Do NOT use for generic planning or single-agent execution.
44
---
55

66
# Manager Worker Dispatch
77

8-
Interpret the admin request, break it into capability-aligned subtasks, and dispatch each subtask through the real CSGClaw API.
8+
Break an admin request into clear tasks, choose workers by capability, and dispatch them through the real CSGClaw API in sequence.
99

10-
Use the bundled script for deterministic API calls instead of rewriting request code inline.
10+
Reuse the bundled script instead of writing ad hoc requests.
11+
Check the script help for the current CLI surface instead of reading reference docs.
1112

1213
## Workflow
1314

14-
1. Read the admin request and split it into concrete deliverables.
15-
2. Infer the required capability for each deliverable.
16-
3. List existing workers with `scripts/manager_worker_api.py list-workers`.
17-
4. Reuse an existing worker when its `description` matches the needed capability and scope.
18-
5. Create a worker when no existing worker description clearly matches.
19-
6. Add the worker to the target room when needed.
20-
7. Dispatch the subtask by having a bot send a message in that room, and make sure every manager-to-worker message starts with an `@` prefix, for example `@bob 你来写前端代码`.
21-
8. If the request is sequential, wait for the previous worker to finish before dispatching the next worker with another `@` message.
22-
9. If the request is parallel, dispatch multiple workers at the same time with separate `@` messages.
23-
24-
Keep assignments specific. Include the expected output, scope, and capability.
15+
1. Break the admin request into concrete deliverables.
16+
2. Match each task to the needed capability; run `list-workers` first, reuse by matching `description`, and create a worker only when needed.
17+
3. Ensure the required workers have joined the target room.
18+
4. Choose a suitable project directory under `~/.picoclaw/workspace/projects`; create a short slug directory if none fits.
19+
5. Write or overwrite `todo.json` in that directory as the only source of truth for the current dispatch plan.
20+
6. Start `scripts/manager_worker_api.py start-tracking` against that `todo.json`.
21+
22+
## todo.json
23+
24+
`todo.json` must be valid JSON.
25+
26+
- Single task: write one task object.
27+
- Multiple tasks: write `{ "tasks": [...] }`; array order is dispatch order.
28+
29+
Each task should keep these fields:
30+
31+
- `id`: task number, required, use `1`, `2`, `3` in dispatch order
32+
- `assignee`: owner, usually a worker name or role-like label
33+
- `category`: short task type such as `feature`, `bug`, or `test`
34+
- `description`: task summary
35+
- `steps`: array of execution steps
36+
- `passes`: completion state, usually `false` at the start
37+
- `progress_note`: progress, result, or blocker note, usually an empty string at the start
38+
39+
`id` must always be present and should increase sequentially with the task order in `todo.json`.
40+
41+
Example:
42+
43+
```json
44+
{
45+
"tasks": [
46+
{
47+
"id": 1,
48+
"assignee": "frontend",
49+
"category": "feature",
50+
"description": "Build the settings page UI and connect the save action.",
51+
"steps": [
52+
"Implement the settings page layout",
53+
"Connect the save action to the API",
54+
"Reply to the manager with the implementation summary"
55+
],
56+
"passes": false,
57+
"progress_note": ""
58+
},
59+
{
60+
"id": 2,
61+
"assignee": "qa",
62+
"category": "test",
63+
"description": "Validate the main settings page flows after frontend delivery.",
64+
"steps": [
65+
"Verify the main edit and save flows",
66+
"Record regressions and blockers",
67+
"Reply to the manager with QA results"
68+
],
69+
"passes": false,
70+
"progress_note": ""
71+
}
72+
]
73+
}
74+
```
2575

2676
## Capability Mapping
2777

28-
Map work to worker descriptions before calling the API. Do not select a worker by its `role` field. Read each worker's `description` and choose the one whose described responsibility best matches the task.
78+
Choose workers by `description`, not just by `role`.
2979

30-
- Frontend UI, page work, styling, interaction: `frontend`
31-
- APIs, services, storage, data flow: `backend`
32-
- Validation, regression checks, acceptance checks: `qa`
33-
- Cross-cutting coordination or unclear requests: split the task first, then assign
80+
- `frontend`: UI, page work, styling, interaction
81+
- `backend`: APIs, services, storage, data flow
82+
- `qa`: validation, regression, acceptance checks
3483

35-
If the admin request implies several capabilities, create one assignment per capability instead of sending one broad task to a single worker.
84+
Split cross-capability work into multiple tasks instead of giving one vague package to a single worker.
3685

3786
## Script Usage
3887

39-
Use `scripts/manager_worker_api.py` for API operations.
40-
41-
Common commands:
42-
4388
```bash
4489
cd ~/.picoclaw/workspace/skills/manager-worker-dispatch
4590
python scripts/manager_worker_api.py list-workers
4691
python scripts/manager_worker_api.py create-worker --name alex --description "qa regression testing"
4792
python scripts/manager_worker_api.py join-worker --room-id room-123 --worker-id u-alex
48-
python scripts/manager_worker_api.py send-message --room-id room-123 --text "@alex 你来进行测试,验证登录流程并记录回归风险"
49-
python scripts/manager_worker_api.py ensure-and-dispatch --room-id room-123 --name bob --description "frontend ui styling interaction" --task "你来写前端代码,实现设置页 UI" --dry-run
93+
python scripts/manager_worker_api.py start-tracking --room-id room-123 --todo-path ~/.picoclaw/workspace/projects/demo/todo.json
94+
python scripts/manager_worker_api.py stop-tracking --todo-path ~/.picoclaw/workspace/projects/demo/todo.json
5095
```
51-
52-
Read `references/api-contract.md` before changing endpoint names, payload fields, or environment variables.
53-
54-
When the script runs inside a CSGClaw box, it reads these environment variables automatically:
55-
56-
- `CSGCLAW_BASE_URL`
57-
- `CSGCLAW_ACCESS_TOKEN`
96+
Use `python scripts/manager_worker_api.py -h` to inspect the latest commands, flags, and environment variable fallbacks before invoking or updating the workflow.
5897

5998
## Operating Rules
6099

61-
- Prefer an existing worker whose `description` matches the task before creating a new one.
62-
- Keep worker names short and stable.
63-
- Add the worker to the room before dispatching the task when the room does not already include that worker.
64-
- When the manager assigns work, always prefix the worker mention with `@`, and tell the worker to reply with `@` as well.
65-
- For sequential work, do not dispatch the next worker until the previous worker has completed.
66-
- For parallel work, multiple workers may be dispatched together with separate `@` messages.
67-
- Use `--dry-run` first when endpoint compatibility is uncertain.
68-
- If the API response shape differs from the documented assumptions, patch the script instead of improvising ad hoc requests.
100+
- Reuse workers before creating new ones.
101+
- Keep `todo.json` aligned with the actual assignment being dispatched.
102+
- Do not casually reorder tasks in the sequential flow.
103+
- Let `start-tracking` drive dispatch from `todo.json`; do not duplicate that logic in manual room-message procedures.
104+
- If the API response shape differs from expectations, patch the script instead of improvising around it.

skills/manager-worker-dispatch/references/api-contract.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,8 @@ When available, load the CSGClaw API settings from `~/.picoclaw/config.json`:
8888
## Notes
8989

9090
- There is no dedicated task-assignment API.
91-
- Dispatch means sending a normal bot message in the target room and mentioning the worker.
92-
- `ensure-and-dispatch` performs: list workers, create if missing, join room, send message.
91+
- Dispatch still means sending a normal bot message in the target room and mentioning the worker.
92+
- Each task in `todo.json` should carry an `id` task number, increasing in dispatch order such as `1`, `2`, `3`.
93+
- `start-tracking` watches `todo.json`, finds the first task whose `passes` is not `true`, and sends that task to its `@assignee`.
94+
- After a worker finishes, they are expected to update that task's `passes` to `true` and write the summary into `progress_note`; the tracker then advances to the next unfinished task.
95+
- Worker provisioning and room membership remain explicit steps through `list-workers`, `create-worker`, and `join-worker`.

0 commit comments

Comments
 (0)