The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(sessions): repair-prompts leaves prompts healthy under the old skill guidance
Teknium51d8010cf776
diff --git a/hermes_cli/sessions_cmd.py b/hermes_cli/sessions_cmd.pyindex 63fac751381..ef29f429159 100644--- a/hermes_cli/sessions_cmd.py+++ b/hermes_cli/sessions_cmd.py@@ -1105,11 +1105,12 @@ def _repair_prompts_pin_names(row) -> list[str] | None:def _repair_prompts_lacks_skill_safety(row) -> bool:# Only the skill_manage guidance is a reliable marker: <available_skills> is legitimately absent when no- # skills are installed, but SKILLS_GUIDANCE is emitted whenever skill_manage is (prompts stored before the- # Skill Safety Rule moved to compaction carry it too, as the rule's opening line).+ # skills are installed, but the guidance is emitted whenever skill_manage is. A prompt stored before the+ # Skill Safety Rule moved to compaction carries that heading, under whichever opening line it was built with.+ from agent.context_compressor_tail import SKILL_SAFETY_HEADINGfrom agent.prompt_builder import SKILLS_GUIDANCEprompt = (row.get("system_prompt") or "").strip()- return bool(prompt and SKILLS_GUIDANCE not in prompt)+ return bool(prompt and SKILLS_GUIDANCE not in prompt and SKILL_SAFETY_HEADING not in prompt)def _cmd_repair_prompts(db, args):diff --git a/tests/hermes_cli/test_sessions_repair_prompts.py b/tests/hermes_cli/test_sessions_repair_prompts.pyindex 8d9b428d1fb..9b6640a0414 100644--- a/tests/hermes_cli/test_sessions_repair_prompts.py+++ b/tests/hermes_cli/test_sessions_repair_prompts.py@@ -102,3 +102,21 @@ def test_scan_leaves_reduced_memory_only_zero_skills_rows_and_session_id_overridassert "already has no stored prompt" in capsys.readouterr().outassert _cmd_repair_prompts(db, _args(session_id="no-such-session", apply=True)) == 1assert "No session matches" in capsys.readouterr().out+++def test_scan_leaves_a_healthy_prompt_stored_before_the_skill_guidance_rewordings(db, monkeypatch, capsys):+ # Literal skills guidance stored before its opening line was reworded: old opening, then the Skill Safety heading.+ legacy = (+ "You are Hermes.\n"+ "<available_skills>\n dogfood: exploratory QA of web apps\n</available_skills>\n"+ "After completing a complex task (5+ tool calls), fixing a tricky error, or discovering a non-trivial "+ "workflow, save the approach as a skill with skill_manage so you can reuse it next time.\n\n"+ "## Skill Safety Rule\n"+ "A skill placeholder containing `[SKILL_PRUNED]` lost its content in context compression and is "+ "inaccessible — reload it with skill_view(name='...') before acting on anything that depends on it.\n"+ )+ healthy = db.create_session("legacy-healthy", "telegram", system_prompt=legacy)+ db.update_session_tool_names(healthy, _pin("skills_list", "skill_manage"))++ assert _apply_json(db, monkeypatch, capsys)["cleared"] == []+ assert db.get_session(healthy)["system_prompt"] == legacy