Bugs pile up between sprints: a flaky test nobody reran, a linter warning that became an error, yesterday's new exception sitting in Sentry. Each one is a small job, and none of them is anyone's job tonight. Lark's Bug hunter makes them its job. Every night it pulls your latest code, runs the full test suite and linters, reads the top new errors from your error tracker, picks the most important real bug, fixes it on a branch with a test that proves it, and opens a draft pull request. Everything else it found is ranked in its report for the morning. Keeping the codebase healthy becomes a job the company does on its own, overnight, and you start the day with one PR to approve.
What the AI bug hunter does each night
The agent's instructions give it a fixed routine:
- Reads its notes. It keeps NOTES.md as its memory: what it checked, what it fixed, what's still open.
- Pulls the latest code.
- Runs the full test suite and the linters.
- Reads yesterday's top new errors, if an error tracker is connected (Sentry, logs).
- Picks the most important real bug among everything it found.
- Reproduces it, so it knows the bug is real before it changes anything.
- Fixes it on a new branch, with a test that fails before the fix and passes after.
- Pushes the branch and opens a draft pull request.
- Updates NOTES.md with what it checked, fixed and left open.
Why one bug a night
The agent fixes one bug per night, the most important one, and reports the rest. One reproduced bug with a failing-then-passing test is easy to review over coffee. The ranked list tells you what's next, and because the agent remembers what it has already reported, the next night starts from what's still open.
How it runs: a nightly schedule on a persistent machine
The Bug hunter wakes at 02:00 every night, in your time zone, with a cap of two runs a day. Each wake-up tells it to read NOTES.md, hunt (tests, linters, new errors), fix the most important real bug on a branch with a draft PR, report the rest and update its notes.
It runs on its own Linux machine in the cloud with a terminal and files. The machine is kept between runs, so your repository, installed dependencies and its notes are already there the next night. It doesn't start from a fresh checkout each night, and it can tell what's new since last time.
If it needs something only you can give (access, a decision), it asks. Questions reach you by Slack, email or text, and you answer in a tap. You can also start a hunt on demand any time.
What you get back in the morning
A draft pull request on its own branch, with the fix and the test that proves it.
Its final message:
- The bug it fixed: what broke, the cause, the draft PR link and the test that proves it.
- Everything else it found, ranked, one line each, with where it is and how bad.
- Nothing new? One line saying so.
It's the kind of report that pairs well with a morning brief from your dashboards: one tells you what changed in the business overnight, the other what broke in the code.
Setting up the bug hunter in Lark
- Open the Agents page and pick Bug hunter under Ready-made agents. The form opens with its instructions and nightly schedule filled in.
- Fill in the blank at the end of its instructions: your repository.
- Connect GitHub so it can pull the code, push branches and open draft PRs. If you use an error tracker such as Sentry, connect it too so it can read yesterday's new errors. Without one, it works from tests and linters.
- Turn the schedule on. It starts paused until you do.
You can pick the model and the agent it runs with (it uses Claude Code by default). The docs cover starting and streaming runs from your own code.
Guardrails
- It never pushes to the main branch. Every fix goes on a new branch.
- Its pull requests are drafts. A person reviews, marks ready and merges.
- It fixes real bugs only. It reproduces a bug before fixing it, and the fix comes with a test that fails before and passes after.
- It reports what it doesn't fix, ranked, so nothing it found is dropped.
Costs
Lark runs on credit. Free includes $1 of agent credit a month; Pro is $29 a month and Team $99, and all of it comes back as credit. Credit pays for the AI model and machine time each run uses, at the providers' prices plus 20%. Plan details are on the pricing section.
Every run shows its cost live as it works. A monthly budget stops your agents exactly where you set it, and the schedule's cap of two runs a day keeps a nightly agent nightly. Read how much AI agents cost to run for how the pieces add up.
FAQ
Can an AI agent fix bugs while I sleep?
Yes. The Bug hunter runs every night at 02:00, finds bugs from your tests, linters and error tracker, and fixes the most important one on a branch with a draft pull request. You review it in the morning.
Does it read errors from Sentry?
If an error tracker is connected (Sentry, logs), it reads yesterday's top new errors as part of the hunt. If none is connected, it hunts with your test suite and linters.
Will it merge its own fixes?
No. It opens draft pull requests and never pushes to the main branch. A person decides what gets merged.
How is this different from a CI fixer?
The Bug hunter runs on a schedule and looks for bugs across tests, linters and errors. The CI fixer runs when a GitHub Actions run fails and fixes that failure. You can run both.
Want a bug fixed and waiting for review tomorrow morning? Start free.