Skip to content

Context references (@-syntax)

This is one of those small features I use constantly. Type @ followed by a reference in a CLI message, and Hermes injects that content inline before sending. No "let me read the file first" round-trip, the file (or diff, or web page) is just there in the message.

Supported references

SyntaxInjects
@file:path/to/file.pyFile contents
@file:path/to/file.py:10-25A specific line range (1-indexed, inclusive)
@folder:path/to/dirDirectory tree listing with file metadata
@diffgit diff (unstaged working tree changes)
@stagedgit diff --staged
@git:5Last N commits with patches (max 10)
@url:https://example.comFetched web page content

Examples

text
Review @file:src/main.py and suggest improvements

What changed? @diff

This test is failing: @file:tests/test_auth.py
and the implementation @file:src/auth.py:50-80

What does this project do? @folder:src @file:README.md

Summarize @url:https://arxiv.org/abs/2301.00001

Multiple references work in one message, and trailing punctuation is stripped automatically.

Tab completion

In the interactive CLI, typing @ opens autocomplete: it lists the reference types, and @file:/@folder: complete filesystem paths with size metadata. You rarely need to type a full path.

Size limits

References are bounded so they cannot blow up your context window:

ThresholdValueBehavior
Soft limit25% of context lengthWarning, expansion still proceeds
Hard limit50% of context lengthExpansion refused, message sent unchanged
Folder entries200 files maxExcess replaced with - ...
Git commits10 max@git:N clamped to 1-10

On a local model with a 64K window this matters more than on a giant cloud context, so for big files prefer a line range: @file:main.py:100-200.

Security

Some paths are always blocked from @file: to prevent leaking secrets into the prompt: SSH keys and config, shell profiles (~/.bashrc, ~/.zshrc), credential files (~/.netrc, ~/.npmrc), and $HERMES_HOME/.env. Whole directories are blocked too (~/.ssh/, ~/.aws/, ~/.gnupg/, ~/.kube/). Paths that resolve outside the workspace are rejected, and binary files are refused with a warning.

Platform availability

Context references are a CLI feature. On messaging platforms the @ syntax is passed through literally, the agent can still read files there using its read_file, search_files, and web_extract tools instead.

Compression note

Injected content counts toward context usage and, if the session is later compressed, the file content is summarized rather than kept verbatim. Inject focused excerpts, not whole large files, when you can.

Personal learning notes on Hermes Agent. Not affiliated with Nous Research. Verify against official docs.