03. Giving the Assistant Context
Attach files with @
Point the assistant at the exact file — or the exact lines — instead of hoping it finds them.
Concept
@ in the prompt opens a fuzzy file picker over the current workspace. Choosing a file inserts an @path chip. That mention stays in your message when you send it, so the assistant starts from the file you named rather than searching the tree first.
You can also type a path yourself. The picker is there so you do not have to remember the full name.
Why this matters
A precise mention is cheaper than a wide search. The assistant spends the turn on the change you asked for, not on locating the file. Line ranges are stronger still: they say “this function,” not “this module.”
Use @ when you already know the file. Ask in prose when you do not.
How to attach a file
- In the prompt, type
@. A dropdown lists matching files as you continue typing. - Move with
↑/↓(Ctrl+P/Ctrl+N, orCtrl+K/Ctrl+J).PageUp/PageDown(orCtrl+U/Ctrl+D) jump a page. - Press
TaborEnterto insert the highlighted file as a chip, then keep writing your request. - Press
Escto close the dropdown without inserting.
@src/main.rs explain the startup pathYou can attach more than one file in the same prompt. Each @ opens the picker again.
Directories
A query that ends with / lists directories only:
@src/TaborEnteron a directory drills into it (the query becomes@src/…/).→on a directory fills the path without a trailing slash, so the next list shows both files and folders inside it. Type/again if you want directories only.→on a file is the same asTab: it inserts the chip.
Line ranges
Two ways to name lines.
Type them. After a path, add :N or :N-M (1-based, inclusive):
@src/main.rs:10
@src/main.rs:10-50Pick them. With a file highlighted in the dropdown, press : or Ctrl+L. A viewer opens with syntax highlighting:
j/kmove the cursor./searches inside the file.vstarts a visual range.Enterconfirms and writes@path:10or@path:10-12onto the chip.Esccancels and leaves the mention as it was.
Hidden and gitignored files
By default the picker respects .gitignore and skips dotfiles. Prefix the query with ! to include them:
@!.env
@!.github
@!.config/The ! stays on the token while you drill (@!src, not @src).
After you send
The chip is part of your message. The assistant treats it as a pointer to that file (or those lines) and reads from there. You do not name an internal tool.
Enter with the caret on a file chip expands it back to plain @path text if you want to edit the mention before sending.