الأكاديمية ← ميزات Hermesتوثيق رسمي · إرشاد عربي

الإشارة إلى ملفات ومصادر داخل المحادثة

Context References

متوسط4 دقائق قراءةالدرس 23سؤالان✓ 2026-08-18
قبل أن تقرأ

ما هذه الصفحة، وماذا تحتوي.

السياق: المساحة التي يقرأها النموذج قبل أن يجيب: رسائلك، الملفات المفتوحة، ما استرجعه من الذاكرة. السياق محدود. ما يدخل فيه يؤثّر في الجواب، وما لا يدخل كأنه غير موجود. القراءة نحو 4 دقائق. انتبه: حشو السياق بكل شيء يضعف الجواب ويرفع التكلفة. أعطه ما يخص المهمة الحالية فقط.

10أقسام
4أمثلة برمجية
3جداول
0أوامر
623كلمة من المصدر
الوصف الرسمي في سطر

Inline @-syntax for attaching files, folders, git diffs, and URLs directly into your messages

ماذا ستستطيع بعدها

نتائج مأخوذة من هذه الصفحة، لا من قالب.

  • تعرف ما السياق ولماذا قد تحتاجه.
  • تقرأ الجدول وتأخذ منه السطر الذي يخصّك فقط.
  • تعرف الخطأ الشائع: حشو السياق بكل شيء يضعف الجواب ويرفع التكلفة. أعطه ما يخص المهمة الحالية فقط.
خريطة الصفحة

انتقل مباشرة إلى ما تحتاجه.

  1. 01Supported References
  2. 02Usage Examples
  3. 03CLI Tab Completion
  4. 04Line Ranges
  5. 05Size Limits
  6. 06Security
  7. 07Platform Availability
  8. 08Interaction with Context Compression
  9. 09Common Patterns
  10. 10Error Handling
الصفحة الرسمية كاملة

بلا اختصار أو حذف.

النص أدناه منقول من المصدر الرسمي بالإنجليزية حتى تبقى الأوامر والأسماء دقيقة كما هي. قبل كل قسم شرح عربي يوضّح ما بداخله.

Type @ followed by a reference to inject content directly into your message. Hermes expands the reference inline and appends the content under an --- Attached Context --- section.

Supported References

جدول مرجعي. لا تقرأه كله، ابحث عن السطر الذي يخصّك فقط.

SyntaxDescription
@file:path/to/file.pyInject file contents
@file:path/to/file.py:10-25Inject specific line range (1-indexed, inclusive)
@folder:path/to/dirInject directory tree listing with file metadata
@diffInject git diff (unstaged working tree changes)
@stagedInject git diff --staged (staged changes)
@git:5Inject last N commits with patches (max 10)
@url:https://example.comFetch and inject web page content

Usage Examples

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه. تذكير: المساحة التي يقرأها النموذج قبل أن يجيب: رسائلك، الملفات المفتوحة، ما استرجعه من الذاكرة.

Text9 أسطر
Review @file:src/main.py and suggest improvements

What changed? @diff

Compare @file:old_config.yaml and @file:new_config.yaml

What's in @folder:src/components?

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

Multiple references work in a single message:

Textسطر واحد
Check @file:main.py, and also @file:test.py.

Trailing punctuation (,, ., ;, !, ?) is automatically stripped from reference values.

CLI Tab Completion

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

In the interactive CLI, typing @ triggers autocomplete:

  • @ shows all reference types (@diff, @staged, @file:, @folder:, @git:, @url:)
  • @file: and @folder: trigger filesystem path completion with file size metadata
  • Bare @ followed by partial text shows matching files and folders from the current directory

Line Ranges

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

The @file: reference supports line ranges for precise content injection:

Textسطران
@file:src/main.py:42        # Single line 42
@file:src/main.py:10-25     # Lines 10 through 25 (inclusive)

Lines are 1-indexed. Invalid ranges are silently ignored (full file is returned).

Size Limits

جدول مرجعي. لا تقرأه كله، ابحث عن السطر الذي يخصّك فقط.

Context references are bounded to prevent overwhelming the model's context window:

ThresholdValueBehavior
Soft limit25% of context lengthWarning appended, expansion proceeds
Hard limit50% of context lengthExpansion refused, original message returned unchanged
Folder entries200 files maxExcess entries replaced with - ...
Git commits10 max@git:N clamped to range [1, 10]

Security

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

Sensitive Path Blocking

These paths are always blocked from @file: references to prevent credential exposure:

  • SSH keys and config: ~/.ssh/id_rsa, ~/.ssh/id_ed25519, ~/.ssh/authorized_keys, ~/.ssh/config
  • Shell profiles: ~/.bashrc, ~/.zshrc, ~/.profile, ~/.bash_profile, ~/.zprofile
  • Credential files: ~/.netrc, ~/.pgpass, ~/.npmrc, ~/.pypirc
  • Hermes env: $HERMES_HOME/.env

These directories are fully blocked (any file inside):

  • ~/.ssh/, ~/.aws/, ~/.gnupg/, ~/.kube/, $HERMES_HOME/skills/.hub/

Path Traversal Protection

All paths are resolved relative to the working directory. References that resolve outside the allowed workspace root are rejected.

Binary File Detection

Binary files are detected via MIME type and null-byte scanning. Known text extensions (.py, .md, .json, .yaml, .toml, .js, .ts, etc.) bypass MIME-based detection. Binary files are rejected with a warning.

Platform Availability

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

Context references are primarily a CLI feature. They work in the interactive CLI where @ triggers tab completion and references are expanded before the message is sent to the agent.

In messaging platforms (Telegram, Discord, etc.), the @ syntax is not expanded by the gateway — messages are passed through as-is. The agent itself can still reference files via the read_file, search_files, and web_extract tools.

Interaction with Context Compression

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

When conversation context is compressed, the expanded reference content is included in the compression summary. This means:

  • Large file contents injected via @file: contribute to context usage
  • If the conversation is later compressed, the file content is summarized (not preserved verbatim)
  • For very large files, consider using line ranges (@file:main.py:100-200) to inject only relevant sections

Common Patterns

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

Text13 سطرًا
# Code review workflow
Review @diff and check for security issues

# Debug with context
This test is failing. Here's the test @file:tests/test_auth.py
and the implementation @file:src/auth.py:50-80

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

# Research
Compare the approaches in @url:https://arxiv.org/abs/2301.00001
and @url:https://arxiv.org/abs/2301.00002

Error Handling

قسم لحل المشكلات. ابحث فيه عن العطل الذي يشبه حالتك بدل قراءته كاملًا.

Invalid references produce inline warnings rather than failures:

ConditionBehavior
File not foundWarning: "file not found"
Binary fileWarning: "binary files are not supported"
Folder not foundWarning: "folder not found"
Git command failsWarning with git stderr
URL returns no contentWarning: "no content extracted"
Sensitive pathWarning: "path is a sensitive credential file"
Path outside workspaceWarning: "path is outside the allowed workspace"
اختبار الفهم

سؤالان إجاباتها كلها في هذه الصفحة.

كل خيار اسم حقيقي من توثيق Hermes. حتى الخيارات الخاطئة حقيقية، لكنها من صفحات أخرى.

1. في جدول هذا الدرس، ما «Description» المقابل لـ«@file:path/to/file.py:10-25»؟
2. أي عنوان من التالي لا يظهر في هذا الدرس؟