How this helps you
Maintenance happens every night instead of in rare clean-up sprints.
Every night at [time], audit [repo] for [audit type]. For each improvement, start a cloud agent to make the change on its own branch and open a PR with proof: tests passing and [proof]. Keep each PR small and focused. Don't merge anything. In the morning, send me a list of PRs with one line each on what changed and the risk.
Fill in: [time] is a quiet hour, such as 3 a.m. [repo] is the repository. [audit type] is dead code, bundle size, security, build time, translations or parity. [proof] is what you need to trust it, such as before and after screenshots.
What they did
In the official Grok Bot for Engineering guide, Lingxi Li, who builds Grok Bot, describes nightly audits. Every night at 3 a.m. her engineer Bots clean up the codebase: improving code quality, removing dead logic, speeding up app load time and reducing bundle size. Each morning she gets a fresh set of PRs, which turned maintenance into a daily routine. Her other audit ideas: security audits, CI/CD build-time audits, internationalisation audits for features shipped in one language, parity audits between clients such as iOS and desktop, and catch-up audits that summarise PRs merged in the last 24 hours. Her Bots start Cursor cloud agents for the work and check the proof attached to each PR, and a PR is only merged automatically when the review is highly confident and the blast radius is low; otherwise she reviews it.
Who it's for: Engineers and small teams with a codebase that needs regular tidying.
Before you start
- A GitHub repo your Bot can open PRs on.
- Cursor cloud agents available to your Bot, or a coding CLI on its computer.
- Branch protection or Auto-review rules so nothing merges to main without your rule allowing it.
How to try it
- Pick one audit type to start, such as dead code or bundle size.
- Run it once by hand with the prompt below and review the PRs it opens.
- Tighten the instructions: what counts as safe, what proof each PR needs (tests, before and after screenshots).
- Turn it into a nightly routine at a quiet hour.
- Decide your merge rule. Lingxi only lets high-confidence, low blast radius PRs merge automatically; start with none.
- Add a second audit type only once the first runs cleanly for a week.
What to expect
A morning list of three to five small PRs, each with a one-line summary, risk note and proof attached.
Common mistakes
- Starting with auto-merge. Earn it audit by audit.
- One giant PR per night instead of small, reviewable ones.
- Running several audit types at once before any of them is reliable.
Related tips
- Run Claude Code or Codex on your Bot's computer with your own plan: Your Bot's computer has a terminal, so it can install a coding CLI, you sign in once, and your Bots can use that subscription from anywhere.
- Watch coding work live and get recordings back: With Cursor connected, your Bot links you to the cloud agent live and sends screenshots and screen recordings.
- What actually stops a coding Bot (and what is only advice): Of 15 operations tested, only a merge to main hit a hard stop. Skill-file rules are only advice.
- An ops Bot that runs postmortems and daily 1:1s with your Bots: When a Bot makes a mistake, an ops Bot finds the cause, updates the shared playbook and tells the others.
Worth knowingOfficial guide on x.ai, written by an engineer on the Grok Bot team. Paraphrased by us; read the guide for her P0 urgency routine and other tips.Next in Routines →Make your first task boring
Learn more: Grok Bot Routines Not Working? Do It by Hand, Save a Skill, Then Schedule · All Grok Bot routines tips