Skip to content

Context: @-tagging and self-gathering

An agent is only ever as good as what it’s looking at. Give Cursor the wrong three files and the right model will still write a confident, wrong patch - because from inside the window, the wrong files are the codebase. So before any chapter about prompting or models pays off, you need the one underneath it: steering what the agent sees. That’s two skills braided together. One is pointing - @-tagging the exact file, folder, or doc you want in the window. The other is knowing when not to point - letting Cursor 2.0 gather its own context, and recognising the cases where that auto-retrieval quietly picks the wrong material and you have to take the wheel back.

This chapter works on the single running project of the course: budgetcli, the inherited budgeting/finance API - a TypeScript monorepo with an API surface, a worker that fetches and parses incoming transaction feeds, and shared utilities. It’s big enough that “just let the agent figure it out” sometimes works and sometimes lands you in the wrong package entirely, which is exactly the tension this chapter is about.

Before you tag anything, understand what Cursor already knows. When you open a workspace, Cursor builds a semantic index of the codebase automatically - it breaks your files into chunks and converts each chunk into a vector embedding, so the agent can retrieve relevant code by meaning, not just by filename match. This index is the substrate underneath both @-tagging and self-gathering: when you @-tag a folder, or when the agent gathers its own context, the index is what makes “find the code that handles transaction-date parsing” resolve to the right files without you naming them.

Two things about the index are worth knowing for your own repo:

  • It’s on by default, and it skips your ignore files. Indexing begins automatically when you open a workspace and indexes everything except what your ignore files exclude - it respects both .gitignore and .cursorignore, so secrets and build artefacts stay out of the embedding store. On a work machine with sensitive code, confirm what’s actually being indexed before you assume privacy. (source)
  • Your code stays private. Per Cursor’s docs, code content is never stored in plaintext: embeddings are created without storing filenames or source code, file paths are encrypted, and chunks are decrypted client-side. That’s the load-bearing detail for anyone on a sensitive repo - the index is built from obfuscated embeddings, not a remote copy of your source. (source)

The index isn’t something you operate day to day. It’s the thing that makes every retrieval move in this chapter work - and the thing to sanity-check once, on a sensitive repo, before you trust any retrieval at all.

  • Pointing - the post-2.0 @-menu inventory: files and folders, @Docs, manual rules, and the worked fix where two attachments beat a search - Pointing with @: the attach menu
  • Not pointing - agentic retrieval finds files your mental map of the repo would have missed, which on inherited code is usually the better move - Self-gathering and hand-pinning
  • Taking the wheel back - the two cases where retrieval reliably guesses wrong, plus the chat-as-session habit that keeps each window sharp - When hand-pinning still wins

The arc runs from what Cursor already knows, out to the two gestures, and back to the judgment that picks between them. The indexing section above is the one you read once and rarely operate again - but on a sensitive repo it’s the one you check before trusting any retrieval at all. The first lesson gives you the precise instrument for the moment you already know which file matters. The second takes it away again, because on an inherited budgetcli your map of the layout is the weakest part of the loop and the agent’s search isn’t limited by it - and then covers where the skill actually lives: naming the cases where a wrong guess is expensive, and spending two seconds to remove the guess. The person who’s merely installed Cursor either @-tags everything out of habit or trusts auto-retrieval blindly. By the end of this chapter you’ll be the other kind of user - the one who knows which of those two the task in front of them deserves.