Skip to content

Walkthrough: A Hundred Agent Sessions on One Box, Five Tips and Their Config

My coding agents do not run on my laptop. They run on one always-on Linux box, one tmux session per repo, as many as 170 at once, and I do not manage them by hand. These are the five tips from my KubeCon talk, each with the config that does it and what it looks like on the box.

A purple octopus in blue glasses hugs a glowing server box while its arms hold dozens of terminal windows, under the sea

The talk was "A Hundred Agent Sessions on One Box: Tips for Running Coding Agents Remotely", a tip talk in the Learning Lounge at KubeCon + CloudNativeCon North America in Salt Lake City on Wednesday, November 11. The deck is at https://tips.michaelrishiforrester.com, and every excerpt below is in https://github.com/peopleforrester/remote-agent-fleet-config, with a quickstart that goes from one empty Debian 13 server to tip 5 in about 30 minutes.

This is my personal system, my agentic software factory. I would rather you take the principles than adopt it. Building software for your own workflow is going to be far more valuable than adopting somebody else's.

The setup: terminals in front of you, agents on the box

Terminals on the desktop and laptops, one tab per session, connect over ssh to one always-on box. Inside the box: tmux with a session per repo, the agents inside (claude, codex, agy), and cron beside them

The desktop and the laptops are terminals. Each tab is one ssh connection into one tmux session on the box, and each tmux session belongs to one repo. The agents (Claude Code, Codex and the Antigravity CLI) run inside those sessions, and cron runs beside them. Close the lid and nothing on the box stops. My phone reaches the same sessions through Claude Code Remote Control.

The box peaked at 170 tmux sessions in mid-October and ran about 90 in early November. The count moves every day; the shape does not.

The tips run in the order I would pick for a fresh start. The first two do not touch a remote box at all.

1. Structure your work before you move it

The octopus files glowing scrolls into labeled jars and drawers on a wooden shelf

Whatever is broken in your structure and your workflow gets copied onto the box you move to, and just like in production, it will not scale.

I have a strategic repo that holds my goals, personal and professional. It asks me questions (are you writing a book this year? taking certifications?) and from the answers it creates coordinator repos, and under those the worker repos that do the work. CertKraken, my practice exam hobby, is one goal: a website, a practice app, an exam trainer and a mobile app. Replicate that twenty times and you have my system.

The structure is also what makes a hundred sessions reachable. Repos live in one tree on the box, a group and then the repo, ~/repos/<group>/<repo>, and a script turns that tree into one attach alias per repo:

    # Alias format: group-reponame [...]
    alias_name="${norm_group}-${norm_leaf}"

    # Session name matches alias name for simplicity
    session_name="${alias_name}"
[...]
    ALIASES+=("alias ${alias_name}='ncs ${session_name} ${repo_path}'")

Cron on each client reruns it every half hour, so a repo cloned in the morning has an alias by lunch:

*/30 * * * * /home/michael/scripts/sync-alpha-sessions.sh [...]

What it looks like. In the recording for this tip, asking the shell what one of the aliases is prints the same one-line shape, ncs, the session name and the repo's path. Running it attaches that repo's tmux session, with the agent's last answer still on the screen.

To adapt it:

  • Put your repos in one tree on the host, a group directory and then the repo.
  • Name the alias, the tmux session and the tab the same thing, so tab completion reads one list.
  • Drop a .no-terminal file in any directory to leave it off the list.

2. Master one workflow before you run many

The octopus inspects a glowing screen on a stone desk through a magnifying glass, a small shield beside it

Start with one goal, not twenty. That one goal is where you work out your safety hooks, your test coverage and your CI/CD pipeline. Do not do what I did, which was start complex.

There are three ways we use AI today: we use it to write code or documents, we use it to integrate with an existing website or service, or we use it to manage a system, Kubernetes or a network. Each needs its own hooks, tests and rules, so run one of each on its own first.

This is also where you decide when a human is in the loop. My rule: if it is going to spend money or publish to an audience, it talks to me first. I have let emails send once or twice, and I regretted it.

