Context Cliff & Scale Limits

When repos get too big for agent attention — modularize early and keep content out of logic paths.

  • scale
  • modularization

Suggested Cursor path: .cursor/rules/agent-scale-limits.mdc

Context Cliff & Scale Limits

The bottleneck is model attention, not disk space. Even with 1M+ token windows, “lost in the middle” degrades quality.

When agents struggle

  • Monoliths where one task requires 15+ directories
  • Single files beyond ~800 lines mixing unrelated concerns
  • Copy, assets, and logic interleaved in the same tree

Modularize early

  • Split micro-frontends or standalone APIs when domains are independent
  • Extract shared packages only when two apps truly share code
  • Keep each workspace lean enough that one feature fits in one folder read

Split thresholds (rules of thumb)

SignalAction
Central data file > ~400 linesSplit by domain with barrel export
Knowledge base > ~20 entriesSplit by topic file
Second product on same stackSeparate repo or Astro workspace
Agent needs full tree for every taskMissing domain boundaries — refactor

Keep changes minimal

  • Smallest correct diff wins
  • Match existing naming, types, and import style
  • No drive-by refactors outside the task domain

Verification

Every project should document its verify command in AGENTS.md (e.g. npm run build, pytest, go test ./...). Run it before calling work done.