diff --git a/agent/context_compressor.py b/agent/context_compressor.py index 2baa2731c627..1406aa2197b9 100644 --- a/agent/context_compressor.py +++ b/agent/context_compressor.py @@ -891,7 +891,13 @@ def _summarize_tool_result_unguarded(tool_name: str, tool_args: str, tool_conten 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 fc94ca2a6b22..a7340f17279a 100644 --- a/agent/prompt_builder.py +++ b/agent/prompt_builder.py @@ -192,7 +192,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 = (