CLAUDE LABJP
VERSION — v2.1.227 landed on August 10 with no new features, just fixes around plan detection and CI behaviorAUTO — Two days remain until August 14, when auto mode becomes the default in Claude Code for Pro, Max, and TeamCI — Bash commands no longer fail across the board under claude-code-action with allowed_non_write_users on GitHub-hosted runnersBILLING — Sessions started with an expired token could misread your plan and nudge Max users toward usage credits; that is now fixedSUNSET — The legacy Workbench and the experimental prompt tool APIs retire on August 17, five days outPRICE — Sonnet 5 promo pricing at $2/$10 per Mtok runs through August 31, moving to $3/$15 on September 1VERSION — v2.1.227 landed on August 10 with no new features, just fixes around plan detection and CI behaviorAUTO — Two days remain until August 14, when auto mode becomes the default in Claude Code for Pro, Max, and TeamCI — Bash commands no longer fail across the board under claude-code-action with allowed_non_write_users on GitHub-hosted runnersBILLING — Sessions started with an expired token could misread your plan and nudge Max users toward usage credits; that is now fixedSUNSET — The legacy Workbench and the experimental prompt tool APIs retire on August 17, five days outPRICE — Sonnet 5 promo pricing at $2/$10 per Mtok runs through August 31, moving to $3/$15 on September 1
Articles/Claude Code
Claude Code/2026-06-27Advanced

Will It Stay Light When You Run It Unattended? Observing and Capping Claude Code's Long-Session Memory

How to keep long, unattended Claude Code sessions from slowly getting heavier — with a tiny ps-based RSS sampler, a rolling-baseline watchdog, and session segmentation, shown with working scripts and a before/after comparison.

Claude Code216Automation42Memory5Headless2Operations15

Premium Article

There was a quiet line in the 2026-06-27 Claude Code update that I did not want to skim past: CPU and memory usage during streaming and long-running sessions were reduced. It is not a flashy feature, but for anyone who keeps Claude Code running unattended for hours, this kind of baseline improvement is the most welcome kind.

As an indie developer, I run headless Claude Code to auto-publish articles across several sites, and the failure I fear most is not a crash — it is the quiet one where the process slowly gets heavier and only the last few jobs of the batch get dropped. A crash is loud; a gradual slowdown that misses the final couple of jobs is easy to miss. This update softens that worry a notch, but if I lean on the app-side improvement alone and stop measuring, I will eventually fall back into the same hole.

This article builds the three operational layers I rely on: observe Claude Code's resident memory in a few dozen lines, detect the onset of bloat, and split long runs into segments so RSS levels off instead of climbing.

What Actually Becomes "Heavy" in a Long Unattended Session

The first thing to separate is that "memory" here means two different things. One is the context Claude carries (the context window), which drives token cost and latency. The other is the resident memory of the local Claude Code process itself (RSS: resident set size), which is how heavy the process looks to the OS. The 6/27 improvement mainly lowered the latter. Context-grooming techniques are a separate topic, so this article stays consistently on RSS.

In unattended runs, RSS tends to become a problem in a few recognizable shapes:

  • Stacking dozens of tool calls into a single session lets streaming buffers and intermediate state accumulate, and RSS creeps upward
  • If a VM or container has a low memory ceiling, the grown RSS hits it and the OS OOM killer takes the whole process down
  • Even without a kill, once swapping starts everything slows down and the later jobs miss their window

A crash is loud, so you notice it. The nasty case is the third one: it just "gets slow" without raising an error. That is exactly why we start from observation.

What the 6/27 Update Lowers — and What It Doesn't

The published improvement is a reduction in CPU and memory usage during streaming and long-running sessions. In other words, the same work now ramps RSS up more gently than before. That is genuinely helpful.

But what the app lowers is the basal metabolism. If your job crams hundreds of operations' worth of work into one session, even a gentler slope will reach the ceiling given enough time. The update delays arrival; it does not promise you can run forever. Observation and segmentation stack on top of the app's improvement without conflicting with it.

A useful framing: the app's memory reduction makes the hill less steep, while the operational practice in this article adds a flat landing partway up that brings you back down.

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
How to keep a fixed eye on Claude Code's resident memory with a ps-based RSS sampler in a few dozen lines
Building a drift-tolerant watchdog using a rolling baseline and median absolute deviation to catch the start of bloat
Splitting long runs into bounded segments and using --resume to cap RSS while preserving context
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 $10 for lifetime access
View Membership →

Related Articles

Claude Code2026-08-03
Existence Checks Pass, Writes Fail — Probing Capabilities Before an Unattended Run
A directory existing and a directory being writable are two different facts. Measured results from five broken-environment cases, and a capability-probe preflight for unattended Claude Code runs.
Claude Code2026-08-02
Resuming After a Budget Stop: What 36 Enumerated Stop Points Taught Me
A budget cap that halts a headless run is neither success nor failure. I enumerated every stop point, measured resume integrity and total spend, and ended up changing what the cap applies to.
Claude Code2026-07-16
Your Overnight Session Wakes Up at 3GB — Four Places Memory Piles Up, and How to Tell Them Apart
The Claude Code process I left running overnight had grown to 3.4GB of resident memory by morning. Here are the four accumulation sources closed in 2.1.209, how to separate what's left in your own setup by sampling RSS slope, and a watchdog pattern that folds a session before it hurts.
📚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
See all →