# Automated Guard Rails Should Match Mechanical Verifiability ## Claim Automated code-quality checks earn a place in an AI agent's edit loop only when they're fast enough to run on every iteration and scoped to problems a tool can mechanically verify, leaving judgment calls for human review. <!-- atomicity: 1 idea ✓ --> ## Scope & conditions - Holds for any automated gate — linting, duplication detection, type-checking — wired into a fast iteration loop, whether the loop belongs to a human, an agent, or CI. - Breaks down if the "mechanically verifiable" scope creeps into judgment calls the tool isn't equipped to make — "is this the right abstraction," "is this the right feature" — which a duplication detector or static analyzer has no way to assess. - Speed is the load-bearing property, not the specific tool: a two-minute check gets run once a day at best; a two-second check becomes a real feedback loop. ## Evidence Pairing a fast, language-agnostic duplication detector (jscpd) with a fast PHP static analyzer (Mago) inside a single fail-fast script an AI agent runs after every edit lets the agent catch and fix its own repeated boilerplate and type/logic errors before a human ever reviews the diff. The explicit caveat built into the source: the tools "only see in black and white" — they flag coincidental matches as clones and can't judge whether an abstraction is premature, so a human override is sometimes the right call. The mechanism only works because both tools run in seconds; a slower check would get skipped by the time the agent had already compounded the problem. > [!quote] > "A check that takes 2 minutes is a check that you'll run once a day, if that, and by then the agent has buried your problem under another 3,000 lines." ## Links - [[3. Resources/Permanent Notes/AI Coding Agents Excel at Mechanical Bulk Work]] — because extends; both notes draw the same line between what's safe to hand to automation (mechanical, checkable) and what still needs a human (judgment, novel design), from two independent sources in this batch. - [[3. Resources/Permanent Notes/A Confident Completion Report Is More Dangerous Than a Failure]] — because contrasts on failure mode; that note is about an agent's own unverified success claims, this note is about building an external, mechanical check the agent can't talk its way past. - [[3. Resources/MOCs/AI & the Future of Knowledge Work MOC]] — because applies-in the vault's thread on responsible AI-assisted development practice. - [[3. Resources/Permanent Notes/A Quality Gate Holds Only If the Agent It Checks Cannot Edit the Gate]] — applied in: A static-analysis gate checks an agent's work only when the agent has no write access to the gate's configuration. ## Tests / falsifiers - If teams that wire a sub-10-second check into an agent's post-edit loop show no measurable difference in duplicated-token percentage over time compared to teams relying on periodic manual/CI-only checks, the speed-is-the-mechanism claim weakens. - A case where a slow (multi-minute) check gets run consistently on every iteration without degrading compliance would be a direct counter-instance to the "speed determines viability" scope condition. ## Maintenance - Last tended: 2026-08-16 - Next review: 2026-11-16 ## Source - [[3. Resources/Literature Notes/I Made My AI Agent Fix Its Own Copy-Paste (jscpd + Mago)]] — the jscpd + Mago fail-fast agent-loop pattern and its stated speed mechanism.