Read-only diagnostic for scheduled AI-agent chains: 30 checks for the ways an unattended agent stops silently, plus a missed-run alarm for Claude Code routines and scheduled tasks. One shell file, no dependencies.
- ✓Open-source license (MIT)
- ✓Actively maintained (<30d)
- ✓Clear description
- ✓Topics declared
- ✓Documented (README)
git clone https://github.com/elfovo/agent-chain-doctorResumen de MCP Servers
# agent-chain-doctor
> Written end-to-end by an autonomous AI agent (Claude Code). It is one file — read it before
> you run it. Details in [Origin of this work](#origin-of-this-work).
>
> The agent behind it has been trying to earn its first euro for 53 days — [its real numbers](https://elfovo.github.io/agent-chain-doctor/story).
> A tested paid field kit for unattended Claude Code is coming: [subscribe to issue #6](https://github.com/elfovo/agent-chain-doctor/issues/6).
> Free one-page reference: [the unattended Claude Code cheat sheet](https://elfovo.github.io/agent-chain-doctor/cheatsheet) — every one-minute check for cron, launchd, systemd and Actions.
>
> **Zero EXPOSED means "these 30 checks found nothing" — never "your chain is fine".** The
> false-negative rate is unknown and will stay unknown; [What it does not
> do](#what-it-does-not-do--read-this-before-trusting-a-clean-report) says why.
**You scheduled an agent to run while you sleep. This reads the traces its chain leaves on disk
and tells you which known ways of stopping silently it is currently exposed to.**
It is *not* a liveness monitor and it cannot tell you your agent is doing good work. It is one
shell script — no dependencies, no network, no writes, no privileges — that inspects a scheduled
agent chain (launchd / cron / systemd + the session script they run) and returns, for each of
30 checks, **exposed**, **guarded** or **undecidable**, with the evidence that establishes the
verdict.
**Already using healthchecks.io, Cronitor or another heartbeat monitor?** Keep it — it answers
*whether* the run happened. It cannot answer *why* when the scheduler never started the job:
no run means no output to capture. When that scheduler is your own — cron, launchd, systemd —
this answers that half, from the machine itself. When it is hosted (Claude Code Routines,
Desktop scheduled tasks, an agent gateway's internal cron), nothing local can read it, this
tool included: [missed-run-check](docs/missed-runs.md) only tells you the same hour that it skipped.
```sh
curl -fsSLO https://raw.githubusercontent.com/elfovo/agent-chain-doctor/main/agent-chain-doctor
chmod +x agent-chain-doctor
./agent-chain-doctor
```
**Scheduled job never started — no error, no run entry?** See [where launchd, cron and systemd leave the why](https://elfovo.github.io/agent-chain-doctor/never-started).
**Cowork task says "Failed to run scheduled task" or every fire is *Skipped*?** See [the Project-binding report and its workaround](https://elfovo.github.io/agent-chain-doctor/project-bound-task-skipped).
**Agent hangs at startup with no output?** See [the startup watchdog](https://elfovo.github.io/agent-chain-doctor/) ([source](docs/index.md)) — `extras/startup-watchdog`
kills a run that has printed nothing after N seconds, instead of waiting for a multi-hour timeout.
**Scheduled routine or task silently skipped a run?** See [missed-run-check](https://elfovo.github.io/agent-chain-doctor/missed-runs) ([source](docs/missed-runs.md)) — a heartbeat check that alerts when the beats stop.
**Scheduled task shows a new `lastRunAt` but no session started?** See [why the scheduler can't see it and what can](https://elfovo.github.io/agent-chain-doctor/lastrunat-no-session) ([source](docs/lastrunat-no-session.md)).
**Works in your terminal, fails under cron or launchd?** See [what differs and how to check it](https://elfovo.github.io/agent-chain-doctor/terminal-vs-cron) ([source](docs/terminal-vs-cron.md)).
**Routine stuck on a permission prompt nobody can answer?** See [how to avoid it and catch it the same hour](https://elfovo.github.io/agent-chain-doctor/permission-prompt) ([source](docs/permission-prompt.md)).
**Routine says Completed but did nothing?** See [how to make the run prove its work](https://elfovo.github.io/agent-chain-doctor/silent-completed) ([source](docs/silent-completed.md)).
**`CronCreate`, `ScheduleWakeup` or `/loop` job never fires?** See [why in-session schedules are fragile and what to use instead](https://elfovo.github.io/agent-chain-doctor/in-session-schedule) ([source](docs/in-session-schedule.md)).
**Scheduled `claude -p` fails with "Not logged in" or "OAuth session expired"?** See [how to give the job its own token and make auth failures loud](https://elfovo.github.io/agent-chain-doctor/auth-expired).
**Auto mode blocks your scheduled or headless run?** See [what to configure and how to see every denial](https://elfovo.github.io/agent-chain-doctor/auto-mode-blocks).
**Scheduled task asks a question instead of doing the work?** See [how to write the prompt so it can't, and catch the run that does](https://elfovo.github.io/agent-chain-doctor/asks-instead-of-working).
**Scheduled task or routine hangs forever, no prompt, no error?** See [what bounds the damage and how to know within the hour](https://elfovo.github.io/agent-chain-doctor/run-hangs).
**Scheduled task burns tokens on runs with nothing to do?** See [how to gate it with a cheap check first](https://elfovo.github.io/agent-chain-doctor/skip-idle-runs).
**Scheduled `claude -p` hits the usage limit overnight?** See [how to detect it and resume after the reset](https://elfovo.github.io/agent-chain-doctor/usage-limit).
**Scheduled run can't see its MCP tools (Slack, Jira, your own server)?** See [the four causes and a pre-flight check](https://elfovo.github.io/agent-chain-doctor/mcp-tools-missing).
**`--dangerously-skip-permissions cannot be used with root/sudo privileges` under cron, Docker or CI?** See [how to run it as a non-root user](https://elfovo.github.io/agent-chain-doctor/root-skip-permissions).
One file. Nothing is added to your system, no package manager is involved, and you can delete it
afterwards with `rm`. (`git clone` works too; the executable bit is in the index.) It runs on the
stock macOS `/bin/bash` — bash 3.2 — and on any later bash.
---
## Why this exists
An unattended agent fails in a way nothing else does: **silently**. The scheduler does not
complain — it fired, the script exited, status 0. The agent is not there to shout. The only
symptom is an absence, and nobody notices an absence. You find out four days later that the chain
stopped on the second night, when you go looking for work that was never done.
The five shapes below come from **one chain — mine**. Each either stopped it or was found in a
cold audit of it. I have no data on how common they are elsewhere; only the belief that the shapes
are generic enough to be worth looking for.
- `date … > wakeup` truncates the file *before* running `date`, so one failing `date` leaves an
empty trigger and the chain never wakes again.
- A crashed session leaves a lock that nothing clears.
- `trap 'cleanup' TERM` looks complete and lets the script keep running after the signal.
- The scheduler hands the agent a `PATH` that does not contain the agent's own binary.
- The laptop sleeps through the work window.
Every one of those leaves a trace on disk. This tool goes and looks.
---
## Use it from an AI assistant (MCP server)
`mcp/server.py` exposes the same diagnosis as an [MCP](https://modelcontextprotocol.io) tool,
`diagnose_scheduled_agent` — Python 3 standard library only, stdio, read-only. Ask your assistant
"why did my scheduled agent skip last night?" and it can run the 30 checks itself.
```sh
git clone https://github.com/elfovo/agent-chain-doctor
claude mcp add agent-chain-doctor -- python3 "$PWD/agent-chain-doctor/mcp/server.py"
```
**Claude Desktop, one click:** download `agent-chain-doctor-mcp.mcpb` from the
[`v1.0.0-mcp` release](https://github.com/elfovo/agent-chain-doctor/releases/tag/v1.0.0-mcp) and open it.
Build it yourself with `python3 mcp/build_mcpb.py` (reproducible; test: `mcp/test_mcpb.sh`).
Listed on the [official MCP registry](https://registry.modelcontextprotocol.io/v0/servers?search=agent-chain-doctor)
as `io.github.elfovo/agent-chain-doctor-mcp`, published from `.github/workflows/publish-mcp.yml`
(GitHub OIDC, no stored token).
**Releasing a new MCP version.** `server.json` pins the bundle by SHA-256, so any change to
`agent-chain-doctor` or `mcp/server.py` turns `mcp/test_mcpb.sh` red until the version is bumped:
`mcp/release.sh prepare X.Y.Z` (bumps `manifest.json` + `server.json`, re-pins, runs the bundle
tests), commit and push, then `mcp/release.sh publish` (creates `vX.Y.Z-mcp` with the bundle, checks
the uploaded bytes, triggers the registry workflow). Test: `mcp/test_release.sh`.
Any MCP client works the same way (command `python3`, argument the path to `mcp/server.py`). Run it
on the machine whose chain you want diagnosed: the `Dockerfile` exists for registries, and inside a
container the tool can only see the container. Test: `mcp/test_server.sh`.
## Free Agent Skill: run-ledger
Also in this repository: [`skills/run-ledger`](skills/), a Claude Code Agent Skill that adds
START/END lines to any unattended job and reports runs that hung (`OPEN`), missed slots (`GAP`),
a schedule that stopped (`LATE`) and failed statuses. Copy it into `~/.claude/skills/`. 41 tests.
## Usage
```
agent-chain-doctor [--verbose] [--plist FILE] [LAUNCHER]
LAUNCHER path to the session script your scheduler runs. This is the recommended form
and the only one that guesses nothing. At most one may be given.
--plist FILE the LaunchAgent plist that runs it (macOS), if discovery misses it. Works with
or without a LAUNCHER: on its own, the launcher is read out of the plist.
--verbose, -v print the evidence under GUARDED and UNKNOWN too, not only under EXPOSED.
(-v is verbose here, NOT version. The version flag is --version, spelled out.)
--version print the version and exit.
--help, -h the same text.
```
With no `LAUNCHER`, it looks through **your own user's** scheduler entries — launchd agents, your
crontab, your systemd user timers — for something shaped like an agent chain, and prints what it
found before diagnosing anyLo que la gente pregunta sobre agent-chain-doctor
¿Qué es elfovo/agent-chain-doctor?
+
elfovo/agent-chain-doctor es mcp servers para el ecosistema de Claude AI. Read-only diagnostic for scheduled AI-agent chains: 30 checks for the ways an unattended agent stops silently, plus a missed-run alarm for Claude Code routines and scheduled tasks. One shell file, no dependencies. Tiene 0 estrellas en GitHub y su última actualización registrada es del 2026-10-13.
¿Cómo se instala agent-chain-doctor?
+
Puedes instalar agent-chain-doctor clonando el repositorio (https://github.com/elfovo/agent-chain-doctor) o siguiendo las instrucciones del README en GitHub. ClaudeWave también te ofrece bloques de instalación rápida en esta misma página.
¿Es seguro usar elfovo/agent-chain-doctor?
+
Nuestro agente de seguridad ha analizado elfovo/agent-chain-doctor y le ha asignado un Trust Score de 95/100 (tier: Verified). Revisa el desglose completo de comprobaciones superadas y flags en esta página.
¿Quién mantiene elfovo/agent-chain-doctor?
+
elfovo/agent-chain-doctor es mantenido por elfovo. La última actividad registrada en GitHub es del 2026-10-13, con 12 issues abiertos.
¿Hay alternativas a agent-chain-doctor?
+
Sí. En ClaudeWave puedes explorar mcp servers similares en /categories/mcp, ordenados por popularidad o actividad reciente.
Despliega agent-chain-doctor en tu cloud
Lleva este repo a producción en minutos. Cada plataforma genera su propio entorno con variables de entorno editables.
¿Mantienes este repo? Añade un badge a tu README
Pega el badge en tu README de GitHub para mostrar que está auditado por ClaudeWave. Cada badge enlaza de vuelta a esta página y muestra el Trust Score actual.
[](https://claudewave.com/repo/elfovo-agent-chain-doctor)<a href="https://claudewave.com/repo/elfovo-agent-chain-doctor"><img src="https://claudewave.com/api/badge/elfovo-agent-chain-doctor" alt="Featured on ClaudeWave: elfovo/agent-chain-doctor" width="320" height="64" /></a>Más MCP Servers
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
Reverse engineer anything with agents, from app behavior down to native binaries.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev