SuperAPIAI Directory

agent-chain-doctor

github.com · AI agents

agent-chain-doctor is a read-only tool for diagnosing scheduled AI-agent chains. By examining traces on disk, it identifies 30 known ways an unattended agent can silently stop, and for each way returns a conclusion of "exposed", "guarded", or "undecidable" along with evidence. The tool is a single shell file with no dependencies, no network, no writes, and no privileges required, and it runs in bash on macOS and Linux. In addition, the repository provides an MCP server version that allows AI assistants to call the diagnostic functionality directly, as well as an Agent Skill for recording run status.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsmacOS · Linux

About this tool

agent-chain-doctor is a read-only tool for diagnosing scheduled AI-agent chains. It aims to solve the problem of unattended agents failing silently: the scheduler fires normally, the script exits with code 0, but the agent has not actually completed its work, and there is no error indication. By examining traces on disk (such as logs, lock files, wake files, prompt files, etc.), the tool identifies 30 known ways an agent chain can silently stop, and for each way gives a conclusion of "exposed", "guarded", or "undecidable", along with the evidence supporting that conclusion.

Main capabilities:

  • Performs 30 checks on scheduled agent chains (launchd / cron / systemd and the session scripts they run), covering common patterns of silent stopping.
  • Each check reports a conclusion with supporting evidence (by default shown when "exposed"; use --verbose to show evidence for all conclusions).
  • Evidence is divided into [live] (facts about system state) and [static] (pattern heuristics in launcher source code); static findings print file:line number and the content of that line so users can verify them themselves.
  • Supports automatic discovery of agent chain candidates in the user's schedulers; if none are found, it refuses to diagnose and returns exit code 2.
  • Exit codes: 0 means there are no "exposed" items; 1 means there are "exposed" items; 2 means the tool refused to diagnose (e.g., invalid arguments, unable to read the target, no chain found, etc.).
  • Provides an MCP server version (mcp/server.py) that exposes the same diagnostics as MCP tools to AI assistants, uses only the Python 3 standard library, communicates over stdio, and is read-only.
  • Provides an Agent Skill (skills/run-ledger) that can add START/END lines to unattended tasks and report hanging (OPEN), missed periods (GAP), scheduling stopped (LATE), and failure status.

Usage:

  • Run the shell script directly (a single file, no dependencies), specifying a launcher (launchd / cron / systemd) or using automatic discovery.
  • Call the diagnose_scheduled_agent tool through an MCP client (such as Claude Desktop); it must run on the target machine.
  • Copy the run-ledger skill to ~/.claude/skills/ directory before use.

Use cases:

  • Diagnose why scheduled AI agents (such as Claude Code routines, scheduled tasks) silently skip or stop at night.
  • Perform health checks before deploying unattended agent chains to identify known fragile patterns.
  • Use with heartbeat monitoring tools (such as healthchecks.io) to supplement cause analysis when the scheduler does not start tasks.

Limitations:

  • This tool is not liveness monitoring and cannot determine whether the agent is doing a good job.
  • The false negative rate is unknown and will remain unknown; a report of "zero exposure" only means the 30 checks found no problems, and does not mean the agent chain is necessarily healthy.
  • For managed schedulers (such as Claude Code Routines, desktop scheduled tasks, cron inside agent gateways), local tools cannot read their status.
  • When run inside a container, it can only see inside the container.
  • Static checks are heuristic and may miss or falsely report issues; users must verify the evidence themselves.
  • When the tool refuses to diagnose, it returns exit code 2, which does not mean healthy.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools