Have Claude Code refactor code while you step away

A developer left Claude Code alone on a refactor for 40 minutes, then confirmed the change by checking the tests and the diff.

Done with Claude Code· Intermediate· Aug 2026

What they did
They assigned Claude Code a refactoring task and let it continue without supervision for roughly 40 minutes. On return, the updated code was in place and the test suite was green. In comments, other users described ways to make this easier to audit, such as running the agent under a limited account and checking the git diff afterward. They also mentioned Claude Code hooks and session JSONL logs as a way to piece together what files were opened and which commands ran.
How it went
The refactor completed successfully and the tests passed. The downside was that the developer still lacked a clear record of the agent’s path through the work, including whether it viewed sensitive files or contacted anything outside the repo.
Tips
If you use this approach, plan for a separate review of diffs and logs once the run ends. For actions that could alter files, delete content, or reach outside the repo, make the agent wait for your approval first.

Try it yourself with Claude Code

You are working in [repo or code area]. Update [specific module or feature] so that it [desired outcome]. Proceed on your own, but pause and ask me before any irreversible step, including deleting files, applying changes I need to approve, sending anything out, or making external requests. While you work, keep a brief note in [PROGRESS.md or similar] listing each change and the reason for it. Check [test command] after each major change. When you are done, report the files you edited, the tests you ran, and any parts that would benefit from human review.

Fill in the [brackets]. Agents can make mistakes, so review anything before it is sent, paid or deleted.

Get 3 agent uses like this every morning

With the day's top AI news. Free, and one click to unsubscribe.