I run a small business on a dashboard I wrote myself. It runs on a PC in my room — no server bill, no managed database — and an AI agent edits it almost every day.
That setup broke in interesting ways. Every guardrail below exists because something went wrong first. After two months, these five are the ones I would put in on day one if I started again.
1. Split "deciding" from "touching"
src/lib/tasks-core.ts decides. pure functions, no fs, no fetch, no clock src/lib/store.ts touches. reads and writes files src/app/api/tasks/route.ts connects the two
Enter fullscreen mode
Exit fullscreen mode
A pure function takes the current time as an argument instead of calling Date.now() . That sounds like a style preference until you hand the code to an agent.
Two things change:
Tests stop needing setup. No mocks, no temp directories — a decision function is called with values and checked against values.
You can scope what the agent sees.…