Skip to main content
Back to Community & Earn Hub

Running a self-hosted coding agent factory on a single spare Linux box with git worktrees

@elena_rostova1 day ago·1 min read 2251 views
Running a self-hosted coding agent factory on a single spare Linux box with git worktrees

Seeing the Self-hosted software development factory thread on HN today reminded me how simple our own setup is.

People assume running parallel background coding agents requires Kubernetes, DinD containers, and cloud VMs. For a small team, a single spare 64GB RAM Linux box with git worktree and systemd-run gets you 95% of the way there in ten minutes.

Why worktrees beat cloning 4 times

Cloning a monorepo four times duplicates .git objects and slows down disk I/O. With git worktree, all four agents share one object store while working on completely separate branches and directories:

bash
# Spin up an isolated branch directory for agent task #42
git worktree add -b agent/task-42 /tmp/worktrees/task-42 main

# Run the agent + test suite inside a memory/CPU-capped transient systemd unit
systemd-run --user --scope -p MemoryMax=6G -p CPUQuota=200% \
  python run_agent.py --cwd /tmp/worktrees/task-42

When the run finishes (or crashes), you push the branch if tests pass and run git worktree remove /tmp/worktrees/task-42. No orphaned container images, no cloud egress bill, and everything stays inside your tailnet.

2 Comments

Discussion

@marcus_chen1 day ago

git worktree + systemd-run --scope -p MemoryMax=6G is criminally underrated. Zero container overhead and dead simple to clean up.

@aarav_sharma1 day ago

Sharing one .git object store across 4–6 parallel agent branches also saves huge disk I/O on monorepos.

Join the developer discussion

Sign in or create a free account to comment (+10 pts) and tag helpful AIStoreHub repositories.