pi-profile

extensionmaintained

Runtime profile switching for the Pi coding agent — swap model, skills, subagents, and system prompt in the same session, no restart needed.

by · v0.2.0 · published 4w ago

$ pi install npm:pi-profile
downloads/mo
296
stars
1
last push
4w ago
open issues
1

Signals

license: MITtestspi manifest: missinginstall size: —deps: 0peer deps: 0

Download trend

613 downloads · last 12 weeks (weekly)

README

🇨🇳 中文

pi-profile

A pi extension for instant identity switching — swap model, skills, subagents, and system prompt in the same session, no restart needed.

/profile researcher          # switch to the researcher identity
/profile default             # back to default
pi --profile researcher      # start directly in a profile

Install

pi install npm:pi-profile

Example profiles (default, researcher) ship in the repo's profiles/ directory — copy them to ~/.pi/profiles/ to start, or build your own with /profile create.

Quick start

# Use the researcher profile (ships as example)
pi --profile researcher

# Inside an interactive session
/profile researcher

# List all profiles
/profile list

How it works

pi-profile hooks into pi's extension API to switch runtime identity:

LayerMechanismEffect
Skillsbefore_agent_start + tool_call3-layer hard block: skills outside profile are invisible to the LLM
SubagentsAgent .md file syncProfile-defined team members available for delegation
Promptbefore_agent_startProfile's system prompt injected each turn (append mode)
Modelpi.setModel()Different profiles use different models
AutocompleteaddAutocompleteProvider/ only shows profile's skills and templates

Identity, not security. Profile controls who the AI is — not what tools it can use or what commands are dangerous. Tool access and security policies are handled by dedicated extensions like pi-permission-suite.

Profile files

Stored as ~/.pi/profiles/<name>.json:

{
  "name": "researcher",
  "label": "🔬 Deep Researcher",
  "description": "Deep research mode with web search focus",

  "systemPrompt": "你是一个严谨的研究助手。\n\n## 准则\n1. 每次回答必须附上来源链接\n2. 优先使用 web_search 验证事实\n3. 交叉验证多个来源后再得出结论\n4. 用结构化格式输出(列表、表格、摘要)\n5. 遇到不确定的,明确说明",

  "model": {
    "provider": "opencode-go",
    "model": "kimi-k2.6",
    "thinkingLevel": "high"
  },

  "skills": ["learn", "wiki-read", "wiki-write"],

  "sessionName": "🔬 Research"
}

Profile interface

FieldTypeDescription
namestringUnique ID (lowercase, no spaces)
labelstring?Display label (emojis OK)
descriptionstring?One-line summary shown in profile list
systemPromptstring?Appended to Pi's default system prompt each turn
model{provider, model, thinkingLevel?}Optional fixed model binding
skillsstring[]?Skills visible to LLM (undefined = all skills visible)
promptsstring[]?Prompt templates visible in autocomplete
subagentsRecord<string, Subagent>Team members synced to Pi's agent system
sessionNamestring?Auto-session label when using this profile

Skill hard blocking (3 layers)

When skills is set, non-listed skills are completely invisible to the LLM:

LayerWhatHow
1System prompt<available_skills> XML filtered — LLM never sees them listed
2Read interceptionLLM calling read() on a non-profile SKILL.md is blocked
3Autocomplete/skill:<name> doesn't appear in auto-complete

This means the LLM cannot know about, discover, or use skills outside the profile's scope. Skills still load at startup — profile controls visibility, not availability.

Commands

CommandDescription
/profileShow current profile + available list
/profile <name>Switch profile
/profile listList all profiles
/profile show <name>Show profile JSON
/profile createInteractive wizard (AI-guided or manual)
/profile rm <name>Delete profile

CLI

pi --profile <name>       # Start with profile
PI_PROFILE=<name> pi      # Via environment variable