u/ImKarmaT

I kept losing hours to AI agents fighting over the same files, so I built a CLI to give each one its own workspace

For the last few months I've been using multiple AI coding agents at the same time -- Claude Code on one feature, Codex on another, sometimes Aider for a quick refactor. The promise is obvious: parallelize your work, ship faster.

The reality was me staring at a terminal at 11pm trying to untangle what happened when two agents both decided to rewrite the same utility file. One would finish, the other would finish on stale code, and git merge would hand me a pile of conflicts that neither agent understood. I'd spend more time cleaning up than I saved.

After the third time I lost an evening to this, I started building ruah.

The idea is dead simple: each task gets its own git worktree (so agents literally can't see each other's changes), and you declare which files each task owns up front. If two tasks claim the same file, ruah rejects it before anything runs. No more "I'll just be careful" -- the tool enforces the boundaries.

It also handles the merge sequencing. If task B depends on task A, ruah merges A first, then rebases B, then merges B. You describe the dependency graph in a markdown file and ruah executes it.

It works with any CLI agent -- Claude Code, Codex, Aider, Cursor, Windsurf, whatever. Zero runtime dependencies, MIT licensed, written in TypeScript.

I'm still actively working on it (v0.3.2 right now), so it's rough around some edges. But the core loop -- worktree isolation, file locking, DAG-based merge order -- has been solid for me.

What's the dumbest amount of time you've lost to a problem that should have been trivial? I need to feel less alone about my 11pm merge sessions.

reddit.com
u/ImKarmaT — 3 days ago
▲ 5 r/OpenAI+8 crossposts

[CLI] ruah — give each AI coding agent its own worktree so they never touch the same files

I kept running into the same problem: spin up two AI agents on the same repo and their edits collide within minutes. So I built a CLI that eliminates it structurally.

**What it does:**

Each task gets its own git worktree and branch. Files are locked before any agent starts. If two tasks claim overlapping files, the second one is rejected — no conflicts possible.

**Highlights:**```
agent 1 ──→ worktree A ──→ src/auth/**  locked
agent 2 ──→ worktree B ──→ src/ui/**    locked  ← no collisions
agent 3 ──→ worktree C ──→ tests/**     locked
```

- Worktree isolation per task (not docker, not temp dirs — actual git worktrees)
- Advisory file locks checked at task creation
- Markdown-defined DAG workflows — independent tasks run in parallel, dependent tasks wait
- Subagent spawning — a running agent can create child tasks that branch from
*its*
worktree
- Works with Claude Code, Aider, Codex, Cursor, Windsurf, or any CLI
- Zero runtime deps, MIT licensed, 152 tests

**3-second demo (creates a temp repo, shows everything, cleans up):**

Feedback welcome — especially on the lock model and whether the DAG workflow format makes sense.```bash
npx  demo
```
github.com
u/ImKarmaT — 3 days ago