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.
This commit is contained in:
Teknium 2026-04-30 05:00:41 -07:00
parent 4178ab3c07
commit ae8930afa5

View File

@ -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