Teardown

How I run my own agent system

I started building my own agent system in February 2026. I call it Nerve Center. It has run on a schedule since April 2026, and I've built 100+ agents for it. It drafts my email and writes a lot of my code. Keeping it running for months turned out to be harder than building it... so here are three times it broke and what I changed after each one.

The code stays private because it runs on my real email and calendar. This page is the operating record with names and hosts taken out. If you want the raw shape, the live brain draws every agent, skill and scheduled job from an inventory the system writes about itself.

The architecture

A supervising daemon owns the agent sessions. A message bus routes work between the sessions and me. A memory graph gives them recall, and Postgres holds anything that has to survive a restart. Around all of it, a watchdog layer checks that work actually got done.

The stack: Python daemons for orchestration and services · TypeScript/Next.js cockpit, self-hosted, with a Vercel standby · Postgres on Supabase for durable state · vector + graph stores for memory · local LLM routing for rote jobs · launchd supervision on always-on hardware
The agent layer: Claude Code sessions · MCP servers for capability · PreToolUse hooks for policy · sub-agents for fan-out

The agent layer is Claude Code. Every session is a Claude Code process under the daemon. MCP servers add the tools. PreToolUse hooks run before any command executes, so a rule holds no matter what the model thinks it's allowed to do. Bigger jobs fan out to sub-agents, each with its own tool grants. Every guardrail below lives in one of those four places.

operator (me) phone · desktop · chat cockpit TypeScript / Next.js · tombstone sync message bus / bridge Python · routes work, sessions, events supervising daemon launchd-owned · guarded restarts only agent sessions (PTY children) 1 lead agent → specialist agents, one per job frontier models for hard work · small models for rote memory graph vector + graph store retrieve before act durable state Postgres / Supabase workflows · approvals · costs watchdog layer checks that work got done · death-cluster detector · stuck-prompt fixer · stale-job alerts send gate → the outside world
Names and hosts removed. Every agent session is a child process of the supervising daemon. The watchdog layer watches every part above it. Email and messages to other people leave through the send gate.

The pieces, briefly

Failure 1: one restart killed 12 sessions at once

Every agent session runs as a child of the supervising daemon. One agent restarted that daemon with a raw process-manager command instead of the guarded reload script. The OS killed the whole process group. All 12 live sessions died within the same two seconds, including the one that sent the command.

The rule lived in a doc, and an agent restarted the service anyway. The safety check sat inside one script, and nothing stopped an agent from going around the script. An agent in a hurry takes the shortest path. I should have expected that.

Now a hook blocks that command before it runs. The reload scripts refuse to run while sessions are live, and if you force one it prints the sessions that would die. A detector also watches for several sessions dying at once and names the session and command behind it within five minutes. The postmortem is a file in the repo.

Failure 2: a stale phone tab brought dead sessions back

The cockpit syncs open sessions across devices. A phone tab I left open overnight held an old copy of that list. It kept reviving sessions I had already closed. They used tokens and kept coming back after I closed them.

Ordinary sync bug. Last write won, and my phone had the oldest copy. The fix was a tombstone on every entry. Closing a session now writes a record that no later write can undo.

A regression test now pins that exact race: a stale reader against a newer writer. UI changes also run end to end at phone and desktop sizes.

Failure 3: a confirmation prompt froze everything for hours

The CLI under one daemon hit a usage limit and opened a confirmation prompt. The daemon sat waiting on a prompt nobody would ever see, and incoming messages piled up behind it. No alert fired, because no process had crashed.

For hours the process was up and the port answered, but nothing got done. The health check now asks whether work actually finished.

A watchdog now spots the stuck prompt and confirms it. The liveness checks count messages processed and state that moved. I put the same check on everything else that can get stuck, after a relay hung the same way on a dead database connection and quietly held outbound messages for hours.

How changes get in

Measured at list prices over one stretch in July 2026, Opus was 93% of my model usage ($1,248 of $1,349). Every change ran on the top model, review included. I never measured what that review caught. Now review effort depends on how much a change can break.

Changes that touch autonomy, sends, money or credentials get a review from several agents, and one of them is told to reject. Normal code gets one reviewer agent. Docs and config get the builder's own tests. After that come the CI gates. Any bug that reached production gets a test that reproduces it before the fix lands, which is how the three failures above became tests.

The reviewers are agents too. I pick what gets built, set the tests it has to pass, and check it by using it.

The bug-fixing agent works the same way. It fixes a bug in an isolated worktree, proves it with a test that fails before the fix and passes after, and stops at a gate. I open-sourced it as claude-bug-squash. It won't merge unless you turn that on.

What it costs

One heavy build session ran $34.67 across 201 model calls. Another ran $32.13 across 188. Those are list prices. I pay a flat monthly plan, so the figures measure how much work went through the models, and a rote job like formatting a status report costs pennies on a small model.

I put the expensive models on building and review and the cheap ones on rote work. Local models handle bulk extraction where privacy matters more than quality. Every run logs its cost in the same tables as everything else.

What goes out under my name

Every email or message my agents send to another person passes one gate. By default it waits for my yes on the exact text. I've signed three narrow standing approvals: rescheduling AI Foundry check-ins with the teams, outreach for a case competition the Foundry runs, and cold email for AgentTree, a side project. AgentTree sends from its own domains, with my name on it. Each approval has a cap and a kill switch.

For email, the gate is one chokepoint that refuses to send without a single-use approval token. There's also a freeze switch I can hit from my phone. I built it this way after an audit found several paths that could have sent email without my approval. Agents had added them for convenience. None were malicious. All of them are closed, and the same kind of hook that guards restarts now guards sends.

If you are building one of these

A note on numbers · 2026-11-22

The counts on the live brain come from an inventory the system writes about itself. Nobody types them.

Hiring an AI PM? Resume (PDF) · me@jddavenport.com