One thing Cursor does different to some other agents such a Claude Code in managing context, is to use a vector database of code chunks so that it can selectively load relevant code chunks into context rather than entire source files.
Another way to control context size (not specific to Cursor), is to use subagents with their own context for specific tasks so that the subagent context can be discarded when done rather that just adding to the agent's main context.
If context gets too full (performance may degrade well before you hit LLM max context length), then the main remedy is to compact - summarize the old context and discard. One way to prevent this from being too disruptive is to have the agent maintain a TODO list tracking progress and what it is doing, so that it can better remain on track after compaction.
A vector database of code chunks sounds like it would have advantages over agentic search. Less reimplemented code that's already in your codebase, things get missed by grep. It should be faster too, I get impatient watching CC doing the same set of searches every time it's launched.
Another way to control context size (not specific to Cursor), is to use subagents with their own context for specific tasks so that the subagent context can be discarded when done rather that just adding to the agent's main context.
If context gets too full (performance may degrade well before you hit LLM max context length), then the main remedy is to compact - summarize the old context and discard. One way to prevent this from being too disruptive is to have the agent maintain a TODO list tracking progress and what it is doing, so that it can better remain on track after compaction.