r/ClaudeCode • • 2d ago

Built with Claude I've got six scheduled Claude Code routines maintaining a production app. Setup, and what broke.

I run a production web app alone, and for about a month Claude Code has been doing the maintenance on a schedule. I don't read the diffs (for better or worse).

Each job is its own cloud routine with its own prompt. There's one that watches production and files GitHub issues, a fixer that picks those up, a builder for small backlog stuff, and a few housekeeping ones (one checks the backlog against the actual code every morning).

Prompts live in the repo, one file per routine, and the routine reads its file from main when it starts. Didn't start that way - I had them pasted into the routine config, and the two copies drifted.

What's helped most (I think) is a lessons file. When something breaks and the cause is general, it gets written down with a line saying when it applies. Before the fixer touches anything, a script hands it just the lessons that match the files it's about to edit. The whole file's ~70 KB now, so having every run read all of it was a waste of context. Lessons that keep getting cited get promoted to rules. The ones nobody cites expire.

Did the same thing for decisions I've made - small files, and the agent only gets the few that match, so it doesn't reopen something I already settled. I count how often I get asked the same question twice. Still happens.

Now the honest part. One of the scheduled routines ran against the wrong branch (twice!) and its daily report looked fine both times. So now there's a check on the checker, which feels a little silly but it's needed. And there's a written list of stuff that always stops and waits for me - billing, security, sign-in, anything that spends model tokens, the tests themselves. I'm not taking anything off that list anytime soon.

The video's one real bug going through it on Nov 23. It's a replay of the record, sped up (not live). 19 minutes filed to closed, didn't touch it.

2 Upvotes

11 comments sorted by

•

u/AutoModerator 2d ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/shetritr 2d ago

the wrong branch one is the classic. the report looked fine because the model wrote it. have a script stamp the first line instead: branch, sha, and how far behind main it is. then wrong branch is visible before you read a word of the summary

1

u/gratajik 2d ago

Yeah, that was a painful one. My clue SHOULD have been the first time, when 19 days went by without any reported issues... obviously disconnected from reality.

1

u/shetritr 2d ago

19 days of silence from a watcher is the tell, yeah. worth a dead man's switch on it: if the watcher files nothing for 3 days, the routine itself is the issue and you get pinged

1

u/SwayneDoodz57 2d ago

if the model has write access to the report file after the script runs, itll sometimes accidentally overwrite that top header when formatting its output

1

u/shetritr 2d ago

fair, so stamp it last, after the model is done, or write it to a separate file it can't touch. the point is the model never holds the pen for that line

2

u/PestiferousGamer 2d ago

Can it make cookies? I like cookies.

1

u/gratajik 2d ago

Hmmm... cooookieeess.. :)

Well, virtual. There's a way users can provide feedback on the site. I can then approve it as a feature (can add to it, but otherwise a single click). So "make a screen with animated realistic cookies" would make The Forge... make cookies!

1

u/ainexfinder 2d ago

The lessons file keyed to file paths is a nice idea. One thing to watch is renames and moves: a lesson tied to a path that no longer exists just stops matching, and from the outside that looks the same as a lesson nobody cites, so it expires for the wrong reason. A small check that flags lessons pointing at missing paths before expiry catches that.

Same idea for the stop-and-wait list. If it only lives in the prompt, it holds until the model decides an edit isn't really "billing". Putting those paths behind CODEOWNERS or branch protection, so the routine can open a PR but can't merge it, makes the list hold even when the model reads it differently.

1

u/VigiliaFounder 2d ago

19 minutes from filed to closed without touching it, that's a great result! Thanks for sharing the whole setup, the lessons file is a really nice idea.

Where I can help: your watcher routine could start from what real users actually hit. Vigilia catches every error in your live app, with the evidence, how many times it happened and a fix prompt.

Your fixer can just connect the MCP server and pull it all in. After you deploy and mark it fixed, Vigilia watches real traffic and tells you if the fix held, a nice extra check on the checker.

Happy to hear how it goes!

1

u/Unusual-Albatross43 2d ago

the 19 quiet days bit me from the other side. my scheduled jobs are told to send nothing when there's nothing to report, because i had stopped reading "all good" messages. that works until a job doesn't run at all. one evening run died on a usage limit and i only found out the next morning, because silence was the normal case.

i don't have a clean fix yet. the next run happened to notice the gap, which is luck more than design. shetritr's dead man's switch is probably the thing i'm missing, quiet and dead need to look different somewhere, just not in my chat.

one more from the same family: a check script of mine sent stderr to /dev/null. it crashed, the output was empty, and empty read as "nothing found". so i stopped hiding errors in anything whose result is "no news".

how do the lessons expire, by time since the last cite or by a count?