Configuration

The P31 CLI reads configuration from ~/.p31/config.yaml.

Config File Schema

# ~/.p31/config.yaml
# All fields are optional; defaults shown.

# AI Router Proxy
proxy_url: http://localhost:4001/v1
proxy_model: flash        # flash, premium, scavenger

# Local Ollama (legacy, falls back if proxy unavailable)
ollama_url: http://localhost:11434

# P31 Services
k4_cage_url: https://k4-cage.trimtab-signal.workers.dev
phos_url: https://phos.p31ca.org

Environment Variables

Environment variables override config file values:

VariablePurpose
P31_PROXY_URLOverride proxy endpoint
P31_PROXY_MODELOverride default model
P31_OLLAMA_URLOverride Ollama endpoint
P31_K4_CAGE_URLOverride K4 Cage URL

Command-line Flags

p31 chat --model premium   # Override model for this session
p31 --verbose              # Enable debug logging
p31 --config /path/to/config.yaml  # Use a custom config file

Model Tiers

ModelUse CaseCost
scavengerSimple tasks, low spoons$0 (Gemini 2.5 Flash)
flashMost reasoning tasks$0.14/1M input
premiumComplex architecture, high spoons$2.19/1M input

MCP Server Configuration

MCP servers are configured in the Go source (cmd/chat.go, initMCP()). In the future, this will move to a config file.