muster

module
v0.0.0-...-628f028 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: MPL-2.0

README

muster

A central hub that serves beads issues over a REST + WebSocket API, and (M2) runs CLI coding agents against them. M1 serves a single beads repository (via --beads-dir); aggregating multiple repositories from one instance is planned for a later milestone.

M2 — Claude Code adapter: dispatching a bead launches the claude CLI inside a per-bead git worktree, hosted in a tmux session, streaming its output over WebSocket (runlog.line) with live attach/send. Runtime deps: git, and tmux ≥ 3.2 (optional — without it agents still run via direct exec, but attach/send are disabled). Agent execution is exercisable via the API today; the embedded UI is not yet wired to the live runlog/attach stream (planned follow-up). muster defaults to listening on 127.0.0.1; non-loopback binds are not yet refused and there is no auth/Origin check, so do not expose beyond localhost (see the --addr row below for the hardening follow-up).

M3 — Worktree & diff exposure: the /worktree and /diff sub-routes on each bead expose the per-bead worktree's change summary and a git-format unified diff, respectively. jj ≥ 0.42 is supported as an alternative VCS backend via --default-vcs=jj (optional; git remains the default). Runtime dep: jj (optional, required only when --default-vcs=jj).

M4 — Dispatcher: dispatch is now a capacity-gated FIFO scheduler (--max-concurrent-dispatches, default 4, runtime-adjustable via PUT /api/v1/orchestrator/capacity). POST /beads/{id}/dispatch is idempotent — a repeat for an in-flight bead returns the existing run (joined:true) instead of a 409. Beads can run a multi-step plan→build→review chain with operator-driven advance/loop-back (POST /beads/{id}/steps/advance and .../loopback; /steps/{idx} now accepts idx>0). The worktree write-side is live for both git and jj — POST /beads/{id}/worktree/finalize, .../push, and DELETE /beads/{id}/worktree. Best-effort token usage is captured per run from Claude Code's on-disk session record and surfaced on run status and a run.quota event.

Quick start

make build
bin/muster serve --beads-dir /path/to/.beads

See specs/002-m1-beads-backed/quickstart.md for a full walkthrough, or specs/004-m3-worktrees/quickstart.md for the M3 worktree/diff walkthrough.

Flags

Flag Env Default Description
--beads-dir BEADS_DIR ./.beads if present Path to the beads directory containing metadata.json and issues.jsonl. Falls back to ./.beads only when it exists; otherwise the flag/env is required.
--bd-bin BD_BIN bd (from PATH) Path to the bd CLI binary. Write endpoints are disabled if bd is not found.
--addr — 127.0.0.1:7766 TCP address to listen on. Defaults to localhost; non-loopback binds are not yet refused and there is no auth/Origin check — do not expose beyond localhost (hardening is a tracked follow-up).
--repo (repeatable) MUSTER_REPO — Map a bead-ID prefix to a source repo, e.g. --repo mp=/path/to/repo. Resolves which repo a dispatched bead's worktree branches from (M2).
--worktrees-dir MUSTER_WORKTREES_DIR ~/.muster/worktrees Root directory for per-bead git worktrees (M2).
--run-timeout MUSTER_RUN_TIMEOUT 0 (none) Optional per-run wall-clock cap, e.g. 30m. 0 = unbounded (M2).
--default-permission-mode MUSTER_DEFAULT_PERMISSION_MODE — Fallback claude autonomy (default/acceptEdits/dontAsk/bypassPermissions/auto) applied to agent-mode dispatches that omit permissionMode. plan is not valid here — it's implicit for plan-mode dispatches and rejected at startup as a default. muster never defaults autonomy silently (M2).
--default-vcs MUSTER_DEFAULT_VCS git VCS backend for per-bead worktrees: git or jj. jj requires jj ≥ 0.42 on PATH and a source repo that is already a jj workspace; plain git repos with --default-vcs=jj return an error at dispatch time (M3).
--max-concurrent-dispatches MUSTER_MAX_CONCURRENT_DISPATCHES 4 Maximum concurrently active agent runs (M4). Further dispatches are accepted and queued FIFO, then admitted automatically as slots free. Must be a positive integer (≤0 fails fast at startup). Adjustable at runtime via PUT /api/v1/orchestrator/capacity — lowering it drains rather than kills running agents. (The push remote for POST /beads/{id}/worktree/push is a per-request {"remote":"…"} body field, default origin, not a flag.)
--muster-dir MUSTER_DIR ~/.muster Directory for muster's own operating config (M6): the constitution (constitution.md), imported skills (skills/*.md), and primed-memory snapshots (primed/*.json). Local files only — never Dolt, never through bd.
--claude-config-path MUSTER_CLAUDE_CONFIG ~/.claude.json Path to the claude CLI config, read (only) for best-effort MCP-server verification (M6). A named MCP server absent from this config yields a non-blocking runlog.warning; muster never spawns or manages MCP servers.

API

