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

  1. In the prompt, type @. A dropdown lists matching files as you continue typing.
  2. Move with / (Ctrl+P / Ctrl+N, or Ctrl+K / Ctrl+J). PageUp / PageDown (or Ctrl+U / Ctrl+D) jump a page.
  3. Press Tab or Enter to insert the highlighted file as a chip, then keep writing your request.
  4. Press Esc to close the dropdown without inserting.
@src/main.rs explain the startup path

You 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/
  • Tab or Enter on 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 as Tab: 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-50

Pick them. With a file highlighted in the dropdown, press : or Ctrl+L. A viewer opens with syntax highlighting:

  • j / k move the cursor.
  • / searches inside the file.
  • v starts a visual range.
  • Enter confirms and writes @path:10 or @path:10-12 onto the chip.
  • Esc cancels 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.