@ra3orblade/swarm 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <p align="center"><img src="docs/art/swarm-icon.svg" alt="Swarm" width="96" height="96"></p>
1
+ <p align="center"><img src="docs/art/swarm-mark.svg" alt="Swarm" width="180"></p>
2
2
 
3
3
  <h1 align="center">Swarm</h1>
4
4
 
@@ -32,7 +32,7 @@ It runs entirely on your machine. No account, no telemetry, works offline. Nothi
32
32
  bunx @ra3orblade/swarm setup
33
33
  ```
34
34
 
35
- > Status: early, but real, and shipping fast — eleven releases so far. Observability across six agent CLIs, task claims in isolated worktrees, runtime resources, rules and incidents, a cross-forge merge queue, spawned agents (`swarm run` / `swarm dispatch`), declarative workflows, executed verification gates (including a built-in reviewer), handoffs, agent-to-agent messaging, session replay, outcome tracking, the collision graph, search, budgets, signed org policy and a self-hosted team daemon are all built and dogfooded daily — Swarm dispatches its own tasks. What's next is on the [roadmap](ROADMAP.md).
35
+ > Status: early, but real, and shipping fast — twenty-one releases so far. Observability across six agent CLIs, task claims in isolated worktrees, runtime resources, rules and incidents, a cross-forge merge queue, spawned agents (`swarm run` / `swarm dispatch`), declarative workflows, executed verification gates (including a built-in reviewer), handoffs, agent-to-agent messaging, session replay, outcome tracking, the collision graph, search, budgets, a status line and permission cards inside Claude Code itself, signed org policy and a self-hosted team daemon are all built and dogfooded daily — Swarm dispatches its own tasks. What's next is on the [roadmap](ROADMAP.md).
36
36
 
37
37
  ---
38
38
 
@@ -44,28 +44,28 @@ bunx @ra3orblade/swarm setup
44
44
 
45
45
  <p align="center"><img src="docs/art/screens/session.png" alt="Session view — live reasoning stream with a stats panel" width="100%"></p>
46
46
 
47
- **Board** — the coordination ledger for a project: **tasks** from your backlog (a markdown file, GitHub Issues or Linear) with a ✓ / ✗ per gate and **Run** / **Dispatch** actions, task **claims** (each in an isolated git worktree), **worktrees** with branch, drift, dirty/unpushed state and which session is inside — plus **Diff**, **PR** (push + open a pull/merge request prefilled from the task and handoff), **Open** and **Remove** per row — **runtime resources** (ports, dev servers, databases held as named singletons), **dispatch** status, recent **gates**, and **incidents** — every command the rules asked about or denied, with the rule and the command, and a **Codify** action that turns one into a `.swarm.toml` rule and a `CLAUDE.md` lesson.
47
+ **Board** — the coordination ledger for a project: **tasks** from your backlog (a markdown file, GitHub Issues or Linear) with a ✓ / ✗ per gate and **Run** / **Dispatch** actions, task **claims** (each in an isolated git worktree), **worktrees** with branch, drift, dirty/unpushed state and which session is inside — plus **Diff**, **PR** (push + open a pull/merge request prefilled from the task and handoff), **Open** and **Remove** per row — **runtime resources** (ports, dev servers, databases held as named singletons), **dispatch** status, recent **gates**, and **incidents** — every command the rules asked about or denied, with the rule and the command, and a **Codify** action that turns one into a `.swarm.toml` rule and a `CLAUDE.md` lesson — **Apply** commits it on a branch and opens the PR, never into your checkout.
48
48
 
49
49
  <p align="center"><img src="docs/art/screens/board.png" alt="Board view — worktrees and incidents" width="100%"></p>
50
50
 
51
- **Rules** — guardrails on the Bash commands a Claude Code session runs: `shared_tree`, `destructive_git`, `pattern_kill`, `protected_ports`, plus `no_foreign_worktree` and the opt-in `claim_required_to_write` on file writes; each `ask | deny | off` per repo in `.swarm.toml`. A `deny` is returned to Claude Code as a real permission denial. Ports held as resources are protected automatically. Guardrails against accidents, not a sandbox — see [what rules are and aren't](https://getswarm.vercel.app/docs/03-rules-and-config#what-rules-are--and-arent).
51
+ **Rules** — guardrails on the Bash commands a Claude Code session runs: `shared_tree`, `destructive_git`, `pattern_kill`, `protected_ports`, plus `no_foreign_worktree` and the opt-in `claim_required_to_write` on file writes; each `ask | deny | off` per repo in `.swarm.toml`. Two more have a third answer: `no_verify` strips `--no-verify` from a git command and lets it run, `dry_run_first` turns the first `terraform apply` or `kubectl delete` in a session into its dry run — and `[[rules.custom]]` takes your own (`match` regex, `ask | deny | rewrite`). A `deny` is returned to Claude Code as a real permission denial. Ports held as resources are protected automatically. Guardrails against accidents, not a sandbox — see [what rules are and aren't](https://getswarm.vercel.app/docs/03-rules-and-config#what-rules-are--and-arent).
52
52
 
53
53
  **Run & Dispatch** — start an agent from Swarm: `swarm run --task X` (or **Run** on a task row) claims the task and spawns `claude -p` in its worktree; steer it by stdin, stop it by pid. Its permission prompts go through the same rules as your interactive sessions — `deny` auto-denies, `ask` becomes an **Allow / Deny** card on the session, nothing else blocks. `swarm dispatch --ready` hands every claimable task to its own run, N at a time; when a run ends Swarm re-runs the gates and looks for the PR, and reports done / gates-failed / no-pr / crashed. Run profiles (`full | no-edits | read-only`) narrow what a spawned agent may do.
54
54
 
55
55
  **Gates & handoffs** — `.swarm.toml` declares the gates every task must pass; a gate with a `cmd` is executed in the task's worktree (exit 0 passes, the output tail is the evidence) — on demand, from the agent, or automatically when a session in a held worktree ends. The latest run decides, failed runs are never deleted. Every session that pauses leaves an auto-handoff (files edited, last verification command, last request); the next session in that worktree gets it, the lease left, gate status and held resources injected at start.
56
56
 
57
+ **In your terminal, not just the dashboard** — Swarm answers Claude Code's hooks with more than yes/no. A **status line** shows the project, the claim, gate state, today's spend and how much of your plan window is left. A permission prompt appears as an **Allow / Deny card** on the session page and the terminal never asks — but only while a dashboard is actually open and visible, and only for `[broker] interactive_wait` seconds. With `[gates] on_stop = "block"` a session **cannot say it is done while a required gate fails**: the stop is refused, the agent gets the gate's name and the tail of its output, and after `max_blocks` refusals it goes through with an incident. And when two live sessions touch the same file, the second one is told so on its next tool call.
58
+
57
59
  **Ask the human** — an agent that hits a decision only you can make calls `swarm_ask`; the question shows on the session page with the options as buttons, Fleet shows an **Asking** badge, a desktop notification fires, and the answer reaches the agent on its own.
58
60
 
59
61
  **Workflows** — `[[workflows]] name = "ship" steps = ["implement", "gate:tests", "gate:review", "pr"]` in `.swarm.toml`, and the daemon advances it: run steps spawn an agent in the task's worktree, gate steps must pass to continue, `pr` pushes the branch and opens the pull request. A failed step stops with an incident that says which one.
60
62
 
61
- **Messaging** — `swarm_send(to, text)` reaches another session by id, whoever holds a task, or `"lead"` (your interactive session in the project). It arrives as injected context on the recipient's next tool call, over stdin to a spawned run, or via `swarm_inbox` — exactly once.
63
+ **Messaging** — `swarm_send(to, text)` reaches another session by id, whoever holds a task, or `"lead"` (your interactive session in the project). It arrives as injected context on the recipient's next tool call, over stdin to a spawned run, or via `swarm_inbox` — exactly once. A session sitting idle at its prompt is **woken** when a message or an answer lands for it, rather than waiting for you to type something (`[messages] wake = false` turns that off).
62
64
 
63
65
  **PRs** — one merge queue across GitHub and GitLab, read through your already-authenticated `gh` / `glab`. Merge from the dashboard when checks and review are clear. No tokens stored.
64
66
 
65
67
  **Timeline** — session lanes per project, coloured by agent, 3–72 h.
66
68
 
67
- <p align="center"><img src="docs/art/screens/timeline.png" alt="Timeline view — session lanes per project" width="100%"></p>
68
-
69
69
  **Spend & Stats** — cost by project, model, agent and **task**, today and all-time, with a context-budget table that ranks sessions by how much context they re-read; per-repo **budgets** (`daily` / `weekly` ceilings that warn, ask or stop); plus the fun numbers: tokens, turns, streaks, activity calendar, words written, what it adds up to in novels and coffee.
70
70
 
71
71
  **Search** — full-text memory over everything Swarm remembers: handoffs, incidents, gate runs and what sessions said. **Dry-run rules** replays a project's history under rule modes you pick before switching anything on.
@@ -74,10 +74,6 @@ bunx @ra3orblade/swarm setup
74
74
 
75
75
  **Graphs** — a live bipartite graph of running sessions against the files they touch. A file two sessions hold with at least one writer turns red: a merge conflict you can still prevent.
76
76
 
77
- <p align="center"><img src="docs/art/screens/outcomes.png" alt="Outcomes view — merge rate, median time to merge and dollars per merge, per model and per agent" width="100%"></p>
78
-
79
- <p align="center"><img src="docs/art/screens/stats.png" alt="Stats view" width="100%"></p>
80
-
81
77
  **Multi-agent** — six brands, one ledger: Claude Code via its hooks and transcripts (the full picture — rules, MCP, spawned runs), and Codex CLI (`~/.codex`), Gemini CLI (`~/.gemini`), Grok (ACP `updates.jsonl`), Aider (`.aider.chat.history.md`) and opencode (its SQLite database, read-only) by reading the session logs they already write. Every session is tagged with its agent; Spend, Timeline and Outcomes break down per agent.
82
78
 
83
79
  **Zero instrumentation** — it reads the hooks and transcripts the agents already write. Every table is a real data grid: sort, resize, reorder, filter, persisted layouts. Light and dark themes.
@@ -108,12 +104,15 @@ pattern_kill = "ask" # pkill -f and friends
108
104
  protected_ports = "ask" # freeing a port listed below (or held as a resource)
109
105
  no_foreign_worktree = "ask" # file writes into a worktree another claim holds
110
106
  claim_required_to_write = "off" # opt-in: writes to the shared checkout need a claim
107
+ no_verify = "rewrite" # also "rewrite": strip --no-verify and run it anyway
108
+ dry_run_first = "off" # first terraform apply / kubectl delete becomes its dry run
111
109
 
112
110
  [rules.protected]
113
111
  ports = [5432]
114
112
 
115
113
  [gates] # what every task must pass; a gate with a cmd is executed, not vouched for
116
114
  required = ["tests", "review"]
115
+ on_stop = "block" # a session can't say it's done while a required gate fails
117
116
  [gates.tests]
118
117
  cmd = "bun test"
119
118
 
@@ -142,6 +141,7 @@ swarm status # live sessions in the terminal
142
141
  swarm doctor # check setup, print the fix for each gap
143
142
  swarm add <path> · ls · ui # pin a project · list projects · open the dashboard
144
143
  swarm tail # follow the live event stream
144
+ swarm statusline # the Claude Code status line (swarm install wires it up)
145
145
 
146
146
  swarm tasks [--ready] # the repo's task source; --ready = claimable now
147
147
  swarm claim <task> [--owner n] # claim a task in a fresh isolated worktree (fail-closed)
@@ -158,6 +158,8 @@ swarm run ls | send <task> "…" | stop <task> # steer (stdin) or stop a spawn
158
158
  swarm run resume <session-id> # pick up where a dead session stopped (its handoff + tail)
159
159
  swarm dispatch --ready | <task…> · status · clear # claim + spawn a run per task, max_parallel at a time
160
160
  swarm questions · answer <id> <text> # what agents are waiting on a human for
161
+ swarm workflow <name> <task> · ls · stop <task> # run a [[workflows]] pipeline over a task
162
+ swarm msg send <to> "…" · ls # message a session, a task holder, or "lead"
161
163
 
162
164
  swarm res ls | acquire <name> [--pid n] [--port n] | release <name> [--force]
163
165
  swarm serve start [--name web] -- <cmd> # dev server: port allocated, PORT set, pid tracked, port protected
@@ -180,6 +182,7 @@ swarm install | uninstall # add/remove Swarm hooks in ~/.claude/settings.js
180
182
  - `swarm_pr_open` — push the branch and open a PR/MR prefilled from the task and handoff
181
183
  - `swarm_dispatch` — a lead agent hands ready tasks to autonomous runs in their own worktrees
182
184
  - `swarm_ask` / `swarm_inbox` — ask the human a question (with options); the answer arrives on its own
185
+ - `swarm_send` — message another session by id, whoever holds a task, or the project's lead
183
186
  - `swarm_acquire_resource` / `swarm_release_resource` / `swarm_resources` — hold a port, dev server or database as a named singleton; held ports are protected from other agents automatically
184
187
  - `swarm_search` — memory over handoffs, incidents, gates and what sessions said
185
188
 
@@ -206,7 +209,7 @@ Design docs (architecture, data model, protocol, interface, roadmap) are rendere
206
209
 
207
210
  ## Teams
208
211
 
209
- One machine is free and always will be. When it outgrows one laptop, `swarm-teamd` is a second, self-hosted service your machines *forward* to — audit events, spend rollups and claims, never transcript text unless a machine opts in, and always after your redaction rules. You get one view of the fleet (machines, cluster-wide claims, spend by person, project, machine and day), a claim taken on one laptop is refused on another with the holder's name, org `policy.toml` is ed25519-signed and verified against a key pinned at `swarm login`, team budgets enforce warn / ask / stop, and monthly chargeback exports come out by user, machine, model or **ticket id**. Every laptop stays local-first and keeps working offline. [Teams guide](https://getswarm.vercel.app/docs/11-teams).
212
+ One machine is free and always will be. When it outgrows one laptop, `swarm-teamd` is a second, self-hosted service your machines *forward* to — hosted or joined from the dashboard's **Team** panel, or from `swarm login` — audit events, spend rollups and claims, never transcript text unless a machine opts in, and always after your redaction rules. You get one view of the fleet (machines, cluster-wide claims, spend by person, project, machine and day), a claim taken on one laptop is refused on another with the holder's name, org `policy.toml` is ed25519-signed and verified against a key pinned at `swarm login`, team budgets enforce warn / ask / stop, and monthly chargeback exports come out by user, machine, model or **ticket id**. Every laptop stays local-first and keeps working offline. [Teams guide](https://getswarm.vercel.app/docs/11-teams).
210
213
 
211
214
  *Licensing: `packages/team` is the single source-available package ([FSL-1.1-ALv2](packages/team/LICENSE.md), Apache-2.0 after two years). Everything else is and stays Apache-2.0.*
212
215