From 9ec15cb4ea2bb5e6906b5ba235408130e4dbebf3 Mon Sep 17 00:00:00 2001 From: nntrivi2001 Date: Tue, 7 Apr 2026 09:59:41 +0700 Subject: [PATCH] feat: update .gitignore to include flows directory and adjust clawteam templates exclusion; enhance LEARNINGS.md and RULES.md with critical spawn method guidelines; revise TOOLS.md to emphasize tmux usage; modify SKILL.md files to prohibit subprocess backend; increase memory limit in docker-compose.yml --- .gitignore | 4 +- .openclaw/workspace/.learnings/LEARNINGS.md | 37 +++++++++++++++++++ .openclaw/workspace/RULES.md | 17 ++++++++- .openclaw/workspace/TOOLS.md | 23 ++++++++++-- .../workspace/skills/clawteam-dev/SKILL.md | 6 +-- .../SKILL.md | 2 +- docker-compose.yml | 2 +- 7 files changed, 80 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 65186e9..e91ac5f 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,8 @@ !.openclaw/canvas/.gitkeep .openclaw/update-check.json +.openclaw/flows/ + # ========================================== # 3. WORKSPACE ISOLATION (GIỮ KHUNG SƯỜN) # ========================================== @@ -85,4 +87,4 @@ # 5. Clawteam Data # ========================================== .clawteam/* -!.clawteam/templates \ No newline at end of file +!.clawteam/templates diff --git a/.openclaw/workspace/.learnings/LEARNINGS.md b/.openclaw/workspace/.learnings/LEARNINGS.md index 903fc15..c99ca6b 100644 --- a/.openclaw/workspace/.learnings/LEARNINGS.md +++ b/.openclaw/workspace/.learnings/LEARNINGS.md @@ -294,3 +294,40 @@ User explicitly required: khi review code thì phải cực kỳ khắt khe, ph - First-Seen: 2026-04-06 - Last-Seen: 2026-04-06 --- + +--- + +## [LRN-20260406-001] clawteam_spawn_method + +**Logged**: 2026-04-06T10:10:00Z +**Priority**: critical +**Status**: resolved +**Area**: orchestration + +### Summary +**Never use subprocess for spawning agents.** Always use `clawteam spawn tmux openclaw --team --agent-name --agent-type --task ""`. + +### Details +When spawning ClawTeam agents, using `clawteam spawn subprocess openclaw` causes agents to die immediately after the subprocess shell exits. This resulted in: +- All 12 agents spawning but dying instantly +- 75 tasks all remaining `pending` with 0 `in_progress` because no one was alive to work +- Tasks falsely marked `completed` (only directory copying happened, not actual development) +- Zero dependency tracking (all tasks independent despite clear ordering requirements) +- Complete project management failure + +### Suggested Action +- **ALWAYS** use `clawteam spawn tmux openclaw --team --agent-name ...` for persistent agent sessions +- **NEVER** use `clawteam spawn subprocess` — it exits immediately after the shell terminates +- Verify agents are alive: `tmux list-sessions | grep clawteam` +- Check task progress: `clawteam task list --status in_progress` +- Set task dependencies with `clawteam task update --add-blocked-by ` +- Monitor progress: `clawteam board attach ` + +### Metadata +- Source: error +- Tags: clawteam, spawn, subprocess, orchestration, critical +- Pattern-Key: clawteam.spawn_method +- Recurrence-Count: 1 +- First-Seen: 2026-04-06 +- Last-Seen: 2026-04-06 + diff --git a/.openclaw/workspace/RULES.md b/.openclaw/workspace/RULES.md index 28e2e89..48e6138 100644 --- a/.openclaw/workspace/RULES.md +++ b/.openclaw/workspace/RULES.md @@ -149,5 +149,20 @@ When PM receives escalated issue: 4. If re-assigning: new worker gets full context (error logs, target files, what was tried) 5. Never add rework to existing blocked task — either unblock it or reassign entirely -### 6. Usage Pattern +### 6. Spawn Method (ABSOLUTE RULE — ZERO EXCEPTIONS) +**ALWAYS** use `clawteam spawn tmux openclaw --team --agent-name --agent-type --task ""` +**NEVER EVER** use `clawteam spawn subprocess` — subprocess agents die immediately after the shell exits, resulting in: +- All spawned agents dying instantly (0 workers alive) +- Task counts stuck at 0 in_progress, 75+ tasks never started +- False "completed" statuses (files created by manual copy, not by agents) +- Zero dependency tracking despite clear ordering requirements +- Complete project management failure + +**Verification after spawning:** +- `tmux list-sessions | grep clawteam` — expect 1 session per agent +- `clawteam task list --status in_progress` — expect tasks actively working +- `clawteam board attach ` — monitor progress in real-time +- `clawteam task list --status blocked` — check for blocked tasks and resolve + +### 7. Usage Pattern When the user requests to use ClawTeam, do NOT use `sessions_spawn` with `runtime="acp"`. Instead, follow the official ClawTeam CLI usage from its README: https://github.com/HKUDS/ClawTeam. Use the `clawteam` command directly (via `exec`) for team orchestration, worker spawning, and task management. diff --git a/.openclaw/workspace/TOOLS.md b/.openclaw/workspace/TOOLS.md index 210d756..febc246 100644 --- a/.openclaw/workspace/TOOLS.md +++ b/.openclaw/workspace/TOOLS.md @@ -58,12 +58,16 @@ clawteam team spawn-team -d "" -n leader # Then create tasks matching template.tasks clawteam task create "" -o # Spawn workers matching template.agents -clawteam spawn subprocess openclaw --team --agent-name --task "..." +# ❌ WRONG: NEVER use subprocess — agents die immediately after shell exits +# clawteam spawn subprocess openclaw --team --agent-name --task "..." + +# ✅ CORRECT: always use tmux openclaw for persistent agent sessions +clawteam spawn tmux openclaw --team --agent-name --task "..." ``` ## ClawTeam Multi-Agent Orchestration -> **Important:** ClawTeam CLI command is `clawteam`. ALWAYS specify `tmux openclaw` or `subprocess openclaw` as backend+agent — default `claude` is not available. +> **Important:** ClawTeam CLI command is `clawteam`. **ALWAYS** specify `tmux openclaw` as the backend — **NEVER** use `subprocess`. Default `claude` is not available. > Official repo: https://github.com/HKUDS/ClawTeam ### ⚠️ CRITICAL: Spawn Syntax @@ -246,8 +250,11 @@ clawteam task create "" -o clawteam spawn tmux openclaw --team --agent-name --agent-type coder \ --task "Do X. After done: clawteam task update --status completed" -# Or with subprocess (faster, no tmux monitor) -clawteam spawn subprocess openclaw --team --agent-name --task "..." +# ❌ WRONG — subprocess agents die immediately; never use this +# clawteam spawn subprocess openclaw --team --agent-name --task "..." + +# ✅ ALWAYS use tmux (persistent, monitorable, survives network blips) +# clawteam spawn tmux openclaw --team --agent-name --task "..." # View board clawteam board show @@ -259,3 +266,11 @@ clawteam task update --status completed - `--model` (model is set by OpenClaw config, not clawteam) - `--timeout` (no timeout flag on spawn) - `-m` (conflicts with clawteam's own options) + +### 📌 Critical Reminders +- **ALWAYS use `tmux openclaw`** — `subprocess` agents die immediately +- **Set task dependencies**: `clawteam task update --add-blocked-by ` +- **Verify agents alive**: `tmux list-sessions | grep clawteam` +- **Monitor progress**: `clawteam board attach ` +- **Check in-progress tasks**: `clawteam task list --status in_progress` +- **Unblock stuck tasks**: use `clawteam task update --status pending` after resolving blocker diff --git a/.openclaw/workspace/skills/clawteam-dev/SKILL.md b/.openclaw/workspace/skills/clawteam-dev/SKILL.md index f77935f..acd8776 100644 --- a/.openclaw/workspace/skills/clawteam-dev/SKILL.md +++ b/.openclaw/workspace/skills/clawteam-dev/SKILL.md @@ -214,9 +214,9 @@ ls ~/.clawteam/workspaces/ 2>&1 | grep -q "No such file" && echo "OK: no workspa 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. -### With subprocess Backend +### ⚠️ Do NOT use subprocess backend -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. +The `subprocess` backend causes agents to die immediately after the shell exits. **Always use the tmux backend** for persistent agent sessions. ## What This Test Validates @@ -224,7 +224,7 @@ Replace `clawteam spawn` with `clawteam spawn subprocess claude` to test the sub |-----------|-----------| | `team spawn-team` | Team creation with leader | | `task create --blocked-by` | Task dependency chains | -| `spawn` (tmux backend) | Agent process launch with worktree isolation | +| `spawn` (tmux backend only) | Agent process launch with worktree isolation | | Identity propagation | Env vars passed to sub-agents | | Agent coordination | Workers update task status and send messages to leader | | Auto-unblock | Blocked task unblocked when dependencies complete | diff --git a/.openclaw/workspace/skills/clawteam-multi-agent-coordination/SKILL.md b/.openclaw/workspace/skills/clawteam-multi-agent-coordination/SKILL.md index 9e00c82..d6f7c16 100644 --- a/.openclaw/workspace/skills/clawteam-multi-agent-coordination/SKILL.md +++ b/.openclaw/workspace/skills/clawteam-multi-agent-coordination/SKILL.md @@ -122,7 +122,7 @@ clawteam board live my-team --interval 3 | Setting | Default | Override | |---------|---------|----------| -| Backend | `tmux` | `clawteam spawn subprocess ...` | +| Backend | `tmux` only | Use `clawteam spawn tmux openclaw` — subprocess NOT allowed | | Command | `claude` (default) / `openclaw` (ours) | `clawteam spawn tmux openclaw` for our setup | | Workspace | `auto` (git worktree) | `--no-workspace` or config `workspace=never` | | Permissions | skip | `--no-skip-permissions` or config `skip_permissions=false` | diff --git a/docker-compose.yml b/docker-compose.yml index cdf3180..99011c4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: resources: limits: cpus: '4' - memory: 8G + memory: 10G reservations: memory: 2G environment: