Skip to content

Count skills Codex loads by printing SKILL.md - #45

Merged
0xCardinal merged 1 commit into
mainfrom
fix/file-skill-invocations
Oct 4, 2026
Merged

0xCardinal merged 1 commit into
mainfrom
fix/file-skill-invocations

Conversation

@0xCardinal

Copy link
Copy Markdown
Member

Problem

Codex has no Skill tool. It loads a skill with a shell command like cat ~/.agents/skills/code-review/SKILL.md. Extension usage only counted Skill tool calls and SKILL.md reads through file tools, so Codex skill use never showed up (e.g. Codex session 01a1056e-0eb9-7d11-8b11-0f70c7128c0d loaded code-review, i-have-adhd and unslop in one cat; none registered).

Change

  • Shell commands that print SKILL.md files (cat/sed/head/…, also via rtk proxy or sh -c) count as skill reads. The full command comes from detail.command when the stored target is clipped at 120 chars. Writing, listing or grepping a skill file does not count.
  • One command can load several skills, so extension_uses is keyed by (event_id, ord). The table is derived from events, so _migrate drops and recreates it; USAGE_VERSION bump refills it.
  • Shell reads use via: "read", so they still fold into a nearby Skill tool load instead of double counting.

Testing

  • New test_codex_shell_skill_reads_count_as_loads; full backend suite passes (404), ruff clean.
  • Migration checked on a DB with the old schema; re-running init is a no-op.
  • Dry run on a real 2 GB DB: 208 shell skill reads found (mostly Codex); sync filter query takes ~1.3s.

🤖 Generated with Claude Code

Codex has no Skill tool; it loads a skill with a shell command such as
`cat ~/.agents/skills/code-review/SKILL.md`. Extension usage only looked at
Skill tool calls and SKILL.md reads through file tools, so Codex skill use
never registered.

Shell commands that print SKILL.md files (cat/sed/head/..., through rtk or
sh -c wrappers) now count as skill reads, using the full command when the
stored target is clipped. One command can load several skills, so
extension_uses is keyed by (event_id, ord); the derived table is rebuilt
on upgrade.
@0xCardinal
0xCardinal merged commit acfc1b3 into main Oct 4, 2026
11 checks passed
@0xCardinal
0xCardinal deleted the fix/file-skill-invocations branch October 4, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant