Skip to content

fix(pi): classify native skill loads as Skill, not Read (#588) - #590

Merged
iamtoruk merged 1 commit into
getagentseal:mainfrom
ozymandiashh:fix/pi-skill-load-classification
Jul 1, 2026
Merged

iamtoruk merged 1 commit into
getagentseal:mainfrom
ozymandiashh:fix/pi-skill-load-classification

Conversation

@ozymandiashh

Copy link
Copy Markdown
Collaborator

Classify Pi/OMP native skill loads (#588)

Fixes #588.

The problem

Pi (and its sibling OMP) have no dedicated skill tool the way Claude Code does. When these agents load a skill natively, they don't emit a Skill call — they emit an ordinary read tool call whose path points at the skill's SKILL.md:

{"type":"toolCall","name":"read","arguments":{"path":".../.pi/skills/bmad-create-story/SKILL.md"}}

The Pi/OMP parser (src/providers/pi.ts, shared by both providers) mapped every read to the Read tool and never populated skills. Two consequences for any session that used Pi skills:

  1. Reads are over-counted. Each skill load inflates the Read tally, so the Tool breakdown misrepresents how much file reading actually happened.
  2. The Skills & Agents panel is always empty. Pi/OMP never contributed anything to the skill dimension, so skill usage was invisible.

Why the first attempt was not enough

The obvious fix, routing SKILL.md reads out of tools and into skills, fixes the Read over-count but leaves the Skills panel empty. The breakdown pipeline is gated:

  • skillBreakdown is populated only from a turn's subCategory (src/parser.ts).
  • subCategory is set only when the classifier tags the turn general (src/classifier.ts).
  • A turn is general only when its tool list contains a literal Skill entry (hasSkillTool).

The Claude parser works because it keeps Skill in its tools list. So simply dropping the read populates a field nothing downstream reads.

The fix

A skill-load read is now surfaced as the Skill tool (not Read), with the skill name recorded in skills, exactly mirroring how the Claude parser represents a skill invocation. This removes the Read over-count and lets the shared classifier tag the turn general so the Skills & Agents breakdown picks it up.

Detection (skillLoadName in src/providers/pi.ts): a read call is a skill load when its path (read from arguments.path, with a defensive arguments.file_path fallback) is either

  • a physical path whose basename is exactly SKILL.md → skill name is the parent directory (e.g. bmad-create-story), or
  • a skill://<name> URI (used by newer OMP builds) → skill name is the URI segment.

Matching is on the SKILL.md basename rather than a directory prefix, because Pi resolves skills from many roots (~/.pi/agent/skills, project .pi/skills, .agents/skills, package skills/, --skill <path>). The path key was verified as path against Pi's read.ts schema and a real transcript; file_path is kept only as a compatibility fallback. bash command extraction is unaffected — it runs over the raw tool calls independently.

A mixed skill-load-plus-edit turn still classifies as coding (no subCategory), which is identical to the existing Claude behavior — parity, not a regression.

Files

  1. src/providers/pi.ts — new skillLoadName(name, args) predicate + name extractor; the parser loop now splits tool calls, surfacing skill loads as Skill and recording names in skills, and the yielded ParsedProviderCall carries skills.
  2. tests/providers/pi.test.ts — tests for SKILL.md, skill://, and file_path detection; a non-skill read staying a Read; and an end-to-end check that a parsed skill load flows through the real classifyTurn to subCategory (the value skillBreakdown consumes).
  3. docs/providers/pi.md — documents the skill-load quirk.

Verification

  • npx tsc --noEmit clean.
  • npx vitest run tests/providers/pi.test.ts tests/providers/omp.test.ts tests/classifier.test.ts — 51 passed. (The unrelated pre-existing overview.test.ts locale/no-color failure is untouched by this change.)

…#588)

Pi and OMP have no dedicated skill tool: a native skill load is emitted as
an ordinary `read` tool call whose path points at the skill's SKILL.md (or a
`skill://<name>` URI in newer OMP builds). The parser mapped every read to the
Read tool and never populated `skills`, so Pi/OMP sessions over-counted Reads
AND always showed an empty "Skills & Agents" breakdown.

Detect these reads (basename === 'SKILL.md', or a skill:// URI), extract the
skill name (parent directory, or the URI segment), and surface the call as the
`Skill` tool with the name recorded in `skills` -- exactly how the Claude
parser represents a skill invocation. That both removes the Read over-count and
lets the shared classifier tag the turn `general` so the Skills & Agents
breakdown picks it up (populating a field the dashboard never received before).
The path is read from arguments.path with a defensive arguments.file_path
fallback.

Tests cover SKILL.md / skill:// / file_path detection, a non-skill read staying
a Read, and an end-to-end check that a parsed skill load reaches the classifier
subCategory that feeds skillBreakdown.
@iamtoruk
iamtoruk merged commit d869ad8 into getagentseal:main Jul 1, 2026
3 checks passed
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.

pi: native skill loads are counted as assistant read calls

2 participants