ClawTeam-OpenClaw
CLAUDE.md1.5k starsChanged 8 months agoMITView on GitHub
clawteam is a Python CLI for orchestrating swarms of CLI coding agents (OpenClaw, Claude Code, Codex, Hermes, nanobot, Cursor, etc.). This repo is win4r/ClawTeam-OpenClaw — a fork of HKUDS/ClawTeam where the default agent is openclaw instead of claude. The +openclaw PEP 440 local identifier in the version (e.g. 0.3.0+openclaw1) must be preserved on bumps. There is no server and no database. All state is JSON files under ~/.clawteam/ (overridable via CLAWTEAM_DATA_DIR). Agents coordinate via the shared filesystem: kanban tasks, per-recipient…
- Installs packages
Trending
Quiet since April.thin dataabout the whole repository
Who's talking about win4r/ClawTeam-OpenClaw
- rohitg00/awesome-openclaw“Add community projects: memory, A2A gateway, multi-agent, and developer tools”GitHub · Apr 4, 2026
- vincentkoc/awesome-openclaw“feat(list): add ClawTeam-OpenClaw”GitHub · Apr 4, 2026
The biggest 2 of 2 mentions linking to the repository that our crawl found. Each line is their own headline.
In this repository5 other files it gives its agents.
- clawteam-devSkill
- frontend-designSkill
- ClawTeamSkill
- clawteamSkill
- clawteamSkill
The file
We split this CLAUDE.md into the rules it gives an agent
6 rules. About 0 are common, 0 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 79
Default per-platform from platform_compat.default_spawn_backend(): tmux on Unix, subprocess on Windows.
- Very specific: line 91
When adding a new CLI: extend both command_validation.py (predicate + validation) and adapters.py (branch in prepare_command).
- Very specific: line 131
Every user-supplied name (team, agent, user, plan ID, inbox recipient…) must flow through clawteam/paths.py:
- Very specific: line 135
If you accept a name from the CLI, config, or a message and join it into a filesystem path, you MUST use these.
- Very specific: line 139
All shared JSON state is written via clawteam/fileutil.py:
- Very specific: line 143
Never call Path.rename() on writeable state.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
What this project is
clawteam is a Python CLI for orchestrating swarms of CLI coding agents (OpenClaw, Claude Code, Codex, Hermes, nanobot, Cursor, etc.). This repo is win4r/ClawTeam-OpenClaw — a fork of HKUDS/ClawTeam where the default agent is openclaw instead of claude. The +openclaw PEP 440 local identifier in the version (e.g. 0.3.0+openclaw1) must be preserved on bumps.
There is no server and no database. All state is JSON files under ~/.clawteam/ (overridable via CLAWTEAM_DATA_DIR). Agents coordinate via the shared filesystem: kanban tasks, per-recipient inboxes, team configs, git worktree registries.
Common commands
# Dev install (from repo root)
pip install -e ".[dev]" # dev deps: pytest, ruff
pip install -e ".[p2p]" # optional ZeroMQ P2P transport
# Lint + test — same commands CI runs (.github/workflows/ci.yml)
ruff check clawteam/ tests/
pytest tests/ # full suite
pytest tests/test_spawn_backends.py -v # one file
pytest tests/test_board.py::test_foo -v # one test
pytest -k "mailbox" # by name
# CLI entry points
clawteam <subcommand> # installed script
python -m clawteam <subcommand> # module entry (clawteam/__main__.py)Tests auto-isolate: tests/conftest.py monkeypatches both CLAWTEAM_DATA_DIR and HOME to tmp_path, so no test can touch real ~/.clawteam/ or ~/.clawteam/config.json.
Architecture — the big picture
CLI surface
All commands live in a single file: clawteam/cli/commands.py (~2700 lines). It uses typer sub-apps:
| Sub-app | Purpose |
config | show / set / get / health |
team | spawn-team / discover / status / request-join / approve-join / cleanup |
inbox | send / broadcast / receive / peek / log / watch |
task | create / get / update / list / stats / wait |
cost | report / show / budget |
session | save / show / clear |
plan | submit / approve / reject |
lifecycle | request-shutdown / approve-shutdown / idle / on-exit / check-zombies |
runtime | tmux-only live injection: inject / watch / state |
identity | show / set |
board | show / overview / live / serve (web UI) / attach (tmux tiled view) |
workspace | list / checkpoint / merge / cleanup / status |
template | list / show |
| (top-level) | spawn and launch |
Subtle trap: spawn takes --team / -t, but launch takes --team-name / -t. These flag names are intentionally different and appear in user docs — do not "harmonize" them.
The _output(data, human_fn) helper picks JSON vs. human-readable output based on the global --json flag. Always call it instead of print() for command results.
Two pluggable backends
Transport (clawteam/transport/) — how messages move between agents.
TransportABC →FileTransport(default, writesinboxes/{agent}/msg-*.jsonatomically) orP2PTransport(ZMQ PUSH/PULL with FileTransport fallback, requires[p2p]extra).MailboxManagerinclawteam/team/mailbox.pybuildsTeamMessagepydantic models, serialises, delegates bytes to the transport.- Selection:
CLAWTEAM_TRANSPORTenv var → config →"file".
TaskStore (clawteam/store/) — kanban task persistence.
BaseTaskStoreABC →FileTaskStore(only implementation today). Shim atclawteam/team/tasks.pypreserves the legacyTaskStoreimport path.- Selection:
CLAWTEAM_TASK_STOREenv var → config →"file".
Both factories live in clawteam/{transport,store}/__init__.py.
Spawn system
Splits cleanly in two:
- Backend (
clawteam/spawn/{base,tmux_backend,subprocess_backend}.py) — how the process is launched.SpawnBackendABC →TmuxBackend(one tmux session per team,clawteam-{team}, one window per agent) orSubprocessBackend.- Factory:
get_backend(name)inclawteam/spawn/__init__.py.normalize_backend_name()forcestmux → subprocesson Windows. - Default per-platform from
platform_compat.default_spawn_backend():tmuxon Unix,subprocesson Windows. spawn_with_retry()wraps a backend with exponential-backoff retry.
- Command prep (
clawteam/spawn/adapters.py) — how CLI flags/args are assembled.NativeCliAdapter.prepare_command()is the dispatcher. Each supported CLI has anis_foo_command()predicate inadapters.py+command_validation.py, and its own branch for flag injection:claude/qwen→ append--dangerously-skip-permissionswhenskip_permissions.codex→--dangerously-bypass-approvals-and-sandbox.gemini/kimi/opencode/hermes→--yolo.hermes→ insertchatsubcommand if command is barehermes, add--source tool, pass prompt via-q(NOT--continue, which resumes an existing session).openclaw→--session <name>,--message <prompt>(or--local --session-idwhen using theagentsubcommand).kimi/nanobot→-w <cwd>+--print -p/-m.- Generic fallback →
-p <prompt>.
- When adding a new CLI: extend both
command_validation.py(predicate + validation) andadapters.py(branch inprepare_command).
Prompt construction
clawteam/spawn/prompt.py::build_agent_prompt() assembles every spawned agent's system prompt: Identity → Mission (Auftragstaktik-style intent / end_state / constraints) → Workspace → Shared Memory → Boids rules (only when team_size > 1) → Task → Coordination Protocol → Metacognition block.
Coordination knowledge (how to use the clawteam CLI) lives in the Skill file (skills/openclaw/SKILL.md), not here. The prompt only tells the agent to call the CLI; the skill teaches it which commands exist. Do not duplicate command docs into prompt.py.
Per-agent model resolution
clawteam/model_resolution.py::resolve_model() implements a 7-level priority chain: CLI --model > agent-level model > agent model_tier (strong/balanced/cheap) > template model_strategy = "auto" (auto-assigns strong to anything containing leader/reviewer/architect/manager) > template model > config default_model > None. Tier table is DEFAULT_TIERS in the same file, overridable via config model_tiers.
Templates
TOML files under clawteam/templates/ (hedge-fund.toml, code-review.toml, research-paper.toml, strategy-room.toml) define team archetypes. clawteam/templates/__init__.py::load_template() searches ~/.clawteam/templates/ first (user overrides) then the built-in dir. User-supplied fields like {goal}, {team_name}, {agent_name} are substituted by render_task() — it uses a _SafeDict that preserves unknown placeholders rather than raising KeyError.
DEFAULT_MAX_AGENTS = 4 (backed by arXiv:2512.08296). Exceeding this triggers a check_agent_count() warning unless --force is passed. Don't raise this ceiling casually.
Filesystem layout under ~/.clawteam/
teams/{team}/
config.json # TeamConfig — members, lead_agent_id, description
inboxes/{agent}/ # FileTransport msg-*.json (atomic writes)
events/ # event log (non-consuming history)
peers/ # P2P peer discovery
plans/ # plan approval docs
tasks/{team}/ # FileTaskStore task-*.json
costs/{team}/ # CostEvent records + rolling cache
sessions/{team}/ # per-agent session IDs (for --resume)
workspaces/{team}/ # workspace-registry.json (mapping of agent → worktree path + branch)
config.json # global config, ALWAYS at ~/.clawteam/ (never affected by CLAWTEAM_DATA_DIR)Config path is intentionally fixed (clawteam/config.py::config_path()): CLAWTEAM_DATA_DIR relocates team/task/inbox state but NOT global config.
Cross-cutting conventions
Path discipline (security-critical)
Every user-supplied name (team, agent, user, plan ID, inbox recipient…) must flow through clawteam/paths.py:
validate_identifier(value, kind)— regex^[A-Za-z0-9._-]+$, rejects empty /./...ensure_within_root(root, *parts)— rejects any path that resolves outsideroot.
If you accept a name from the CLI, config, or a message and join it into a filesystem path, you MUST use these. Grep for existing uses in clawteam/team/manager.py, clawteam/team/mailbox.py, clawteam/workspace/manager.py for the pattern.
Atomic writes + advisory locks
All shared JSON state is written via clawteam/fileutil.py:
atomic_write_text(path, content)— mkstemp in target dir → fsync →os.replace. Windows retries onPermissionError.file_locked(path)— exclusive advisory lock on<path>.lock(fcntl on Unix, msvcrt on Windows). Use for read-modify-write sequences.
Never call Path.rename() on writeable state. Use os.replace() — Path.rename() fails on Windows when the destination exists. This fix was explicitly cherry-picked from upstream (#102).
Windows portability
clawteam/platform_compat.py centralises cross-platform shims: is_windows(), default_spawn_backend(), exclusive_file_lock(), pid_alive(), install_signal_handlers(), shell_join(), shell_quote(). Go through these — don't add import fcntl at module top level outside this file.
The tmux backend is unavailable on Windows; board attach hard-requires it. board serve (web UI) is the cross-platform alternative.
Pydantic model conventions
Most models (in clawteam/team/models.py, clawteam/templates/__init__.py, etc.) use model_config = {"populate_by_name": True} with Field(alias="camelCaseOnDisk"). Dumped JSON uses by_alias=True, exclude_none=True to match the teammate-tool spec. Serialising must preserve this — see _dump() in cli/commands.py and MailboxManager.send() for the canonical pattern.
Environment variable layering
Config resolution order throughout the codebase is: env var → ~/.clawteam/config.json → default. Canonical env vars: CLAWTEAM_DATA_DIR, CLAWTEAM_USER, CLAWTEAM_TEAM_NAME, CLAWTEAM_TRANSPORT, CLAWTEAM_TASK_STORE, CLAWTEAM_WORKSPACE, CLAWTEAM_DEFAULT_BACKEND, CLAWTEAM_SKIP_PERMISSIONS, CLAWTEAM_DEFAULT_MODEL. AgentIdentity.from_env() additionally honours legacy OPENCLAW_* / CLAUDE_CODE_* prefixes for back-compat.
Ruff
line-length = 100, select = ["E", "F", "I", "N", "W"], ignore = ["E501"]. Import sorting is enforced (I001). Run ruff check --fix to auto-sort before committing. CI fails on any ruff warning.
Fork-specific gotchas
- OpenClaw is the default. The spawn command defaults to
["openclaw"]and the adapter has openclaw-specific flag handling. Do not change this toclaude— the upstream project does that, this fork deliberately does not. - OpenClaw exec-approval mode must be
allowlist, notfull, otherwise spawned workers hang on interactive permission prompts. The README install step 5 configures this;skills/openclaw/SKILL.mdreferences$CLAWTEAM_BINso the allowlist can pin the exact path. - Hermes quirks: workers use
hermes chat --yolo --source tool -q "<task>". Thechatsubcommand is auto-inserted only when the command is barehermes. Never add--continueon spawn — it resumes existing sessions only. Hermes sometimes completes without runningclawteam inbox send; ifinbox peekis empty but the kanban shows COMPLETED, fall back totmux capture-pane -t clawteam-<team>:<window> -p -S -500. - Hermes
--source toolis a known upstream no-op on Hermes ≤ 0.8.0. The adapter passes it correctly; Hermes'srun_agent.py:1057/:6600short-circuitself.platform or os.environ.get(...)so the env var set bycmd_chatis never consulted. Spawned workers currently show up undersource=cliinhermes sessions list. Seeskills/hermes/SKILL.md § Known upstream issuesfor the one-line fix. Do not "helpfully" add workarounds in the adapter — there's no env var or flag that can override Hermes's hardcodedplatform="cli", and the correct fix lives upstream. - Built-in templates default to openclaw. To spawn Hermes workers from a template:
clawteam launch <template> --command hermes --force. (Onspawn, Hermes is the trailing positional:clawteam spawn --team ... hermes.) - CHANGELOG follows Keep a Changelog. Cherry-picks from upstream go under
### Fixedwith(cherry-picked from upstream #XXX)suffix, and new features reference the localwin4r/ClawTeam-OpenClawPR number.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

