agent-ops-kit is a free set of guardrails for LLM agent loops that run on their own: a heartbeat watchdog, a gate that needs no model, a safe launcher and a playbook for handing agents more freedom step by step. In July 2026 I took these patterns out of the system I run my company with, minus everything specific to it. It's the boring layer that makes automation survivable.

Stdlib-only Python and portable Bash, no telemetry. Needs Python 3.10 or newer. MIT license, version 0.2.0.

A real run of the kit's demo on 11 November 2026: a fake job and a stand-in brain that only echoes.

What goes wrong when LLM agent loops run on their own?

I built the kit around three problems. Jobs fail silently at 3 a.m. and nobody notices for weeks. Headless LLM loops wake up on a schedule, find nothing to do and bill you anyway. And agents called autonomous get write access on day one and edit their own guardrails on day two.

In July 2026 I audited one real hourly repair loop in my setup for 7 days. About 95 % of its runs were no-ops, roughly $231 a week of API-equivalent spend for zero changes. The fix was an LLM-free gate in front of the loop, built the same day. That gate is the idea behind precheck.py.

Also in July 2026, my alarm investigator earned its auto mode after a supervised week of 36 cases: 17 false alarms correctly dismissed, 6 real fixes, each approved by me first, 0 rollbacks. As of October 2026 I run 119 background jobs, almost all of them plain scripts that run without AI, on purpose.

What is inside agent-ops-kit?

Heartbeat watchdog

Every job you care about touches a heartbeat file when it finishes well. The watchdog checks each file against a maximum age (26 hours by default) and appends one alert per problem to a JSONL store: never_ran, stale, unreadable, or bad_config when the job entry itself is broken. The other jobs are still checked. It never notifies anyone.

Precheck gate

A gate that needs no model. It prints one line, IDLE or WORK with a reason, and only an explicit IDLE may skip a cycle. A missing alert store counts as no alerts. Any other read or parse problem means WORK, because a skipped real cycle leaves a failure unhealed, while a wasted cycle only costs tokens.

Safe wrapper

heal_wrapper.sh is the safe launcher for a headless brain. It checks a kill switch, takes a single-instance lock, runs the precheck and only then starts the brain with a wall-clock budget. The four gates are explained below. Relative paths in the config resolve against the kit folder, so cron, launchd or systemd can start it from anywhere.

The /heal template

The brain template for Claude Code, a skill called /heal. It validates, classifies, fixes only what is provably safe, verifies, rolls back on doubt and writes one digest line. It runs in shadow mode unless the config says auto, makes at most 2 attempts and never touches protected paths. With the default command, Claude Code lets it write only under state/ and run only the watchdog.

Staged-autonomy playbook

docs/staged-autonomy.md is the ladder as a checklist: shadow, pilot, gated, auto. Between steps there is a written promotion review that a human decides and dates. Auto is only for a named, closed list of actions that are safe, confident and reversible. An incident that reaches production moves the subsystem one rung down.

Demo and tests

examples/demo/ is a five-minute walkthrough with a fake job and a fake brain, no LLM needed. tests/ holds 22 pytest tests and a smoke test of the wrapper with 10 scenarios.

What does the wrapper check before it starts the brain?

Kill switch

Only a literal JSON true in enabled, or a missing enabled key, lets the brain run. A missing, unreadable or invalid config counts as off: the wrapper logs FATAL and exits with 78. It fails closed, because an ambiguous config must not let the brain run.

Single-instance lock

The wrapper holds an operating-system file lock (flock) for the whole run. A crashed run leaves no stale lock behind, and a live run can never be taken over, however long it runs. The lock in 0.1.0 depended on age and could be taken from a live run, for example after the computer slept.

LLM-free precheck

The precheck runs next, and no model is involved. Only an explicit IDLE skips the cycle: the brain doesn't start and no tokens are spent. Errors, a corrupt alert store or a store it may not read mean WORK, so a gate error costs tokens and never means silence.

Wall-clock budget

The brain runs in its own process group with a wall-clock budget: AGENT_OPS_WALLCLOCK_S, 3600 seconds by default, and time asleep counts. When the budget runs out (exit 70), when the wrapper is stopped with SIGTERM, SIGINT or SIGHUP, or when the brain leaves processes behind, the wrapper ends the whole group before it releases the lock.

How does the kit compare to my own setup today?

The kit shows the pattern of July 2026: one LLM brain that also restarts jobs. Since 5 September 2026 my own setup has one consumer for all alarms. A restart runs as plain code, without AI. An AI agent only investigates what a restart doesn't fix or what isn't safe to restart. I changed it because three systems read the same alarm stream and got in each other's way: 222 of 325 alarm fingerprints were handled twice.

What does 0.2.0 fix after the review of 11 November 2026?

I design and decide, Claude Code writes the code, and models from other labs review it. On 11 November 2026 four of them (Codex, GLM, Muse and Grok) reviewed the whole repo and reported 17 real problems and 1 false alarm. A real end-to-end run with Claude Code found one more: with the old default command the brain could not write its proposal, so every run ended without a trace. All 18 are fixed, and a second review round of the fixes followed.

The biggest fixes: two brain runs could overlap, because an age-based lock could be taken from a live run. The time budget and a stop signal did not end the brain's child processes. One typo in a job entry stopped the whole watchdog. Started by cron from another folder, the watchdog looked in the wrong place and the wrapper saw IDLE. And the README said a corrupt config counts as enabled, while the wrapper fails closed.

The protected paths are enforced by instructions and, with the default brain command, by Claude Code's tool permissions. That is not an operating-system sandbox, and a brain command of your own decides its own permissions. A heartbeat only says a job finished; it says nothing about whether its result was right.

What are the known limits of 0.2.0?

  • The carve-outs are enforced by instructions and, with the default brain command, by Claude Code's tool permissions. That is not an operating-system sandbox, and a brain command of your own decides its own permissions.
  • State paths are trusted as given: alerts_path and the heartbeat paths are used exactly as written. Don't point them at a config an untrusted party can edit.
  • A wrapper killed with SIGKILL (kill -9) can't end the brain first. The lock is then free while the brain may still run.
  • A wrapper that a non-interactive shell started in the background with & ignores SIGINT, as bash does there. Stop it with SIGTERM.
  • Write to the alert store only through the watchdog. Resolving an alert rewrites the file, so a line appended at that moment without the store lock can be lost.
  • A heartbeat only says a job finished. It says nothing about whether its result was right.

How do I try agent-ops-kit?

You need Python 3.10 or newer and Bash. The tools need no packages and send no telemetry. The default brain command calls Claude Code, so for a real run you need it installed. These commands clone the kit, copy the example config, run the watchdog and the wrapper once, then run the tests and the wrapper's smoke test:

git clone https://github.com/kevintheo-ai/agent-ops-kit && cd agent-ops-kit
cp config/agent_ops.example.json config/agent_ops.json
python3 scripts/watchdog.py --config config/agent_ops.json
bash scripts/heal_wrapper.sh
python3 -m pytest tests/ -q
SMOKE=1 bash tests/smoke_heal_wrapper.sh

The demo in examples/demo/ is a five-minute walkthrough with a fake job and a stand-in brain that only echoes, so it works without an LLM. Swap in the default brain command later. Its last step shows the point of the kit: when there is nothing to do, no model starts. The tests need pytest. The README has all the limits and the upgrade notes from 0.1.0.

Read the README on GitHub

Let's talk

“Are you hiring for agent operations, or do you run your company with AI agents too?”

Email meLinkedInFollow on XGitHub

x@kevintheo.com

I post my new test results on X. Follow me there if you want to see them.