Configuration
Provider credentials
The Pi backend authenticates using a provider API key or Pi’s stored OAuth login.AGENT_PROVIDER=openai but have no OPENAI_API_KEY and no stored OpenAI login, Pi automatically checks for a stored openai-codex OAuth credential and remaps the provider to openai-codex. You can also run pi interactively and use /login to authenticate through the Pi UI.
Memory tools
The Pi backend loads two extensions from.pi/extensions/: nuggets.ts and proactive.ts. These register the following tools:
nuggets.ts tools
| Tool | Description |
|---|---|
nuggets | Persistent memory tool. Actions: remember, recall, forget, list. Stores and retrieves FHRR-backed facts across sessions. |
createNote | Creates a rich note in the Nuggets graph with title, content, tags, scope, and stability. |
addLink | Creates a bidirectional link between two existing notes with a descriptive reason. |
editNote | Rewrites the content, title, or tags of an existing graph note by ID. |
searchNotes | Searches the Zettelkasten memory graph using text overlap and FHRR similarity. |
nuggets extension also injects existing facts and top-ranked notes into the system prompt before each agent turn, so the agent starts with relevant context automatically.
proactive.ts tools
| Tool | Description |
|---|---|
schedule | Creates, deletes, or lists cron-based schedules. Use one_shot=true for one-time reminders. Cron format: minute hour day-of-month month day-of-week. |
reflectAndCleanMemory | Runs a safe maintenance pass over the note graph: rewrites stale notes, merges near-duplicates, improves tags and links, archives low-value entries. Inspects at most limit notes (default 10). |
Session pool
The gateway maintains one Pi subprocess per active conversation. You can tune the pool with two environment variables:| Variable | Default | Description |
|---|---|---|
MAX_PI_PROCESSES | 5 | Maximum number of simultaneous Pi subprocesses. When the pool is full, the least-recently-active session is evicted. |
PI_IDLE_TIMEOUT_MS | 300000 (5 min) | Time in milliseconds after the last message before an idle Pi process is stopped. The session file is preserved so the next message resumes where you left off. |
Pi resumes an existing session automatically when the provider and model match the previous session. If you change
AGENT_PROVIDER or AGENT_MODEL, Pi starts a fresh session rather than continuing an incompatible one.Skills
How skills are loaded
When the gateway starts, it discovers skills in this priority order:AGENT_SKILL_PATHS
Any paths listed in
AGENT_SKILL_PATHS are loaded first. Separate multiple entries with commas or newlines.Registry skills (skills/)
Nuggets looks for a
skills/ directory in the project root. Each subdirectory can contain a skill.json metadata file and a SKILL.md instructions file.How Pi receives skills
Each enabled skill is passed to the Pi subprocess as a--skill <path> argument. Pi reads the SKILL.md file directly and includes the instructions in its context. Skills with adapters.pi.enabled set to false in their skill.json are excluded.
Skill management in chat
You can manage sticky skills directly in your conversation:| Command | Effect |
|---|---|
/skills or /skill list | Lists all available skills with their scope and active status. |
/skill use <name> | Activates a skill for this conversation (sticky scope). |
/skill remove <name> | Deactivates a skill for this conversation. |
/skill clear | Removes all sticky skills from this conversation. |
scope: sticky in their skill.json automatically activate when the message text matches a configured trigger word. One-shot skills activate for a single message and then deactivate.
SKILL.md format
A Pi-compatible skill file uses YAML frontmatter for metadata and a markdown body for instructions:skill.json alongside the SKILL.md: