Pi Code
Overview¶
Pi Code is Earendil's AI coding agent. CodeFreedom generates a TypeScript extension for dynamic model discovery, configures LSP servers, and launches Pi with zero manual configuration.
Binary: pi (installed via Pi's official installation)
Canonical name: pi-code (alias: pc)
Commands¶
cf run agent pi-code # Launch (native mode)
cf run agent pi-code -p deepseek # Launch with a profile
cf run agent pi-code --list-profiles # List available profiles
Short:
Flags¶
| Flag | Description |
|---|---|
-p NAME, --profile NAME |
Load a named profile |
-l, --list-profiles |
List available profiles |
How It Works¶
Extension-Based Config¶
CodeFreedom automates Pi Code setup via a TypeScript extension:
- Generates extension at
<pi-agent-home>/extensions/codefreedom.ts - Extension registers a provider using
pi.registerProvider()for dynamic model discovery - Fetches
/v1/model/infofrom the proxy for rich capabilities (vision, reasoning, costs) - Configures
pi-mcp-adaptervia.mcp.jsonfor MCP tool support - Launches Pi with the extension loaded automatically
Extension Details¶
The generated codefreedom.ts extension:
- Registers a custom provider with Pi's extension API
- Dynamically discovers models from the running proxy
- Provides model metadata: capabilities, pricing, context windows
- Refreshes the model list when the proxy restarts
LSP Server Configuration¶
Pi Code supports Language Server Protocol (LSP) integration. CodeFreedom reads LSP server configuration from the profile and ensures the required servers are available:
MCP Tool Integration¶
Pi Code discovers MCP tools via .mcp.json in the workspace. CodeFreedom writes this file with all available tool endpoints when launching the agent.
Lean Context Integration¶
CodeFreedom configures lean-ctx in Pi's agent home directory for persistent project knowledge across sessions. This enables Pi to recall project patterns, decisions, and code relationships.
Native Mode¶
When launched natively, CodeFreedom:
- Loads the full env chain (component-specific, shared, workspace, system)
- Resolves the selected profile's environment variables
- Generates the
codefreedom.tsextension - Configures LSP servers and lean-ctx
- Writes
.mcp.jsonfor tool discovery - Launches
piwith all configuration in place
Model Discovery¶
Pi Code's extension fetches model info from the proxy:
Models appear in Pi's model selector with full metadata — no manual model list configuration needed.
Third-Party Notices¶
Pi Code is developed by Earendil. CodeFreedom does not modify, patch, or bundle Pi Code. It only generates extensions, configures environment variables, and launches the binary.