pi-rpc-sdk
Pi RPC and SDK integration
Grounding
pi-mono/packages/coding-agent/docs/rpc.md— Framing section (LF-only record delimiter;readlineincompatibility with U+2028/U+2029).pi-mono/packages/coding-agent/docs/sdk.md— programmatic session patterns pluscreateAgentSession,AgentSession,createAgentSessionRuntime,ModelRegistry.create(),AuthStorage.create(), andSessionManager.inMemory().pi-mono/packages/coding-agent/docs/json.md—--mode jsonevent stream: session header,agent_*/turn_*/message_*/tool_execution_*events,jqfiltering examples.pi-mono/packages/coding-agent/src/modes/rpc/rpc-client.ts— reference TypeScript client mentioned fromrpc.mdintro when applicable.pi-mono/packages/coding-agent/src/core/agent-session.ts— API surface for in-process embedding (perrpc.mdnote to TypeScript users).
Invariants
- Framing rules are normative text in
pi-mono/packages/coding-agent/docs/rpc.md; quote or paraphrase strictly from that file when advising client implementers. - Skill commands and prompt templates are expanded for RPC prompts per
rpc.mdInput expansion bullet underpromptcommand. --mode jsonis read-only observation (stdout events);--mode rpcis bidirectional control (stdin commands + stdout responses). Different use cases, same framing caveats for U+2028/U+2029.- For TypeScript/Node embedding,
createAgentSession()is the primary factory; it requiressessionManager,authStorage, andmodelRegistry. For advanced multi-session hosting, usecreateAgentSessionRuntime()which returnsAgentSessionRuntimewith lower-level access toagent,sessionManager,settingsManager,modelRegistry,extensions,bashExecutor,resourceLoader—pi-mono/packages/coding-agent/docs/sdk.md.
Workflows
More from romiluz13/pi-agent-skills
pi-extension-authoring
Authoring Pi TypeScript extensions — ExtensionAPI, custom tools, commands, UI hooks, resources_discover, `registerProvider()`, and how extendResources merges skill paths after base reload. Use when the user builds or debugs pi extensions, registers tools, adds /commands, hooks events, integrates TUI components, or ships extension examples. Use for "how do I extend pi", "extension API", "registerTool", "registerProvider", even if pi-mono is not mentioned.
29pi-customization
Pi coding agent customization — Themes, Keybindings, Prompt Templates, System Prompt overrides, and Settings. Use when configuring or modifying the visual appearance, UI colors, keyboard shortcuts, prompt templates, or the default system prompt behavior of the pi terminal agent. Use for "custom theme pi", "change keybindings", "modify system prompt", "SYSTEM.md", "APPEND_SYSTEM.md", "settings.json", "keybindings.json", "prompt template", even if pi-cli-workspace is already active.
26pi-package-authoring
Pi packages — npm/git distribution of extensions, skills, prompts, themes via keywords pi-package and package.json pi manifest; pi install paths and security expectations. Use when shipping or consuming pi-package, adding pi.skills entries, or explaining install vs project-local -l. Use for "publish pi skills on npm", "pi install", "pi-package.json", even without naming this skill.
25pi-cli-workspace
Pi terminal agent workspace — install, /commands, sessions, compaction, settings.json, AGENTS.md, skill discovery, precedence, session JSONL, /tree, providers/auth, models.json, credential resolution, platform setup, editor (@file, Tab, images, !bash), message queue (steering, follow-up), built-in tools (read/bash/edit/write/grep/find/ls, --tools, --no-tools), print mode (-p, piped stdin), SYSTEM.md/APPEND_SYSTEM.md, CLI flags (-c, -r, --session, --fork, --no-session), @files args, resource flags (--no-extensions, --no-skills), model shorthand (provider/id, name:thinking), all slash commands, env vars, philosophy (no MCP/sub-agents/plan-mode by design). Use for pi config, skills, sessions, compaction, providers, models, tmux, Termux, Windows, tools, modes, system prompt, message queue, or "does pi support X".
24