CLAUDE LABJP
BILLING — Day two after the Jun 15 change: Agent SDK, headless runs, GitHub Actions, and third-party agents now bill against separate monthly credits ($20/$100/$200) at full API rates with no rollover, making first-day cost measurements the basis for any reworkREGULATED — TCS partnered with Anthropic to bring Claude to banks, airlines, and other regulated industries, while DXC integrates Claude into the core systems those sectors rely onRETIRED — Sonnet 4 and Opus 4 left the API on Jun 15; confirm via your logs that scripts referencing them have moved to the latest generation such as Opus 4.8EXPORT — Claude Fable 5 and Mythos 5 remain suspended under a US export-control directive (since Jun 12); Anthropic says it is working to restore accessSAFE — Only the two new Mythos-class models are affected; every other model including Opus 4.8 keeps running normallySUBAGENTS — Claude Code sub-agents can spawn their own sub-agents up to five levels deep, widening the design space for multi-stage delegationBILLING — Day two after the Jun 15 change: Agent SDK, headless runs, GitHub Actions, and third-party agents now bill against separate monthly credits ($20/$100/$200) at full API rates with no rollover, making first-day cost measurements the basis for any reworkREGULATED — TCS partnered with Anthropic to bring Claude to banks, airlines, and other regulated industries, while DXC integrates Claude into the core systems those sectors rely onRETIRED — Sonnet 4 and Opus 4 left the API on Jun 15; confirm via your logs that scripts referencing them have moved to the latest generation such as Opus 4.8EXPORT — Claude Fable 5 and Mythos 5 remain suspended under a US export-control directive (since Jun 12); Anthropic says it is working to restore accessSAFE — Only the two new Mythos-class models are affected; every other model including Opus 4.8 keeps running normallySUBAGENTS — Claude Code sub-agents can spawn their own sub-agents up to five levels deep, widening the design space for multi-stage delegation
Articles/Claude Code
Claude Code/2026-06-16Advanced

Keeping Large Claude Code Refactors Revertible One Commit at a Time — Field Notes on Checkpoints and Rollback Detection

Hand a big refactor to Claude Code and the speed hides a real cost: review-proof, oversized diffs. Here are the field notes I actually run — declaring checkpoints in a manifest, enforcing commit granularity with a pre-push hook, and tying rollback calls to observability.

Claude Code152Refactoring2Git4RollbackObservability2

Premium Article

You ask Claude Code to "rewrite this whole directory into a different structure," and forty seconds later a 2,000-line diff lands and your hands stop moving. I have lived that moment several times, on personal apps and on client work alike. Generation is fast, but the focused attention review needs grows roughly exponentially with the size of the diff.

For a while I powered through reviews on willpower. Once I started running several projects in parallel as an indie developer, that approach plainly broke down. Now I invert the order. Before I let Claude Code generate anything, I design where I can safely roll back to, and I make Claude Code honor that granularity. These are the field notes for the manifest, hook, and rollback detection I actually use — written so you can copy them.

Estimate the layer that breaks even when tests are green

Claude Code is smart, so most refactors come back as working code. The trouble is that the gap between "it runs" and "it runs correctly" widens with the size of the diff.

The failures I have actually hit lived in a layer unit tests cannot reach. A database connection's initialization order was off by one line, and connections only exhausted during idle periods after deploy. On another project, existing code quietly relied on "swallow the exception and return a default," and a clean rewrite that simply threw instead took down an entire nightly batch. In both cases a new diff broke a contract the old code held implicitly — and because the tests never expressed that contract, they stayed green.

The takeaway is singular: refactor size and reviewability have to be designed as separate things. Rewriting big is fine. The problem is being handed it all at once and forced to verify it all at once.

Declare checkpoints as a manifest, up front

When I start a refactor, the first thing I do is not generate code — it is mark the points I can return to. Rather than leaving that in comments or my head, I put it in a YAML manifest committed to the repo, so the later hooks and reviews can read it.

# refactor.checkpoints.yml — fixed before the refactor begins
target: Move OrderService toward a structure with clearer boundaries
rollback_signals:
  p95_latency_ms: 450      # exceed this -> revert to the previous CP
  error_rate_pct: 1.0
checkpoints:
  - id: CP1
    intent: Add interfaces/ and usecases/. Do not change a single line of OrderService
    invariant: No calls from existing code occur (pure addition only)
  - id: CP2
    intent: Add an adapter so the new UseCase calls the existing OrderService
    invariant: The entry Controller supports both paths via a flag defaulting to the old route
  - id: CP3
    intent: Port tests to the UseCase side. Keep old tests. Flag defaults to false
    invariant: Behavior with the flag false exactly matches CP2
  - id: CP4
    intent: Flip the flag to true for part of production traffic; if clean, invert the default
    invariant: The flag can be returned to false instantly at any time
  - id: CP5
    intent: Delete the old OrderService and the flag branch
    invariant: Predicated on CP4 being stable in production

The part that earns its keep is invariant — the condition that must hold once each checkpoint is done. Writing down not just "what to do" but "what is provably still intact when it finishes" naturally shifts the request to Claude Code from "rewrite the whole thing" to "produce only the diff that satisfies CP1's invariant." The reason a giant diff comes back is not Claude Code; it is that I never defined the granularity. Realizing that was the start of this whole practice.

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
A workflow for declaring checkpoints in a YAML manifest before you start, mapping each commit to a single revertible point
A pre-push hook that mechanically rejects commits over 300 lines, missing a checkpoint ID, or failing to build — stopping oversized diffs at the door
A Python snippet that compares metric series before and after to automate the rollback decision, plus how to set the thresholds
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-05-26
Four Weeks With Claude Code: Driving Xcode Warnings to Zero in an Indie iOS Codebase
An indie iOS developer behind 50M+ downloads pairs with Claude Code for four weeks to clear hundreds of accumulated Xcode warnings. Notes on weekly scope, what to delegate, and the boundary where human judgment still wins.
Claude Code2026-04-02
to Parallel Development with Claude Code Worktrees
A practical guide to parallel development using Claude Code's worktree feature. Learn how to run multiple tasks simultaneously, isolate branches for safe development, and build powerful workflows step by step.
Claude Code2026-03-25
Claude Code Worktree — Maximize Productivity with Parallel Development
Master parallel branch development with Claude Code's --worktree flag. Work on multiple features simultaneously without switching overhead.
📚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 →