The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(compression): a slash-skill body's example paths stay out of the anchor index
Tekniumd602082868bc
diff --git a/agent/context_compressor.py b/agent/context_compressor.pyindex c3c72e6ac86..898f9116a39 100644--- a/agent/context_compressor.py+++ b/agent/context_compressor.py@@ -1046,7 +1046,8 @@ _ANCHOR_NOISE = frozenset({def _build_anchor_index(turns: list[dict[str, Any]]) -> str:"""Regex-harvest exact identifiers from the compacted region (LLM-free); per-category caps, most-frequent first."""- text = "\n".join(c for c in (msg.get("content") for msg in turns) if isinstance(c, str) and c)+ contents = (_typed_user_text(m["content"]) if m.get("role") == "user" and isinstance(m.get("content"), str) else m.get("content") for m in turns)+ text = "\n".join(c for c in contents if isinstance(c, str) and c)if not text:return ""sections: list[str] = []diff --git a/tests/agent/test_ghost_skill_pruning.py b/tests/agent/test_ghost_skill_pruning.pyindex ba32dd9b311..c94bb3f8329 100644--- a/tests/agent/test_ghost_skill_pruning.py+++ b/tests/agent/test_ghost_skill_pruning.py@@ -19,6 +19,7 @@ Test patterns for the marker emit checks adapted from PR #32375"""import json+from pathlib import Pathfrom unittest.mock import MagicMock, patchfrom agent.context_compressor import (@@ -258,7 +259,7 @@ class TestMarkerSurvivesRealCompress:note = ('[IMPORTANT: The user has invoked the "probe-inv" skill, indicating they want '"you to follow its instructions. The full skill content is loaded below.]")body = "RULE: include INV-HERON.\n" + "skill body prose. " * 600- invocation = _build_skill_message({"name": "probe-inv", "content": body}, None, note,+ invocation = _build_skill_message({"name": "probe-inv", "content": body}, Path("/skills/probe-inv"), note,user_instruction="remember PLUM-77")c = _make_compressor(protect_first_n=1, protect_last_n=2, tail_mode="lean")msgs = [@@ -280,6 +281,7 @@ class TestMarkerSurvivesRealCompress:assert _skill_pruned_marker("probe-inv") in summary_textassert "/probe-inv remember PLUM-77" in summary_textassert "skill body prose" not in summary_text+ assert "scripts/foo.js" not in summary_text # the scaffold footer's example path is not session workclass TestReinjectionBoundsAndRedaction: