From 8ea467097214746b1b6b49b248984f2adabb1017 Mon Sep 17 00:00:00 2001 From: Bartok9 Date: Thu, 30 Apr 2026 03:36:44 -0400 Subject: [PATCH 1/2] fix(skills): wire bump_use() into skill invocation and preload paths (#17782) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bump_use() existed and was tested but had zero production call sites — use_count stayed 0 for all skills, breaking Curator's stale-detection logic which relies on last_used_at. Wire bump_use() into: 1. build_skill_invocation_message() — when a user invokes /skill-name 2. build_preloaded_skills_prompt() — when a skill is preloaded at session start Both are the canonical 'a skill is actively being used' moments, distinct from 'browsing' (bump_view in skill_view tool call). Closes #17782 --- agent/skill_commands.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/agent/skill_commands.py b/agent/skill_commands.py index e878326afeee..ad1f03824d3f 100644 --- a/agent/skill_commands.py +++ b/agent/skill_commands.py @@ -393,6 +393,14 @@ def build_skill_invocation_message( return f"[Failed to load skill: {skill_info['name']}]" loaded_skill, skill_dir, skill_name = loaded + + # Track active usage for Curator lifecycle management (#17782) + try: + from tools.skill_usage import bump_use + bump_use(skill_name) + except Exception: + pass # Non-critical — skill invocation proceeds regardless + activation_note = ( f'[IMPORTANT: The user has invoked the "{skill_name}" skill, indicating they want ' "you to follow its instructions. The full skill content is loaded below.]" @@ -432,6 +440,14 @@ def build_preloaded_skills_prompt( continue loaded_skill, skill_dir, skill_name = loaded + + # Track active usage for Curator lifecycle management (#17782) + try: + from tools.skill_usage import bump_use + bump_use(skill_name) + except Exception: + pass # Non-critical + activation_note = ( f'[IMPORTANT: The user launched this CLI session with the "{skill_name}" skill ' "preloaded. Treat its instructions as active guidance for the duration of this " From 396dc34a5d4a3a20f730d260162cb9b00c995a87 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Thu, 30 Apr 2026 05:00:41 -0700 Subject: [PATCH 2/2] fix(skills): also bump_use on skill_view tool invocation Widen #17818 to cover the dominant 'agent actively used this skill' path: when the model calls the skill_view tool, bump use_count alongside view_count. The slash-command and --skill preload paths (covered by the cherry-picked commit) only catch user-initiated invocation; most skill activation happens via the agent calling skill_view to consume an indexed skill. Curator's stale-timer keys off last_used_at (agent/curator.py:233), so without this wire-up agent-created skills would transition to stale simultaneously regardless of actual use. --- tools/skills_tool.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/skills_tool.py b/tools/skills_tool.py index ed7a3e6a8d55..37319a74084f 100644 --- a/tools/skills_tool.py +++ b/tools/skills_tool.py @@ -1497,8 +1497,12 @@ def _skill_view_with_bump(args, **kw): # qualified forms ("plugin:skill") return with the canonical name. resolved = parsed.get("name") or name if resolved: - from tools.skill_usage import bump_view + from tools.skill_usage import bump_use, bump_view bump_view(str(resolved)) + # A skill_view tool call is the agent actively loading the skill + # to act on it — that counts as use, not just a browse/view. + # Curator's stale timer keys off last_used_at (see agent/curator.py). + bump_use(str(resolved)) except Exception: pass return result