Build a Codebase That Compounds With Each New AI Agent
Daniel Pyrathon
Software Engineer at Farcaster • Founder of Bountycaster
Jul 28, 20252 min read
Build a codebase that compounds with each new AI agent
Every month a shiny new agent framework drops. I used to chase them. It didn’t make me faster.
What did help was hardening my repo. If you spend ~20% getting the basics right, every new model/agent feels like a free upgrade instead of a week of upgrading. Here’s the short list I’d set up on any fresh project.
- Strict types / hints — Flip on strict modes (TypeScript, Python, Go, Rust). Clear contracts = better suggestions and safer edits. You’ll feel this the first time an AI refactor doesn’t explode.
- Schema validation at boundaries — Validate all external IO especially on third party APIs (Zod, Pydantic, Serde). Fail fast so the model fixes to the contract instead of guessing. Silent shape‑drift is where weekends go to die.
- Linters & formatters in CI — ESLint/Prettier/Ruff catch drift early. One style, smaller diffs, less “why did this file change?” noise for you and the model.
- Docs as context — Short docstrings and inline notes turn into high‑signal prompts. I ask questions first, code later: Ask First, Code Later.
- Well‑known frameworks — Rails, Django, Next.js come with years of patterns. The AI has seen those patterns. You’ll both argue less about basics.
- Git worktrees — Spin up a worktree per experiment. Parallel branches, no context collisions, easy side‑by‑side diffs. Great when an agent is “trying things.”
- Voice dictation — Talking is faster than typing when you’re iterating (I use Aqua Voice). Ask, tweak, re‑run. It keeps you in flow.
- Small, isolated branches — Treat most work as single‑player; pull humans for risky stuff (auth, money, migrations). More here: Single‑Player PRs.
Why this works
Models do better when the world is boring and explicit: strong types, strict schemas, consistent style, scoped changes. You get faster loops, fewer “mystery” regressions, and explanations you can actually trust.