The guardrails are Claude Code hooks in ~/.claude/settings.json. A PreToolUse hook runs before every tool call and can block it; a Stop hook runs the tests at the end of each agent turn:

    "PreToolUse": [
      {
        "matcher": "",
[...]
            "command": "$HOME/.claude/hooks/safety-net.sh",
[...]
    "Stop": [
[...]
            "command": "$HOME/.claude/hooks/auto-test-on-stop.sh"

What it looks like. The recording for this tip runs one of those hooks, the one that keeps AI attribution out of commit messages. Fed the JSON an agent's tool call carries, it refuses the commit and exits 2, which is how a PreToolUse hook blocks the call:

# the agent's PreToolUse hook, before the command runs:
beta$ printf '%s' '{"tool_name":"Bash","tool_input":{"command":"git commit -m \"Add notes by Claude\""}}' | ~/.claude/hooks/check-commit-message.sh; echo "exit $?"
BLOCKED: Commit message contains AI/Claude reference: "Claude"
Rule: NEVER include references to Claude Code, Claude, or AI in commit messages.
Commit messages should be professional and describe the technical changes only.
Please rewrite the commit message without AI attribution.
exit 2

To adapt it:

  • Write the checks your own repos need. safety-net.sh refuses a recursive delete outside the working directory, a forced branch delete, a forced push and a hard reset.
  • An empty matcher runs the hook for every tool; Bash runs it for shell commands only.
  • Where a command-line tool exists, prefer it to an MCP server. Each session starts its own copy of every stdio MCP server it is configured with, so a hundred sessions run a hundred copies.

3. Move to one always-on box

The octopus balances a glowing server cube on an open laptop while a closed laptop sleeps above it and an old laptop and a small board wait on the sea floor

I am a big proponent of not running coding agents on end-user devices, especially in an enterprise. If you have a leftover personal access token somewhere on that file system, I promise you the agent is going to find it. Then you are asking how it archived a GitHub repo it had no permission to touch, and the answer is a token from a year ago that it found in your SSH directory. It was trying to make you happy.

Security is the first reason. The second is the lid: once the agents are on another box, closing your laptop does not kill anything. The third is performance. Run 170 sessions on the laptop you read your email on and it chokes.

The box does not have to be a new server. An old laptop on your home network is enough. Give it the code and narrowly scoped tokens, not your browser sessions and saved logins, and put it on a private network such as Tailscale.

Once every screen is a thin client, one thing gets in the way: you attach from a big desktop monitor, then from a laptop, and the window keeps the other screen's size. Four lines of ~/.tmux.conf on the box make tmux follow the screen in front of you:

set -g window-size latest
set -g aggressive-resize on
[...]
set-hook -g client-attached "resize-window -A"
[...]
set-hook -g client-resized "resize-window -A"

What it looks like. The recording for this tip puts the laptop and the desktop side by side on the same session. When the desktop attaches, the agent's output reflows to the desktop's window, and the laptop's tab says [ncs] detached cleanly. Press Enter to re-attach, Ctrl-C to exit. and waits.

To adapt it:

  • Reload with tmux source-file ~/.tmux.conf. The lines were checked on tmux 3.5a.
  • Keep both hooks. resize-window switches the window to a manual size, so with only the attach hook a window stays at the size it had on attach.

4. Automate your connections

The octopus plugs cables from laptops and monitors into one server tower, one plug sparking

I got tired of typing ssh every time I opened the lid and finding 150 sessions waiting for the same commands again. Some of you do this in production. It never occurred to me to do it with my personal system, and I highly recommend it.

Each tab runs ncs, a small loop around plain ssh -t and tmux new-session -A -D. -A attaches the session if it exists and creates it if it does not, and -D detaches every other client, so whichever machine you sit down at wins. The loop branches on ssh's exit status:

    while true; do
        ssh "${ssh_opts[@]}" -t alpha "[...]tmux new-session -A -D -s ${session} -c \"${repo_path}\""
        local rc=$?
        case $rc in
[...]
            0)
                echo
                echo "[ncs] detached cleanly. Press Enter to re-attach, Ctrl-C to exit."
                read -r
                ;;
[...]
            255)
[...]
                    echo "[ncs] connection lost (network/ssh). Reconnecting in 5s... (Ctrl-C to abort)"
                    sleep 5

Exit 0 is a detach, yours or another machine taking over, and the loop waits for Enter instead of grabbing the session back. Exit 255 is ssh itself failing, a dropped link, and it retries after five seconds. autossh reads a 0 exit as done and quits, so the machine that lost the session would find its tab gone. Two lines in ~/.ssh/config make a silent dead link show up as a 255 within 90 to 120 seconds:

Host alpha
[...]
  ServerAliveInterval 30
  ServerAliveCountMax 3

I also have a close and restore command that shuts every terminal window and reopens them by group: all the book sessions together, all the CertKraken ones together. The same tree walk that writes the aliases writes restore-workflow.ps1 for Windows Terminal, one window per group with one tab per repo, and each tab runs ncs, so it comes back attached to its running session.

What it looks like. In the recording for this tip, the desktop holds a session and the laptop runs the same alias. The laptop takes the session with the agent's answer on screen, and the desktop prints the 0 branch's line and waits for Enter. Neither machine fights the other for it.

To adapt it:

  • alpha is the host's alias in ~/.ssh/config; use yours.
  • autossh is still right for a single catch-all session where nothing competes for it.
  • On another terminal, keep the idea: generate one tab per session from the same list, and make each tab run ncs.

5. Grow into a dispatcher

The octopus sips from a mug in an open shell while a server turns gears and a clock on its own, a plane passing overhead

If the box never sleeps, the schedule belongs on the box, not on a laptop in an overhead bin. My first agentic loop was cron. Every morning the agent transcripts are archived, idle sessions are stopped after that, and once a month a headless agent run refreshes my notes:

# Daily durable snapshot of ~/.claude/projects (Anthropic prunes it)
30 4 * * * /home/michael/scripts/claude-session-snapshot.sh [...]
[...]
# Stop agent sessions idle >4d [...] Runs after the 4:30 snapshot so transcripts are archived first.
[...]
0 5 * * * [...] ${R1}/scripts/root-tools/reaper.py [...]
[...]
# [...] monthly workflow refresh [...]
# claude -p with a $25 cap and 60 min timeout; commits to staging, exits 1 without committing on any failure.
0 6 1 * * [...] uv run wk refresh [...]

What it looks like. The recording for this tip reads the snapshot's log on the box. Every morning of the week before the talk, the snapshot committed and pushed between 4:30 and 4:37:

alpha$ grep -E 'committed$|pushed to origin$' ~/.local/log/claude-session-snapshot.log | tail -14
[...]
2026-11-06T04:34:21+01:00 committed
2026-11-06T04:35:11+01:00 pushed to origin
2026-11-07T04:33:39+01:00 committed
2026-11-07T04:34:03+01:00 pushed to origin
2026-11-08T04:35:17+01:00 committed
2026-11-08T04:37:05+01:00 pushed to origin

Then I stopped cycling through sessions by hand, telling each one what to do and letting it run for a couple of hours. My specs and tasks are GitHub issues in each repo, and a dispatcher, Hecaton, reads them and starts headless Claude Code sessions that work each issue and come back with a result. The result has to pass the tests and a set of reviewers (security, architecture, prose) before the merge. When a piece of work keeps failing, the dispatcher widens the tests, then moves to a stronger model. That came to more than 4,500 merged results in 23 days, October 14 to November 5.

My repos are tiered: tier one is worked whenever it has an issue, tier two only when tier one is empty, and tiers three and four only on my request. When I open a repo by hand, the first thing I tell the session is to tell Hecaton I am in there, and Hecaton leaves that repo's issues alone until I leave the repo.

To adapt it:

  • Archive first, then anything that removes: the snapshot runs at 4:30 and the reaper at 5:00.
  • Keep the transcript archive private. It holds everything the agents saw.
  • Treat --max-budget-usd as a tripwire, not a limit. It stops the run once the CLI's own estimate reaches the cap, after the step that crossed it, so set a hard spending limit on the account as well.

When not to do this yet

I started on one desktop with the agents running locally, and that is where I would start you. Do not move anything to a box until one goal's workflow works where you sit, with its hooks, tests and human checkpoints. I started complex, on Kubernetes, and that was a mistake; I backed off to one box. Distribute only once you have a dispatcher.

And if you run a company, the answer is not an old laptop in someone's house. Get agents off end-user desktops and run Claude Code, Codex and Antigravity as a service.

Start with one goal and the quickstart

Pick one goal, give it a knowledge repo and a few worker repos, and get one workflow passing its hooks and tests with a human in the loop for money and audiences. Then add the box, the connections and the dispatcher, in that order.

The configs are at https://github.com/peopleforrester/remote-agent-fleet-config, its quickstart builds tips 1 to 5 on an empty Debian 13 server, and the deck is at https://tips.michaelrishiforrester.com/deck/.