Developers
Build on Branchlane
Connect coding agents and your own tools through a local MCP server, and read what Branchlane keeps in the repository. No cloud API, no account.
Updated November 23, 2026 for Branchlane 2.3
What you can build
Branchlane has no cloud API. Everything a tool can reach runs on the same Mac, or lives in the repository where any tool can read it:
- A local MCP server for agents. Coding agents and your own tools start lanes, save checkpoints, record test evidence and ask for review. Connect
- Plain files and Git refs. A policy file, Agent Trace notes, commit trailers and a summary of every worktree, all readable without Branchlane running. Policy, attribution
- Your own AI and MCP servers. Point Branchlane at any OpenAI-compatible model server, and let its assistant call your MCP server over HTTP. Extend Branchlane
The lane server needs Branchlane Pro and runs only while Let agents connect is on in Settings > Agents. Branchlane has no URL scheme, App Intents or AppleScript dictionary.
Connect an agent
Open Settings > Agents, turn on Let agents connect, and copy the line for your agent. It already holds your port and token. Branchlane never writes these files for you.
Claude Code
Run once in Terminal:
claude mcp add --transport http branchlane http://127.0.0.1:47120/mcp --header "Authorization: Bearer <token>"
Codex
Add to ~/.codex/config.toml:
[mcp_servers.branchlane]
url = "http://127.0.0.1:47120/mcp"
http_headers = { Authorization = "Bearer <token>" }
Any other MCP client
Use the Streamable HTTP transport with the endpoint http://127.0.0.1:47120/mcp and the header Authorization: Bearer <token>. The port can be changed in Settings. To try it by hand:
curl -s http://127.0.0.1:47120/mcp \
-H "Authorization: Bearer $BRANCHLANE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"my-tool","version":"1.0"}}}'
curl -s http://127.0.0.1:47120/mcp \
-H "Authorization: Bearer $BRANCHLANE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"lane_begin","arguments":{"path":"/Users/me/src/app","intent":"Retry sync with backoff when the server is busy","agent":"my-tool/model-x","scope":["Sources/Sync/"]}}}'
Every tool returns its result as a JSON string inside a text item:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"content": [{ "type": "text", "text": "{\n \"branch\" : \"lane/retry-sync-with-backoff-a7f4\",\n \"lane_id\" : \"a7f460dc\", ... }" }],
"isError": false
}
}
Protocol details
- Address: IPv4 loopback only,
127.0.0.1. Nothing listens on other interfaces or on::1. Default port 47120. - Transport: HTTP/1.1, one request per connection. Only
POST /mcpis served; other methods get 405. There is no SSE stream, so every answer comes back on the POST. Notifications get 202 with an empty body. - Body: send
Content-Length. Chunked bodies get 411. Bodies up to 4 MiB, headers up to 64 KiB. - Auth:
Authorization: Bearer <token>, a 64-character hex token kept in the Keychain. New Token in Settings replaces it. Missing or wrong tokens get 401. - Origin: a request with an
Originheader that is notlocalhost,127.0.0.1or::1gets 403, so web pages cannot call the server. - MCP: protocol versions
2025-06-18,2025-03-26and2024-11-05. Methodsinitialize,ping,tools/listandtools/call, and JSON-RPC batches. Tools only: no resources or prompts. - Repositories: the sandboxed app can only open repositories the person has opened in Branchlane. Otherwise the tool answers with an error that says so.
Tools
Every tool takes path, your working directory: the repository, or the lane's worktree. lane_id can be left out when path is inside the lane's worktree. Only lane_status is read-only.
| Tool | Arguments (bold is required) | What it does |
|---|---|---|
lane_begin | path, intent, agent, scope[], target, clone[] | Starts a lane: a branch lane/<slug>-<id> and a worktree under .branchlane/lanes/<id>. Returns lane_id, worktree, branch, target. Work only in that worktree afterwards. clone copies ignored folders such as node_modules or .build. |
lane_status | path, lane_id | Read-only. Status, whether recorded evidence still matches the code, review feedback, files and hunks the person left out, and collisions with other worktrees or the target, with line ranges and which side should go first. |
lane_checkpoint | path, lane_id, note | Snapshots the worktree, uncommitted changes included, without staging or committing. |
lane_evidence | path, lane_id, command, exit_code, output | Records that a command ran on the current content and how it ended. Valid only while the content stays exactly the same, so call it after your last edit. Only the end of output is kept, with secrets masked. Returns evidence_id. |
lane_propose | path, lane_id, summary, claims[{text, evidence[]}] | Asks the person to review the lane as it is now. Claims without current evidence are flagged. |
lane_request | path, lane_id, action: push | force_push | rewrite_history, reason | Asks to push, force-push or rewrite history. The policy decides, and some requests wait up to two minutes for the person. An approved push runs with the person's credentials. |
A proposal with claims tied to evidence:
{"name": "lane_propose", "arguments": {
"path": "/Users/me/src/app/.branchlane/lanes/a7f460dc",
"summary": "Pushes are retried with exponential backoff and jitter. Six attempts at most.",
"claims": [
{ "text": "A busy server is tried again, up to six times", "evidence": [1] },
{ "text": "The library file format is unchanged" }
]
}}
Lane flow and states
lane_begin, then work only inside the returned worktree. Commit there as you like: Branchlane snapshots uncommitted work too.lane_statusbefore you start and before you propose. It tells you which files other agents are touching.lane_checkpointwhenever you like. The checkpoint hook also saves one at the end of every turn.lane_evidenceafter your last edit, for each test, build or lint run. Keep the returned ids.lane_proposewith a summary and claims that cite those ids.lane_statuslater, for review feedback, left-out files and hunks, and notes.
| Value | In the app | When |
|---|---|---|
running | Working | lane_begin, or returned by the person |
proposed | Ready for Review | lane_propose |
accepted | In Queue | The person accepted it; requireEvidence must pass |
needsUpdate | Needs Update | The target moved and the work no longer applies. Rebase onto the target and propose again. |
integrated | Integrated | Landed on the target in one commit |
reverted | Reverted | Taken back out with one commit |
abandoned | Abandoned | Cleaned up without integrating |
Checkpoint hook
POST /hook/checkpoint takes the hook JSON that Claude Code sends and reads its cwd. If that folder is inside a lane worktree, Branchlane saves a checkpoint and answers {"checkpoint":true}; anywhere else it answers false and does nothing. Merge this into .claude/settings.local.json:
{
"hooks": {
"Stop": [{ "hooks": [{
"type": "command",
"command": "curl -s -m 5 -X POST -H 'Authorization: Bearer <token>' -H 'Content-Type: application/json' --data-binary @- http://127.0.0.1:47120/hook/checkpoint >/dev/null 2>&1 || true"
}] }]
}
}
The command fails quietly when Branchlane is not running, so the agent is never blocked.
Policy file
.branchlane/policy.json in the main worktree tells Branchlane, and the agents it serves, what is allowed. Commit it so the whole team shares it. Settings > Agents can create it with these defaults:
{
"forbid": ["force_push", "rewrite_history"],
"protectedBranches": ["main", "master"],
"protectedPaths": [],
"requireApproval": ["push"],
"requireEvidence": [],
"sensitivePaths": []
}
- Actions are
push,force_push,rewrite_historyandintegrate. - Decision order: a forbidden action is denied. On a protected branch, force-push and rewrite are denied and the rest go to the person. Otherwise actions in
requireApprovalgo to the person and the rest are allowed. - requireEvidence lists command prefixes, such as
swift test, that must have passed on exactly the proposed content before a lane can be accepted. - protectedPaths need an explicit yes for each file in review. sensitivePaths are shown first, on top of built-in ones such as migrations, auth code, CI workflows, lock files and
.envfiles. - Patterns follow
.gitignorerules. Keys are camelCase. A file that does not parse falls back to the defaults and the error shows in Settings.
Settings > Agents also turns the policy into Claude Code permissions.deny rules, so Claude Code itself refuses what the policy forbids.
Agent attribution
Branchlane marks agent work in the graph and blame for everyone, Free included. Your tool can feed it in three ways.
Commit trailers
An Agent: trailer wins. Otherwise Branchlane looks at Co-authored-by:, then at the author and committer, for known agent identities such as noreply@anthropic.com, Codex, Copilot, Cursor, Gemini, Devin, Jules and aider. Integration commits that Branchlane makes carry:
Lane: a7f460dc
Change-Id: I3c1f…
Agent: claude-code/claude-opus-5-5
Agent Trace notes
Line-level records live as git notes on refs/notes/agent-trace, one note per commit, in the Agent Trace format (version 0.1.0, application/vnd.agent-trace.record+json). A note may hold one record, an array, or one per line. Records from other tools on the same commit are kept. Blame shows the lines AI wrote.
{
"version": "0.1.0",
"id": "…",
"timestamp": "2026-11-23T02:09:00.000Z",
"vcs": { "type": "git", "revision": "<commit>" },
"tool": { "name": "claude-code" },
"files": [{
"path": "Sources/Sync/RetryingSyncEngine.swift",
"conversations": [{
"contributor": { "type": "ai", "model_id": "claude-opus-5-5" },
"ranges": [{ "start_line": 12, "end_line": 48 }]
}]
}],
"metadata": { "com.bbdyno.branchlane": { "written_by": "Branchlane", "lane": "a7f460dc" } }
}
Notes travel with refs/notes/agent-trace:refs/notes/agent-trace when you share lanes.
Lane records
Lanes are stored as Git refs under refs/branchlane/lanes/<id>/ (state, checkpoints, proposal). The state commits hold a lane.json. Teammates' lanes are fetched to refs/branchlane/shared/<remote>/<id>/. Treat these as read-only.
Worktree summary
When a repository has more than one worktree and the person has Pro, Branchlane keeps <git common dir>/branchlane/worktrees.json up to date, at least once a minute. Agents that do not speak MCP can read it instead of running git status in every worktree. It is removed when only one worktree is left.
{
"version": 1,
"about": "…",
"generatedAt": "2026-11-23T02:09:00Z",
"target": "refs/heads/main",
"worktrees": [
{ "path": "…", "branch": "lane/retry-sync-a7f4", "head": "…",
"access": "readable", "uncommittedFiles": ["Sources/Sync/SyncEngine.swift"], "lastChange": "…" }
],
"collisions": [
{ "between": ["…", "…"], "conflicts": false, "sameFiles": ["Sources/Sync/SyncEngine.swift"],
"conflictLines": { "Sources/Sync/SyncEngine.swift": [["40-60", "41"]] } }
]
}
Extend Branchlane
Your own model server
Settings > Assistant accepts any OpenAI-compatible server. Branchlane calls POST {base}/chat/completions with stream: true and reads server-sent events or a plain JSON reply, and uses GET {base}/models to test the connection. Without a path it adds /v1, so Ollama (http://localhost:11434) and LM Studio (http://localhost:1234) work as they are. A key is never sent over plain HTTP to another machine.
Repository data is wrapped between random BEGIN data-… and END data-… markers, and the model is told that what is inside is data, not instructions.
Your own MCP server for the assistant
The assistant can call tools on MCP servers that the person adds in Settings > Assistant. Serve the Streamable HTTP transport (protocol 2025-06-18) over HTTPS, or over HTTP on localhost. Branchlane sends MCP-Protocol-Version, keeps Mcp-Session-Id, and can add a Bearer token. Stdio servers cannot be started from the App Sandbox.
Questions and requests
Ask on the support page. Integrations that need something not listed here are welcome as feature requests.