How I Taught My AI Coding Agent to Stop Undoing My Design Decisions A developer using Claude Code built a system of lightweight Architecture Decision Records (ADRs) wired into the AI agent's context to stop it from reverting deliberate design decisions. The agent had repeatedly 'fixed' intentional code patterns, such as polling instead of webhooks, causing regressions. By adding a Scope field with file globs and explicit forbidden actions, the agent stopped relitigating settled decisions for six months across several projects. My AI coding agent kept "fixing" things I had broken on purpose — reverting deliberate design decisions back to textbook defaults, over and over. The fix wasn't better prompting. It was giving the agent a memory of why decisions were made: lightweight Architecture Decision Records ADRs wired directly into its context. Six months later, the agent hasn't relitigated a single settled decision. Here's the exact setup, the format that works, and 5 lessons. 🚀 I run a fully autonomous implementation system — an AI agent built on Claude Code that picks up tasks, writes code, runs tests, and opens changes for review with minimal supervision. It's been running for months across several projects, and most of the time it's great. But there was one failure mode that drove me up the wall. Every codebase accumulates decisions that look wrong unless you know the history: To a fresh pair of eyes, every one of these looks like a bug. And an AI agent is permanently a fresh pair of eyes. So my agent would touch a nearby file, notice the "obviously wrong" pattern, and helpfully modernize it. Polling → webhooks. Sync writes → async. Old pin → latest version. Each individual change looked like a competent refactor. Each one reintroduced a bug we'd already paid for once. The worst part: it wasn't random. It was recurrent . The agent has no episodic memory across sessions, so it rediscovered the same "improvement" every few weeks, like a groundhog day of well-intentioned regressions. My review load wasn't "check the new feature" — it was "re-argue settled decisions with someone who forgot the argument." I tried the obvious fix first: I stuffed rules into my CLAUDE.md the instruction file Claude Code loads at session start . "Do not change the polling integration. Do not make file writes async. Do not upgrade dependency X." It sort of worked, and completely didn't scale: The insight that unlocked it: the agent didn't need more rules . It needed the history — the same thing a new human teammate needs. And software engineering already has a boring, 15-year-old tool for exactly this: Architecture Decision Records. An ADR is just a short markdown file recording one decision: context, decision, consequences. Humans have used them forever. It turns out they're an almost perfect memory format for AI agents — if you make three adjustments. Here's my full template. Note the Scope field — that's the load-bearing addition for agents: ADR-014: Use polling, not webhooks, for order-sync integration Status: accepted 2026-03 Scope: src/integrations/orders/ , src/jobs/order poll Decision We poll the vendor API every 30s instead of subscribing to webhooks. Context Vendor webhooks silently dropped ~2% of events under load confirmed with vendor support, ticket from our March incident . Missed events caused unfulfilled orders. Polling is chattier but lossless — the poller reconciles against a cursor, so nothing is missed. Consequences - Accept ~30s max latency on order sync. This is fine for our SLA. - Do NOT "upgrade" this to webhooks, even as a fallback layer. A hybrid was tried; it doubled the failure modes. Revisit if Vendor ships webhook delivery receipts / retry semantics. The agent-specific adjustments: Scope is a glob, not prose. src/integrations/orders/ is checkable in one line. Consequences states the forbidden action explicitly Revisit if keeps the decision honest. Don't paste ADRs into your prompt. The whole point is keeping per-session context small. My CLAUDE.md contains only this: Design decisions MANDATORY Settled decisions live in docs/adr/. INDEX.md maps file globs to ADR numbers. Before modifying any file: 1. Check INDEX.md for globs matching the file. 2. Read the matching ADRs before writing code. 3. Never revert or work around an accepted decision. If your task conflicts with one, STOP and flag the conflict in your summary instead of coding around it. 4. If you make a new non-obvious design choice, append a draft ADR Status: proposed and add it to INDEX.md. And docs/adr/INDEX.md is a ~30-line lookup table: | Globs | ADR | |--------------------------------|-----------------| | src/integrations/orders/ | ADR-014 | | src/storage/writer | ADR-009 | | package.json dep: serializer | ADR-011, ADR-017| The flow, end to end: php flowchart LR A Task assigned -- B Agent checks INDEX.md