Skip to content

Commit b19a378

Browse files
authored
docs: sync with goclaw source changes 4d31fe0..0dab087f (EN+VI) (#33)
1 parent d6d2634 commit b19a378

12 files changed

Lines changed: 258 additions & 246 deletions

File tree

agent-teams/delegation-and-handoff.md

Lines changed: 39 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,65 @@
11
# Delegation & Handoff
22

3-
Delegation allows the lead to spawn work on member agents. Handoff transfers conversation control between agents without interrupting the user's session.
3+
Delegation allows the lead to assign work to member agents via the task board. Handoff transfers conversation control between agents without interrupting the user's session.
44

55
## Agent Delegation Flow
66

7+
Delegation works through the `team_tasks` tool — the lead creates a task with an assignee, and the system auto-dispatches it to the assigned member:
8+
79
```mermaid
810
flowchart TD
9-
LEAD["Lead receives user request"] --> DELEGATE["1. Delegate to member<br/>spawn agent=member,<br/>task='do the work'"]
10-
DELEGATE --> MEMBER["Member agent executes<br/>in isolated session"]
11-
MEMBER --> COMPLETE["2. Task auto-completed<br/>with delegation result"]
12-
COMPLETE --> ANNOUNCE["3. Result announced<br/>back to lead"]
11+
LEAD["Lead receives user request"] --> CREATE["1. Create task on board<br/>team_tasks(action=create,<br/>assignee=member)"]
12+
CREATE --> DISPATCH["2. System auto-dispatches<br/>to assigned member"]
13+
DISPATCH --> MEMBER["Member agent executes<br/>in isolated session"]
14+
MEMBER --> COMPLETE["3. Task auto-completed<br/>with result"]
15+
COMPLETE --> ANNOUNCE["4. Result announced<br/>back to lead"]
1316
1417
subgraph "Parallel Delegation"
15-
DELEGATE2["spawn member_A"] --> RUNA["Member A works"]
16-
DELEGATE3["spawn member_B"] --> RUNB["Member B works"]
18+
CREATE2["create task → member_A"] --> RUNA["Member A works"]
19+
CREATE3["create task → member_B"] --> RUNB["Member B works"]
1720
RUNA --> COLLECT["Results accumulate"]
1821
RUNB --> COLLECT
1922
COLLECT --> ANNOUNCE2["Single combined<br/>announcement to lead"]
2023
end
2124
```
2225

23-
## Task Linking
26+
> **Note**: The `spawn` tool is for **self-clone subagents only** — it does not accept an `agent` parameter. To delegate to a team member, always use `team_tasks(action="create", assignee=...)`.
2427
25-
Delegations can optionally link to a team task via `team_task_id`. For v2 teams, **if you omit `team_task_id`, the system auto-creates a task** — you don't need a separate create step:
28+
## Creating a Delegation Task
2629

27-
```json
28-
{
29-
"action": "spawn",
30-
"agent": "analyst_agent",
31-
"task": "Analyze the market trends in the Q1 report"
32-
}
33-
```
34-
35-
The system auto-creates a task and links the delegation. You can also provide an explicit task ID:
30+
Use the `team_tasks` tool with `action: "create"` and a required `assignee`:
3631

3732
```json
3833
{
39-
"action": "spawn",
40-
"agent": "analyst_agent",
41-
"task": "Analyze the market trends in the Q1 report",
42-
"team_task_id": "550e8400-e29b-41d4-a716-446655440000"
34+
"action": "create",
35+
"subject": "Analyze the market trends in the Q1 report",
36+
"description": "Focus on Q1 revenue data and competitor analysis",
37+
"assignee": "analyst_agent"
4338
}
4439
```
4540

46-
**If `team_task_id` is invalid** or from a wrong team:
47-
- Delegation rejected with helpful error message
48-
- Error includes guidance to omit `team_task_id` to auto-create
41+
The system validates and auto-dispatches:
42+
- **`assignee` is required** — every task must be assigned to a team member
43+
- **Assignee must be a team member** — non-members are rejected
44+
- **Lead cannot self-assign** — prevents dual-session execution loops
45+
- **Auto-dispatch**: after the lead's turn ends, pending tasks are dispatched to their assigned agents
4946

5047
**Guards enforced**:
51-
- Cannot reuse a completed or cancelled task ID
52-
- Cannot reuse an in-progress task ID (each spawn needs its own task)
53-
54-
This ensures every piece of work is tracked on the task board.
55-
56-
## Sync vs Async Delegation
57-
58-
### Sync Delegation (Default)
48+
- Max **3 dispatches** per task — auto-fails after 3 attempts to prevent infinite loops
49+
- Task dispatched to lead agent is blocked and auto-failed
50+
- Member requests (non-lead) can optionally require leader approval before dispatch
5951

60-
Parent waits for result before continuing:
52+
## Parallel Delegation
6153

62-
```json
63-
{
64-
"action": "spawn",
65-
"agent": "analyst_agent",
66-
"task": "Quick analysis",
67-
"team_task_id": "550e8400-e29b-41d4-a716-446655440000",
68-
"mode": "sync"
69-
}
70-
```
71-
72-
- Lead blocks until member finishes
73-
- Result returned directly to lead
74-
- Best for quick tasks (< 2 minutes)
75-
- Task auto-claimed and auto-completed on success
76-
77-
### Async Delegation
78-
79-
Parent spawns work in the background and receives the result via a system announcement when complete:
54+
Create multiple tasks in the same turn — they dispatch simultaneously after the turn:
8055

8156
```json
82-
{
83-
"action": "spawn",
84-
"agent": "analyst_agent",
85-
"task": "Deep research into market trends",
86-
"team_task_id": "550e8400-e29b-41d4-a716-446655440000",
87-
"mode": "async"
88-
}
57+
// Lead creates 2 tasks in one turn
58+
{"action": "create", "subject": "Extract facts", "assignee": "analyst1"}
59+
{"action": "create", "subject": "Extract opinions", "assignee": "analyst2"}
8960
```
9061

91-
- Lead gets a delegation ID immediately
92-
- Lead can continue with other work
93-
- Periodic progress notifications sent to chat (every 30 seconds, if enabled)
94-
- Result announced when complete via a system message to the lead
95-
96-
**Response** (delegation ID for tracking):
97-
```json
98-
{
99-
"delegation_id": "abc123def456",
100-
"team_task_id": "550e8400-e29b-41d4-a716-446655440000"
101-
}
102-
```
103-
104-
## Parallel Delegation Batching
105-
106-
When lead delegates to multiple members simultaneously, results are collected and announced together:
107-
108-
1. Each delegation runs independently
109-
2. Intermediate completions accumulate results (artifacts)
110-
3. When **last sibling** finishes, all results are collected
111-
4. Single combined announcement delivered to lead
112-
113-
**Example**:
114-
115-
```json
116-
// Lead delegates to 2 members simultaneously
117-
{"action": "spawn", "agent": "analyst1", "task": "Extract facts"}
118-
{"action": "spawn", "agent": "analyst2", "task": "Extract opinions"}
119-
120-
// Results announced together:
121-
// "analyst1 (facts extraction): ..."
122-
// "analyst2 (opinions extraction): ..."
123-
```
62+
Results are collected and announced together when all complete.
12463

12564
## Auto-Completion & Artifacts
12665

@@ -252,24 +191,14 @@ Please greet the user and continue the conversation.
252191

253192
## Evaluate Loop (Generator-Evaluator)
254193

255-
For iterative work, use the evaluate pattern:
194+
For iterative work, use the evaluate pattern with task creation:
256195

257196
```json
258-
{
259-
"action": "spawn",
260-
"agent": "generator_agent",
261-
"task": "Generate initial proposal",
262-
"mode": "async"
263-
}
197+
{"action": "create", "subject": "Generate initial proposal", "assignee": "generator_agent"}
264198

265199
// Wait for result, then:
266200

267-
{
268-
"action": "spawn",
269-
"agent": "evaluator_agent",
270-
"task": "Review proposal and provide feedback",
271-
"context": "[previous result from generator]"
272-
}
201+
{"action": "create", "subject": "Review proposal and provide feedback", "assignee": "evaluator_agent"}
273202

274203
// Generator refines based on feedback...
275204
```
@@ -290,12 +219,12 @@ For async delegations, the lead receives periodic grouped updates (if progress n
290219

291220
## Best Practices
292221

293-
1. **Omit `team_task_id` for simplicity**: v2 teams auto-create tasks on delegation
294-
2. **Use sync for quick tasks**: < 2 minutes
295-
3. **Use async for long tasks**: > 2 minutes, parallel work
296-
4. **Batch parallel work**: Delegate to multiple members simultaneously
222+
1. **Use `team_tasks` to delegate**: create tasks with `assignee` — system auto-dispatches
223+
2. **Don't use `spawn` for delegation**: `spawn` is self-clone only, not for team members
224+
3. **Create multiple tasks in one turn**: they dispatch in parallel after the turn ends
225+
4. **Use `blocked_by`**: coordinate task ordering with dependencies
297226
5. **Link dependencies**: Use `blocked_by` on task board to coordinate order
298227
6. **Handle handoffs gracefully**: Notify user of transfer; pass context
299228
7. **Set iteration limits in instructions**: Prevent infinite evaluate loops
300229

301-
<!-- goclaw-source: 57754a5 | updated: 2026-03-18 -->
230+
<!-- goclaw-source: 0dab087f | updated: 2026-03-27 -->

channels/telegram.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ All config keys are in `channels.telegram`:
4040
| `dm_policy` | string | `"pairing"` | `pairing`, `allowlist`, `open`, `disabled` |
4141
| `group_policy` | string | `"open"` | `open`, `allowlist`, `disabled` |
4242
| `require_mention` | bool | true | Require @bot mention in groups |
43+
| `mention_mode` | string | `"strict"` | `strict` = only respond when @mentioned; `yield` = respond unless another bot is @mentioned (multi-bot groups) |
4344
| `history_limit` | int | 50 | Pending messages per group (0=disabled) |
4445
| `dm_stream` | bool | false | Enable streaming for DMs (edits placeholder) |
4546
| `group_stream` | bool | false | Enable streaming for groups (new message) |
@@ -94,6 +95,7 @@ Group config keys:
9495
- `group_policy` — Override group-level policy
9596
- `allow_from` — Override allowlist
9697
- `require_mention` — Override mention requirement
98+
- `mention_mode` — Override mention mode (`strict` or `yield`)
9799
- `skills` — Whitelist skills (nil=all, []=none)
98100
- `tools` — Whitelist tools (supports `group:xxx` syntax)
99101
- `system_prompt` — Extra system prompt for this group
@@ -105,9 +107,37 @@ Group config keys:
105107

106108
In groups, bot responds only to messages that mention it (default `require_mention: true`). When not mentioned, messages are stored in a pending history buffer (default 50 messages) and included as context when the bot is mentioned. Replying to a bot message counts as mentioning it.
107109

110+
#### Mention Modes
111+
112+
| Mode | Behavior | Use case |
113+
|------|----------|----------|
114+
| `strict` (default) | Only respond when @mentioned or replied to | Single-bot groups |
115+
| `yield` | Respond to all messages UNLESS another bot/user is @mentioned | Multi-bot shared groups |
116+
117+
**Yield mode** enables multiple bots to coexist in one group without conflicts:
118+
- Bot responds to all messages where no specific @mention targets another bot
119+
- If a user @mentions a different bot, this bot stays silent (yields)
120+
- Messages from other bots are automatically skipped to prevent infinite cross-bot loops
121+
- Cross-bot @commands still work (e.g., `@my_bot help` sent by another bot)
122+
123+
```json
124+
{
125+
"channels": {
126+
"telegram": {
127+
"mention_mode": "yield",
128+
"require_mention": false
129+
}
130+
}
131+
}
132+
```
133+
108134
```mermaid
109135
flowchart TD
110-
MSG["User posts in group"] --> MENTION{"Bot @mentioned<br/>or reply?"}
136+
MSG["User posts in group"] --> MODE{"mention_mode?"}
137+
MODE -->|strict| MENTION{"Bot @mentioned<br/>or reply?"}
138+
MODE -->|yield| OTHER{"Another bot/user<br/>@mentioned?"}
139+
OTHER -->|Yes| YIELD["Yield — stay silent"]
140+
OTHER -->|No| PROCESS
111141
MENTION -->|No| BUFFER["Add to pending history<br/>(max 50 messages)"]
112142
MENTION -->|Yes| PROCESS["Process now<br/>Include history as context"]
113143
BUFFER --> NEXT["Next mention:<br/>history included"]
@@ -232,7 +262,7 @@ Each Telegram instance maintains an isolated HTTP transport — no shared connec
232262

233263
| Issue | Solution |
234264
|-------|----------|
235-
| Bot not responding in groups | Ensure privacy mode is disabled via @BotFather (`/setprivacy` → Disable). Then check `require_mention=true` (default) — mention bot or reply to its message. |
265+
| Bot not responding in groups | Ensure privacy mode is disabled via @BotFather (`/setprivacy` → Disable). Then check `require_mention=true` (default) — mention bot or reply to its message. For multi-bot groups, try `mention_mode: "yield"`. |
236266
| Media downloads fail | Verify bot has `Can read all group messages` in @BotFather (`/setprivacy` → Disable). Check `media_max_bytes` limit. |
237267
| STT transcription missing | Verify STT proxy URL and API key. Check logs for timeout. |
238268
| Streaming not working | Enable `dm_stream` or `group_stream`. Ensure provider supports streaming. |
@@ -245,4 +275,4 @@ Each Telegram instance maintains an isolated HTTP transport — no shared connec
245275
- [Browser Pairing](#channel-browser-pairing) — Pairing flow
246276
- [Sessions & History](#sessions-and-history) — Conversation history
247277

248-
<!-- goclaw-source: eab3766c | updated: 2026-03-24 -->
278+
<!-- goclaw-source: 0dab087f | updated: 2026-03-26 -->

core-concepts/how-goclaw-works.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ graph TD
1515
GW --> SC[Scheduler<br/>4 lanes]
1616
SC --> AL[Agent Loop<br/>Think → Act → Observe]
1717
AL --> PR[Provider Registry<br/>18+ LLM providers]
18-
AL --> TR[Tool Registry<br/>33+ built-in tools]
18+
AL --> TR[Tool Registry<br/>50+ built-in tools]
1919
AL --> SS[Session Store<br/>PostgreSQL]
2020
AL --> MM[Memory Store<br/>Vector + FTS]
2121
PR --> LLM[LLM APIs<br/>OpenAI / Anthropic / ...]
@@ -37,7 +37,7 @@ If the LLM wants to use a tool (search the web, read a file, run code), GoClaw e
3737

3838
The tool results go back to the LLM. It can call more tools or generate a final response. This loop repeats up to 20 iterations per turn.
3939

40-
GoClaw detects tool loop patterns: a **warning** is raised after 3 identical consecutive calls, and the loop is **force-stopped** after 5 identical no-progress calls.
40+
GoClaw detects tool loop patterns: a **warning** is raised after 3 identical consecutive calls, and the loop is **force-stopped** after 5 identical no-progress calls. Note: `exec`/`bash` tools and MCP bridge tools (`mcp_*` prefix) are treated as **neutral** — they neither reset nor increment the read-only streak, since their side effects are ambiguous.
4141

4242
```mermaid
4343
graph LR
@@ -82,7 +82,7 @@ Each lane has its own semaphore. This prevents cron jobs from starving user mess
8282
|-----------|-------------|
8383
| **Gateway** | HTTP + WebSocket server on port 18790 |
8484
| **Provider Registry** | Manages 18+ LLM provider connections and credentials |
85-
| **Tool Registry** | 33+ built-in tools with policy-based access control (extensible via MCP and custom tools) |
85+
| **Tool Registry** | 50+ built-in tools with policy-based access control (extensible via MCP and custom tools) |
8686
| **Session Store** | Write-behind cache + PostgreSQL persistence |
8787
| **Memory Store** | Hybrid search with pgvector + tsvector |
8888
| **Channel Managers** | Telegram, Discord, WhatsApp, Zalo, Feishu adapters |
@@ -103,4 +103,4 @@ Each lane has its own semaphore. This prevents cron jobs from starving user mess
103103
- [Tools Overview](#tools-overview) — The full tool catalog
104104
- [Sessions and History](#sessions-and-history) — How conversations persist
105105

106-
<!-- goclaw-source: 19eef35 | updated: 2026-03-25 -->
106+
<!-- goclaw-source: 9168e4b4 | updated: 2026-03-26 -->

providers/ollama.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,27 @@ Ollama lets you run large language models on your own machine. GoClaw connects t
2121
}
2222
```
2323

24+
## Docker Deployment
25+
26+
When running GoClaw inside Docker, `localhost` and `127.0.0.1` in provider URLs are automatically rewritten to `host.docker.internal` so the container can reach Ollama running on the host machine. No manual configuration needed.
27+
28+
If Ollama is running on a different host, set the full URL explicitly:
29+
30+
```json
31+
{
32+
"providers": {
33+
"ollama": {
34+
"provider_type": "ollama",
35+
"api_base": "http://my-ollama-server:11434/v1"
36+
}
37+
}
38+
}
39+
```
40+
2441
## What's Next
2542

2643
- [Provider Overview](#providers-overview)
2744
- [Ollama Cloud](#provider-ollama-cloud) — hosted Ollama option
2845
- [Custom / OpenAI-Compatible](#provider-custom)
2946

30-
<!-- goclaw-source: 57754a5 | updated: 2026-03-18 -->
47+
<!-- goclaw-source: 9168e4b4 | updated: 2026-03-26 -->

reference/rest-api.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,24 @@ Get an MCP server.
436436

437437
### `PUT /v1/mcp/servers/{id}`
438438

439-
Update an MCP server.
439+
Update an MCP server. Updatable fields:
440+
441+
| Field | Type | Description |
442+
|-------|------|-------------|
443+
| `name` | string | Server display name |
444+
| `transport` | string | `"stdio"`, `"sse"`, `"streamable-http"` |
445+
| `command` | string | Command to run (stdio) |
446+
| `args` | string[] | Command arguments |
447+
| `url` | string | Server URL (sse/streamable-http) |
448+
| `api_key` | string | API key for the server |
449+
| `env` | object | Environment variables |
450+
| `headers` | object | HTTP headers |
451+
| `enabled` | boolean | Enable/disable |
452+
| `tool_prefix` | string | Prefix for tool names |
453+
| `timeout_sec` | integer | Request timeout in seconds |
454+
| `agent_id` | string | Bind to specific agent |
455+
| `config` | object | Additional configuration |
456+
| `settings` | object | Server settings |
440457

441458
### `DELETE /v1/mcp/servers/{id}`
442459

@@ -502,7 +519,20 @@ Get a channel instance.
502519

503520
### `PUT /v1/channels/instances/{id}`
504521

505-
Update a channel instance.
522+
Update a channel instance. Updatable fields:
523+
524+
| Field | Type | Description |
525+
|-------|------|-------------|
526+
| `channel_type` | string | Channel type |
527+
| `credentials` | object | Channel credentials |
528+
| `agent_id` | string | Bound agent UUID |
529+
| `enabled` | boolean | Enable/disable |
530+
| `display_name` | string | Human-readable name |
531+
| `group_policy` | string | Group message policy |
532+
| `allow_from` | string[] | Allowed sender IDs |
533+
| `metadata` | object | Custom metadata |
534+
| `webhook_secret` | string | Webhook verification secret |
535+
| `config` | object | Additional configuration |
506536

507537
### `DELETE /v1/channels/instances/{id}`
508538

@@ -782,4 +812,4 @@ The following are **only available via WebSocket RPC**, not HTTP:
782812
- [Config Reference](#config-reference) — full `config.json` schema
783813
- [Database Schema](#database-schema) — table definitions and relationships
784814

785-
<!-- goclaw-source: 4d31fe0 | updated: 2026-03-26 -->
815+
<!-- goclaw-source: 9168e4b4 | updated: 2026-03-26 -->

0 commit comments

Comments
 (0)