Rethinking Claude Code Best Practices: Lydia Hallie on Getting Out of the Loop Safely

AI Engineer 2026: Anthropic Talks
21 parts- 1Claude for Long-Horizon Tasks: Lance Martin's Four Rules for Agents That Run for Hours
- 2Inside the Claude Managed Agents Workshop: Pets, Cattle, Outcomes and Dreaming
- 3How Anthropic Builds: Mike Krieger on Being Unreasonable With Claude
- 4How Jarred Sumner Ships Millions of Lines of Agent-Written Code
- 5A Field Guide to Fable: Thariq Shihipar on Unhobbling Claude and Finding Your Unknowns
- 6Claude Tag Lands 65% of Anthropic's Product PRs: Takeaways From Cat Wu and Thariq Shihipar
- 71,000 Claude Agents, Git and a Database: How Fable 5.2 Formalized Fermat Without a Custom Harness
- 8Your Old Prompts Are Making Claude Worse: Lance Martin's Checklist for Frontier Models
- 9Why One Agent Isn't Enough: Anthropic on Flows, UltraCode and Running 1,000 Agents
- 10Tokens Should Have Jobs: Anthropic's Case for Advisors, Graders and Dreamers
- 11Give the Agent a Budget, Not a Token: Anthropic's CI Team on Safe Agent Permissions
- 12Rethinking Claude Code Best Practices: Lydia Hallie on Getting Out of the Loop SafelyCurrent
- 13How Anthropic Merges 30,000 Code Changes a Day: Addy Osmani on Verifying the Software Factory
- 14Using LLMs to Secure Source Code: Eugene Yan's Six-Step Pipeline From Anthropic
- 15From Messages API to Managed Agents: Anthropic's Applied AI Team on Harnesses That Go Stale
- 16Forward Deployed Engineering 101: When Your AI Startup Needs FDEs, From Palantir to Anthropic
- 17The Enterprise Tech Stack for AI Agents: Why Your POC Stalls and How to Design Past It
- 18The Claude Certified Architect Exam as a Field Guide to Agentic Engineering
- 19The Future of MCP: David Soria Parra on Connectivity, Progressive Discovery and Skills Over MCP
- 20Gateways Are All You Need: How Anthropic Thinks About MCP in the Enterprise
- 21How to Build Agents That Run for Hours: Anthropic's Planner, Generator and Evaluator Harness
TL;DR
Lydia Hallie of the Claude Code team on how best practices moved from the human to the model, harness and environment: auto mode, deny rules, sandboxes, exit-code-2 hooks and orchestrators.
Lydia Hallie works on the Claude Code team at Anthropic. Their AI Engineer talk, which they re-recorded at home after technical difficulties on stage, answers a question every heavy Claude Code user is hitting: the best practices from earlier in the year were about steering, approving and checking. If you are no longer in the loop for any of that, what replaces you?
Their answer: nothing disappeared. Each practice moved to the model, the harness or the environment.
Source: Rethinking Claude Code Best Practices, Lydia Hallie, Anthropic, AI Engineer. For exact settings syntax, use the Claude Code docs.
Then and Now#
Early in 2026 a typical session used Opus 4.5. It was good for its time but stopped early, needed constant correction, and accumulated "IMPORTANT!" lines in CLAUDE.md. Without auto mode, you either approved every command or took the risky route of skipping permissions entirely.
Now, at least inside Anthropic, sessions look different: dozens running in parallel for hours, verifying their own results, some orchestrating others. Engineers have become managers of sessions. Hallie cites Anthropic's post about going from roughly 2,500 changes a day in May to more than 30,000 a day in September (covered in Addy Osmani's talk on how Anthropic merges 30,000 changes a day).
The old best practices were about steering sessions, approving commands, restricting what Claude could do, checking output and starting sessions. Wherever you step out of that loop, something else must take over.
Step 1: Use Today's Defaults#
Start by updating the defaults: Opus 5.5 (their daily driver; Fable 5.2 had just launched) and auto mode, which Anthropic made the default permission mode in August.
Then clean up CLAUDE.md. Emphatic "IMPORTANT" and "NEVER" lines written for older models can now send the model off track, causing more tool calls and worse results. CLAUDE.md should contain only what Claude cannot see from the code, like a service that still depends on a legacy source not referenced anywhere. Your stack and where to look are discoverable. They point to a prompt-audit command in Claude Code that checks CLAUDE.md and skills against what the current model no longer needs. This echoes Lance Martin's talk on old prompts making Claude worse.
Tune auto mode in plain English#
Auto mode runs a separate classifier on almost everything other than reading and editing project files. It allows obviously safe commands like running tests or installing dependencies and blocks ones it is unsure about. By default it trusts only the current folder and repo, so "ship this to staging" might be blocked when it needs to push to a deploy repo.
If you are approving a lot even in auto mode, configure it in your settings in plain English: which repos, buckets and domains you trust, and what it should always allow or never do. That text is what the classifier sees. More detail in our auto mode explainer.
Step 2: Keep It Safe#
Getting out of the loop is easy. Making it okay that you are gone is the hard part.
Auto mode is better than you, but not a guarantee#
Hallie cites an Anthropic study from August: when humans were in the loop, only about 14% caught a clearly dangerous command. Auto mode blocked 89%. Far better than people, but about one in ten still got through. Guarantees only come from the harness.
Deny rules still matter#
A deny rule is checked before the auto mode classifier; a tool call matching a deny rule never reaches it. Their rule for deciding what needs a deny rule mirrors the undo test from Sachin Malhotra's budget, not a token talk: if Claude gets this wrong once, can I take it back? Wrong code can be reverted, so leave it to the model. Discarding uncommitted changes, or reading a secret into the transcript, cannot be undone, so it should be a rule. Example: auto mode is fine with reading .env by default. If you never want that, add a deny rule. See also deny instead of prompting.
Permissions cannot see side effects; sandboxes can#
npm test is a normal command and auto mode runs it. But it executes code you did not write: dependencies, or a quick script Claude wrote. A compromised dependency could read .env or your SSH keys and send them to an unknown server. A human approver would have clicked allow too, because there was nothing visible to refuse.
Permissions decide whether a tool call runs. They cannot limit what it reaches once running. A sandbox can: the operating system enforces which files a command may read, which folders it may write and which hosts it may reach, including for every child process. With sandboxing on, the same deny rule is passed down to the OS, so when the dependency tries to open .env, it simply cannot. By default most of the machine is still readable, so add rules for things like SSH keys.
For long runs, use a cloud session#
The sandbox covers shell commands, but Claude Code's own files, MCP servers and hooks still run on your machine. The cleanest option for multi-hour work is a cloud session: its own machine, a fresh clone of the repo, and it keeps running with your laptop closed. Secrets like .env, SSH keys and your GitHub token are not there because they are not in git. If the task needs an API key, add it as a network secret so it can be used without being sent to the model. Network access defaults to package registries and GitHub; add other domains explicitly.
The machine is disposable, but what leaves it is not: pushed commits, messages sent through connectors. So keep auto mode and commit your deny rules to the repo so they come along, to catch things like force pushes or secrets in commits.
Step 3: Verify#
When you approved every step, you knew the work was good because you had seen every change. Now Claude works for hours and you will not read every file.
Even with a clear prompt, Claude makes many small decisions. Ask it to move auth to a new API and one run might leave the old API in place, another might only migrate new logins, and a third might log everyone out. All plausible. The fix is verification points along the way: anything that returns pass or fail, such as tests, a build or a screenshot. Reviewing those is much faster than reviewing the full diff, and a run that logs everyone out never gets past the first check.
Ways to set them up, from soft to hard:
- In the prompt: describe what done looks like, ask Claude to split work into tasks each with its own tests, and ask it to show you actual output since you were not there.
- Hooks, for checks that must run: lint on every file edit, run the relevant tests when a task is marked complete (touching auth means passing auth tests), and run the full suite before the session ends.
The gotcha they highlight: most tools exit with code 1 on failure, but a hook exiting with 1 lets Claude Code mark the task complete anyway. Exit with code 2 to send Claude back to fix it. See the hooks reference for exact behavior.
Step 4: Scale Out With CI and an Orchestrator#
With cloud sessions, each run has its own machine, so you do not have to juggle worktrees. You still start and review each session yourself, which is already a good place to be.
The next step is making CI the thing that checks every PR, no matter how the session was set up. With CI autofix, Claude sees failing checks and fixes them, so your review time is not spent on what a check could catch. For low-risk changes you can enable merge-when-ready so GitHub merges once checks pass.
On Hallie's team, every PR is first reviewed by Claude, not the session that wrote it, with fresh context and a separate group of agents double-checking each bug it finds. Then human review scales with risk: docs and copy changes need no person once checks are green, ordinary product changes get one reviewer, risky changes get two.
Finally, stop starting sessions yourself. Claude Code projects, in beta, give you one orchestrator session: you say what needs doing, it splits the work and starts a session (a "thread") per task, verifies what comes back, and sends unfinished work back. You talk to one session instead of eight. Use a model good at judgment for the orchestrator, like Fable, and a model good at doing the work for threads, like Opus 5.5; you can set them separately. Context management is handled for you.
Where Each Old Practice Went#
| Old best practice | Who does it now |
|---|---|
| Steering the session | The model |
| Approving commands | Auto mode, plus your deny rules |
| Restricting what is possible | The environment: sandbox or cloud session |
| Checking the output | Tests, hooks and CI |
| Starting sessions | An orchestrator session |
Their suggested experiment: take one task much bigger than you would normally give Claude, make sure CI catches what you care about, spend time configuring the environment (network access, secrets, setup scripts), start it in the cloud, and watch where it gets stuck or pulls you back in. That is the next thing to hand over.
Our Take#
This is the best single summary of how Claude Code usage has changed in 2026. The table above is worth pinning. The two details most people get wrong are both small: deny rules for irreversible actions are still essential even with auto mode, and hook scripts must exit with code 2 to actually block completion.
FAQ#
Do I still need deny rules if I use auto mode?#
Yes. Auto mode blocked about 89% of clearly dangerous commands in Anthropic's study, not all of them. Deny rules are checked before the classifier and are the only guarantee for actions you cannot undo.
Why does my Claude Code hook not stop a task from completing?#
If the hook script exits with code 1, Claude Code can still mark the task complete. Exit with code 2 to send Claude back to fix the failure.
What should go in CLAUDE.md now?#
Only what Claude cannot discover from the code itself, such as hidden dependencies or legacy systems not referenced in the repo. Emphatic instructions written for older models can hurt results.
Sources#
- Rethinking Claude Code Best Practices - video
- Claude Code documentation
- Claude Code hooks reference
- Auto mode safety evaluations and default rollout
The Full Series#
This post is part of our coverage of Anthropic's talks at AI Engineer 2026:
- Claude for Long-Horizon Tasks: Lance Martin's Four Rules for Agents That Run for Hours
- Inside the Claude Managed Agents Workshop: Pets, Cattle, Outcomes and Dreaming
- How Anthropic Builds: Mike Krieger on Being Unreasonable With Claude
- How Jarred Sumner Ships Millions of Lines of Agent-Written Code
- A Field Guide to Fable: Thariq Shihipar on Unhobbling Claude and Finding Your Unknowns
- Claude Tag Lands 65% of Anthropic's Product PRs: Takeaways From Cat Wu and Thariq Shihipar
- 1,000 Claude Agents, Git and a Database: How Fable 5.2 Formalized Fermat Without a Custom Harness
- Your Old Prompts Are Making Claude Worse: Lance Martin's Checklist for Frontier Models
- Why One Agent Isn't Enough: Anthropic on Flows, UltraCode and Running 1,000 Agents
- Tokens Should Have Jobs: Anthropic's Case for Advisors, Graders and Dreamers
- Give the Agent a Budget, Not a Token: Anthropic's CI Team on Safe Agent Permissions
- How Anthropic Merges 30,000 Code Changes a Day: Addy Osmani on Verifying the Software Factory
- Using LLMs to Secure Source Code: Eugene Yan's Six-Step Pipeline From Anthropic
- From Messages API to Managed Agents: Anthropic's Applied AI Team on Harnesses That Go Stale
- Forward Deployed Engineering 101: When Your AI Startup Needs FDEs, From Palantir to Anthropic
- The Enterprise Tech Stack for AI Agents: Why Your POC Stalls and How to Design Past It
- The Claude Certified Architect Exam as a Field Guide to Agentic Engineering
- The Future of MCP: David Soria Parra on Connectivity, Progressive Discovery and Skills Over MCP
- Gateways Are All You Need: How Anthropic Thinks About MCP in the Enterprise
- How to Build Agents That Run for Hours: Anthropic's Planner, Generator and Evaluator Harness
Continue Reading#
Get the next comparison like this in your inbox
One email a week on Anthropic and the rest of the AI dev stack. Free.
Read next on Claude Code
Claude Code Auto Mode Explained: Permissions Without Prompts
Claude Code auto mode swaps permission prompts for a background safety classifier. How the Shift+Tab cycle, hard_deny rules and glob deny patterns fit together.
8 min readClaude Code denyInsteadOfPrompting: Deny Permission Prompts Everywhere
Claude Code 2.1.319 adds permissions.denyInsteadOfPrompting: any call that would wait on a permission prompt is denied and the turn carries on, subagents included.
6 min readHow Anthropic Merges 30,000 Code Changes a Day: Addy Osmani on Verifying the Software Factory
Addy Osmani of Anthropic and Manish Kapur of Sonar on going from 2,500 to 30,000 merged changes a day: light vs dark software factories, evidence-based review and earned autonomy.
7 min readTechnical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.





