@vimsucks/pi-inline-skills0.1.0
Invoke Pi skills anywhere in a prompt with inline slash mentions.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
@vimsucks/pi-inline-skills
Invoke Pi skills anywhere in a prompt with short /skill-name mentions.
Use /code-review and /semgrep to inspect this change.
@vimsucks/pi-inline-skills keeps the original user message intact, injects the selected skill instructions as a separate context message, renders that message compactly in the TUI, and completes skill names while you type.
Features
- Invoke one or more loaded skills anywhere except the leading slash-command position.
- Keep the exact prompt text in session history and when forking back to a message.
- Render invoked skills as a compact
[skills] code-review, semgrepcontext message. - Complete inline skill names without taking over Pi's command or file-path completion.
- Reuse an active skill by content digest instead of injecting its full body repeatedly.
- Reinject a skill after compaction, branching, or a file change removes or invalidates the active definition.
- Coexist with
pi-skillful.
Installation
Install from npm:
pi install npm:@vimsucks/pi-inline-skills
Alternatively, install from GitHub:
pi install git:github.com/vimsucks/pi-inline-skills
Install for one project only:
pi install -l npm:@vimsucks/pi-inline-skills
Run without installing:
pi -e npm:@vimsucks/pi-inline-skills
After installation, restart Pi or run /reload in the current session.
Usage
Mention any loaded skill by its name:
Please use /code-review to review the current branch.
Invoke multiple skills in one request:
Use /code-review and /semgrep to inspect this change.
Inline skill mentions must be preceded by whitespace, and the message must already contain non-whitespace text before the mention. Spaces, tabs, and newlines are supported:
Review this with /code-r
Explain this change
/code-r
Selecting the suggestion inserts /code-review , including a trailing space. Once an inline skill token starts, its completion list contains only matching skills and never falls back to file suggestions.
Pi 0.84.2 does not expose inline / as a custom autocomplete trigger. The extension therefore wraps the active editor component and requests the registered provider when an inline skill token is typed. Existing custom editor factories registered before this extension are preserved; editors without Pi's autocomplete request capability still retain manual Tab completion.
Command ownership
The leading slash-command position is reserved for Pi and other command providers. Inline positions belong to this extension.
| Input | Owner |
|---|---|
/skill:code-review check this change |
Pi's native skill command |
Use /code-review for this change |
pi-inline-skills |
/some-command also use /semgrep |
Command provider for the leading token; this extension for semgrep |
Explain/code-review |
Plain text; missing whitespace before / |
Use /skill:code-review |
pi-skillful |
This extension only recognizes whitespace-delimited /<known-skill-name> mentions after non-whitespace text earlier in the message. Standard Pi registers skills as /skill:name; a direct leading alias such as /code-review works only when another installed command provider supplies it. The extension deliberately ignores /skill:name, unknown names, escaped mentions such as \/code-review, URLs, and path-like tokens.
How it works
- The
inputevent detects known inline skill mentions and returnscontinue, preserving the exact user text. before_agent_startloads the requestedSKILL.mdfiles and injects onepi-inline-skillscustom message.- A
contexthandler places that custom message immediately before its request in model context while leaving transcript order unchanged. - A message renderer displays the invocation as a compact
[skills] ...row. - An autocomplete provider offers matching skills only in inline positions and delegates every other case to Pi.
Pi converts custom messages to user-role messages before provider serialization, so the injected instructions participate in model context and session compaction.
Deduplication
Each loaded skill body receives a SHA-256 digest. The first invocation injects the full skill:
<skill name="code-review" digest="sha256:...">
...skill instructions...
</skill>
A later invocation reuses the active definition with a small reference:
<skill-ref name="code-review" digest="sha256:...">
Apply the previously loaded skill to the current request.
</skill-ref>
Only full definitions in Pi's effective, compaction-aware context count as active. If compaction removes the definition, a branch predates it, or the file digest changes, the extension injects the full skill again.
Compatibility with pi-skillful
The packages use separate inline syntaxes:
pi-inline-skills:/code-reviewpi-skillful:/skill:code-review
pi-inline-skills never handles /skill:name, so both packages can remain installed. When Pi expands a leading native skill command, duplicate protection also prevents this extension from injecting the same skill again.
Streaming prompts
Steering and follow-up messages are already inside an active agent run. Pi currently has no public API for atomically queueing a custom context message together with its user message, and separate queue items are unsafe in one-at-a-time mode.
When an inline mention appears in a steering or follow-up message, the extension leaves the text unchanged and shows a warning in the TUI. Submit requests that require inline skill injection when Pi is idle.
Development
Requirements:
- Node.js 22.19 or newer
- pnpm 12.12.0 (pinned in
package.json)
pnpm install --frozen-lockfile --ignore-scripts
pnpm check
pnpm test
pnpm pack:dry-run
For local testing:
pi -e ./extensions/index.ts
The repository commits pnpm-lock.yaml for reproducible development installs. .npmrc and publishConfig use the public npm registry; do not add credentials to either file. Pi host packages remain peer dependencies supplied by Pi at runtime, with development copies used only for checks and tests.
Publishing
After the checks and tests pass, publish from a clean working tree on main:
pnpm publish
The package is configured for public access on https://registry.npmjs.org/. If npm requests additional authentication, complete it in an interactive terminal. Verify the published version with npm view @vimsucks/pi-inline-skills version --registry=https://registry.npmjs.org/.
Security
Pi extensions run with the user's full system permissions. Review extension source before installation. This extension reads only SKILL.md files already registered by Pi and does not execute skill files itself.
License
MIT