lockage
日本語版: README_ja.md
An MCP server that lets multiple code-development LLMs (Kiro, Claude Code, and others) collaborate on development centered on a local git repository.
When you run several agents on the same repository at once, you normally hit problems: "two agents write the same file and break it," "nobody knows who is touching what," and "integration (merging) turns into chaos." lockage solves this by combining physical isolation via git worktree with a lightweight coordination layer on top of SQLite.
It is a tool aimed at collaboration on a single host (one personal machine).
This document is for people getting started with lockage. For a diagrammed picture of the whole system and how agents exchange messages, see docs/overview.md. For how to develop, build, and test lockage itself, see docs/development.md; for the operational details of publishing PRs (lockage-publish), see docs/publishing.md; for releasing the npm package, see docs/releasing.md.
What makes it distinctive
-
Two layers: physical isolation (worktree) + logical visibility (claim / dirty set)
Each agent is physically separated by a git worktree, which makes it impossible for two agents to write the same file at the same time. On top of that sits an advisory coordination layer where agents declare "who is responsible for what." The coordination layer only warns; it never blocks (warn-never-block). No hard lock that could cause deadlock is used.
-
Atomic task claim (CAS)
A task claim is serialized with SQLite's BEGIN IMMEDIATE + version CAS, mechanically preventing two agents from taking the same task (the later one receives conflict and is not blocked).
-
Integration merge gate
The path that integrates worktree results is serialized through a single gate. A task under a ticket, regardless of how many tasks there are (even just one), goes through the serial merge gate (1-B) and is aggregated into the ticket integration branch lockage/ticket/<short-id>. Only a minor task with no parent ticket (a task not linked to a ticket) that has no divergence is merged straight into the base branch on the spot (1-C) (if there is divergence or a conflict candidate, it also goes through the serial gate 1-B). Conflict candidates are detected by a 3-way pre-check and sent back without auto-resolving, leaving the decision to a human or the assignee.
-
A2A wake eliminates polling
Events such as another agent stepping into your area, a dependency task completing, or a message addressed to you — all of these can be awaited with a single wait_for_unblock long-poll. The agent no longer needs to busy-poll.
Board posts are tracked per agent as read / unread, so a post that arrives while you are working (not waiting) is not lost: the next wait_for_unblock wakes on it, and heartbeat reports the unread count while you work.
-
SQLite is the single source of truth for state
The source of truth for state such as tasks, claims, worktrees, and the board is SQLite. The default location is ~/.lockage/lockage.sqlite in the home directory (changeable via LOCKAGE_DB).
lockage is an MCP server that provides atomic claim, dependency DAG, ticket management, worktree physical isolation, advisory claim/dirty set, integration merge gate, board/A2A wake, and the blocked-interrupt lifecycle.
Requirements
- Node.js 22.5 or later (SQLite uses Node's built-in
node:sqlite, so no native build or extra DB is needed)
- git (used for worktree / merge operations)
Setup
Setup is per client: install the lockage plugin / Power for the client you use. Each plugin bundles both the coordination rules (AGENTS.md and the lockage-workflow skill) and the lockage MCP server definition (npx -y lockage@<version>, pinned to the exact package version), so a single install lines up the two prerequisites for multi-agent coordination — the server and the rules — in one step. No clone or npm run build is needed (the first run may take a little time to fetch).
For the detailed install procedure of each client, see plugins/README.md. The MCP server registration details (changing the ledger location via LOCKAGE_DB, the maintenance tool set, removing a hand registration) are collected in docs/mcp-registration.md.
After installing, distribute the coordination rules as the next section describes — for Claude Code and Antigravity this is covered by the plugin install itself; for environments that cannot use a plugin / Power, see "Distributing the coordination rules".
Kiro Powers