In a talk on turning slop into gold, Lauren Tan describes how their team at Cursor ships a steadily growing stream of agent-written pull requests to production, many of them merged overnight, while keeping the revert rate at about half a percent. The thesis is that the new job of a software engineer is to massively increase output while maintaining, or even improving, code quality. The key ingredient is trust. That does not mean blind trust in agents. It means an environment built so that agents do the right thing by default.
Investment in an agent's environment can be ranked in four layers, from most effort to least:
AGENTS.md files for the things that genuinely require judgment.Prose comes last because it is the least enforceable. One principle ties the layers together.
Whenever an agent needs correcting, turn the correction into a deterministic check or an architectural change instead of another line in a rules file.
Repeat this enough times and there is less and less to look for in code review, until agents can merge most of their own pull requests.
Agents generate output from their input, and the codebase is one of the largest inputs they receive. Code used to arrive a few pull requests at a time. Now a single engineer directs hundreds of agents, and changes arrive in something closer to a continuous stream.
In that environment, the codebase behaves like a garden. Every workaround, anti-pattern, and piece of deprecated code looks like an established convention, and the next agent will copy it. Like weeds, bad patterns spread quickly, so the goal is to keep the codebase clean enough that agents are always copying good examples.
The team built Dune, an internal client framework for their Electron app (roughly "Next.js for Electron"), to encode lessons learned as constraints. Two examples stand out.
Ban APIs that require nuance. Anything that takes expertise to use well tends to produce slop. React's useEffect is the classic example. It has legitimate uses, but it is frequently misused, and agents are not good at using it correctly. The team banned it from product code and allows it only inside framework internals, which eliminates the problem categorically.
Encode context in the directory structure. A recurring bug was agents importing main-process code into the renderer process, causing long tasks and visible jank. The fix was to create two top-level directories, electron-main and electron-renderer, and forbid imports between them using a dependency graph analyzer and lint rules.
Architectural rules only hold if something enforces them. Lint rules, type systems, and compilers do this without relying on an agent's judgment. The useEffect ban, for example, takes only a few lines of ESLint configuration:
// eslint.config.js
export default [
{
files: ["src/**/*.{ts,tsx}"],
ignores: ["src/framework/**"],
rules: {
"no-restricted-imports": ["error", {
paths: [{
name: "react",
importNames: ["useEffect"],
message: "useEffect is reserved for framework internals. Derive the value during render or use a framework hook.",
}],
}],
},
},
];
The error message matters as much as the rule. An agent that hits this error is told what to do instead, which keeps it from inventing a new workaround.
The alternative to a check is usually a comment, and agents often use Markdown and code comments as a place to justify not doing the right thing. In Cursor's VS Code-based editor, agents leaned heavily on imperative timers such as setTimeout, requestAnimationFrame, and requestIdleCallback as quick fixes. The timers were papering over a clash between VS Code's imperative architecture and React's declarative one. The agents wrote comments explaining why each workaround was justified, the pattern spread, and the constant creation and destruction of timers triggered frequent garbage collection and degraded the app's performance.
On the new Electron app built on Dune, the team banned nearly all comments. Comments go stale, humans rarely read them, and they give agents an escape hatch. Most importantly, comments are not enforceable. A comment telling the next agent not to do something cannot be trusted. A lint rule can, especially one whose error message points the agent toward the root cause instead of a workaround.
Code review on the team has largely shifted to reviewing verification artifacts such as videos, screenshots, diagrams, and formal proofs.
Runtime verification gives an agent a way to run the code and use the same debugging tools a human would, such as the Chrome DevTools Protocol. Two techniques make this more effective:
Formal verification is a newer addition. The team uses TLA+ to model check major user flows, such as notifications across multiple devices and platforms, and Lean to prove properties of algorithms, such as confirming that a custom virtualization library does not flicker or jitter. Both have already found real bugs, though neither is treated as a silver bullet.
Property-based UI testing with Bombadil adds another layer. Tan also built a skill that renders state charts of user flows, which are easier to review alongside screenshots and videos than the code itself.
Verification is where most of the tokens go. Tan reports that the majority of their token usage is spent verifying work rather than generating it. None of these techniques are new. Model checking, property-based testing, and runtime verification are established tools that were often too expensive to write and maintain. Agents reduce that cost enough that it is now economical to test far more thoroughly than before.
Rules, skills, and AGENTS.md files still have a place, but only for decisions that require judgment. A useful test is whether two reasonable reviewers could disagree about the outcome. If they could not, the decision belongs in a check.
Deciding when to extract a shared abstraction is a good example. Sometimes three similar components should be merged, and sometimes they should stay separate. No lint rule can tell the difference, because the answer depends on whether the components are likely to change together. A rule such as "Prefer duplication until a third use case appears, and extract only when the call sites change for the same reason" gives an agent a heuristic without pretending to be a law.
Prose has two weaknesses. Agents can ignore it, and they tend to over-rotate on it, treating a minor correction as a rule that can never be broken. Writing each rule as a heuristic with its reasoning attached helps an agent recognize when an exception applies.
Tan has packaged much of this approach as pstack, a skill stack for Cursor with community ports for other harnesses. A few skills map directly onto the layers:
correct finds mistakes agents keep repeating and makes each one impossible.no-comments strips comments and turns any constraint they claim into a check.create-verification-skill builds a project's verification skill and feature map.statechart checks a TLA+ model and draws it as a state chart.pstack is prose, but these skills spend that prose building the layers above it.
It is tempting to jump straight to building a "software factory" that automates everything. The talk recommends building the foundations first. Improve the codebase when correcting an agent, add a lint rule to prevent new occurrences of an anti-pattern, clean up the existing ones, and make verification strong.
If the inner coding loop produces slop, automating it only produces more slop, and fixing it requires throwing ever more tokens at the problem.
With solid foundations, automation becomes straightforward. On Tan's team, every new release automatically spins up agents that fuzz the entire application by using it like a real user, open a fix pull request for each bug they find, and auto-merge those fixes. That only works because the codebase is good enough that pull requests tend to be good by default. Despite the higher velocity and a growing number of contributors, the app has become faster on startup, typing, and switching chats since launch.