From 846a5fd4f0288fd80bb07595fb233208e826c2ba Mon Sep 17 00:00:00 2001 From: Jonathan Boisson Date: Sun, 7 Jun 2026 13:42:49 +0000 Subject: [PATCH] fix: ghost skill P0/P1 mitigation - [SKILL_PRUNED] marker + safety rule --- agent/context_compressor.py | 8 +++++++- agent/prompt_builder.py | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/agent/context_compressor.py b/agent/context_compressor.py index 16db1bedc30f..b12634b76bca 100644 --- a/agent/context_compressor.py +++ b/agent/context_compressor.py @@ -551,7 +551,13 @@ def _summarize_tool_result(tool_name: str, tool_args: str, tool_content: str) -> code_preview += "..." return f"[execute_code] `{code_preview}` ({line_count} lines output)" - if tool_name in {"skill_view", "skills_list", "skill_manage"}: + if tool_name == "skill_view": + name = args.get("name", "?") + if content_len > 5000: + return f"[skill_view] name={name} ({content_len:,} chars) [SKILL_PRUNED: content lost in compression; reload with skill_view before relying on it]" + return f"[skill_view] name={name} ({content_len:,} chars)" + + if tool_name in {"skills_list", "skill_manage"}: name = args.get("name", "?") return f"[{tool_name}] name={name} ({content_len:,} chars)" diff --git a/agent/prompt_builder.py b/agent/prompt_builder.py index b11cade39bd6..2ced932efd34 100644 --- a/agent/prompt_builder.py +++ b/agent/prompt_builder.py @@ -175,7 +175,12 @@ SKILLS_GUIDANCE = ( "skill with skill_manage so you can reuse it next time.\n" "When using a skill and finding it outdated, incomplete, or wrong, " "patch it immediately with skill_manage(action='patch') — don't wait to be asked. " - "Skills that aren't maintained become liabilities." + "Skills that aren't maintained become liabilities.\n" + "\n" + "## Skill Safety Rule\n" + "1. **UNAVAILABLE** — If a skill placeholder contains `[SKILL_PRUNED]`, the skill content was lost in compression and is inaccessible.\n" + "2. **RELOAD** — Before performing any action that depends on a skill, re-check its content with `skill_view(name='...')` if it shows `[SKILL_PRUNED]`.\n" + "3. **WAIT** — If a skill is loading or was just pruned, wait for the reload confirmation before proceeding." ) KANBAN_GUIDANCE = (