pi-go

module
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2026 License: MIT

README

pi-go

A terminal-based coding agent built on Google ADK Go with multi-provider LLM support, sandboxed tool execution, LSP integration, and a subagent system.

pi-go TUI

Features

  • Multi-provider LLM — Claude (Anthropic), GPT/O-series (OpenAI), Gemini (Google), and Ollama for local models
  • Sandboxed tools — File read/write/edit, shell execution, grep, find, tree, and git operations, all restricted to the project directory via os.Root
  • Interactive TUI — Bubble Tea v2 terminal UI with Markdown rendering (Glamour), slash commands, and theming
  • Session persistence — JSONL append-only event logs with branching, compaction, and resume
  • Model roles — Named configurations (default, smol, slow, plan, commit) selectable via CLI flags
  • Subagents — Process-based multi-agent system with types: explore, plan, designer, reviewer, task, quick_task
  • LSP integration — JSON-RPC client for Go, TypeScript/JS, Python, Rust with auto-format and diagnostics hooks
  • AI Git tools — Repository overview, file diffs, hunk parsing, and LLM-generated conventional commits (/commit)
  • RPC server — Unix socket JSON-RPC 2.0 for IDE/editor integration
  • Extensions — Hooks (shell callbacks), skills (.SKILL.md instructions), and MCP server support

Architecture

cmd/pi/             Entry point — CLI parsing, output mode selection
internal/
├── agent/          ADK agent setup, retry logic, runner
├── cli/            Cobra CLI flags, output modes (interactive, print, json, rpc)
├── config/         Global and project config (roles, hooks, MCP, themes)
├── extension/      Hooks, skills, MCP server integration
├── lsp/            LSP JSON-RPC client, language registry, manager, hooks
├── provider/       LLM providers implementing genai model interface
├── rpc/            Unix socket JSON-RPC 2.0 server
├── session/        JSONL persistence, branching, compaction
├── subagent/       Process spawner, orchestrator, concurrency pool
├── tools/          Sandboxed tools (read, write, edit, bash, grep, find, git, lsp)
└── tui/            Bubble Tea v2 UI, slash commands, commit workflow
Request flow
User input → CLI → Agent → LLM provider → Tool calls → Sandbox → Response → TUI
                     ↕                        ↕
              Session store              LSP servers
              (JSONL events)          (format, diagnostics)

See ARCHITECTURE.md for detailed documentation.

Requirements

  • Go 1.25+
  • At least one LLM provider API key (ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY) or a running Ollama instance

Build

make build      # build the pi binary
make test       # run unit tests
make lint       # go vet
make e2e        # run E2E integration tests
make clean      # remove binary

Usage

# Default interactive mode
./pi

# Select a model by prefix
./pi --model claude:sonnet
./pi --model openai:gpt-4o
./pi --model gemini:gemini-2.5-pro
./pi --model ollama:qwen3.5:latest
./pi --model minimax-m2.5:cloud #automatically detect ollama if :cloud

# Use model roles
./pi --smol          # fast, cheap model
./pi --slow          # most capable model
./pi --plan          # planning-oriented model

# Additional options
./pi --continue      # continue last session
./pi --session <id>  # resume specific session
./pi --system "..." # custom system instructions
./pi --url "..."    # custom API endpoint URL

# Non-interactive modes
./pi --mode print "explain this codebase"
./pi --mode json "list all TODO comments"
./pi --mode rpc --socket /tmp/pi-go.sock   # start RPC server
Slash commands
Command Description
/help Show available commands
/model Switch model mid-conversation
/session List and switch sessions
/branch Create a conversation branch
/commit Generate and apply a git commit
/compact Compact session history
/agents Show running subagents
/history Show command history
/plan Start PDD planning session
/run Execute a spec with task agent
/skill-create Create a new skill
/skill-list List available skills
/skill-load Reload skills from disk
/restart Restart pi-go
/clear Clear conversation
/exit Exit the agent

Configuration

Pi looks for configuration in ~/.pi-go/config.json (global) and .pi-go/config.json (project-local):

  • Model roles — Map role names to specific model strings
  • Hooks — Shell commands triggered on tool events (e.g., post-write formatting)
  • MCP servers — External tool servers via Model Context Protocol
  • Themes — Terminal color schemes via theme config field

License

See LICENSE for details.

Directories

Path Synopsis
cmd
pi command
internal
agent
Package agent sets up the ADK Go agent loop with tools, system prompt, and runner for the pi-go coding agent.
Package agent sets up the ADK Go agent loop with tools, system prompt, and runner for the pi-go coding agent.
auth
Package auth implements OAuth PKCE and device-code flows for SSO login.
Package auth implements OAuth PKCE and device-code flows for SSO login.
cli
extension
Package extension provides hooks (before/after tool call), skill loading, and MCP tool integration for the pi-go agent.
Package extension provides hooks (before/after tool call), skill loading, and MCP tool integration for the pi-go agent.
guardrail
Package guardrail tracks daily token usage and enforces limits.
Package guardrail tracks daily token usage and enforces limits.
logger
Package logger provides session logging for pi-go.
Package logger provides session logging for pi-go.
lsp
rpc
Package rpc implements a Unix socket JSON-RPC server for pi-go.
Package rpc implements a Unix socket JSON-RPC server for pi-go.
session
Package session — branch.go implements session branching.
Package session — branch.go implements session branching.
sop
tui
Package tui implements the interactive terminal UI using Bubble Tea v2.
Package tui implements the interactive terminal UI using Bubble Tea v2.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL