AgentRecipes
Recipes › Engineering & security

How to let scheduled Claude Code routines maintain an old SaaS with one PR per change and reviewed, batched deploys

Engineering & securityClaude Code✓ Confirmed by source

Confirmed by source: First-hand production account by Preceden's founder (Matt Mazur) of a live paid SaaS, with per-category PR counts, deploy and revert record, guardrails and the full list of tool access; self-reported, and revenue impact not yet measured. (checked 2026-10-20)

The problem

A founder no longer has time for a 17-year-old Rails side project, so small bugs, missing tests, stale support docs and SEO fixes pile up. He wants agents to keep improving the live product around the clock without risking billing, auth, data or uptime.

Tools needed

Step-by-step recipe

  1. Split the work into role agents, each a scheduled routine that starts a fresh session with its own written playbook: an hourly SEO agent capped at two changes per run, an hourly code agent offset by 30 minutes, a nightly dependency agent (one bump per night, security alerts first, only releases at least 14 days old), daily listings and rank-tracking agents, and a weekly retro agent that audits the others.
  2. Write shared hard limits every agent reads: no billing, authentication or email logic, no schema changes except indexes, a size cap per change, and a kill-switch file that stops everything.
  3. Make every change its own branch and pull request into a dev branch, never master. Bug fixes must include a test that fails before and passes after, and a security review runs before each merge; any finding halts the system until the owner looks.
  4. Run a deploy agent twice each weekday while the owner is around: it opens a dev-to-master PR, runs the full test suite, a Claude security review of the whole batch, an independent Codex CLI review and required CI, then deploys through the hosting API and watches logs and Sentry for 30 to 45 minutes, ready to revert the entire batch.
  5. Keep all state in plain files: a ledger entry per run (a run cannot finish without writing it), an idea bank, read-back notes to check later whether an SEO change worked, and a lessons file that is distilled into shared rules. Add mechanical safety: atomic locks between agents, a nightly job that reconciles merged PRs against the ledgers, and agents that stop a hung sibling.
  6. When an agent needs a decision it files an 'ask' with context, options and a recommendation. One morning Slack message says how many are waiting; each answer becomes a standing directive every agent reads first, so the same question is not asked twice.
  7. Give read access to the services the product depends on (database read-only, logs, errors, search data, support tickets) so agents can size and verify problems, but turn anything that writes production data into a script the owner runs himself, with at most a narrow, guarded exception.
  8. Start small: one daily routine that opens one PR with an improvement of its choice, review it, nudge it when it drifts, and only then add agents and permissions as your risk tolerance allows.

Copyable prompt

Prompt template
Set up a scheduled routine for [REPO] that runs [HOURLY/DAILY] in a fresh session.
Playbook for this agent ([ROLE, e.g. code agent]):
1. Read [RULES FILE] and [STANDING DIRECTIVES FILE] first. Stop immediately if [KILL SWITCH FILE] exists.
2. Pick at most [N] small improvements from [IDEA BANK] or from [SIGNALS: Sentry errors, failing pages, support tickets].
3. Never touch [OFF-LIMITS AREAS, e.g. billing, auth, email, schema changes other than indexes]. Keep each change under [SIZE CAP].
4. For a bug fix, first write a test that fails, then make it pass.
5. Put each change on its own branch and open a PR into [DEV BRANCH]. Never push to [MAIN BRANCH].
6. Before finishing, append a ledger entry to [LEDGER FILE]: what changed, why, how you verified it, PR link.
7. If you need a decision, write an ask to [ASKS FILE] with context, options and your recommendation, then stop that item.

Original template written by our AI agent for AgentRecipes, not copied from the source. Replace the [BRACKETS] and {{variables}} with your own values and test before relying on it.

What the builder reported

Over about a month the routines shipped 1,531 PRs to Preceden, mostly support article improvements (437), test coverage (392), Ruby bug fixes (162), dead code removals and refactors (144) and JavaScript fixes (113). There were 20 batched deploys of 5 to 275 changes each, none reverted, across roughly 1,000 ledgered runs, 67 asks and 25 standing directives. The author reports no downtime, no security issues and no bug reports caused by the changes. He expects an MRR impact but has no figures yet.

These are the source author's own claims. AgentRecipes has not run this recipe itself.

Watch out for

Source

Original write-up: X (2026-09-21) ↗

Found via AI Use Cases for Business: “Scheduled Claude Code Routines Shipped 1,531 PRs to a 17-Year-Old SaaS in a Month”. This recipe summarises the source in words written by our AI agent; read the original for the full details. Link last checked 2026-10-20.

More engineering & security recipes

Review agent-written pull requests with layered AI review and risk-based human approvalOnce coding agents open pull requests, there are far more changes than people can read line by line, but skipping review lets bugs and…Claude Code✓ Confirmed by sourceRewrite a critical production service with Claude Code behind a black-box test harnessA high-throughput background service is becoming a bottleneck and paging on-call, but rewriting it by hand is slow and risky, and…Claude Code✓ Confirmed by sourceShip vendor recipe prompts so coding agents integrate your API the way you wouldDevelopers ask coding agents to add a vendor feature from public docs alone; the agent often picks the wrong product surface, burns…Claude Code✓ Confirmed by source

New agent recipes in your inbox

A short email with the newest automation recipes, each linked to its real-world source. No spam. Every email has a one-click unsubscribe link.