Skip to content
/

pi-mono

pi-mono · badlogic/pi-mono · ★ 55k · last commit 2026-05-26

Primitive shape 6 total
Commands 5 Skills 1
00

Summary

pi-mono — Summary

pi-mono is the official monorepo for the pi coding agent ecosystem by Earendil Works (badlogic / Mario Zechner). It ships four TypeScript packages: @earendil-works/pi-coding-agent (interactive TUI CLI), @earendil-works/pi-agent-core (agent runtime with tool calling), @earendil-works/pi-ai (unified multi-provider LLM API for OpenAI, Anthropic, Google, Mistral, DeepSeek, Vertex AI, Codex OAuth), and @earendil-works/pi-tui (terminal UI library with differential rendering). Pi is positioned as a minimal, extensible coding harness that adapts to developer workflows via TypeScript Extensions, Skills, Prompt Templates, and Pi Packages (npm/git). It explicitly omits sub-agents and plan mode from defaults, instead allowing developers to build or install what they need. The pi binary supports interactive, print/JSON, RPC, and SDK embedding modes. Pi is one of the few frameworks that ships a unified multi-provider LLM API as a first-class package, making it trivially easy to route different tasks to different providers within one workflow. Compared to seeds, pi-mono is closest to claude-conductor in its minimal-defaults philosophy and template-driven extension model, but surpasses it by shipping a complete agent runtime, multi-provider LLM API, and TUI library as separately usable npm packages.

01

Overview

pi-mono — Overview

Origin

Created by badlogic (Mario Zechner, @badlogicgames). Published as @earendil-works/pi-coding-agent. Version 0.75.5. 55,497 stars, 30 contributors. Active development (last pushed 2026-05-26). MIT license. The pi.dev domain was donated by exe.dev.

Philosophy

From the coding-agent README:

"Pi is a minimal terminal coding harness. Adapt pi to your workflows, not the other way around, without having to fork and modify pi internals. Extend it with TypeScript Extensions, Skills, Prompt Templates, and Themes."

"Pi ships with powerful defaults but skips features like sub agents and plan mode. Instead, you can ask pi to build what you want or install a third party pi package that matches your workflow."

Supply-Chain Hardening (Notable)

pi-mono implements unusually strong supply-chain protections documented in the README:

  • Direct dependencies pinned to exact versions; .npmrc sets save-exact=true and min-release-age=2
  • package-lock.json is the dependency ground truth; pre-commit blocks accidental lockfile changes
  • Published CLI includes npm-shrinkwrap.json to pin transitive deps for npm users
  • CI installs with npm ci --ignore-scripts
  • npm run check verifies pinned deps, native TypeScript import compatibility, and generated coding-agent shrinkwrap
  • Scheduled GitHub workflow runs npm audit and npm audit signatures

This is the most supply-chain-conscious framework in the entire batch — a direct contrast to claude-flow's IPFS injection incident.

Key Design Opinions

  • Minimal defaults, maximum extensibility via typed TypeScript Extension API
  • Self-describing: "you can ask pi to build what you want" — meta-extensibility
  • Multi-provider LLM from day one (not bolted on later)
  • OSS session sharing via Hugging Face for training data collection
  • No plan mode, no sub-agents by default — install them when needed
02

Architecture

pi-mono — Architecture

Distribution & Install

  • Distribution type: npm-package (4 packages) + cli-tool
  • Primary install: npm install -g --ignore-scripts @earendil-works/pi-coding-agent
  • Installer alternative: curl -fsSL https://pi.dev/install.sh | sh
  • Binary name: pi
  • Version: 0.75.5
  • License: MIT
  • Required runtime: node>=18 (inferred from TypeScript + modern ESM)

Package Structure

