Installable Pi extension that makes slash autocomplete work where people actually type: inside normal text and on the second line. It also expands public prompt templates inside ordinary text and stops leading absolute paths such as /home/spike/file.ts from being misrouted as slash commands.
If you found this repo from GitHub search, the practical summary is simple: install it, run /reload, and you get better inline slash UX without forking Pi core.
Pi already handles slash commands well at the start of the first line. This extension covers the two gaps that are most noticeable in day-to-day use:
- inline slash autocomplete inside regular text;
- slash autocomplete on the second line;
- inline expansion of loaded public prompt templates such as
/ru-clean; - submit bypass for a leading absolute path such as
/tmp/log.txt.
Before:
text /gs -> no useful inline slash completion
/home/spike/file.ts -> can be treated as a slash command
After:
text /gs -> suggests /gsd
text /skill:create -> suggests /skill:create-skill
text /ru-clean -> expands the public prompt body
/home/spike/file.ts -> sent as a normal user message
What is actually shipped:
- inline slash and skill autocomplete works not only at the start of the first line, but also mid-line and on the second line;
- known public prompt commands expand to their UTF-8 Markdown body inside ordinary text, including multiple tokens and multiline input;
- leading prompt invocations remain delegated to core so template arguments keep working;
- fenced code, inline code, escaped tokens, unknown slash tokens, skills, and absolute paths remain safe;
- a leading absolute path such as
/home/spike/file.tsor/tmp/log.txtis sent as a normal user message instead of being treated as a slash command; - the current scope is proven by local tests and shell verifiers, without an upstream patch.
pi install npm:@datspike/pi-inline-slash-extension/reload
- type
text /gs-> expect/gsdautocomplete; - type
text /skill:create-> expect/skill:create-skillautocomplete; - if a prompt template such as
/ru-cleanis already loaded, submittext /ru-clean-> expect its Markdown body inside the user message; - type
/home/spike/file.tsand press Enter -> expect a normal user message, not command routing.
If these checks pass, the extension is wired correctly.
This package expands prompt templates discovered through Pi's public getCommands() catalog. It does not ship /ru-clean or other prompt content itself; those templates come from your global/project prompt directories or other installed packages.
Use an exact whitespace-delimited prompt command inside ordinary text:
Fix the bug /ru-clean
Implement and verify /two-sessions /ru-clean
Several segments may appear in one multiline message. Inline segments do not accept arguments because their boundary would be ambiguous. A prompt command at the beginning of the message remains delegated to Pi core, so normal template arguments still work.
Use a backslash when the slash command must stay literal:
Show the token \/ru-clean without expanding it.
| Capability | Status |
|---|---|
| Mid-line slash autocomplete | supported |
| Second-line slash autocomplete | supported |
| Leading absolute path submit bypass | supported |
| Inline public prompt-template expansion | supported |
| Override of core first-line slash behavior | not supported |
| Synthetic catalog of hidden built-in commands | not supported |
This repository is a good fit if you:
- use Pi interactively and often type slash commands inside longer prompts;
- want
/home/...or/tmp/...inputs to stay normal messages; - want an extension-layer solution without maintaining a Pi core fork.
It is probably not the right fit if you need a full built-in slash catalog or want to change core first-line slash behavior.
The extension is wired through the package entrypoint extensions/inline-slash.ts. Prompt expansion works in every input-capable mode; the custom editor is installed only when ctx.hasUI is true.
High-level flow:
- registers the
inputhandler without calling runtime action methods during extension loading; - after
session_start, builds the public catalog viabuildCommandCatalog(api.getCommands()); - expands only exact public
source="prompt"tokens; - wraps
CustomEditorviasrc/inline-slash/editor.ts; - attaches submit routing through
createInlineSlashSubmitStrategy; - registers the editor through
ctx.ui.setEditorComponent(...).
Core is not patched. More detail: docs/ARCHITECTURE.md.
The package entrypoint is extensions/inline-slash.ts, and package.json declares the pi.extensions manifest.
pi install npm:@datspike/pi-inline-slash-extensionThis is the recommended setup for normal use after npm publication.
If you prefer not to install the package, Pi can load the same entrypoint directly from settings:
{
"extensions": [
"/absolute/path/to/pi-inline-slash-extension/extensions/inline-slash.ts"
]
}Typical settings file:
~/.pi/agent/settings.json
- Pi starts without an import error from
extensions/inline-slash.ts; - after
/reload, typingtext /gsshows/gsd; - submitting
/home/spike/file.tsno longer goes toUnknown commandand instead stays a normal user message.
Main files:
extensions/inline-slash.tssrc/inline-slash/command-catalog.tssrc/inline-slash/provider.tssrc/inline-slash/classifier.tssrc/inline-slash/editor.tssrc/inline-slash/prompt-expansion.tsdocs/UPSTREAM-SEAMS.md
Important boundaries:
- the catalog is built from
pi.getCommands()only; - prompt expansion reads only
source="prompt"entries and usessourceInfo.pathas the template path; sourceInfois treated as the canonical provenance contract;sendUserMessageis required only for the absolute-path bypass path;/unknownstays on the delegated core path.
The remaining editor seam is isolated in src/inline-slash/editor.ts. More detail: docs/ARCHITECTURE.md and docs/UPSTREAM-SEAMS.md.
Automated proof covers the shipped user-facing behavior:
text /gs-> the local inline catalog suggests/gsd;text /skill:create-> the local inline catalog suggests/skill:create-skill;- second line
/gs-> autocomplete works without a first-line restriction; /home/spike/file.tsand/tmp/log.txtbypass slash dispatch on submit;- ordinary text with
/ru-cleanexpands the prompt body, including multiple and multiline segments; - a message that starts with an absolute path still expands later prompt segments before
sendUserMessage; - leading
/ru-clean args, code blocks, inline code,\\/ru-clean, missing files, unknown tokens, and skill tokens follow their safe boundaries; /gsd auto,/skill:create-skill demo, and/unknownremain on the delegated core submit path.
Detailed coverage and command breakdown: docs/VERIFICATION.md.
Main command:
npm run verify:s03
bash scripts/verify-s03.shDrill-down commands:
npm run verify:s01
bash scripts/verify-s01.sh
npm run verify:s02
bash scripts/verify-s02.shverify:s03 is the main verification entrypoint. It runs the shipped proof surface and validates the README markers used by the repository guards. More detail: docs/VERIFICATION.md.
After loading the extension in Pi, run /reload and verify the following scenarios:
scenario:inline-gsd-mid-line-> typetext /gsand confirm that/gsdautocomplete appears.scenario:inline-skill-mid-line-> typetext /skill:createand confirm that/skill:create-skillappears.scenario:second-line-gsd-> on the second line type/gsand confirm that/gsdappears.scenario:inline-prompt-expansion-> submit ordinary text containing/ru-cleanand confirm the Markdown body is expanded.scenario:inline-prompt-protection-> verify leading delegation, code fences, inline code, escapes, missing files, unknown tokens, and skill tokens.scenario:path-home-submit-bypass-> type/home/spike/file.tsand press Enter; expected result is normal user-message behavior withoutUnknown command.scenario:path-with-inline-prompt-> submit an absolute path followed by ordinary text and/ru-clean; expect the path to stay literal and the prompt body to expand.scenario:path-tmp-submit-bypass-> type/tmp/log.txtand press Enter; expected result is the same bypass through a normal message.scenario:delegate-gsd-submit-> on the first line type/gsd autoand press Enter; expected result is the normal slash command path.scenario:delegate-skill-submit-> on the first line type/skill:create-skill demoand press Enter; expected result is the normal skill submit path.scenario:delegate-unknown-submit-> on the first line type/unknownand press Enter; expected result is core unknown-command handling, not a normal user message.
- the inline catalog is built only from public
pi.getCommands()output and does not synthesize a full built-in slash catalog; - only public sources
extension,prompt,skillare accepted; - the package does not provide prompt bodies; it expands prompt templates loaded by Pi from other sources;
- prompt expansion is limited to exact whitespace-delimited tokens with no inline arguments;
- prompt files that cannot be read remain literal and produce a compact UI warning when available;
- first-line start-of-message slash autocomplete remains delegated core behavior;
- non-slash autocomplete contexts such as
@file references stay delegated to the core provider; - submit bypass looks only at the leading token after
trim(): a leading absolute path is bypassed, everything else goes to core submit; /unknownintentionally remains delegated core unknown-command handling;- package installability is not the same as full API stability, because inline refresh still depends on a narrow editor runtime seam.
Compatibility baseline:
- working and verified baseline:
@mariozechner/pi-coding-agent^0.65.0.
For the shipped scope, an upstream patch is not required. The current package and tests prove the needed behavior at the extension layer.
A small upstream patch would still improve long-term package stability: a public editor seam for autocomplete open/refresh/close and a pre-dispatch submit hook. Details are in docs/UPSTREAM-SEAMS.md.
Reasons to revisit an upstream patch:
- support inline autocomplete for built-in commands that are not present in public
pi.getCommands(); - change core handling for
/unknown; - change the standard first-line slash behavior instead of delegating to core;
- remove the remaining dependency on editor internals for more reliable compatibility.
No. The extension stays at the extension layer and keeps the standard first-line slash path delegated to core.
No. /unknown intentionally stays on the normal core path.
No. The inline catalog is built from public pi.getCommands() output only.
docs/ARCHITECTURE.mdfor runtime wiring and boundaries.docs/VERIFICATION.mdfor automated and manual proof.docs/UPSTREAM-SEAMS.mdfor the remaining editor/runtime seam request.