Skip to content
All guides
Guides Put your agent on a schedule Nightly maintenance

Nightly maintenance pass

Your knowledge base is only as useful as it is tidy. Over a busy week, notes pile up, loose thoughts land in the wrong place, and your agent's memory drifts out of date. A nightly maintenance pass reviews the day, files what's loose, and refreshes what your agent remembers — all while you sleep, so you wake up to a workspace that's organized, not a mess to wade through. No code, just asking.

Before you start

This pass edits real files. Set up Git first so every change is recorded and easy to undo — see See changes with Git. New to scheduled tasks? Set up a daily brief walks through the basics first.

How to set it up

1

Just ask, in plain language

Open your agent and describe the tidy-up you want each night. Naming it "knowledge base maintenance" explicitly helps the agent set up the right kind of task. Something like:

Every night at 2am, run a knowledge base maintenance pass: review the past day's notes and changes, file loose notes into the right folders, fix obvious typos and broken links, and update MEMORY.md — add anything important I learned or decided today, and revise or remove anything now stale or outdated.

The agent turns that into a scheduled task. You don't write the schedule — you describe it, and it sets it up.

2

Switch the task to Auto approval (do this, or it will stall)

This is the step people miss, and it's the one that quietly breaks overnight runs. When your agent creates a scheduled task, it sets that task's approval mode to Manual — meaning the task pauses and waits for you to approve things as it goes. That's fine when you're watching, but at 2am there's no one to click "yes," so the pass just sits there, stalled, until you notice hours later. And it isn't only file edits that trigger a pause — ordinary shell commands do too (more on that below), so "it only edits files, that's safe" isn't enough to keep it moving.

The fix is a one-time switch, and it has to be done by hand — the agent can't set it for you. Open the scheduled task itself in Claude Code (or Codex) and change its approval mode from Manual to Auto (in Codex, choose Approve for me). It's a per-task setting, so you set it once on this task and it holds. The next step (Git snapshots) is what makes running on Auto safe to trust.

Why Manual stalls on so much: for security, the harness will not auto-approve certain shell commands even with a broad allow-rule — anything it can't statically verify as safe. That includes commands chained with &&, ; or |, and — the sneaky one — any command containing a $, since $62 or $HOME reads as shell-variable syntax. A note file with a dollar amount in it, written through a shell command, is enough to make a Manual-mode task hang overnight. Auto approval clears this whole category. (If you write your own skills, you can also sidestep it by using the agent's built-in file tools instead of shell commands to write content — those aren't shell and never hit this wall.)

3

Have it commit before and after

Because this pass rewrites files, ask it to save a Git snapshot first and another when it's done. That way every overnight change is its own clean checkpoint you can review in the morning — and roll back in one step if a tidy-up went too far. See See changes with Git.

4

Know the one catch

Because it runs on your own machine, the task only fires while your computer is awake and the app is open. If your machine was asleep at 2am, it catches up once when you wake it. That's the trade-off for keeping everything on your own computer. If you want maintenance that runs even when your laptop is off, that's the always-on hosted path. Ask David.

5

Review the first few mornings

For the first week, glance at what it changed overnight before trusting it fully. Tell the agent what to do more or less of: "don't touch my journal," "be more aggressive about filing," "always ask before deleting." It adjusts the task. Once it matches how you like things kept, you can stop checking.

Good jobs for the nightly pass

  • File loose notes and inbox items into the right folders
  • Review the day's notes and changes, then update MEMORY.md — adding what's new and pruning what's stale
  • Fix broken links and obvious typos
  • Roll over unfinished tasks to tomorrow's planner

Stuck or need help?

Send a message and it comes straight to me. Tell me where you got stuck and I'll write back.

Rather have it done for you?

If following the steps yourself isn't how your brain works today, that's fine. On a Zoom call you share your screen and hand me control, and I set it up for you, right there on your own computer. You watch it come together and end the call with a working setup, nothing left on your plate.

Pick a time below. No pitch, no pressure, no homework beforehand.