Skip to content

The agent that grows with you

fix(anthropic): a possessive 'hermes-agent's' is prose and is still rewritten

kshitijk4poorae62e832cc35
diff --git a/agent/anthropic_adapter.py b/agent/anthropic_adapter.py
index 228f4d5e458..a7f73e3cb62 100644
--- a/agent/anthropic_adapter.py
+++ b/agent/anthropic_adapter.py
@@ -473,8 +473,9 @@ _OAUTH_SYSTEM_REPLACEMENTS = (
# 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)""")
+# dereferences, and the rewritten form does not exist (#48860). A sentence-final ``.`` and a
+# possessive ``'s`` are prose.
+_OAUTH_SLUG_PATTERN = re.compile(r"""(?<![\w./:@'"`-])hermes-agent(?![\w/@"`-]|\.\w|'(?!s\b))""")
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.py
index 97684baffca..c2390dc257b 100644
--- a/tests/agent/test_anthropic_adapter.py
+++ b/tests/agent/test_anthropic_adapter.py
@@ -1910,7 +1910,7 @@ def test_oauth_system_prompt_sanitizer_preserves_docs_url():
"Docs: https://hermes-agent.nousresearch.com/docs ; "
"interpreter ~/.hermes/hermes-agent/venv/bin/python ; "
"source github.com/NousResearch/hermes-agent ; mail [email protected] ; "
- "skill_view(name='hermes-agent') ; built by hermes-agent."
+ "skill_view(name='hermes-agent') ; hermes-agent's docs ; built by hermes-agent."
),
},
{"role": "user", "content": "Hi"},
@@ -1931,4 +1931,5 @@ def test_oauth_system_prompt_sanitizer_preserves_docs_url():
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
+ assert "claude-code's docs" in system_text # so is a possessive
+ assert kwargs["system"][-1]["text"].count("claude-code") == 3 # the caller's block, not the CC prefix