Method Path Description
GET /api/v1/beads List all beads (optional ?column= filter)
GET /api/v1/beads/{id} Get a single bead
POST /api/v1/beads Create a bead (requires bd)
PATCH /api/v1/beads/{id} Update a bead (requires bd)
POST /api/v1/beads/{id}/move Move to column (requires bd)
POST /api/v1/beads/{id}/dispatch Run a CLI agent on the bead — body {agent, mode, permissionMode} (M2); optional chain[] step override (M4); optional skills[] per-dispatch skill override unioned onto the bead's skill:<id> labels (M6)
GET /api/v1/beads/{id}/steps/{idx}/attach tmux attach command + pane for a running step (M2; idx=0)
POST /api/v1/beads/{id}/steps/{idx}/send Forward keystrokes to the live agent pane (M2; idx=0)
GET /api/v1/beads/{id}/worktree Change summary for the bead's worktree — file list with kind (added/modified/deleted/renamed/copied), VCS name, and clean flag (M3)
GET /api/v1/beads/{id}/diff Git-format unified diff of all worktree changes; optional ?path= to scope to a single file (M3)
POST /api/v1/beads/{id}/comments Add comment (requires bd)
GET /api/v1/orchestrator/status Backend health, config, tmux + adapter availability
GET/PUT /api/v1/constitution Read/replace the versioned constitution merged into every dispatched prompt (M6). PUT {markdown} bumps the version and emits constitution.changed.
GET /api/v1/skills · /api/v1/skills/categories List the skill registry (embedded built-ins + imported) / its categories (M6)
POST/DELETE /api/v1/skills · /api/v1/skills/{id} Import a skill from a URL {url} / delete an imported skill (built-ins are read-only → SKILL_READONLY) (M6)
GET/POST/DELETE /api/v1/memories · /api/v1/memories/{key} List (?q=)/upsert {key?,value}/delete memories — a thin facade over bd remember/forget/memories (M6)
POST /api/v1/memories/prime Snapshot current memories into a bead's next dispatch {beadID} (M6)
GET /api/v1/stream WebSocket event stream (bead.*, runlog.line, tmux.session.*; M6 adds constitution.changed, runlog.warning)

Build & test

make build        # produces bin/muster
make test         # go test ./... (claude always faked; real-tmux tests run if tmux is present, else skip)
make cover-check  # coverage gates
make lint         # gofmt + go vet + golangci-lint
make test-e2e     # real end-to-end M2 run (needs claude logged in + tmux)

make test never requires claude or tmux to be installed: claude is always faked, and the handful of integration tests that exercise the real tmux transport skip automatically when a supported tmux (>= 3.2) isn't present — but they do run against a real tmux when one is available, so they aren't fakes-only. make test-e2e (build-tagged, excluded from the default suite) drives a real dispatch against claude + tmux — see the M2 quickstart. The test-e2e target and the underlying //go:build e2e test ship with the M2 orchestrator stack (stack 3 of the M2 PR series); on a tree that has only the docs/foundation stacks merged the target is absent, and go test -tags=e2e -run TestE2E ./internal/orchestrator/ is the manual equivalent.

Multi-repo setup

See BEADS_MULTIREPO_SETUP_GUIDE.md.

Directories

Path Synopsis
cmd
muster command
internal
adapter
Package adapter defines the Adapter interface and registry for agent integrations.
Package adapter defines the Adapter interface and registry for agent integrations.
adapter/claude
Package claude implements the Adapter interface for the Claude Code CLI.
Package claude implements the Adapter interface for the Claude Code CLI.
api
api/constitution
Package constitution serves the M6 constitution CRUD endpoints.
Package constitution serves the M6 constitution CRUD endpoints.
api/memories
Package memories serves the M6 memories endpoints — a thin facade over bd's remember/recall/forget/memories primitives.
Package memories serves the M6 memories endpoints — a thin facade over bd's remember/recall/forget/memories primitives.
api/skills
Package skills serves the M6 skill-registry endpoints.
Package skills serves the M6 skill-registry endpoints.
config
Package config loads beads directory configuration and backend selection.
Package config loads beads directory configuration and backend selection.
orchestrator
Package orchestrator implements the run lifecycle: resolve repo → worktree → prompt → spawn transport → stream runlog → watch exit → transition bead.
Package orchestrator implements the run lifecycle: resolve repo → worktree → prompt → spawn transport → stream runlog → watch exit → transition bead.
shellquote
Package shellquote provides POSIX shell single-quoting for building sh -c command strings safely.
Package shellquote provides POSIX shell single-quoting for building sh -c command strings safely.
skills
Package skills is muster's skill registry: embedded read-only built-in skills plus user/URL-imported skills persisted as local markdown files under <musterDir>/skills/.
Package skills is muster's skill registry: embedded read-only built-in skills plus user/URL-imported skills persisted as local markdown files under <musterDir>/skills/.
store/bdshell
Package bdshell provides a typed wrapper around the bd CLI binary.
Package bdshell provides a typed wrapper around the bd CLI binary.
store/dolt
Package dolt implements a store.Backend that reads from a Dolt SQL server.
Package dolt implements a store.Backend that reads from a Dolt SQL server.
store/jsonl
Package jsonl implements a read-only store.Backend that reads from issues.jsonl.
Package jsonl implements a read-only store.Backend that reads from issues.jsonl.
tmux
Package tmux provides the canonical CLI-agent transport via tmux sessions.
Package tmux provides the canonical CLI-agent transport via tmux sessions.
worktree
Package worktree manages per-bead git worktrees.
Package worktree manages per-bead git worktrees.
ws
wt
Package wt provides a VCS-agnostic per-bead worktree abstraction.
Package wt provides a VCS-agnostic per-bead worktree abstraction.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL