Repository navigation
fix(pi): classify native skill loads as Skill, not Read (#588) - #590
Merged
iamtoruk merged 1 commit intoJul 1, 2026
Merged
Conversation
…#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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Skillcall — they emit an ordinaryreadtool call whose path points at the skill'sSKILL.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 everyreadto theReadtool and never populatedskills. Two consequences for any session that used Pi skills:Why the first attempt was not enough
The obvious fix, routing SKILL.md reads out of
toolsand intoskills, fixes the Read over-count but leaves the Skills panel empty. The breakdown pipeline is gated:skillBreakdownis populated only from a turn'ssubCategory(src/parser.ts).subCategoryis set only when the classifier tags the turngeneral(src/classifier.ts).generalonly when its tool list contains a literalSkillentry (hasSkillTool).The Claude parser works because it keeps
Skillin 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
Skilltool (notRead), with the skill name recorded inskills, exactly mirroring how the Claude parser represents a skill invocation. This removes the Read over-count and lets the shared classifier tag the turngeneralso the Skills & Agents breakdown picks it up.Detection (
skillLoadNameinsrc/providers/pi.ts): areadcall is a skill load when its path (read fromarguments.path, with a defensivearguments.file_pathfallback) is eitherSKILL.md→ skill name is the parent directory (e.g.bmad-create-story), orskill://<name>URI (used by newer OMP builds) → skill name is the URI segment.Matching is on the
SKILL.mdbasename rather than a directory prefix, because Pi resolves skills from many roots (~/.pi/agent/skills, project.pi/skills,.agents/skills, packageskills/,--skill <path>). The path key was verified aspathagainst Pi'sread.tsschema and a real transcript;file_pathis kept only as a compatibility fallback.bashcommand extraction is unaffected — it runs over the raw tool calls independently.A mixed skill-load-plus-edit turn still classifies as
coding(nosubCategory), which is identical to the existing Claude behavior — parity, not a regression.Files
src/providers/pi.ts— newskillLoadName(name, args)predicate + name extractor; the parser loop now splits tool calls, surfacing skill loads asSkilland recording names inskills, and the yieldedParsedProviderCallcarriesskills.tests/providers/pi.test.ts— tests for SKILL.md,skill://, andfile_pathdetection; a non-skill read staying aRead; and an end-to-end check that a parsed skill load flows through the realclassifyTurntosubCategory(the valueskillBreakdownconsumes).docs/providers/pi.md— documents the skill-load quirk.Verification
npx tsc --noEmitclean.npx vitest run tests/providers/pi.test.ts tests/providers/omp.test.ts tests/classifier.test.ts— 51 passed. (The unrelated pre-existingoverview.test.tslocale/no-color failure is untouched by this change.)