pi-mono/
├── packages/
│   ├── coding-agent/       # @earendil-works/pi-coding-agent (the pi CLI)
│   │   ├── src/
│   │   │   ├── cli.ts      # Entry point (bin: pi)
│   │   │   ├── main.ts     # AgentSession and mode routing
│   │   │   ├── modes/
│   │   │   │   ├── interactive/   # TUI interactive mode
│   │   │   │   ├── print-mode.ts  # JSON/print mode
│   │   │   │   └── rpc/           # RPC mode for process integration
│   │   │   └── core/       # Agent session, auth, bash, compaction, extensions
│   │   └── package.json
│   ├── agent/              # @earendil-works/pi-agent-core
│   │   # Agent runtime: tool calling, state management, message handling
│   ├── ai/                 # @earendil-works/pi-ai
│   │   # Unified multi-provider LLM API
│   │   # Providers: OpenAI, Azure OpenAI, OpenAI Codex, DeepSeek, Anthropic,
│   │   #           Google, Vertex AI, Mistral
│   └── tui/                # @earendil-works/pi-tui
│       # Terminal UI library with differential rendering
├── .pi/
│   ├── extensions/
│   ├── git/
│   ├── npm/
│   ├── prompts/
│   └── skills/
│       └── add-llm-provider.md
└── scripts/

Operating Modes

Mode CLI Purpose
Interactive pi TUI REPL with keybindings, editor, message queue
Print / JSON pi -p "..." Non-interactive; returns response as text or JSON
RPC (programmatic) Process integration for tools embedding pi
SDK (npm import) Embed pi in custom applications

Target AI Tools / Providers

Via @earendil-works/pi-ai: OpenAI, Azure OpenAI, Codex (OAuth), DeepSeek, Anthropic, Google, Vertex AI, Mistral. All providers accessible via pi /login and model selection in the TUI.

Extensibility API

TypeScript Extensions have access to the full agent session API. Pi Packages are npm packages exposing extensions, skills, prompt templates, and themes.

03

Components

pi-mono — Components

CLI Commands (built-in)

Command Purpose
pi Start interactive TUI session
pi -p "prompt" Print mode (non-interactive)
/login Authenticate with a provider
/help Show available commands
/settings Open settings
/theme Change theme
pi update --self Self-update pi

Tools (default agent toolset)

4 default tools given to the model:

  • read — read files
  • write — write files
  • edit — edit files
  • bash — execute bash commands

Additional capabilities via skills, extensions, or pi packages.

Sessions

  • Branching: Create session branches to explore alternatives
  • Compaction: Built-in context compaction support
  • Cross-provider handoffs: @earendil-works/pi-ai supports handing off conversations to different models mid-session

Skills

.pi/skills/add-llm-provider.md — skill for adding new LLM providers to pi-mono itself (meta: the repo's own development skill)

Extensions API

TypeScript Extensions can:

  • Register new commands
  • Add new tools
  • Modify agent behavior
  • Add UI components to the TUI
  • Handle lifecycle events

Themes

JSON theme files in src/modes/interactive/theme/

Pi Packages

npm packages exposing extensions/skills/templates/themes. Installed via npm and auto-discovered by pi.

@earendil-works/pi-ai Highlights

  • Cross-provider handoffs mid-session (context serialization)
  • Image input and generation
  • Thinking/reasoning mode (provider-specific)
  • OAuth providers (Vertex AI, Codex)
  • Browser usage support
  • Streaming tool calls with partial JSON
05

Prompts

pi-mono — Prompts

pi-mono does not ship prescriptive prompt templates for end-user workflows. The prompt system consists of:

  1. Prompt Templates — user-defined markdown files in .pi/prompts/ loaded into sessions
  2. Skills — behavior-modifying markdown files in .pi/skills/
  3. System prompt customization — extensions can modify the system prompt programmatically via the TypeScript Extension API

Verbatim Excerpt 1 — .pi/skills/add-llm-provider.md (the only skill in the repo)

This is a development skill used when working on pi-mono itself:

# Add LLM Provider Skill
# (content: instructions for how to add a new provider to @earendil-works/pi-ai)

(Full content was not publicly fetchable via raw URL at analysis time; the file exists at .pi/skills/add-llm-provider.md but contained a 404 for the raw fetch.)

Verbatim Excerpt 2 — README Philosophy on Extensibility

From the coding-agent README:

"Pi ships with powerful defaults but skips features like sub agents and plan mode. Instead, you can ask pi to build what you want or install a third party pi package that matches your workflow."

"Pi runs in four modes: interactive, print or JSON, RPC for process integration, and an SDK for embedding in your own apps."

Technique: Meta-extensibility — the primary "prompt" for pi is the agent itself, instructed to build the features you need rather than shipping them preconfigured. This is the opposite of BMAD's pre-built persona library.

Cross-Provider Handoff Prompt (from @earendil-works/pi-ai docs)

The AI package supports seamless model switches by serializing conversation context. No special prompt syntax required — the API handles context serialization transparently when switching providers.

09

Uniqueness

pi-mono — Uniqueness & Positioning

Differs from Seeds

pi-mono is closest to claude-conductor in its minimal-defaults philosophy — both avoid prescribing workflows and instead provide scaffolding. However, pi-mono surpasses claude-conductor dramatically by shipping a complete agent runtime (pi-agent-core), multi-provider LLM API (pi-ai), and TUI library (pi-tui) as separately usable npm packages. Claude-conductor is 15 markdown templates; pi-mono is 4 production npm packages with a 55K-star community. The multi-provider LLM API with cross-session handoffs is unique in the seeds — no seed framework ships a provider-agnostic LLM client. The TypeScript Extension API for programmatic customization is the most powerful extensibility model in the batch, compared to spec-driver/superpowers' skill-md approach. pi-mono is also the platform on which pi-ralph (this batch's samfoy framework) is built.

