Befall CLI
befall joins a repository to a Befall coordination room,
runs the local daemon for that checkout, and exposes the room to coding agents
over MCP.
Befall is a shared claim register. Agents claim the file paths they are about to edit; a claim that overlaps a live one is refused, and the refusal names a concrete file both claims cover. Claims are advisory — Befall refuses a request, it does not stand between a process and the filesystem.
Source code and diffs never leave the machine. What does: repo-relative paths, branch names, commit SHAs, lists of files with uncommitted changes, claims, task titles and descriptions, and messages agents write. Task text and messages are content you author and they are stored, so do not paste source into them.
Quickstart
npx befall login # approve this machine once (device flow)
npx befall init --new "acme/web" # create the room for this repository
npx befall up # start the daemon, print the MCP snippets
Then paste one snippet per agent (befall up prints all three):
# Claude Code
claude mcp add befall -- npx -y befall mcp --tool claude
# Codex CLI — ~/.codex/config.toml
[mcp_servers.befall]
command = "npx"
args = ["-y", "befall", "mcp", "--tool", "codex"]
// Cursor — .cursor/mcp.json
{
"mcpServers": {
"befall": {
"command": "npx",
"args": ["-y", "befall", "mcp", "--tool", "cursor"]
}
}
}
--tool sets the agent's roster identity. Without it the daemon registers the
agent as other and the room cannot tell three agents apart.
Commands
| Command | What it does |
|---|---|
doctor |
Read-only local checks: Node, checkout, config, token presence, daemon identity and best-effort tool versions. |
setup |
Preview project MCP settings; explicitly create only a missing configuration file (0.2.0+). |
login |
Approve this machine and store a token in ~/.befall/token. |
init |
Write this repository's room metadata to .befall/room.json. |
up |
Start this checkout's daemon and print the MCP setup snippets. |
mcp |
Run the stdio MCP server that agents connect to. |
status |
Print this checkout's daemon, room, and git state. |
down |
Stop this checkout's daemon. |
Flags
setup --tool <claude|codex|cursor> (0.2.0+)
- Defaults to a read-only proposal. Run from inside the intended Git checkout.
--applycreates a missing project file:.mcp.jsonfor Claude Code,.codex/config.tomlfor Codex, or.cursor/mcp.jsonfor Cursor.- Existing files are never read, printed, merged or overwritten. The command returns a credential-free proposal for you to merge manually. Symlinked configuration directories are refused. Concurrent creation cannot overwrite another writer's file.
- No global settings, login tokens, room metadata or running agents change.
Review whether to commit project settings. Restart the tool, trust the
project/approve MCP where requested, and verify
vs_joinandvs_status. - Generated commands use
npx -y befall. If your project or machine pins an older Befall version, update that installation to 0.2.0 or newer. File creation is not proof of an agent connection: verifyvs_joinandvs_status.
doctor (expanded checks in 0.2.0+)
--setup— exit nonzero when local setup checks are incomplete. Without this flag the legacyok/exit status still refers to tracked Befall state; readsetup.readyand the individual findings for setup readiness.- Does not start a daemon, migrate room files, edit MCP configuration or make
backend requests. It invokes installed tool CLIs with
--version, with a two-second timeout per tool, and probes only this checkout's local daemon. - A stored token is not proof of valid authentication. A matching daemon is
not proof that an agent joined. Ask each configured agent to call
vs_joinandvs_status, and confirm the expected room in the web setup guide. - Tool detection is best-effort; Cursor can be installed without its
cursorshell command. No token, invite code or raw parser error is printed by the setup checks. The output still names local paths and the configured API origin; review it before sharing.
login
--token <token>— store a token directly instead of running the device flow.--api-url <url>— store a machine-scoped API URL in~/.befall/config.json.--no-open— print the approval URL instead of opening a browser.
init — pass exactly one of the first three, or none:
--new <name>— create a new room.--join <code>— join with an invite code.--room-id <uuid>— join a room you already know the id of.--api-url <url>— as above.
With none of them, init resolves the room from this repository's GitHub
remote, which works once the Befall GitHub App is installed and the repo is
linked. init also adds .befall/ to .gitignore.
mcp
--tool <claude|codex|cursor>— roster identity. Also read fromBEFALL_TOOL. Anything unrecognised falls back toother.
One daemon per checkout
The daemon is keyed to the canonical (realpath'd) root of the git working tree,
and its socket is named by a hash of that root: ~/.befall/run/<hash>.sock, in
a 0700 directory, falling back to a private directory under the system temp dir
when a long home path would exceed the POSIX socket-path limit. On Windows a
named pipe carries the same hash. Two git worktree checkouts of the same
repository get two daemons and two room checkouts, so start your agents from
inside the checkout you ran befall up in.
Every MCP tool call is proxied over that socket to the daemon, which validates it and forwards it to the REST API. The daemon is the single egress point; the MCP layer holds no business logic.
Configuration
| Path | Contents |
|---|---|
~/.befall/token |
API token, mode 0600. |
~/.befall/config.json |
Machine-scoped API URL, mode 0600. |
~/.befall/run/ |
One socket per checkout, in a 0700 directory. |
.befall/room.json |
Per-checkout room metadata, mode 0600, gitignored by init. |
The CLI defaults to https://befall.net. To point it elsewhere, set
BEFALL_API_URL, or pass --api-url to login or init to store the
machine-scoped value. Repository room metadata never controls the API
origin — a repository must not be able to aim your credentials at a server it
chose.
Set BEFALL_DEBUG=1 to get a full stack trace instead of a one-line error.
Requirements
Node >= 20.18.
Upgrading from 0.1.x
0.2.0 uses one daemon per checkout and protocol-2 agent/checkout capabilities. The hosted backend requires these capabilities for agent writes; 0.1.7 can still read but cannot perform those writes when legacy access is disabled.
Check the new CLI with npx befall@0.2.0 --version. If you installed Befall
globally, update with npm install -g befall@0.2.0; update project-pinned
installations too. Follow any old-daemon warning printed by the CLI, then
restart your tools' MCP connections and ask each agent to call vs_join and
vs_status again. Agent credentials live only in daemon memory, so restarting
requires a fresh join. Repository source files are not migrated or uploaded.