Our team has been using Cursor AI for over a year, and it has become an essential part of our workflow. We really appreciate how much it helps us. But we are facing a problem: AI sometimes generates output that includes noise or content we don’t want. I’m currently exploring Cursor’s agent paradigm to improve the consistency and quality of our code. I’d love to learn about any best practices or proven patterns for building a more robust setup with Cursor.
My Paradigm with Cursor
I know context is fundamental to agentic coding. Since an agent is essentially a stateful abstraction built on top of a stateless LLM, so the context is everything.
To maintain high‑quality output, I try to ensure that the agent’s context window contains only the minimal and essential information. To achieve this, I follow:
Open a new agent window when the context approaches saturation (around 70%) to avoid context rot and prevent the agent from carrying unnecessary historical noise.
Use a subagent as an execution unit when delegating tasks. Because the main agent and subagent do not share the same context window, the main agent can remain clean and ready for larger tasks. For example, I now structure my prompt like this:
## Background
xxxx
## Goal
xxxx
## Role and Steps
You are a task manager. The overall task should be divided into several smaller tasks, each delegated to a subagent. Your responsibility is to verify the subagent’s output. The following steps are REQUIRED:
1. xxxx
2. xxxx
3. Subsequent steps are up to your judgment.
## Constraints
You are not allowed to xxxx
Ensure the codebase is not a shoot. When the agent works, it would greps portions of the codebase into its context window, which means the quality of codebase matters a lot. So whenever I have time, I clean-up those shoot code in the base.
Another challenge I’m facing is code review.
Code Review
Cursor can generate a large amount of code within minutes, but reviewing that code could kill me. Even though I use the paradigm described above to structure tasks and keep the agent’s context clean, the review process still takes a significant amount of time. At the moment, I don’t have a stable or reliable workflow for reviewing AI‑generated code.
I also tried enabling the “agent review” feature (the automatic review after each commit) in the settings page, but it never worked for me. I’m not sure whether this is due to my Cursor version or because I have three repositories loaded in my workspace. Either way, the auto‑review feature doesn’t seem to trigger or produce any meaningful output.
What I’m Trying to Know
How to build a stable code‑review workflow? Besides /code-review skill, what could I do else?
headroom is oss, they compact the size of the repo/context which u wanna provide to the agent.
Openspecs while works as an additional spec layer between cursor and a big codebase. So cursor never have to get the complete codebase. it’s free, it might help you
Hey, great breakdown of your workflow, a lot of it sounds solid. A couple thoughts on your questions.
About auto Agent Review after a commit. You’re on Cursor 3.1.17, which is a pretty old build. There was an issue where Agent Review wouldn’t trigger with an error like “commit not found” in workspaces with multiple repos, and it’s already fixed in newer versions. Update Cursor to the latest version and try again: Cursor Settings > Agents > enable auto-run after task or commit. If it’s still silent after the update, share the Request ID and a screenshot of your settings and we can look into it.
While you’re updating, you can run review manually:
/agent-review right in the agent panel
from the Source Control tab, it compares all local changes against main
you can pick depth: Quick for small diffs, Deep for complex logic and refactors
About the code review workflow overall. Besides /code-review, it helps to connect two levels:
Agent Review runs locally before push, catches issues early
Bugbot runs on the PR stage, integrates with GitHub or GitLab, leaves inline comments, and can autofix
There’s a good write-up on the difference and when to use each here: Difference between Bugbot and Agent review Difference between Bugbot and Agent review?. Also, Agent Review reads rules from BUGBOT.md in the repo, so you can set your own review criteria for your Qt/C++ style to reduce that “noise”.
About the subagent pattern. Delegating to a subagent to keep the main context clean is a solid idea. For a code-reviewer subagent, you can set model: inherit so you’re not tied to a specific model. Docs: subagents Subagents | Cursor Docs, agent review Agent Review | Cursor Docs.
Update your version and let me know if auto-review starts working.
Thank you Dean, you are very supportive! I updated and /agent-review worked really good. Also, I can now see context usage report with canvas, pretty helpful to me.
I do find an issue tho, system prompt varies to different agent, will it collapse after compact?
Thank you Amar for your advice, but I don’t think that’s a good idea. External tools shouldn’t compact the context, because that can lead to unpredictable information loss. Instead, agents should receive the context they need — as much useful context as possible while keeping the context size minimal.
Glad to hear /agent-review is working and that the context usage in canvas was helpful.
On your question about the system prompt and compact, you don’t need to worry. The system prompt (Cursor’s base instructions plus anything specific to the model or agent) is re-sent on every request and isn’t part of what compaction compresses. Compaction only runs over the chat history, messages, tool calls, and tool results, not the system prompt. So if you switch to a different agent, it just has its own system prompt, and compact won’t “collapse” it.
Practical takeaway for your subagent pattern: keep critical instructions and review criteria in rules files, not only in the chat. For example .cursor/rules with alwaysApply, AGENTS.md, BUGBOT.md. These rules are pulled from config, not kept alive by chat memory, so they’re more resilient to compaction than info buried in the conversation.