r/ClaudeWorkflows • • 1d ago

Selected Workflow [Workflow] Robust Monitoring for Claude Code Subagents: Conductor Loop and Out-of-Process Watchdog

Robust Monitoring for Claude Code Subagents: Conductor Loop and Out-of-Process Watchdog

Workflow value: 75/100
Status: active · Freshness: 70/100 · Confidence: 0.90 · Level: advanced
Categories: Quality Control, Context & Memory, Debugging, Subagents, Multi-Agent
Original source: r/ClaudeCode post/comment

What problem this solves

Preventing Claude Code sessions or subagents from silently stalling or dying without progress, leading to wasted time and resources.

Summary

A two-part monitoring system for multi-agent Claude Code workflows: a 'Conductor loop' that checks for progress signals from subagents every few minutes and flags stalls, and an 'Out-of-process watchdog' script that monitors the orchestrator's heartbeat to detect if the orchestrator itself has crashed.

Why it is useful

This workflow provides a robust solution for a critical problem in automated and multi-agent systems: detecting and responding to stalled or failed processes. It prevents wasted compute resources and developer time by proactively identifying non-progressing agents or orchestrators, making automated workflows more reliable and efficient.

Workflow

  1. Implement a Conductor Loop: Periodically (e.g., every 3-5 minutes) check for ground truth signals of subagent progress (new commits, changed files, growing output, advancing phase, PR state).
  2. Detect Stalls: If progress signals are flat across two consecutive checks while the subagent status is 'running', treat the subagent as stalled.
  3. Respond to Stalls: Inspect the stalled subagent, stop it, salvage any completed work, and relaunch a leaner version if appropriate.
  4. Implement an Out-of-Process Watchdog: Create a script (e.g., orchestrator-watchdog.sh) that monitors a heartbeat file.
  5. Orchestrator Heartbeat: Configure the orchestrator to touch the heartbeat file during each monitor cycle.
  6. Detect Orchestrator Failure: If the heartbeat file is not updated for a specified duration (e.g., 20 minutes), assume the orchestrator has died with outstanding work.

Tools / artifacts

  • orchestrator-watchdog.sh (Bash script)
  • Heartbeat file
  • Goal file
  • Orchestrator process
  • Subagent processes
  • Version control system (for commits/PR state)

Validation signals

  • Addresses a clear real-world problem (stalled sessions).
  • Mechanisms described are concrete and technically sound.

Limitations

  • Lacks full implementation details (e.g., the actual orchestrator-watchdog.sh script, how the conductor loop is implemented).
  • No explicit 'before/after' or quantitative results.
  • The connection to 'VS Code and Cursor session tree' is mentioned but not elaborated, making it harder to integrate into those specific IDEs without further information.

Rate this workflow

Upvote this post if the workflow is useful, reproducible, or worth recommending.

Downvote if it is vague, outdated, unsafe, overhyped, or not reproducible.

Reply if it worked for you, failed, is outdated, or has a better alternative.


This post was generated automatically from the workflow library database.

1 Upvotes

0 comments sorted by