Positioning

pi-mono targets developers who want a minimal, extensible coding harness that doesn't prescribe methodology — in contrast to opinionated frameworks like BMAD or superpowers. The multi-provider LLM API makes pi the right choice for teams that want provider flexibility or cost optimization through model routing. The supply-chain hardening (exact pinning, shrinkwrap, audit in CI) targets security-conscious teams.

Observable Failure Modes

  • No built-in planning mode: Users must install or build plan-mode functionality. The "ask pi to build it" meta-extensibility is a philosophy, not a guarantee of reliability.
  • Minimal defaults mean minimal guardrails: No TDD enforcement, no auto-validators, no commit gates by default. Quality is entirely user-responsibility.
  • Extension API stability: TypeScript Extension API changes may break third-party extensions without major version bumps.
  • Multi-provider complexity: Cross-provider context handoffs require understanding provider-specific capabilities and token limits; seamless in the API, but not seamless in practice.

Explicit Antipatterns (from philosophy)

  • Forking pi internals to add features (use TypeScript Extensions instead)
  • Installing pi with lifecycle scripts (--ignore-scripts is mandated)
  • Trusting same-day npm dependencies (min-release-age=2 enforced)
04

Workflow

pi-mono — Workflow

Workflow Philosophy

pi does not prescribe a workflow. It is a minimal harness that developers extend. The default workflow is: start pi, talk to the agent, it reads/writes/edits files and runs bash commands. Extensions like pi-ralph (samfoy) add structured workflows on top.

Default Phase Model

Phase Description Artifact
Session start pi launches TUI Session context
Interaction User messages → model → tool calls File changes, bash output
Session branch Create branch to explore alternative Branched session history
Compaction Context compaction (built-in) Compacted context
Cross-provider handoff Switch model mid-session Continued session on new model
Export Export session to HTML for sharing Session HTML

Approval Gates

None by default. Pi is interactive; the user approves tool calls by continuing the conversation. Extension-added approval gates are possible.

Multi-Provider Workflow (unique to pi-mono)

The @earendil-works/pi-ai package enables:

  1. Start session with Anthropic Claude
  2. Switch to OpenAI GPT mid-session (cross-provider handoff)
  3. Use Gemini for a specific subtask
  4. Return to Claude — all in one conversation

Context serialization preserves the conversation across providers.

Session Sharing

pi-share-hf (external tool) publishes pi sessions to Hugging Face datasets for OSS session data collection. This is a documented community workflow.

06

Memory Context

pi-mono — Memory & Context

Session State

pi sessions are stored and manageable:

  • Branching: Create session branches to explore alternative approaches
  • History: Session history is persistent and browsable
  • Cross-provider handoffs: Context serialized to move between models mid-session

Context Compaction

Built-in — @earendil-works/pi-coding-agent has packages/coding-agent/src/core/compaction/ module. The TUI has a compaction UI. Details of the compaction algorithm are in source code (not fully documented publicly).

Cross-Provider Context Handoff (Unique)

@earendil-works/pi-ai supports context serialization for cross-provider handoffs:

  • Serialize current conversation context
  • Resume on a different provider/model
  • Conversation history is preserved

This is a unique capability in the batch: no other framework ships a library for handing off context between LLM providers mid-session.

Memory Persistence

Session-scoped (the session file persists). No explicit project-level or global memory by default. Extensions can add persistent memory.

