CLAUDE LABJP
CODE — Claude Code ships a broad quality and reliability update with /rewind, stronger MCP resilience, and steadier OAuth handlingCODE — CPU and memory use drops during streaming and long sessions, keeping always-on automation stableADMIN — New org model restrictions let administrators control which models are availableMCP — Structured output, remote MCP, and session resume all get more reliableMODEL — Claude Fable 5 is generally available, with a 1M-token context window, always-on adaptive thinking, and 128K outputLINEUP — Opus 4.8, Sonnet 4.6, and Haiku 4.5 lead the lineup; pick the right one per taskCODE — Claude Code ships a broad quality and reliability update with /rewind, stronger MCP resilience, and steadier OAuth handlingCODE — CPU and memory use drops during streaming and long sessions, keeping always-on automation stableADMIN — New org model restrictions let administrators control which models are availableMCP — Structured output, remote MCP, and session resume all get more reliableMODEL — Claude Fable 5 is generally available, with a 1M-token context window, always-on adaptive thinking, and 128K outputLINEUP — Opus 4.8, Sonnet 4.6, and Haiku 4.5 lead the lineup; pick the right one per task
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 Code168Automation29Memory2HeadlessOperations6

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-06-19
An Article My Gate Rejected Got Published — The Cost of Chaining the Quality Gate and git push in One Call
In an unattended publishing pipeline, an article my quality gate had rejected went live anyway. The cause was chaining the gate and git push into a single shell call. Here is how the exit code gets swallowed, and a two-phase publish-marker design that refuses to push until every gate has demonstrably passed.
Claude Code2026-06-17
When an Announced Billing Change Is Withdrawn at the Last Minute, Change No Code
A billing change that was supposed to take effect was withdrawn on the day. To survive announce, apply, and revert without touching code, I keep platform behavior behind a single flag and project the monthly delta from real logs.
Claude Code2026-06-25
Higher Rate Limits Don't Mean Tighter Schedules — Spend the Headroom on 429 Recovery
When Claude Code's rate limits went up, the instinct was to pack the schedule tighter. Here's why I did the opposite and routed the new headroom into retry budget instead — a pacing note for unattended pipelines.
📚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 →