🤖HermesBlog
Hermes Feature Guides · Part 18/9/2026

Context References — Precise Citations

Context References — Precise Citations — easy-to-understand guide based on official docs

It’s like handing a friend a specific page with a highlighted line instead of tossing them the whole encyclopedia—Hermes lets you feed AI exactly what it needs, nothing more.


What Are Context References?

In Hermes, just type @ followed by a reference in your message, and the AI automatically expands that content and attaches it to your prompt. No more opening files, copying text, and pasting it in. For large projects or hefty documents, this turns a tedious chore into a single keystroke.


Supported Reference Types

Syntax What It Does
@file:path/to/file Injects the entire file content
@file:path/to/file:10-25 Injects only lines 10 to 25 (1-based)
@folder:path/to/folder Shows the folder’s directory tree and file info
@diff Injects your current unstaged code changes
@staged Injects changes you’ve staged but not committed
@git:5 Injects the last 5 commit messages (max 10)
@url:https://example.com Fetches and injects web page content

How to Use It — Real Examples

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

The AI reads main.py in full and gives you actionable feedback.

What changed? @diff

Curious about your recent edits? This pulls the git diff output automatically.

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

Want a paper summarized? Drop the link, and the AI grabs the content itself.


Pro Tip: Use Line Ranges

When files get large, don’t dump everything. Narrow it down:

@file:src/main.py:42        # just line 42
@file:src/main.py:10-25     # just lines 10 to 25

This saves tokens and helps the AI focus on the code that matters.


Safety First — Built-In Protections

Hermes has your back with multiple safeguards:

  • Sensitive path blocking: Directories like .ssh, .aws, and .kube are automatically rejected—no accidental key leaks.
  • Path traversal protection: References can only access files inside your current working directory, so no “escaping” to other locations.
  • Binary file detection: Images, archives, and other binary files are never injected, preventing garbled output.

Size Limits — Don’t Overfeed

To keep the AI from choking, Hermes enforces two thresholds:

  • Over 25% of the context length: a warning is added, but the reference still expands.
  • Over 50%: expansion is refused, and your original message is returned.

Folders show up to 200 entries, and @git caps at 10 commits.


Summary and Practical Advice

Context references are one of Hermes’ most useful features—they make your AI conversations sharper and more efficient. My top tip: prefer line ranges (@file:xxx:10-25) over whole files. You’ll save tokens and help the AI zero in on the critical code. Also, get comfortable with @diff and @git—they’re gold for code reviews and version tracking.

Now go try @ yourself. You’ll wonder how you ever worked without it.

📖 Official Docs

This article is based on the official Hermes Agent documentation:Official docs › user-guide/configuration