agentleFS
JunnDungJunnDung/cursor-agent-starter-kit/.cursor/rules/10-context-optimization.mdc

cursor-agent-starter-kit / rules

Cursor rule1 starsChanged 6 months agoMITView on GitHub

Token efficiency and context management to keep sessions fast.

The file

We split this 10-context-optimization.mdc into the rules it gives an agent

10 rules. About 0 are common, 7 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Avoid repeating what you already said.

    line 15
  2. Distinctive:

    Only cite code with line numbers when referencing existing code.

    line 16
  3. Distinctive:

    Read only the files you need.

    line 20
  4. Distinctive:

    Do not read an entire codebase to understand one function.

    line 21
  5. Distinctive:

    Use search tools (grep) to find specific patterns before reading.

    line 22
  6. Very specific:

    Use workflows/reflect.md to condense session learnings.

    line 28
  7. Distinctive:

    Check the conversation length.

    line 32
  8. Distinctive:

    Start a fresh context

    line 35
  9. Very specific:

    Use alwaysApply: true only for rules that should always be active.

    line 48
  10. Very specific:

    Use alwaysApply: false for task-specific rules.

    line 49

≈ “Common” is an estimate: at least 1 in 5 of the 7,324 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
10-context-optimization.mdc
---
description: Token efficiency and context management to keep sessions fast.
alwaysApply: false
priority: medium
tags: [performance, context, optimization]
---

# Context Optimization Rule

Manage context to keep responses fast and accurate.

## Always active

- Keep responses concise.
- Avoid repeating what you already said.
- Only cite code with line numbers when referencing existing code.

## When reading files

- Read only the files you need.
- Do not read an entire codebase to understand one function.
- Use search tools (grep) to find specific patterns before reading.

## When context is large

- Summarize what you know at decision points.
- Mark sections of the conversation with headers.
- Use `workflows/reflect.md` to condense session learnings.

## Before long tasks

Check the conversation length. If it exceeds 50 messages:
- Summarize the current state
- Archive completed work in memory files
- Start a fresh context

## Frontmatter conventions

```yaml
---
description: One sentence summary.
alwaysApply: true/false
priority: high/medium/low
tags: [tag1, tag2]
---
```

Use `alwaysApply: true` only for rules that should always be active.
Use `alwaysApply: false` for task-specific rules.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.