What it does
Agent Lease gives coding agents leases on paths, a presence view of who is active in the repository, and a shared message log. A PreToolUse hook enforces the leases, so an agent trying to edit a file that another agent holds is refused before the edit happens. Leases expire after 30 minutes, claims on several paths succeed completely or not at all, and a lease on a directory covers everything beneath it. Free files are claimed automatically on the first edit, and a running script is leased for the length of its run.
It suits two agents, or two sessions of one agent, working in the same repository. The publisher describes a case where one agent edited a deploy script while another was running it, which produced a broken build. Agents can reserve paths with claim, release them, check ownership with owner, and read the room state and messages. A CLI offers the same operations for Codex in non-interactive mode, which cannot approve MCP calls.
Setup involves registering hooks for session start, prompt submission, tool use and session stop. For Claude Code, an init option adds a hook that wakes an idle session when an addressed message arrives. For Codex, a wake service nudges a named session, which requires renaming the session, setting an environment variable and enabling a systemd unit. An optional local web room runs on loopback only.
Limitations and requirements
Coordination fails open by default, so broken coordination does not stop work; setting AGENT_LEASE_FAIL_CLOSED=1 changes this for unattended runs. Enforcement depends on Claude Code or Codex PreToolUse hooks. Codex waking requires a named session, an environment file and a systemd service. Messages are pulled when an agent next reads them, so it is not a live chat. The web room is loopback only. The publisher states that production activation and independent review of the Quality Gate are pending, and that the dashboard alone does not enforce merges.
Safety
Our team has not reviewed this resource. Only automated rules checked it; resources with high-risk signals are not published. These are signals, not a guarantee that installing it is safe. Try it in a sandbox project first.
- Runs code or changes an assistant's behaviour
Sources
- Official MCP Registry first seen 13 Nov 2026 · last seen 13 Nov 2026 · its page on the source
Agent Lease
Keep Claude Code and Codex off each other's files: hook-enforced path leases, presence, messages.
v0.2.0As shown on registry.modelcontextprotocol.io when we last read it