{"slug": "how-to-stop-cursor-ai-forgetting-your-net-architecture-the-9-fix", "title": "How to stop Cursor AI forgetting your .NET architecture (the $9 fix)", "summary": "A .NET developer has created a $9 fix for Cursor AI's \"Context Tax\"—the 15 minutes lost each morning re-explaining codebase conventions to the AI. The solution uses four directory-scoped .mdc rules and a stateful Learning Log to enforce Clean Architecture boundaries, audit dependency injection, and detect hallucination loops, potentially saving 62 hours per developer annually.", "body_md": "**How to stop Cursor AI forgetting your .NET architecture (the $9 fix)\n\n``**\n\nYour Cursor session starts. You type your first prompt. The AI confidently suggests instantiating HttpClient inside your repository — the exact anti-pattern you banned six months ago. You sigh, type 'actually we use typed HttpClients registered via DI,' and burn 15 minutes re-teaching an AI that was supposed to help you. This is the Context Tax. Every .NET developer using Cursor pays it. Here's how to stop.\n\nThe Context Tax: what it costs you every morning\n\nThe Context Tax is the fifteen minutes you spend re-explaining your codebase to Cursor at the start of every session. You describe your DI conventions, your Clean Architecture layers, your EF Core patterns, your Result pipeline. Cursor nods along. You build a feature. Session ends. Next morning? Back to square one.\n\nMultiply that by 250 working days and you're losing 62 hours a year — nearly two full working weeks — just re-establishing context. At a senior contractor rate of £75/hr, that's £4,650 of lost time. Per developer.\n\nWhy Cursor's built-in rules aren't enough\n\n`plaintext`\n\nCursor supports a .cursor/rules/ directory. You can drop .mdc files in there and the AI reads them. So why doesn't that solve the problem?\n\n``**\n\nMost public Cursor rules repos give you a single rules.mdc file that gets loaded on every prompt. Every. Single. Prompt. That's 2,000+ tokens of preamble before your actual instruction. Your fast-request budget evaporates on rules that aren't even relevant to the file you're editing.\n\n**\n\nA rule that says \"use Result not exceptions\" tells Cursor what to do. But it doesn't tell Cursor why you chose that pattern, what you tried before it, or what edge cases you hit. That's state. And rules alone don't carry state.\n\nWhen Cursor gets stuck — and it will — it doesn't know when to stop. It invents methods that don't exist, doubles down on wrong answers, and burns tokens in a loop. There's no built-in mechanism to say \"step back and re-read the file.\"\n\nThe fix: directory-scoped rules + a stateful Learning Log\n\nThe solution to context drift isn't a bigger prompt file. It's a persistence protocol — a system that loads only the right rules for the right files, and maintains a Learning Log that the AI reads, updates, and carries across sessions.\n\n``\n\nHere's what that looks like in practice. When you open a file in ~/api/Services/, only the DI auditor and architecture boundary rules activate. When you're in the data layer, only the EF Core read-pattern enforcer kicks in. And every architectural decision you make gets logged — so tomorrow morning, the AI picks up right where you left off.\n\nThe 4 rules that make Cursor stateful\n\n``\n\nThe Agentic Architect framework ships four specialist .mdc rules. Each solves a specific failure mode of the Context Tax.\n\narch-core.mdc — The Boundary Guardian\n\n``\n\nEnforces your Clean Architecture layers. No DbContext in controllers. No business logic in repositories. No crossing layer boundaries without explicit justification. The AI starts every prompt already knowing your SOLID boundaries.\n\nSOLID compliance audits on every AI suggestion\n\nLayer boundary enforcement (Presentation / Application / Domain / Infrastructure)\n\nAnti-pattern early-warning — catches the 'Big Ball of Mud' before it starts\n\ndotnet-di.mdc — The DI Auditor\n\nA dedicated dependency injection auditor that catches Scoped → Singleton capture bugs during AI code generation. Knows IServiceCollection, Scrutor, Autofac, and the Microsoft DI container cold.\n\nLifetime mismatch detection (Scoped injected into Singleton)\n\nConstructor-injection best-practice enforcement\n\nModule registration discipline — prevents spaghetti registrations\n\nbug-breaker.mdc — The Hallucination Killer\n\nA circuit-breaker that detects when the AI is looping on a bad solution. Forces Cursor to step back, re-read the file, and ask you — instead of inventing methods that don't exist and burning through your token budget.\n\nLoop-detection on repeated failed attempts\n\nForced context re-read protocol — stops the spiral\n\nToken waste prevention — fewer tokens burned on hallucinations\n\npersistence.mdc — The Learning Log Engine ★\n\n``****\n\nThe crown jewel. This rule maintains a LEARNING_LOG.md file at your project root — a living document that records every architectural decision, refactor reason, constraint discovery, and 'we tried that, don't do it again' lesson. Each session starts with the AI auto-hydrating from the log.\n\nADR-style decision logging (architectural decisions get timestamped entries)\n\nSession-start hydration — AI reads the log before processing any prompt\n\nCross-session continuity — the AI remembers decisions from last week, last month\n\nWhat the rules actually prevent (real drift examples)\n\nThese aren't hypothetical. These are the specific regressions the framework catches that raw Cursor will happily generate.\n\n```\n      The DriftWhat Cursor DoesWhat the Rules Do\n\n      throw instead of ResultCursor defaults to try/catch/throw in controllers — ignores your Result convention set 6 months agoarch-core.mdc blocks throw in controllers. dotnet-di.mdc requires Result through your pipeline.\n      Captive DI dependenciesAI injects a Scoped DbContext into a Singleton cache service — compiles fine, explodes at runtimedotnet-di.mdc catches the lifetime mismatch during generation and blocks the suggestion.\n      Missing AsNoTracking()Cursor generates reads that track every entity — memory balloons, queries slowef-core-reads.mdc enforces AsNoTracking() on all query-only operations.\n      Hallucination spiralAI invents IOrderRepository.FindByLegacyCode(), code doesn't compile, AI invents another method to fix itbug-breaker.mdc detects 3+ failed attempts on the same file, forces a re-read, and asks you.\n```\n\nInstall in 60 seconds. No build step. No config.\n\n```` Download the kit — you get the full .cursor/rules/ folder and a pre-seeded LEARNING_LOG.md.\n\n****``\n\nDrop into your project root — .cursor/rules/ auto-detects. No CLI commands. No build tools.\n\n****Run the hydrate prompt once — the AI reads your codebase, seeds the Learning Log with existing patterns, and starts tracking from there.\n\nAll 9 specialist rules, one £9.00 payment\n\n``\n\nThe full kit ships with all 9 production-tested .mdc rules — the 4 described above plus 5 more covering Result pattern discipline, EF Core performance patterns, MediatR conventions, and more. MIT-licensed. Commit them. Share them with your team. Modify them. They're yours.\n\n``9 specialist .mdc rules — directory-scoped, token-efficient\n\n``Pre-seeded LEARNING_LOG.md template\n\nQuickstart PDF — install and hydrate in 60 seconds\n\nLifetime updates — new rules and protocol upgrades free forever\n\nMIT-licensed — no subscription, no cloud lock-in, no vendor dependency\n\n14-day no-questions refund — if it doesn't stop the Context Tax, get your money back\n\nBuilt for senior .NET engineers, not beginners\n\nThis framework assumes you already have a Clean Architecture/DDD codebase, you use Cursor daily, and you're tired of the AI forgetting your conventions. If you're learning C# for the first time, come back when you have architecture to protect.\n\n``\n\nIf you're a Staff Engineer who's spent the last 6 months building a MediatR pipeline with Result and orchestrated handlers — and Cursor still suggests throw new Exception() in your controllers — this is for you.\n\n*Originally published at https://agenticstandardcontact-byte.github.io/agentic-architect/blog/06-stop-cursor-ai-drift-dotnet.html. Part of the Agentic Architect persistence kit for Cursor + .NET.*", "url": "https://wpnews.pro/news/how-to-stop-cursor-ai-forgetting-your-net-architecture-the-9-fix", "canonical_source": "https://dev.to/agentic_standard/how-to-stop-cursor-ai-forgetting-your-net-architecture-the-9-fix-25ij", "published_at": "2026-05-30 13:47:33+00:00", "updated_at": "2026-05-30 13:52:05.447308+00:00", "lang": "en", "topics": ["ai-tools", "artificial-intelligence", "large-language-models", "ai-products", "ai-infrastructure"], "entities": ["Cursor", ".NET", "Clean Architecture", "EF Core", "HttpClient"], "alternates": {"html": "https://wpnews.pro/news/how-to-stop-cursor-ai-forgetting-your-net-architecture-the-9-fix", "markdown": "https://wpnews.pro/news/how-to-stop-cursor-ai-forgetting-your-net-architecture-the-9-fix.md", "text": "https://wpnews.pro/news/how-to-stop-cursor-ai-forgetting-your-net-architecture-the-9-fix.txt", "jsonld": "https://wpnews.pro/news/how-to-stop-cursor-ai-forgetting-your-net-architecture-the-9-fix.jsonld"}}