The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(anthropic): quoted slugs stay identifiers; a sentence-final dot is prose
kshitijk4poorf7676e7ff1f5
diff --git a/agent/anthropic_adapter.py b/agent/anthropic_adapter.pyindex 9347acc4667..228f4d5e458 100644--- a/agent/anthropic_adapter.py+++ b/agent/anthropic_adapter.py@@ -470,11 +470,11 @@ def _oauth_wire_namer(anthropic_tools: List[Dict[str, Any]]):_OAUTH_SYSTEM_REPLACEMENTS = (("Hermes Agent", "Claude Code"), ("Hermes agent", "Claude Code"), ("Nous Research", "Anthropic"),)-# The slug is rewritten only as a standalone word. Joined to a host, path, repo or mailbox-# (``hermes-agent.nousresearch.com``, ``~/.hermes/hermes-agent/venv``,-# ``NousResearch/hermes-agent``) it is an address the model dereferences, and the rewritten-# form does not exist (#48860).-_OAUTH_SLUG_PATTERN = re.compile(r"(?<![\w./:@-])hermes-agent(?![\w./@-])")+# The slug is rewritten only as a standalone prose word. Joined to a host, path, repo, mailbox+# or quoted as an identifier (``hermes-agent.nousresearch.com``, ``~/.hermes/hermes-agent/venv``,+# ``NousResearch/hermes-agent``, ``skill_view(name='hermes-agent')``) it is an address the model+# dereferences, and the rewritten form does not exist (#48860). A sentence-final ``.`` is prose.+_OAUTH_SLUG_PATTERN = re.compile(r"""(?<![\w./:@'"`-])hermes-agent(?![\w/@'"`-]|\.\w)""")def _apply_claude_code_identity(system, anthropic_tools, anthropic_messages, to_wire):diff --git a/tests/agent/test_anthropic_adapter.py b/tests/agent/test_anthropic_adapter.pyindex f0ef4abe0f8..97684baffca 100644--- a/tests/agent/test_anthropic_adapter.py+++ b/tests/agent/test_anthropic_adapter.py@@ -1909,7 +1909,8 @@ def test_oauth_system_prompt_sanitizer_preserves_docs_url():"Hermes Agent by Nous Research uses hermes-agent skills. ""Docs: https://hermes-agent.nousresearch.com/docs ; ""interpreter ~/.hermes/hermes-agent/venv/bin/python ; "- "source github.com/NousResearch/hermes-agent"+ "source github.com/NousResearch/hermes-agent ; mail [email protected] ; "+ "skill_view(name='hermes-agent') ; built by hermes-agent."),},{"role": "user", "content": "Hi"},@@ -1927,4 +1928,7 @@ def test_oauth_system_prompt_sanitizer_preserves_docs_url():# ``~/.hermes/claude-code/venv/bin/python`` fails on a file that does not exist.assert "~/.hermes/hermes-agent/venv/bin/python" in system_textassert "github.com/NousResearch/hermes-agent" in system_text- assert "claude-code" not in system_text.replace("claude-code skills", "")+ assert "[email protected]" in system_text+ assert "skill_view(name='hermes-agent')" in system_text # a quoted slug is an identifier+ assert "built by claude-code." in system_text # a sentence-final dot is prose+ assert system_text.count("claude-code") == 2