Background Agents


Background Agents

My favourite thing about Github Agents is that they run in their own isolated containers and can scale infinitely.

Until recently I’ve felt a bit stuck with Claude Code. On one hand its the best code generator. On the other, it doesn’t scale well beyond one instance and I have to wait for it to complete, which sometimes can be quite a while.

Now I’ve figured out a way to work on multiple tickets at a time by running multiple instances of claude code. This is something they talk about in the docs, albeit a rather brief section called ”Run parallel Claude Code sessions with Git worktrees”. But in most applications there are external dependencies (like a database) that are shared across worktrees.

Short of dockerising everything including Claude (which I might attempt next) I decided to create a new database in the postgres cluster for each worktree.

This keeps things nice and isolated so I can run migrations and make database changes whilst running multiple parallel claude code instances.

Then when I’m finished I can open a pull request (every worktree has its own branch) and remove the git worktree.

There are a few drawbacks with this method though:

  • For one, the other resources the app connects to are still shared.
  • I need to remember to delete the databases when I remove the worktree (although I have a script for this).
  • It can take a while to create a new worktree as I need to install all the dependencies and compile each time.
  • Claude could still do crazy things that affect my system.

Running Claude Code in isolated containers is really the gold standard here, I could potentially pre-compile the dependencies, have a docker container with everything already setup, have no shared dependencies, and not worry about Claude going off the rails on my machine.

I’ll have a play and see how far I get that way.

113 Cherry St #92768, Seattle, WA 98104-2205
​Unsubscribe · Preferences​

Not a vibe coder

I'm sharing the exact methods I use as an AI engineer to build production systems - techniques so effective they work even in niche languages like Elixir. Get the complete playbook delivered to your inbox 👇

Read more from Not a vibe coder

Hooks Hooks are another feedback mechanism we can use in Claude code.They run arbitrary commands after certain lifecycle events.There’s one hook I lean on heavily “Stop”.It’s called when Claude has finished generating code. Which maps really nicely to my normal workflow where I would run commands like compile, lint, prettier, etc. to check the code is in a good state before continuing.These commands are generally fast to run and when they fail the error is fed back to the LLM and continue to...

Sub Agents I’ve been playing around with Claude Code sub-agents a lot recently and only just cracked how to get them working reliably. At first I thought they’d just work automatically. After all, the docs do say just prompt Claude with ALWAYS USE and it’ll magically select the right agent. But that never worked for me.Instead I found tagging the agent with @sub-agent-name forced Claude to select it. This feels a bit broken but I guess its messy tool selection and thats a tricky problem. I...