
how to structure your .cursor directory so agents start with the smallest useful context, spend fewer tokens, and produce faster, more focused results
i spent time recently reorganizing how my repositories load cursor context. the old setup worked, but it was heavy. every agent turn started with a large bundle of rules, duplicated guidance, and inventories the model did not need for most tasks.
the new setup is deliberately smaller. agents still find what they need, but they pay for less context up front. that means lower token cost, less time waiting for the model to "read the room", and answers that stay closer to the task i actually asked for.
if you already have my cursor setup in place, think of this post as the next layer. that post covers the full toolkit. this one covers how to arrange the toolkit so it does not eat your context window before work begins.
treat your .cursor directory like a library with a card catalog, not like one giant PDF pasted into every prompt. keep a thin always-on layer for guardrails, route everything else through links, scope detailed rules to the file types they apply to, and load skills on demand. the agent can always open more context when the task requires it, but the default should be the minimum useful baseline.
AGENTS.md and notice agents getting slower or noisier over time.cursor folder grew organically and now repeats the same instructions in three placescontext is not free. every always-on rule, every paragraph in AGENTS.md, and every skill description the system injects up front consumes tokens before the agent writes a single useful line.
that cost shows up in three places:
the counterintuitive part is that less default context often produces better results. when the baseline is tight, the agent has fewer conflicting instructions to reconcile. when it needs sql conventions, it loads sql conventions. when it needs a release checklist skill, it loads that skill. the fetch is intentional instead of accidental.
most .cursor directories start sensibly. you add one rule for coding standards. then a skill for your most common workflow. then AGENTS.md grows because you keep answering the same architecture questions. then another rule duplicates half of the first one because you wanted sql-specific guidance.
soon every chat begins like this:
AGENTS.md file that restates the same material in prosenone of this is wrong in isolation. together it is expensive noise.
the organizing principle is one canonical document per topic, indexes that route rather than restate.
think in layers:
| layer | job | load profile |
|---|---|---|
AGENTS.md | entry point, hard constraints, route-by-task table | small, always present |
.cursor/README.md | local index of rules, skills, and subagents | small, linked from entry |
.cursor/rules/*.mdc | enforceable standards | thin always-on + glob-scoped detail |
.cursor/skills/*/SKILL.md | procedural runbooks | on demand when task matches |
.cursor/reference/*.md | catalogs, contracts, long inventories | only when maintaining or choosing |
AGENTS.mdAGENTS.md should answer two questions quickly:
a useful shape:
# my-repo agent entry
one-paragraph architecture invariant.
## hard constraints
- link to the always-on behavior rule
- link to task-scoped rules
- one line on validation expectations
## route by task
| task | canonical source |
| -------------------- | ---------------------------- |
| local setup | README |
| cursor asset layout | .cursor/README.md |
| full skill inventory | .cursor/reference/catalog.md |
| domain architecture | docs/architecture note |
what to leave out:
.cursor/README.md as the local indexthis file is the map of cursor-native assets. keep it scannable with tables, not essays.
include:
tell the agent explicitly when not to load the heavy stuff. a line like "do not open the full catalog unless maintaining assets or the user asks for an inventory" saves tokens repeatedly.
this is the highest-leverage change i made.
always-on should mean "behavior and safety", not "every convention in the repository".
my always-on behavior rule covers:
detailed conventions move to glob-scoped rules:
---
description: "sql and model conventions"
globs: "**/*.sql"
alwaysApply: false
---
and:
---
description: "yaml metadata conventions"
globs: "**/*.yml"
alwaysApply: false
---
now a markdown edit does not load sql rules. a yaml edit does not load manuscript rules. the agent gets the right lane without reading every lane at once.
for content-heavy repos, the same idea applies across zones. one rule scoped to website posts, another scoped to book chapters, each with its own glob pattern. the agent loads voice and punctuation rules for the files it is actually touching.
skills are powerful because they are procedural and task-bound. that also makes them expensive if you treat them like always-on policy.
keep each skill focused:
description that says when to use itthe agent discovers skills through descriptions and loads the file when the task matches. it should not need the full text of every skill before you say hello.
if you want a template for tightening skill structure, see starter templates for ai rules, skills, and commands.
some material is too long to inline but still valuable. put it in .cursor/reference/ and link to it.
good candidates:
each reference file should say at the top when to load it. catalogs especially should warn against opening them on every task.
the fastest audit you can run is a duplication pass.
search for the same ideas repeated across:
AGENTS.md.cursor/common duplicates:
pick one canonical home for each topic. everywhere else, replace the copy with a link.
this also makes maintenance easier. when validation changes, you update one file instead of hunting for stale copies the agent may still believe.
token efficiency is not only about rules and skills. it is also about what cursor indexes from the repo.
keep using:
.gitignore for generated output and dependencies.cursorignore for extra exclusions such as build artifacts, minified bundles, and local secretsless junk in the index means less irrelevant material during semantic search and fewer wrong-file detours.
i covered the basics in my cursor setup under context hygiene. the .cursor directory optimization and indexing optimization work together.
a lean baseline does not mean a ignorant agent. it means the agent starts focused and expands deliberately.
patterns that work well:
@Files and @Folders when you already know where the answer livesdescriptionpatterns that waste tokens:
the model is good at retrieval when you give it a map. it is worse when you give it the whole encyclopedia and ask it to find page one.
you do not need a weekend rewrite. this sequence worked for me:
list:
alwaysApply: trueAGENTS.mdask for each item: "did i need this on a generic question about yesterday's pull request?"
AGENTS.md as a routerkeep hard constraints and a route-by-task table. move everything else behind links.
merge overlapping guardrails. link out to collaboration preferences or behavioral skills instead of copying them.
sql, yaml, typescript, website markdown, book markdown, ci workflows. each gets its own scoped rule if the guidance is non-trivial.
catalogs, contracts, and maintenance guides live under .cursor/reference/. add a "when to load" note at the top.
if two files say the same thing, pick a winner and remove the loser. stale duplicates are worse than missing docs because they look authoritative.
run these after the refactor:
the differences are subtle per turn but add up quickly:
this is the same philosophy behind cursor automations for housekeeping and hygiene, where the automation prompt stays short because the repo already contains the playbook. efficient .cursor layout makes both interactive agents and background automations cheaper to run.
you do not need a perfect .cursor directory on day one. you need one that grows without accumulating duplicate authority.
start small, route aggressively, scope rules to the files they govern, and treat catalogs as reference material rather than default context. the agent will still go look when it needs to. that is the point. you are just stopping it from carrying the whole library into every conversation.
small enough that you can read it in under a minute and still trust the agent on safety and scope. if your always-on material needs scrolling, move detail into glob-scoped rules or skills.
only if you removed the canonical source entirely. routing fixes that. the conventions still exist, they just load when relevant. if you see misses, tighten the skill description, adjust globs, or add one line in AGENTS.md pointing to the canonical doc.
optimize for intentional loading. "always knows everything" sounds safe but usually means "always reads everything", which is slower, costlier, and often muddier. give the agent a map and let retrieval do its job.
cursorCursor Automations in 2026: wire event-triggered coding agents to Slack, CI, and...
aiThe specs exist. The AI just can't see them. I've always been the type who builds hobby...
amazonbedrockConnect Claude Code, Cursor and Codex to Amazon Bedrock's new console (2026) Summary. On 5...
aiThere is a weird uncanny valley with LLM-generated UI right now. The code functions perfectly, but if...
aiI went down a rabbit hole this morning reading the late-2025 Juejin AI roundups side by side, and the...
mcpInstall guide and config at curatedmcp.com Zendesk MCP: Let Claude Handle Your Support...
Workflows from the Neura Market marketplace related to this Cursor resource