Pi / OpenCode native TUI slash commands don't work in composer
Version: v0.1.40
OS: macOS
Harness: Pi (primary), OpenCode (same class of issue)
What happened
Typing Pi-native commands (/new, /sessions, /resume, /tree, /fork, /clone, /compact, /export, /session) or OpenCode-native commands (/sessions, /new, /compact, /export, /undo) in MonoCode's composer (Ask, build, / for commands...) does not execute them. They get sent as plain LLM prompt text.
Expected: they execute the harness-native action (or a MonoCode equivalent), like they do in pi TUI / opencode TUI.
Root cause (checked in source)
- MonoCode spawns Pi as
pi --mode rpc (src/lib/harness/piProtocol.ts:buildPiSpawnArgs). Per Pi docs/rpc.md: "Built-in TUI commands (/settings, /hotkeys, etc.) are not included [in get_commands]. They would not execute if sent via prompt."
src/lib/harness/piAdapter.ts → discover: () => discoverPiSkills() → piSkillsFromRpcData (src/lib/harness/piSkills.ts) filters to only source==="skill" + skill: prefix. Built-in TUI commands never enter the / picker.
- Only
omp sets rawSlashCommands:true (src/lib/harness/piFamily.ts:157). pi doesn't, so isNativeCommandPrompt("/new","pi") is false (src/lib/skills.ts:114) and the text goes to the model.
- MonoCode session layer (
monocode.db sessions + resumeByThread in piFamily.ts / opencode.ts) already owns tabs/sidebar — it just needs slash shims calling existing RPCs.
Proposed fix
Phase 1 — portable Pi + OpenCode shims (intercept in promptPreparation.ts + App.tsx:3538 before sendTurn, list in Composer.tsx picker):
| Slash |
Pi native |
OpenCode native |
MonoCode mapping |
/new |
/new |
/new (/clear) |
new tab |
/clear |
— (new, unified) |
alias of /new |
same tab, new_session RPC + rebind, reset context meter, divider in blocks_json |
/sessions + /resume, /continue |
/resume |
/sessions, /resume, /continue |
focus Sessions sidebar picker |
/compact + /summarize |
/compact |
/compact, /summarize |
existing compactPiContext / compactOpenCodeContext |
/export |
/export |
/export |
pi export_html RPC / opencode markdown export |
/copy |
/copy |
— |
copy last assistant block (harness-agnostic) |
/models, /thinking |
/model, /thinking |
/models, /thinking |
aliases to model/thinking dropdowns (set_model / set_thinking_level) |
Unknown /xxx on pi/opencode should show "TUI-only, not supported in MonoCode" instead of sending to the model.
Phase 2 — Pi session tree (pi-only):
/tree (read-only first): get_tree RPC → picker of prompts/branches
/tree:switch: jump + continue in same tab
/fork <n>: fork(entryId) (get_fork_messages) → new tab prefilled
/clone: clone RPC → duplicate tab
Phase 3: /share//unshare, /undo//redo (opencode git-backed vs pi /tree — needs workspace_snapshot UI), /init.
Don't port: /login, /logout, /connect, /settings, /themes, /editor, /exit, /trust, /scoped-models, /llama.
Files to touch
src/lib/harness/piAdapter.ts — shim command list
src/lib/promptPreparation.ts, src/App.tsx:3538 — intercept before sendTurn
src/chrome/Composer.tsx:496 — / picker entries
Happy to PR Phase 1 (/new + /clear + /sessions + /compact + unknown-slash warning) if maintainers agree with the mapping.
Pi / OpenCode native TUI slash commands don't work in composer
Version: v0.1.40
OS: macOS
Harness: Pi (primary), OpenCode (same class of issue)
What happened
Typing Pi-native commands (
/new,/sessions,/resume,/tree,/fork,/clone,/compact,/export,/session) or OpenCode-native commands (/sessions,/new,/compact,/export,/undo) in MonoCode's composer (Ask, build, / for commands...) does not execute them. They get sent as plain LLM prompt text.Expected: they execute the harness-native action (or a MonoCode equivalent), like they do in
piTUI /opencodeTUI.Root cause (checked in source)
pi --mode rpc(src/lib/harness/piProtocol.ts:buildPiSpawnArgs). Per Pidocs/rpc.md: "Built-in TUI commands (/settings,/hotkeys, etc.) are not included [inget_commands]. They would not execute if sent viaprompt."src/lib/harness/piAdapter.ts→discover: () => discoverPiSkills()→piSkillsFromRpcData(src/lib/harness/piSkills.ts) filters to onlysource==="skill"+skill:prefix. Built-in TUI commands never enter the/picker.ompsetsrawSlashCommands:true(src/lib/harness/piFamily.ts:157).pidoesn't, soisNativeCommandPrompt("/new","pi")is false (src/lib/skills.ts:114) and the text goes to the model.monocode.dbsessions+resumeByThreadinpiFamily.ts/opencode.ts) already owns tabs/sidebar — it just needs slash shims calling existing RPCs.Proposed fix
Phase 1 — portable Pi + OpenCode shims (intercept in
promptPreparation.ts+App.tsx:3538beforesendTurn, list inComposer.tsxpicker):/new/new/new(/clear)/clear/newnew_sessionRPC + rebind, reset context meter, divider inblocks_json/sessions+/resume,/continue/resume/sessions,/resume,/continue/compact+/summarize/compact/compact,/summarizecompactPiContext/compactOpenCodeContext/export/export/exportexport_htmlRPC / opencode markdown export/copy/copy/models,/thinking/model,/thinking/models,/thinkingset_model/set_thinking_level)Unknown
/xxxonpi/opencodeshould show "TUI-only, not supported in MonoCode" instead of sending to the model.Phase 2 — Pi session tree (pi-only):
/tree(read-only first):get_treeRPC → picker of prompts/branches/tree:switch: jump + continue in same tab/fork <n>:fork(entryId)(get_fork_messages) → new tab prefilled/clone:cloneRPC → duplicate tabPhase 3:
/share//unshare,/undo//redo(opencode git-backed vs pi/tree— needsworkspace_snapshotUI),/init.Don't port:
/login,/logout,/connect,/settings,/themes,/editor,/exit,/trust,/scoped-models,/llama.Files to touch
src/lib/harness/piAdapter.ts— shim command listsrc/lib/promptPreparation.ts,src/App.tsx:3538— intercept beforesendTurnsrc/chrome/Composer.tsx:496—/picker entriesHappy to PR Phase 1 (
/new+/clear+/sessions+/compact+ unknown-slash warning) if maintainers agree with the mapping.