Docs/Extend pi-kit

Skill drafting and verification

Draft a skill from a thread, replay it against the outcome, approve and manage it.

The bundled @pi-kit/learn package turns a finished thread into a proposed skill: a SKILL.md that describes the procedure the thread followed. You review the draft, can replay it against the original result, and approve it into a project or your user folder. This changes the instructions later tasks get; it does not train the model.
Try it with the self-learning example.

Request a draft#

Type /learn in the thread, or choose Learn a skill from this thread from the thread menu or the outcome badge's menu. Drafting works for any thread with messages; verification also needs a recorded outcome (a commit, merge or pull request) with its base and head commits.
Drafting uses the Attendant's model, which can be local or hosted.
  • Attendant on: a finished thread is drafted automatically when it did enough work (at least 6 tool calls and 10 changed lines), no existing skill matches its first prompt, and the project has not opted out. Drafting counts toward the attendant's Daily cost cap.
  • Attendant off: /learn asks once per thread before it sends anything to the model.
The model gets a reduced, redacted transcript: prompts, tool calls with their targets and results, errors and the recovery after them, recognized checks, and the outcome's diff and commit message.

Review a draft#

The draft appears as a card at the end of the thread and as a chip on the sidebar row. Read opens the learning workspace: name, SKILL.md as pi will load it, Where it goes (This project or Every project) and Verification. It stays linked to the thread; reopen it from the sidebar.
A good skill describes the steps, constraints and checks, not the original files. Remove details that only applied to the first task. The workspace validates the format and name before you approve.

Verify against the outcome#

Verify now replays the task with the draft:
  1. pi-kit creates a scratch worktree at the outcome's base commit.
  2. It pins the draft skill and starts a new thread with the original first prompt, which you can edit first.
  3. It compares the replay with the outcome.
ReportShows
Files and hunksWhat was reproduced, missing or extra.
ChecksThe project's recognized check commands, run in the scratch worktree. A check that names the original folder by absolute path is skipped.
ResultPass, Partial or Failed.
/learn verify does the same from the composer. A replay is a model run and can cost money. One replay runs per draft at a time; Stop interrupts it. The replay thread keeps the full transcript.
The replay works in a separate folder but is not a sandbox: commands with absolute paths can reach other folders. pi-kit compares the main checkout before and after and reports changes there. A passing replay shows that one outcome was reproduced, not that the skill is correct in general.

Approve or discard#

Approve writes the skill to .pi/skills/<name>/SKILL.md in the project, or, for Every project, to your user skills folder. An existing skill with the same name is never overwritten; choose another name. The skill is available in the composer at once.
Discard keeps the record but writes nothing. A discarded thread is not drafted again automatically; reopen the draft from the thread menu.

Manage learned skills#

Settings → Skills → Library shows learned skills with their source thread, how often they were used, outcomes after use and verification results.
ActionDoes
EditOpens the skill in the review workspace.
Re-verifyReplays it again.
RetireMoves it to .retired/; nothing is deleted.
RestoreBrings a retired skill back from Retired skills.
Learned skills are ordinary SKILL.md files: edit, commit and share them like any skill. Recheck them when your project's conventions or test commands change.
PI_KIT_LEARN_PACKAGE=off keeps the package from loading. If you remove it with pi remove, pi-kit does not install it again.