Agent-Proof Your Rails App: Your Codebase Is the Prompt - Kinsey Durham Grace

Summary

In “Agent-Proof Your Rails App: Your Codebase Is the Prompt,” Kinsey Durham Grace argues that reliable AI coding agents depend less on clever prompts and more on the environment you give them: searchable code, explicit business rules, runnable verification, and enforced architectural boundaries. Drawing on her experience with GitHub’s Copilot coding-agent platform team, she says agents can write good Ruby but still fail because they cannot discover intent, verify behavior, or recognize hidden constraints.

The central takeaway: treat your repository as the agent’s working context, and replace repeated instructions with constraints that make incorrect changes difficult to produce or merge.

Main points

1. Require evidence, not a convincing-looking patch

Approximately 3:30–10:40

Instead of asking “Does this change look right?”, ask “What did the agent prove before declaring it finished?” Her examples:

  • Bug fixes: a regression test fails before the fix and passes afterward.
  • UI changes: the agent runs the app and exercises the actual workflow.
  • Performance changes: before-and-after traces demonstrate improvement.
  • Important features: a repository-local verification procedure specifies setup, actions, required evidence, and cleanup.

She warns that tests written after implementation can reproduce the agent’s original misunderstanding: the code and test agree, but neither proves the intended behavior. Test-first development and observing actual execution provide stronger evidence. Verification should also be proportional to risk rather than equally exhaustive for every change.

2. Turn corrections into durable repository improvements

Approximately 7:15–9:20

Review comments alone do not teach the next agent session. When an agent repeatedly makes a mistake, capture the lesson in something persistent: a verification skill, lint rule, feature map, or CI check. Initially, watch the agent’s tool usage—not just its final diff—to discover failures such as claiming to understand a file it never opened.

She describes a gradual trust ladder: supervise execution, review every changed line, let automation enforce style and structure, review evidence first, and only eventually permit automatic merging. Advancement should depend on measured outcomes, including rollbacks, problems caught before human review, and review latency.

3. Discoverability is an architectural property

Approximately 10:40–19:30

Agents repeatedly rediscover your app through searches and command-line tools. Their performance suffers when relevant behavior is spread across unrelated files, buried in configuration, or generated dynamically at runtime.

Examples include:

  • Account deletion, where “correct” behavior depends on associations, anonymization, retention requirements, and business decisions that may exist only in someone’s head.
  • Metaprogrammed methods that exist at runtime but cannot be found by a straightforward text search.
  • Indirection chains and scattered configuration that force the agent to inspect many files for a small change.
  • Poor identifiers that remove useful clues about a class or method’s purpose.

Rails conventions help by giving agents predictable places to look. But Rails’ more implicit mechanisms can work against that advantage. Her point is not to eliminate all abstraction; it is to make important behavior and intent easy to locate.

4. Enforce architecture instead of merely describing it

Approximately 19:30–27:00

An AGENTS.md instruction such as “always use the billing service” competes with everything else in the agent’s context. A lint or CI rule that rejects direct billing writes makes the same requirement enforceable.

She presents an enforcement ladder:

  1. Comments and documentation.
  2. Agent instructions.
  3. Consistent code conventions.
  4. Generators that make the preferred implementation easiest.
  5. Local lint rules.
  6. CI gates.
  7. Type or interface boundaries.

Her practical challenge is to identify the three rules agents violate most often and move each one a single step up that ladder—not necessarily straight to the strongest enforcement.

For Rails, she discusses namespaces, Shopify’s Packwerk, and isolated engines as boundary mechanisms. She favors cohesive feature boundaries and module-owned data accessed through explicit interfaces. However, she explicitly cautions against premature modularization: introduce boundaries where recurring failures justify them, not merely because architecture sounds desirable.

5. Preserve the “how” and “why”

Approximately 27:00–28:35

Small feature maps can capture where a feature lives, how it works, why decisions were made, and what traps to avoid. That prevents every agent session from repeating the same investigation—or missing institutional knowledge that never reached the repository. Keep these maps current, because misleading documentation can be worse than missing documentation.

6. Make one agent reliable before adding parallel agents

Approximately 28:35–30:45

More agents can mean more duplicated work and conflicting changes rather than more useful output. Her proposed order is: establish reliable execution and verification for one agent, then introduce parallelism with task ownership and shared completion state. Locks alone do not communicate what has already been accomplished.

Practical takeaway for a Rails project

The most actionable starting point is to take recurring agent mistakes and convert them into repository mechanisms:

  • Provide a dependable setup and test workflow.
  • Define observable acceptance evidence for risky changes.
  • Document non-obvious domain rules and feature locations.
  • Add lint or CI checks for repeated architectural violations.
  • Improve naming and discoverability where agents actually struggle.
  • Delay broad autonomous refactoring and multi-agent scaling until those foundations work.

The talk’s closing idea is that these improvements also help new developers, on-call engineers, and your future self: a predictable, understandable codebase communicates intent to whoever reads it next.