Skip to content

Add @ context references for files, folders, diffs, git, and URLs#2090

Closed
kshitijk4poor wants to merge 6 commits into
NousResearch:mainfrom
kshitijk4poor:issue-682-at-context-references
Closed

Add @ context references for files, folders, diffs, git, and URLs#2090
kshitijk4poor wants to merge 6 commits into
NousResearch:mainfrom
kshitijk4poor:issue-682-at-context-references

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Summary

  • add a reusable @ context reference parser/expander for @file, ranged @file, @folder, @diff, @staged, @git:N, and @url
  • wire reference expansion into both CLI and gateway message preprocessing, with token-budget warnings/refusal behavior
  • add CLI autocomplete for @file: and @folder: and document the new feature in the user guide

Closes #682.

Testing

  • source .venv/bin/activate && python -m pytest -o addopts='' tests/test_context_references.py tests/hermes_cli/test_commands.py tests/test_cli_context_references.py tests/gateway/test_context_references.py -q
  • source .venv/bin/activate && python -m pytest -o addopts='' tests/ -q (fails in this environment on unrelated existing tests outside this change set: tests/hermes_cli/test_gateway_service.py::TestEnsureUserSystemdEnv::test_sets_xdg_runtime_dir_when_missing, tests/integration/test_ha_integration.py::TestGatewayWebSocket::test_event_received_and_forwarded, tests/tools/test_delegate.py::TestDelegationCredentialResolution::test_direct_endpoint_does_not_fall_back_to_openrouter_api_key_env, tests/tools/test_transcription.py::TestGetProvider::test_explicit_openai_no_key_returns_none, tests/tools/test_transcription.py::TestTranscribeOpenAI::test_no_key, and three tests/tools/test_web_tools_config.py::TestParallelClientConfig::* cases because parallel is not installed.)

teknium1 added a commit that referenced this pull request Mar 21, 2026
…injection

Add @file:path, @folder:dir, @diff, @StaGeD, @git:N, and @url:
references that expand inline before the message reaches the LLM.
Supports line ranges (@file:main.py:10-50), token budget enforcement
(soft warn at 25%, hard block at 50%), and path sandboxing for gateway.

Core module from PR #2090 by @kshitijk4poor. CLI and gateway wiring
rewritten against current main. Fixed asyncio.run() crash when called
from inside a running event loop (gateway).

Closes #682.
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #2343. Core module cherry-picked with authorship preserved. CLI/gateway wiring rewritten against current main, asyncio.run() crash fixed for gateway context. Thanks for the solid implementation!

@teknium1 teknium1 closed this Mar 21, 2026
outsourc-e pushed a commit to outsourc-e/hermes-agent that referenced this pull request Mar 26, 2026
…injection

Add @file:path, @folder:dir, @diff, @StaGeD, @git:N, and @url:
references that expand inline before the message reaches the LLM.
Supports line ranges (@file:main.py:10-50), token budget enforcement
(soft warn at 25%, hard block at 50%), and path sandboxing for gateway.

Core module from PR NousResearch#2090 by @kshitijk4poor. CLI and gateway wiring
rewritten against current main. Fixed asyncio.run() crash when called
from inside a running event loop (gateway).

Closes NousResearch#682.
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…injection

Add @file:path, @folder:dir, @diff, @StaGeD, @git:N, and @url:
references that expand inline before the message reaches the LLM.
Supports line ranges (@file:main.py:10-50), token budget enforcement
(soft warn at 25%, hard block at 50%), and path sandboxing for gateway.

Core module from PR NousResearch#2090 by @kshitijk4poor. CLI and gateway wiring
rewritten against current main. Fixed asyncio.run() crash when called
from inside a running event loop (gateway).

Closes NousResearch#682.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…injection

Add @file:path, @folder:dir, @diff, @StaGeD, @git:N, and @url:
references that expand inline before the message reaches the LLM.
Supports line ranges (@file:main.py:10-50), token budget enforcement
(soft warn at 25%, hard block at 50%), and path sandboxing for gateway.

Core module from PR NousResearch#2090 by @kshitijk4poor. CLI and gateway wiring
rewritten against current main. Fixed asyncio.run() crash when called
from inside a running event loop (gateway).

Closes NousResearch#682.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…injection

Add @file:path, @folder:dir, @diff, @StaGeD, @git:N, and @url:
references that expand inline before the message reaches the LLM.
Supports line ranges (@file:main.py:10-50), token budget enforcement
(soft warn at 25%, hard block at 50%), and path sandboxing for gateway.

Core module from PR NousResearch#2090 by @kshitijk4poor. CLI and gateway wiring
rewritten against current main. Fixed asyncio.run() crash when called
from inside a running event loop (gateway).

Closes NousResearch#682.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…injection

Add @file:path, @folder:dir, @diff, @StaGeD, @git:N, and @url:
references that expand inline before the message reaches the LLM.
Supports line ranges (@file:main.py:10-50), token budget enforcement
(soft warn at 25%, hard block at 50%), and path sandboxing for gateway.

Core module from PR NousResearch#2090 by @kshitijk4poor. CLI and gateway wiring
rewritten against current main. Fixed asyncio.run() crash when called
from inside a running event loop (gateway).

Closes NousResearch#682.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…injection

Add @file:path, @folder:dir, @diff, @StaGeD, @git:N, and @url:
references that expand inline before the message reaches the LLM.
Supports line ranges (@file:main.py:10-50), token budget enforcement
(soft warn at 25%, hard block at 50%), and path sandboxing for gateway.

Core module from PR NousResearch#2090 by @kshitijk4poor. CLI and gateway wiring
rewritten against current main. Fixed asyncio.run() crash when called
from inside a running event loop (gateway).

Closes NousResearch#682.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: @ Context References — Scoped File, Folder, Diff & URL Injection in Messages

2 participants