Context Files

.pi/ directory contains per-project pi configuration:

  • extensions/ — TypeScript extensions
  • skills/ — skill files
  • prompts/ — prompt templates
  • git/ — git integration config
  • npm/ — npm config

State Files

pi does not write task state files like prd.json or progress.txt. Task tracking, if needed, must come from an extension (e.g., pi-ralph).

07

Orchestration

pi-mono — Orchestration

Multi-Agent Support

Not by default — pi omits sub-agents from its default feature set. However:

  • pi-subagents — a third-party pi package for parallel subagent spawning (referenced by evo's optimize skill as the pi host mechanism)
  • Third-party extensions like pi-ralph (samfoy) add orchestration loops

Orchestration Pattern

None by default (interactive single-agent). Third-party packages add patterns.

Execution Mode

Interactive-loop — the user talks to pi, which responds with tool calls and outputs. No autonomous looping by default. With extensions like pi-ralph, becomes continuous-ralph.

Multi-Model Support

Yes — the core strength of pi-mono. @earendil-works/pi-ai supports:

  • OpenAI, Azure OpenAI, OpenAI Codex (OAuth), DeepSeek, Anthropic, Google, Vertex AI, Mistral
  • Cross-provider handoffs mid-session
  • Model selection from within the TUI via /login

Model routing is user-driven (selecting from TUI), not automated per-task.

Isolation Mechanism

None by default. Pi operates in the project directory. Extensions could add worktree isolation.

Crash Recovery

Session files persist; sessions can be resumed. Compaction helps with long sessions.

RPC Mode

pi supports RPC mode for process integration — embedding pi in other tools or pipelines as a subprocess with structured I/O. This is the integration point for tools like openclaw that use pi via SDK.

SDK Mode

@earendil-works/pi-coding-agent exports a TypeScript SDK for embedding pi in custom applications. openclaw is documented as a real-world SDK integration.

08

Ui Cli Surface

pi-mono — UI & CLI Surface

Dedicated CLI Binary

Yes — pi (TypeScript/Node.js, npm package).

Key CLI Options

  • pi — interactive TUI mode
  • pi -p "prompt" — print/JSON mode (non-interactive)
  • pi /login — provider authentication
  • pi update --self — self-update
  • pi --ignore-scripts — install without lifecycle scripts

Local UI — Terminal TUI

@earendil-works/pi-tui is a full terminal UI library with:

  • Differential rendering — only re-renders changed parts of the terminal
  • Message queue
  • Session branching UI
  • Compaction display
  • Theme support (JSON theme files)
  • Keyboard shortcuts

The TUI is an interactive REPL with rich terminal output. Platform-specific docs for Windows, Termux (Android), tmux, and terminal setup.

Local Web Dashboard

None. pi is terminal-only.

IDE Integration

None native. pi-mono is an independent CLI; IDE integration is via external tools (e.g., running pi in a VS Code terminal).

Observability

  • Session history browsable in TUI
  • Export session to HTML (export command) for sharing or archival
  • OSS session sharing via pi-share-hf (Hugging Face)
  • RPC mode for programmatic session monitoring

Multi-Mode Operations

Mode Use case
Interactive Human development
Print/JSON Scripting and automation
RPC Process integration (e.g., in openclaw)
SDK Embedding in custom apps

Related frameworks

same archetype · same primary tool · same memory type

Claude-Flow / Ruflo ★ 55k

Eliminates single-agent context limits and sequential bottlenecks by orchestrating fault-tolerant swarms of specialized AI agents…

Hermes Agent (NousResearch) ★ 168k

Self-improving personal AI agent with closed learning loop, 7 terminal backends, and messaging gateway — not tied to any AI…

OpenCode ★ 165k

Terminal-first AI coding agent with multi-model routing, native desktop app, and a typed .opencode/ configuration system for…

OpenHands ★ 75k

Open-source AI software development platform (open-source Devin alternative) with Docker sandbox isolation, 77.6% SWE-bench…

DeerFlow ★ 70k

Long-horizon superagent that researches, codes, and creates by orchestrating parallel sub-agents with isolated contexts in Docker…

oh-my-openagent (omo) ★ 60k

Multi-provider AI agent orchestration for OpenCode: escape vendor lock-in by routing Sisyphus (Claude/Kimi/GLM) and Hephaestus…