For Cursor devs watching a good repo go bad

Cursor didn't write spaghetti.
It eroded your architecture, session by session.

Your repo used to have a shape. Then a hundred agent sessions each made locally reasonable choices — a helper here, an inline query there, a pattern from the model's defaults instead of yours — and the shape dissolved. That's erosion, not explosion, and prompting 'follow the existing patterns' has never stopped it. useDeploy stops it structurally: boundaries the agent physically can't cross, contracts CI won't let drift, and a validation loop that turns bad edits into red builds.

Context rot: why a good repo degrades one session at a time

The mechanism is well documented by now, and it isn't a bug in Cursor — it's what happens when many small, confident edits accumulate without a structural counterweight. Each session, the agent sees a slice of your repo and edits rationally against that slice. Multiply by a hundred sessions and the project's shape drifts toward the AI's defaults — choices that look reasonable in isolation, stacked into something no one would have designed. There's no self-consistency to fall back on, either: human code carries patterns you can refactor against, while LLM code "has none of that, if yes its by pure chance that won't repeat" (news.ycombinator.com). And erosion compounds into the doom loop: past a certain size, the AI that built the codebase can no longer reliably refactor it, because it has outgrown the model's effective context window (morphllm.com). Rules files slow this down. But rules are prose, and prose is advisory — what holds, long term, is what fails the build.

Erosion symptoms in a once-clean repo

Three patterns for everything

Your repo had one way to fetch data; now it has your way, the model's 2023 way, and the model's 2025 way. New code copies whichever one the agent saw last.

The service layer is leaking

Agent shortcuts: controllers calling the database directly 'just this once' — times forty. Each one reasonable; the sum is architecture loss.

Confident edits, invisible casualties

The agent fixes the file it sees and breaks the caller it doesn't. You find out from a user, not from a check.

Your conventions became suggestions

Rules files get obeyed when convenient. Nothing fails when they're ignored, so violations survive review and become precedent.

Review fatigue set in

You stopped reading every diff months ago. Entropy compounds precisely where attention lapsed — the agent's confidence never dropped, but your scrutiny did.

Refactors keep getting deferred

"Tech debt isn't paid down, it's being added to" (news.ycombinator.com) — and every session adds interest while the cleanup stays one sprint away.

The wall: the edit the agent can't make

Rules files ask; linters refuse. In useDeploy the layering is ESLint flat-config, so the agent's most damaging habit — reaching across layers because it can't see why the layer exists — hits a wall that fails the build. The feedback loop even improves the agent: a named lint error is a clearer instruction than any paragraph of conventions, so retries converge on the right pattern instead of drifting around it.

agent session vs. boundary lint
 1  ● Agent: "I'll query Prisma directly from the
 2    Subscription entity to save a round-trip."
 3  
 4    + import { PrismaClient } from '@prisma/client'
 5      // modules/billing/domain/subscription.ts
 6  
 7  $ bun run lint
 8  
 9  modules/billing/domain/subscription.ts
10    error  domain/ may not import '@prisma/client'
11           ddd-boundaries/no-infra-in-domain
12  
13  ✖ Build fails. The edit never lands.
14  ● Agent retries — through the repository port.

A harness, not just a starter

Constrained blast radius

Six bounded contexts — iam, tenancy, billing, storage, ai, webhooks — mean an agent session scoped to billing physically can't reshape auth. Small slices stay small.

Boundaries as failing builds

The DDD layering is ESLint flat-config, not a wiki page: domain code importing express, @prisma/client, or infrastructure kills the build. The cross-layer shortcut has nowhere to land.

Drift-proof contracts

Zod schemas in @app/contracts, a client typed by openapi-fetch, and the api-types-fresh CI gate: when an edit changes what an endpoint returns, the merge blocks until both sides re-agree. Payload drift caught — not just type drift.

A validation loop the agent can trust

450+ tests and a Playwright E2E gate give the agent something real to check itself against — closing the code → validate → code loop instead of asserting success.

Side effects behind an outbox

The event bus persists to a durable outbox, so an agent adding a feature never needs to inline an email send or a webhook call into a handler — the tempting shortcut doesn't exist.

CLAUDE.md that's operative

The repo's rules file isn't aspirational prose — it encodes the same boundaries the linter enforces, alongside architecture docs at /docs. What the agent reads and what CI checks agree.

The migration path: modules first, then strangler-fig

You don't fix an eroded repo with one heroic refactor — the erosion happened because nothing was modular, so the modules have to come first. Stand useDeploy up next to your repo. The commodity layers — auth, orgs, billing, storage — are already built and tested there, which means your eroded versions get deleted, not restored; that alone removes a huge share of the entropy. Then migrate strangler-fig style, one domain at a time: point Cursor at the new base, tell it to port the pricing logic (or projects, or notifications), and let the boundary lint, the api-types-fresh gate, and the test suite do the exhausted-reviewer job you've been doing manually. The agent that eroded your old repo is genuinely good at this work when the target has walls — a named lint error teaches it faster than any conventions doc ever did. End state: same product, same editor, same workflow. But drift now dies in CI, in seconds, instead of compounding into architecture.

Questions Cursor devs ask

Isn't a rules file enough?+
Rules files are prose, and prose is advisory — nothing fails when the agent ignores it on the one edit that matters. useDeploy keeps the prose (an operative CLAUDE.md the agent loads every session) and adds enforcement: ESLint boundaries and CI gates that reject violations mechanically. Ask and refuse, not ask and hope.
Do I have to change how I work?+
No — this is a base built for the Cursor workflow, not against it. You keep prompting; the agent keeps editing. What changes is the failure mode: drift toward the model's defaults now surfaces as a red build in seconds instead of as architecture three months later.
My repo isn't that far gone. Should I migrate or fix in place?+
If the erosion is early, adopt the pattern in place: add boundary linting and a contract gate to your own repo — the walls matter more than the base. The case for migrating is everything else in the truck: six tested bounded contexts, 450+ tests, the E2E gate, the outbox — commodity layers you'd otherwise be defending by hand while also refactoring.
Won't the agent just fight the linter?+
It converges. A named lint error is the clearest instruction an agent ever receives — far clearer than a conventions paragraph — so retries move toward the port interface instead of around it. In practice the walls make the agent better at your codebase, which is the whole trade.

One license. Two ways to own it.

CORE

Founder

$99one-time

A frozen snapshot of UseDeploy. Yours forever, no updates.

  • Frozen-version zip download
  • Full source, commercial use, unlimited projects
  • All 800+ tests · all docs pages
  • 14-day refund
RECOMMENDED

LATEST + UPDATES

Lifetime

$199$249one-time

Always the latest UseDeploy. Re-download every release, free.

  • Latest-version zip — re-downloadable forever
  • Every future release at no extra charge
  • Priority Discord support
  • All 800+ tests · all docs pages
  • 14-day refund

Point your agent at a base it can't erode

Same Cursor workflow, different physics: ESLint-enforced boundaries, drift-proof contracts, and a CI harness that turns bad edits into red builds instead of architecture.