Swarm Board
by moonrzz
README.md
<div align="center">
<img src="docs/assets/hero-banner.svg" alt="Codex Swarm Banner" width="100%" />
<br />
<br />
[](LICENSE)
[](requirements.txt)
[](#2-quick-start)
[](#3-architecture)
[](#3-architecture)
<p>
<strong>An Antigravity-style multi-agent swarm orchestrator for OpenAI Codex โ featuring true peer-to-peer <code>@mention</code> wakeups, zero-token parked workers, isolated Git worktrees, and an interactive Hive & Mention Graph Web UI.</strong>
</p>
<p>
๐ <strong>English</strong> ยท <a href="README.zh-CN.md">็ฎไฝไธญๆ</a> ยท <a href="README.ja.md">ๆฅๆฌ่ช</a>
</p>
<p>
<a href="#1-why-codex-swarm">Why Codex Swarm?</a> โข
<a href="#2-interface-showcase">Interface Showcase</a> โข
<a href="#3-architecture">Architecture</a> โข
<a href="#4-quick-start">Quick Start</a> โข
<a href="#5-try-peer-to-peer-collaboration">P2P Prompt</a> โข
<a href="#6-mcp-tool-reference">MCP Tools</a>
</p>
</div>
---
## 1. Why Codex Swarm?
Native Codex subagents use a strict parent-child hierarchy where siblings cannot talk to each other, active waits consume turn runtime, and every subagent shares the parent working directory by default. **Codex Swarm** bridges those gaps using `codex app-server` + a local Streamable HTTP MCP bus so you can orchestrate a full swarm right inside **Codex Desktop App / CLI** via `$swarm`.
| Capability | Native Codex Subagents | Codex Swarm (`Path 3 ยท Form A`) |
|---|---|---|
| **Peer-to-Peer `@mention` Comms** | Parent โ child relay only | **Direct P2P** (`author` โ `verifier` wake each other via `@name` / `@all` / `@#channel`) |
| **Idle Worker Cost** | Active wait eats turn timeout | **Zero-token parked threads** โ turns end cleanly and wake on `@mention` (`turn/start` / `turn/steer`) |
| **Workspace Isolation** | Shared parent CWD | **Automatic `git worktree`** per parallel author (`.swarm-worktrees/<id>/<worker>`) |
| **Single-Window Experience** | Terminal / thread tree only | **Auto-opens in Codex Side Browser (`iab`)** next to your chat, plus Desktop shortcut |
| **Live Swarm Visualization** | No shared board or graph | **4-Tab Web UI** with **Hive** & **Mention Graph** timeline playback (`0.5รโ4ร`) |
| **Model Hot-Switching** | Requires fresh spawn | **Hot-switch `waiting` worker models** while preserving full `threadId` history |
| **Stall Detection & Approvals** | Manual inspection | **Built-in 180s stall watchdog** + one-click **Allow / Session / Decline** UI cards |
---
## 2. Interface Showcase
Light-first, zero-CDN offline Web Dashboard (`http://127.0.0.1:8765/`) with one-click Dark mode toggle and responsive narrow-pane layout (`โค640px`) built specifically for Codex's side browser.
<table>
<tr>
<td width="50%" align="center">
<strong>๐ Hive View (่ๅทข) & Timeline Playback</strong><br />
<sub>Pixel Queen Bee Coordinator, status-colored hexes, blue active & amber waiting arrows</sub><br /><br />
<img src="docs/assets/preview-hive.png" alt="Hive Graph View" width="100%" />
</td>
<td width="50%" align="center">
<strong>๐ธ๏ธ Mention Graph (ๆๅๅพ)</strong><br />
<sub>Directed P2P interaction network with message-count badges (<code>ร1</code>, <code>ร2</code>)</sub><br /><br />
<img src="docs/assets/preview-mention.png" alt="Mention Graph View" width="100%" />
</td>
</tr>
<tr>
<td width="50%" align="center">
<strong>๐ Overview (ๆฆ่ง)</strong><br />
<sub>Live KPIs, <code>plan.json</code> outcome threads, approval queue, and worker live stream</sub><br /><br />
<img src="docs/assets/preview-overview.png" alt="Overview Tab" width="100%" />
</td>
<td width="50%" align="center">
<strong>๐ฌ Shared Message Board (ๆถๆฏๆฟ)</strong><br />
<sub>Sequence-numbered <code>#seq</code> feed, channel filters, <code>[done]</code> tags, and quick <code>@mention</code> chips</sub><br /><br />
<img src="docs/assets/preview-board.png" alt="Message Board Tab" width="100%" />
</td>
</tr>
</table>
---
## 3. Architecture
<div align="center">
<img src="docs/assets/architecture.svg" alt="Codex Swarm Architecture" width="100%" />
</div>
1. **Stay in your Codex chat**: Your active Codex Desktop App / CLI thread acts as `Coordinator` via the `$swarm` skill and connects to `http://127.0.0.1:8765/mcp`.
2. **Event-driven worker threads**: The local Python Daemon manages a persistent `codex app-server --stdio` process. Every worker runs in its own `threadId` and **ends its turn immediately** after posting to the board โ consuming zero tokens while parked.
3. **Instant wakeup & steer**: When any worker or coordinator posts `@target`, the daemon injects unread `#seq` context via `turn/start` (if `waiting`) or `turn/steer` (if `working`).
4. **Single-window side browser**: On Codex Desktop App, `$swarm` automatically reveals the built-in In-App Browser (`iab`) and pins the dashboard tab (`markDeliverable`) right beside your conversation.
---
## 4. Quick Start
### Prerequisites
- **Windows 10 / 11** + PowerShell
- **Python 3.11+** (`pip install -r requirements.txt` โ only `aiohttp` is required)
- **Git** (for `workspace="share"` worktree isolation)
- **OpenAI Codex Desktop App** or **Codex CLI** signed in (auto-discovers `CODEX_CLI_PATH`, `PATH`, or bundled `WindowsApps\OpenAI.Codex_*\...\codex.exe`)
### Install in 4 Commands
```powershell
git clone https://github.com/moonrzz/codex-swarm.git
cd codex-swarm
pip install -r requirements.txt
.\install.ps1
```
`install.ps1` automatically:
1. Installs the `$swarm` skill to `%USERPROFILE%\.agents\skills\swarm\SKILL.md`;
2. Backs up `%USERPROFILE%\.codex\config.toml` and registers `[mcp_servers.swarm_board]` (`default_tools_approval_mode = "approve"`);
3. Creates a silent one-click **ใCodex ่็พค็ๆฟใ** shortcut on your Desktop (pass `-DesktopShortcut:$false` to skip).
### Launch & Use
```powershell
# Start background daemon manually (or let $swarm / Desktop shortcut start it automatically)
.\start-swarm-daemon.ps1 -Background
# Stop background daemon
.\stop-swarm-daemon.ps1
```
Open a new conversation in **Codex Desktop App / CLI** and type:
```text
$swarm Refactor the auth module into token and session layers, add unit tests, and run a peer review
```
---
## 5. Try Peer-to-Peer Collaboration
Want to verify direct sibling-to-sibling communication without modifying any repository files? Paste this read-only prompt into Codex:
<details>
<summary><strong>Click to expand ready-to-paste P2P verification prompt</strong></summary>
```text
$swarm Verify direct peer-to-peer (P2P) collaboration between sibling workers without editing any files:
1. Spawn two read-only workers (`workspace="inherit"`, `sandbox="read-only"`):
- `proposer`: Draft a 3-point minimal code review checklist, then post directly to `@reviewer` for critique (do NOT `@coordinator` and do NOT write `[done]`), and end your turn immediately.
- `reviewer`: Wait for `@reviewer`, point out at least 1 vague rule, and post directly to `@proposer` requesting measurable criteria (do NOT `@coordinator` or `[done]`), then end your turn.
2. Have `proposer` revise the checklist and post v2 back to `@reviewer` (still without `@coordinator`).
3. Have `reviewer` verify v2 and post `@coordinator [done]` summarizing both rounds.
4. As Coordinator, do not relay between them; only report to me after receiving `@coordinator [done]`, listing the P2P `#seq` numbers.
```
Then open the **ๅ
ณ็ณปๅพ โ ๆๅๅพ** tab to see direct bidirectional arrows (`proposer โ reviewer`) bypassing `Coordinator`!
</details>
---
## 6. MCP Tool Reference
<details>
<summary><strong>12 Tools exposed at <code>http://127.0.0.1:8765/mcp</code></strong></summary>
| Tool | Role | Description |
|---|---|---|
| `swarm_init` | Coordinator | Create a new active swarm bound to `repo_root` and `title` |
| `swarm_title` | Coordinator | Rename the active swarm |
| `swarm_plan` | Coordinator | Publish `plan.json` (`goal`, `tasks`, `threads`) for Overview & Hive |
| `swarm_models` | Coordinator | List available Codex models from `codex app-server` |
| `swarm_add` | Coordinator | Spawn a persistent worker (`inherit` or isolated `share` git worktree) |
| `swarm_status` | All | Inspect roster states, head `#seq`, dashboard URL, and pending approvals |
| `swarm_model` | Coordinator | Hot-switch a `waiting` worker's model while keeping its `threadId` |
| `swarm_kill` | Coordinator | Terminate a worker and optionally clean up its worktree/branch |
| `swarm_channel` | All | `create`, `list`, `archive`, `subscribe`, or `unsubscribe` channels |
| `post_message` | All | Post to the board and auto-wake `@name` / `@all` / `@#channel` recipients |
| `read_board` | All | Read incremental messages after `since` `#seq` |
| `swarm_wait` | Coordinator | Block until `@coordinator` / `[done]` / `[stall]` arrives after `since` |
</details>
---
## 7. Worktree Merge & Project Structure
When parallel authors run with `workspace="share"`, each commits on `swarm/<swarm_id>/<worker>`:
1. Have a read-only `verifier` audit diffs and test results;
2. Merge verified branches: `git merge --no-ff swarm/<swarm_id>/<worker>`;
3. Clean up: `swarm_kill(name="<worker>", remove_worktree=True, delete_branch=True)`.
<details>
<summary><strong>Project Structure & Automated Tests</strong></summary>
```powershell
python -m unittest discover -s tests -v
```
```text
codex-swarm/
โโ codex_swarm/
โ โโ app_server.py # codex app-server --stdio JSON-RPC 2.0 client
โ โโ orchestrator.py # @mention wakeup router, model hot-swap, approvals, stall watchdog
โ โโ mcp_http.py # Streamable HTTP MCP server (/mcp)
โ โโ web_ui.py # Light-first 4-tab Web UI + Hive/Mention Graph & playback
โ โโ store.py # SQLite WAL + append-only JSONL persistence
โ โโ worktree.py # Git worktree isolation & cleanup
โ โโ config.py # Settings & automatic codex.exe discovery
โโ docs/assets/ # Vector banner, architecture diagram & UI showcase screenshots
โโ skills/swarm/SKILL.md
โโ assets/swarm-icon.ico
โโ tests/test_swarm_daemon.py
โโ install.ps1
โโ start-swarm-daemon.ps1
โโ stop-swarm-daemon.ps1
โโ launch-dashboard.ps1
โโ launch-dashboard-silent.vbs
```
</details>
---
## License
Released under the [MIT License](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues