◉CLAUDE LABJP
●2.1.296 — Subagents can set their own autoCompactWindow, and an env var pins the model used by workflow agents●HAIKU 5.5 — Since 2.1.293 (Oct 7), claude-haiku-5-5 is the default Haiku model on the Anthropic API●SONNET 4.5 — Retires on the Claude API on 11/30, 47 days left. Migrate to Sonnet 5.5●Q&A — A write-up shows three places to look when a Mod draws nothing and reports no error●AGENTS.MD — One write-up explains how to split the entry points when Codex and Claude Code share a folder: AGENTS.md and CLAUDE.md●NEW — Approval prompts for "cd, git add, commit" every time: not a missing setting, but how it works●2.1.296 — Subagents can set their own autoCompactWindow, and an env var pins the model used by workflow agents●HAIKU 5.5 — Since 2.1.293 (Oct 7), claude-haiku-5-5 is the default Haiku model on the Anthropic API●SONNET 4.5 — Retires on the Claude API on 11/30, 47 days left. Migrate to Sonnet 5.5●Q&A — A write-up shows three places to look when a Mod draws nothing and reports no error●AGENTS.MD — One write-up explains how to split the entry points when Codex and Claude Code share a folder: AGENTS.md and CLAUDE.md●NEW — Approval prompts for "cd, git add, commit" every time: not a missing setting, but how it works
Articles/Claude Code
⟐ Claude Code/2026-07-07Advanced

My background session sat at running all night — adding heartbeats to the agents view

The Claude Code agents view finally lets you see every background session at once, but a running badge is not proof of progress. Here is the external heartbeat layer I built to catch a silently stalled session in minutes instead of the next morning, with real numbers and the traps I hit.

Claude Code261background sessionsunattended automation6indie development25observability21

✦ Premium Article

Last Tuesday, one of the background sessions I had running overnight sat at "running" until morning.

When I opened the agents view, the other eleven showed green checkmarks, and that one still had a spinning icon. Its last log line was seven hours old, and nothing had moved since. The task itself was a trivial dependency bump that should have finished in a couple of minutes. What stayed with me was not what had gone wrong, but why I had not noticed until morning.

As an indie developer, I run a handful of wallpaper apps and a few technical blogs, and every night I batch the small chores — dependency bumps, changelog drafts, crash summaries, ad-config checks — as headless Claude Code runs. On a busy night that is twelve sessions. The July 6, 2026 update that improved the agents view and background-session reliability was a genuinely welcome change for this workflow, letting me see every run on one screen. But after a week of leaning on it, one thing became clear: the agents view tells you a session exists, not that it is making progress.

This article shares the external heartbeat layer and reconciler I built to close that gap.

When running lies to you

Let me start from the failure side, because that is where the need becomes obvious.

Background sessions stall for two broad reasons. One is a crash — the process dies, the agents view flips to a failed state, and it is relatively easy to spot. The nastier one is the second: the process is alive but no longer moving forward.

In just the cases I have personally hit, the states looked like this.

Kind of stallProcessAgents viewActual progress
Hung on a network responsealiverunningstopped
Tool call that never returnsaliverunningstopped
Silent retry loopaliverunningeffectively stopped
Wedged waiting on inputaliverunningstopped

Every one of them keeps showing "running." Presence is true; liveness is false. In observability terms, what we actually want is a proof of life, not a proof of attendance.

That distinction turns fatal under unattended operation. During the day, when a human is watching, a spinner that lingers too long feels wrong and gets noticed. But a background session is in the background precisely because nobody is watching — so there is no one to feel that friction. The stall simply sits there until the next morning.

For tracing a session's identity all the way to a commit, I wrote separately about threading a correlation key through unattended runs with readable session names. This piece is about the layer before that: asking whether the session is even alive right now.

Separating presence from liveness

There is only one design principle here: add a liveness signal to the agents view from the outside.

Concretely, have each background session leave a small "I am still alive" stamp at a fixed cadence. Then a separate tiny process watches the freshness of those stamps. Fresh stamp, alive; stale stamp, suspected stall. That is the heartbeat idea.

Why external? You cannot — and should not — modify the agents view or the session state itself. The only levers you truly hold are emitting a side effect whenever something happens inside the session, and observing that side effect from outside. Combine the two and you can bolt on a liveness layer without breaking any official behavior.

The stamp can be startlingly small. What I actually write is just three fields: session name, epoch seconds, and current phase.

{"session":"wallpaper-ios-deps-0706-a3f","ts":1751850600,"phase":"tool:bash"}

The important choice is using epoch seconds (ts) rather than a date string. I once wrote log dates with a plain date, UTC and JST drifted apart, and a run overwrote the previous day's file. If a machine is going to compare times, hold them as integers that leave no room for timezone interpretation. Freshness then falls out of a single subtraction: current epoch seconds minus ts.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Why the running badge in the agents view cannot reveal a stall, and how separating presence from liveness reshapes the whole design
✦A complete working setup: a PostToolUse hook stamps each session with a heartbeat, and a reconciler judges staleness using plain epoch seconds
✦The measured drop from next-morning discovery to a nine-minute median, plus fixes for the three traps: silent thinking, cloud-sync write contention, and long single tools
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $15 for lifetime access
View Membership →

Related Articles

⟐ Claude Code2026-09-20
I Was Paying for Pro and Still Getting Billed by the Console
Your subscription and your API usage are two separate ledgers, and Claude Code will happily run on either one. Which credential wins is decided by a precedence list where your login sits dead last. Here is how to read status, and why unattended runs answer differently.
⟐ Claude Code2026-09-06
I counted 42 skills on my shelf, and four of them were just a note saying they had moved
Claude Code v2.1.261 added /skill-doctor. Before running it I counted my own skill shelf from the files, found four tombstones, and learned that the obvious awk one-liner for spotting duplicate plugin names quietly reports skills that are not duplicates at all.
⟐ Claude Code2026-09-04
The One File I Keep Out of Claude Code's Reach: project.pbxproj
With Xcode project files, the breakage that still opens costs far more than the breakage that refuses to open. Here is what I measured before moving every edit behind a script, and where the line sits today.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links