DigestOps

How do you keep an eye on long agent runs and recover when one stalls?

19 posts

Playbook

Practitioners monitor agent state via external watchdogs or file tails and recover using persistent checkpoints or state files to avoid restarting long runs.

  1. Use an external watchdog for loop detection

    Run a separate read-only process to monitor the event stream. If the agent retries the same fix, first prompt it for a falsifiable root-cause hypothesis. If stuck, swap in a fresh agent with a handoff note. If still stuck, move the task to a human queue. 3

  2. Persist state in files to survive resets

    Maintain three files: state/current.md, backlog.md, and decisions.md. Add a pre-commit hook that rejects any commit without a checkpoint. This prevents re-doing merged tasks or re-investigating failed tests after context resets. 2

  3. Save steps as database commits

    Save every agent step to a database before continuing, treating each save as a commit. If a run crashes, resume from the last commit. A typical run contains about 12 commits, allowing recovery without starting from scratch. 8

  4. Pause after two stalled iterations

    Define goals in files with command-checkable completion conditions. If two iterations pass without progress on the same stage, pause the agent and send a notice. Other stops include blocked merges, protected paths, or schema changes. 4

  5. Monitor reasoning for improvised workarounds

    Tail session files and send content to a model like Groq or Cerebras to check against custom rules. Alert if the agent chooses to change code and report later instead of stopping to ask about missing environment pieces. 1

Choosing between approaches

Some approaches rely on external tools like ThoughtCop or pi-durable, while others use native features or simple file structures. Manual compaction thresholds vary by model, with one practitioner setting auto-compaction at 400k and manual checks between 200k and 400k 7, while another uses three thresholds to manage cost before pricing doubles 6.

Not covered yet

The material does not specify how to handle side effects from external API calls that Git cannot revert, beyond general strategies to capture state and verify results independently 10.

Drawn from the top 10 posts for this question; the numbers match the list below · updated 2026-11-18
Type

Posts

9 more posts to see