File references let you include file contents or directory trees directly in your chat messages using @path syntax. This provides quick context without manually copying content, and since the content is expanded inline before sending, it avoids tool calls—saving tokens.
Type @ followed by a file or directory path:
@src/index.ts # Include file contents @src/ # Include directory tree @./relative/path # Relative paths @"path with spaces.txt" # Quoted paths (required for spaces)
References can appear anywhere in your message:
Review @src/auth.ts for security issues Compare @old.json with @new.json What's in @src/ that handles authentication?
Press Tab after @ to auto-complete paths:
@src/<Tab> # Shows files in src/ @package<Tab> # Completes to @package.json @"Screenshot 2024<Tab> # Completes to @"Screenshot 2024-01.png"
Completion works anywhere in the input line. Tab completion automatically adds quotes when needed for paths with spaces.
When a reference could match both a prompt and a file:
@name matches a prompt from /prompts list, it's treated as a promptTo force file resolution when a prompt has the same name, use an explicit path: @./myfile
Supported: Text files (source code, config, markdown) up to 250KB.
Not supported: Binary files (images, executables, archives) show an error.
Large files are truncated at 250KB:
⚠ File 'large-file.json' was truncated (exceeds 250KB limit)
Directory references expand to a tree listing:
@src/
Expands to:
src/ ├── lib/ │ ├── auth.ts │ └── utils.ts ├── index.ts └── config.json
Limits:
Review a file:
> Review @src/auth.ts for security issues
Compare files:
> What's different between @v1/handler.py and @v2/handler.py?
Explore structure:
> What's the structure of @infra/cdk/?
Mixed context:
> Using the config in @serverless.yml, update @src/lambda/index.ts
| Issue | Solution |
|---|---|
| Reference treated as prompt | A prompt with the same name exists. Use an explicit path: @./myfile |
| File not found | Verify the path is relative to your current directory, or use an absolute path |
| Directory too deep | Subdirectories beyond 3 levels aren't shown. Reference a specific subdirectory: @src/deep/path/ |
| Path with spaces not recognized | Use quoted syntax: @"path with spaces.txt" |
File references currently support:
@*.ts)@file.ts:10-20)@~/file)Binary files (images, executables, archives) are not supported.
File references