Skip to content

anoopkansupada/lacp-cli

Repository files navigation

LACP - Local AI Coordination Protocol

npm version License: MIT

Universal multi-LLM coordination for shared codebases

LACP enables multiple AI assistants (Claude Code, Gemini, GPT, etc.) to work on the same codebase without conflicts. It uses file-based communication that any LLM can read and write.

Why LACP?

🤖 Multi-Agent Development: Coordinate Claude, Gemini, GPT, and other LLMs on the same project 🔒 Conflict Prevention: File claims ensure agents don't overwrite each other's work 📝 Context Sharing: Activity logs keep all agents informed about what's been done 🤝 Work Delegation: Handoffs enable agents to request help from each other's specialties 📂 No Special Infrastructure: Works through simple JSON files - no servers, no APIs

The Problem LACP Solves

Without LACP:

❌ Claude edits auth.ts while Gemini is also modifying it → merge conflict
❌ GPT finishes a feature but Claude doesn't know → duplicated work
❌ No context about what was done → confusion and wasted effort

With LACP:

✅ Claude claims auth.ts → Gemini sees it's claimed and works on UI instead
✅ Activity log shows completed work → everyone stays in sync
✅ Handoffs provide clear context → seamless collaboration

Installation

npm install -g lacp

Or use locally in a project:

npm install lacp
npx lacp init

Quick Start

Initialize in your project

cd your-project
lacp init

This creates:

  • .lacp/ - Coordination files (tracked in git)
  • .lacp-state/ - Ephemeral state (gitignored)

Basic workflow

# Before starting work
lacp claim "src/auth/*" --agent claude-cursor --task "Implement OAuth"

# Check coordination status
lacp status

# When done
lacp done "src/auth/*" --agent claude-cursor --summary "OAuth implemented with Google provider"

# Request another agent's help
lacp handoff create --from claude-cursor --to gemini-antigravity --task "Review OAuth UI"

Commands

lacp init

Initialize LACP in the current project.

lacp init
lacp init --force  # Reinitialize

lacp status

Show current coordination state: active claims, online agents, pending handoffs.

lacp status
lacp status --json         # JSON output for programmatic use
lacp status --agent claude-cursor  # Agent-specific view

lacp claim <scope>

Claim files before modifying them. Prevents conflicts with other agents.

lacp claim "src/auth/*" --agent claude-cursor --task "Implement OAuth"
lacp claim "*.test.ts" --agent claude-cursor --task "Fix tests" --duration 30

lacp release [scope]

Release claims when work is complete.

lacp release "src/auth/*" --agent claude-cursor
lacp release --agent claude-cursor --all  # Release all claims

lacp handoff

Create and manage work handoffs between agents.

# Create a handoff
lacp handoff create \
  --from claude-cursor \
  --to gemini-antigravity \
  --task "Review and improve UI styling" \
  --context "OAuth flow is working, needs visual polish" \
  --files "src/auth/LoginForm.tsx,src/auth/styles.css"

# List pending handoffs
lacp handoff list
lacp handoff list --agent gemini-antigravity  # For specific agent

# Accept a handoff
lacp handoff accept <handoff-id> --agent gemini-antigravity

# Complete a handoff
lacp handoff complete <handoff-id>

lacp log

View and add activity log entries.

# View recent activity
lacp log view
lacp log view --count 50
lacp log view --agent claude-cursor

# Add log entries
lacp log add --agent claude-cursor --action start --scope "src/*" --task "Refactoring"
lacp log add --agent claude-cursor --action complete --scope "src/*" --summary "Refactored auth"
lacp log add --agent claude-cursor --action note --summary "Found potential bug in validation"

Shorthand Commands

# Start work (claim + log)
lacp start "src/auth/*" --agent claude-cursor --task "OAuth implementation"

# Finish work (log complete + release)
lacp done "src/auth/*" --agent claude-cursor --summary "OAuth completed"

lacp cleanup

Remove expired claims and stale agents.

# Remove expired claims
lacp cleanup

# Remove stale agents (inactive >30 minutes)
lacp cleanup --stale 30m

# Preview without making changes
lacp cleanup --stale 1h --dry-run

lacp watch

Watch mode for long-running agents: auto-heartbeat and surface relevant handoffs.

# Start watch mode for your agent
lacp watch --agent jeeves-openclaw

# Custom heartbeat interval (default: 30s)
lacp watch --agent claude-cursor --interval 60

lacp install-hooks

Install git pre-commit hook that warns when committing files claimed by other agents.

# Install the hook
lacp install-hooks

# Overwrite existing hook
lacp install-hooks --force

File Structure

project/
├── .lacp/                    # Tracked in git
│   ├── PROTOCOL.md           # Protocol specification
│   ├── claims.json           # Current file claims
│   ├── activity.jsonl        # Activity log (append-only)
│   ├── handoffs/             # Handoff requests
│   │   └── {id}.json
│   └── instructions/         # LLM-specific instructions
│       └── template.md
└── .lacp-state/              # Gitignored
    └── agents/               # Agent presence/heartbeat
        └── {agent-id}.json

For LLM Integration

Adding LACP to Claude Code

Add to your CLAUDE.md:

## Multi-LLM Coordination (LACP)

Before modifying files:
1. Read `.lacp/claims.json` - Check for conflicts
2. Claim files before modifying
3. Log activity in `.lacp/activity.jsonl`

Your Agent ID: `claude-cursor`

Adding LACP to Other LLMs

  1. Copy .lacp/instructions/template.md to your LLM's instruction file
  2. Replace {AGENT_ID} with your agent's ID
  3. Follow the protocol in .lacp/PROTOCOL.md

Agent ID Convention

Format: {llm}-{ide}

Examples:

  • claude-cursor - Claude Code in Cursor
  • gemini-antigravity - Gemini in Antigravity
  • gpt-vscode - GPT in VS Code
  • claude-terminal - Claude Code in terminal

How It Works

  1. Claims prevent conflicts: Agents must claim files before modifying
  2. Activity log provides context: All significant actions are logged
  3. Handoffs enable delegation: Agents can request work from each other
  4. Files are the universal interface: Any LLM that can read/write files can participate

Conflict Resolution

First-Write-Wins Policy: When two agents race to claim the same files, the first to write claims.json wins. The second agent will detect the conflict and must wait for release or work on different files.

Claim Timeouts: All claims expire after a timeout (default: 60 minutes). This prevents crashed agents from blocking files indefinitely. Use lacp cleanup to remove expired claims.

Stale Agents: Agents inactive for >15 minutes are considered offline. Use lacp cleanup --stale 30m to remove stale agent presence files.

Real-World Example

Check out examples/simple-coordination/ for a complete walkthrough of Claude and Gemini coordinating on an authentication feature.

Use Cases

  • Feature Development: Backend agent builds API, frontend agent builds UI
  • Code Reviews: Security agent audits auth code, performance agent checks queries
  • Debugging: Multiple agents investigate different hypotheses in parallel
  • Refactoring: One agent updates types, another updates implementations
  • Cross-Platform: iOS agent works on Swift, web agent works on TypeScript

Contributing

See CONTRIBUTING.md for development setup and guidelines.

Related Projects

License

MIT - See LICENSE for details.


Built for the OpenClaw community 🐾

Share your multi-LLM coordination stories! Open an issue or PR to showcase your setup.

About

Local AI Coordination Protocol - Multi-LLM coordination for shared codebases

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors