r/ClaudeCode • u/RasifoX • 23m ago
Built with Claude I kept losing edits when 2+ Claude Code agents touched the same file, so I built agentlanes
I run several Claude Code agents in parallel on one machine (an 8 GB Raspberry Pi running ~35 services). Three things kept breaking: two agents edited the same file and one silently lost its work, two started heavy builds at once and ran the box out of memory, and I couldn't tell who changed what.
So I wrote agentlanes:
agentlanes claim TASK --paths src/auth/: a lease on files; a PreToolUse hook refuses other agents' edits (it stopped a real Claude Code session even with permissions bypassed)agentlanes slot build 1 -- make: a memory-capped job queueagentlanes lane new auth: a git worktree + branch per agentagentlanes run -- claude: on Linux the agent can only write inside its lane, enforced by the kernel (Landlock, no root)- MCP server + Claude Code plugin:
/plugin marketplace add metastazorg/agentlanes
pip install agentlanes-cli. Stdlib only, no daemon, Apache-2.0. https://github.com/metastazorg/agentlanes
How I built it: mostly with Claude Code itself. Several agents worked on it in parallel, which is exactly how the bugs above showed up, so every feature came from a real collision we hit. Lessons: advisory locks aren't enough (an agent that runs sed -i walks right past them), so the hook + kernel lane layer was the part that actually fixed it; and leases must die with the process, or a crashed agent blocks everyone.
Would love feedback, especially if you run 3+ agents at once.
•
u/AutoModerator 23m ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Independent-Sir3234 11m ago
Kernel-level Landlock rules close the exact gap that hooks miss, since a raw bash command can still write outside the target directory even when edit tools are guarded. On an 8 GB Pi, a memory-capped build queue also keeps the OOM killer from taking out active sessions mid-edit.
What happens to a claimed path lease if a Claude Code session crashes before releasing it?