Agent Swarm Orchestrator
by @matzoh
Orchestrate OpenClaw Agent Swarm workflows for multi-project coding automation with Obsidian task intake, Claude coding, Codex review, GitLab MR flow, merge+...
clawhub install agent-swarm-orchestrator๐ About This Skill
name: agent-swarm-orchestrator description: Orchestrate OpenClaw Agent Swarm workflows for multi-project coding automation with Obsidian task intake, Claude coding, Codex review, GitLab MR flow, merge+sync, and done-status closure.
Agent Swarm Orchestrator
Multi-project coding automation: Obsidian task intake โ Claude Code โ Codex review โ GitLab MR โ merge + sync.
Architecture
Obsidian note (status: ready)
โ scan-obsidian.sh (cron 5min)
โ spawn-agent.sh
โโโ git worktree + branch
โโโ prompt file (task + context.md)
โโโ tmux session โ run-agent.sh
โโโ claude -p "$PROMPT" | tee log
โโโ review-and-push.sh
โโโ codex review (graded)
โโโ push + glab mr create --yes
โโโ notification โ Telegrammerge-and-sync.sh (manual trigger)
โโโ glab mr merge
โโโ sync-project-main.sh (fast-forward local main)
โโโ check-agents.sh (background) โ mark done + send notification
check-agents.sh (cron 3min / called by merge-and-sync)
โโโ dead tmux + commits โ trigger review
โโโ >60min โ timeout notification
โโโ MR merged โ mark done in tasks.json + .notification โ Telegram
Core Paths
| Path | Purpose |
|------|---------|
| ~/agent-swarm/ | Control plane (scripts, registry, tasks) |
| ~/agent-swarm/registry.json | Project configs (repo, paths, branch) |
| ~/agent-swarm/tasks.json | Task state machine |
| ~/GitLab/repos/ | Local repos |
| ~/GitLab/worktrees/ | Per-task worktrees |
| ~/Documents/Obsidian Vault/agent-swarm/ | Task intake notes |
Scripts
| Script | Purpose |
|--------|---------|
| spawn-agent.sh | Create worktree + prompt + tmux โ run-agent |
| run-agent.sh | claude -p โ check commits โ trigger review |
| review-and-push.sh | Codex review โ graded fix โ push โ MR |
| check-agents.sh | Cron + post-merge: detect done/stuck, mark done, send notification |
| scan-obsidian.sh | Parse Obsidian notes, spawn status: ready tasks |
| send-notifications.sh | Send .notification files via OpenClaw CLI |
| merge-and-sync.sh | Merge MR + sync local main |
| sync-project-main.sh | Fast-forward local repo to origin/main |
| new-project.sh | Initialize project (GitLab + registry + context + Obsidian) |
| cleanup.sh | Daily archive old tasks, clean worktrees/logs |
Usage
Spawn task
~/agent-swarm/scripts/spawn-agent.sh ""
Monitor
tmux attach -t agent- # live output
tail -f ~/agent-swarm/logs/.log # log file
Merge and sync
~/agent-swarm/scripts/merge-and-sync.sh
New project
~/agent-swarm/scripts/new-project.sh
Task Lifecycle
starting โ running โ [no-output | reviewing]
reviewing โ [ready_to_merge | review-error | needs-manual-fix | fixing]
fixing โ reviewing (retry, max 2)
ready_to_merge โ done (auto on MR merged)
Prerequisites
Claude Code CLI
~/.claude.json oauthAccount)~/.claude/settings.json: skipDangerousModePermissionPrompt: true~/.claude.json projects: trust ~/GitLab/worktrees and ~/GitLab/repos (hasTrustDialogAccepted: true)ANTHROPIC_* env vars leaking into tmux (causes proxy conflicts)Tools
claude CLI (Claude Code)codex CLI (OpenAI Codex, for review)glab CLI (GitLab)jq, python3, tmuxCron
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
*/3 * * * * ~/agent-swarm/scripts/check-agents.sh
*/5 * * * * ~/agent-swarm/scripts/scan-obsidian.sh
0 3 * * * ~/agent-swarm/scripts/cleanup.sh
Notifications
Configure in ~/agent-swarm/registry.json:
{
"notifyMethod": "openclaw",
"notifyChannel": "telegram",
"notifyTarget": ""
}
swarm_notify() in config.sh reads these values and calls:
openclaw message send --channel telegram --target --message "..."
โ ๏ธ Do NOT use >/dev/null 2>&1 in swarm_notify โ errors must be visible so failed sends are not silently marked as sent.
Prompt Template
Each task gets a prompt file with:
1. Project name, task description, priority
2. Working directory and branch
3. Project context (from context.md)
4. Standard instructions (commit, push, MR, update context.md if architectural changes)
Obsidian Integration
status: active | stop controls project scanning### Task Name + status: ready + > description### INIT_PROJECT + status: ready triggers new-project.shReview Policy
-p mode, auto-exit)codex exec review)needs-manual-fixPortable Install
mkdir -p ~/agent-swarm/{scripts,logs,projects}
cp -f /scripts/*.sh ~/agent-swarm/scripts/
chmod +x ~/agent-swarm/scripts/*.sh
echo '{"projects":{}}' > ~/agent-swarm/registry.json
echo '{"tasks":[]}' > ~/agent-swarm/tasks.json
Then: register projects in registry.json, set cron, configure notifications.
Intent โ Action Mapping
When a user message matches one of these intents, take the corresponding action immediately without asking for confirmation:
| User says | Context | Action |
|-----------|---------|--------|
| "ๅๅนถ" / "merge" / "merge it" | Replied to a PR_READY notification | Extract and from the notification, run merge-and-sync.sh |
| "่ตทไปปๅก" / "spawn" / "ๆฐไปปๅก" | With a task description | Run spawn-agent.sh |
| "ๆฅ็ถๆ" / "check status" | Any | Run check-agents.sh and summarize output |
| "ๆฐ้กน็ฎ" / "new project" | With a project name | Run new-project.sh |
Extracting MR info from PR_READY notifications
PR_READY notifications follow this format:
โ
PR_READY
Project:
Task:
Task ID:
Branch:
MR: https://gitlab.com/.../-/merge_requests/ | Review ...
Extract Project โ , and the number at the end of the MR URL โ .
Guardrails
You are the dispatcher, not the analyst
When a user reports an issue or requests a change to project code:
The coding agent runs in a full worktree with complete project context โ it is better positioned to read code, diagnose issues, and implement fixes than you are from a chat session.
Other rules
done, ready_to_merge, review-error, needs-manual-fix๐ก Examples
Spawn task
~/agent-swarm/scripts/spawn-agent.sh ""
Monitor
tmux attach -t agent- # live output
tail -f ~/agent-swarm/logs/.log # log file
Merge and sync
~/agent-swarm/scripts/merge-and-sync.sh
New project
~/agent-swarm/scripts/new-project.sh
โ๏ธ Configuration
Claude Code CLI
~/.claude.json oauthAccount)~/.claude/settings.json: skipDangerousModePermissionPrompt: true~/.claude.json projects: trust ~/GitLab/worktrees and ~/GitLab/repos (hasTrustDialogAccepted: true)ANTHROPIC_* env vars leaking into tmux (causes proxy conflicts)Tools
claude CLI (Claude Code)codex CLI (OpenAI Codex, for review)glab CLI (GitLab)jq, python3, tmuxCron
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
*/3 * * * * ~/agent-swarm/scripts/check-agents.sh
*/5 * * * * ~/agent-swarm/scripts/scan-obsidian.sh
0 3 * * * ~/agent-swarm/scripts/cleanup.sh
Notifications
Configure in ~/agent-swarm/registry.json:
{
"notifyMethod": "openclaw",
"notifyChannel": "telegram",
"notifyTarget": ""
}
swarm_notify() in config.sh reads these values and calls:
openclaw message send --channel telegram --target --message "..."
โ ๏ธ Do NOT use >/dev/null 2>&1 in swarm_notify โ errors must be visible so failed sends are not silently marked as sent.