/api/chat request as mode: "agent" | "plan" | "harness" and decides which tool allowlist the Pi runtime receives.
The full list of available tools and per-mode allowlists lives in apps/web/src/lib/pi/plan-mode.ts.
Agent mode
Agent mode is the default and the broadest. It enables full repo-scoped editing and the Pi-managed extension tools. Allowed toolsPlan mode
Plan mode is read-only. The agent inspects the repo, asks focused follow-up questions, and produces numbered execution plans. Structured plan cards keepexecute, stay, and refine actions visible after page refresh or session resume — backed by persisted custom session entries so legacy text parsing remains a fallback.
Allowed tools
read, bash (inspection only — mutating shell activity is blocked with an explicit reason), grep, find, ls, questionnaire, project_inventory, workspace_index, and the read-only autocontext_status family.
Behavior contract
- Tool allowlist is inspection-only.
- Blocked shell commands return an explicit reason instead of silently mutating the repo.
- Plan state is emitted on the stream as
planevents that include{ executing, completed, total, todos, message, state }. - Plan cards survive refresh because Plan mode persists structured entries to the Pi session file.
evaluatePlanCommand and applyPlanModeSelection in apps/web/src/lib/pi/plan-mode.ts for the exact enforcement logic.
Harness mode
Harness mode is for workspace-architecture work. It swaps general repo-mutation tools (write, edit) for the workspace-aware workspace_write and resource_install tools so durable changes always go through the adaptive workspace contract.
Allowed tools
read, bash, grep, find, ls, workspace_write, resource_install, questionnaire, web_fetch, plus the project-resource and autocontext-status families.
When to use it
- Adding or changing canonical files under
agent-workspace/memory/,plans/,skills/,evals/, orartifacts/. - Installing Pi skills, prompts, extensions, themes, or packages.
- Authoring workspace policies or evaluation material that must include rationale.
workspace_write requires a rationale for protected or rationale-required areas. resource_install is the only supported way to add chat-installed Pi resources under agent-workspace/.pi/*.
Slash commands
Type/ in the chat input to open a scrollable, keyboard-navigable command menu. The menu is populated from GET /api/chat/commands, which returns the builtins below plus any active skills and prompts when skill slash commands are enabled.
Keyboard shortcuts
Selecting a command only inserts it into the input — you still submit the message to run it. This is discovery-only in the current release; no package, OAuth, or compact execution backends are wired up yet.
Built-in commands
Skill and prompt commands
Active skills and prompts appear as slash commands (for example,
/refactor-tech-debt from a prompt of that name) when enableSkillCommands is true in Pi settings. Names are normalized by replacing whitespace with -; entries that collide with a builtin are skipped. Disable the toggle in the Pi settings dialog or via POST /api/chat/settings to hide skill and prompt commands from the menu.
Streaming behavior
Two streaming behaviors decide how prompts queued mid-stream are handled:streamingBehavior: "steer"— enqueue the message as a steering prompt for the active assistant turn.streamingBehavior: "followUp"— enqueue the message to run after the current turn finishes.
queue events.
Related
API reference
The chat endpoints and the full stream event taxonomy.
Adaptive workspace
Where
workspace_write is allowed to write, and why.Generative UI
Inline OpenUI components the agent can stream into chat in Agent and Plan modes.