Pi

Self-extensible AI coding agent CLI with a terminal UI, tool calling, and session management

Tool
npm
v1.4.0
117,463 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
88 /100 Excellent
Development Activity 100
Maintenance 100
Community 76
Maturity 36
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
79 /100 Good
Architecture 84
Code Quality 85
Innovation 82
Learning Curve 65

Pi is an open-source, self-extensible coding agent you run from the terminal — an interactive CLI that reads, edits, and writes files, executes shell commands, and manages multi-turn sessions, all rendered through a custom differential-rendering TUI. It ships as @earendil-works/pi-coding-agent, the flagship package of a four-package monorepo that also exposes its underlying pieces (pi-agent-core for the agent runtime, pi-ai for a unified multi-provider LLM API, and pi-tui for the terminal UI layer) as independently usable libraries.

Pi deliberately ships without a built-in permission system, running with the same access as the user who launched it; the project instead documents three containerization patterns (a Gondolin micro-VM extension, plain Docker, or OpenShell) for teams that need stronger sandboxing. It has an unusually mature supply-chain-hardening posture for a young project — pinned direct dependencies, npm audit signatures in CI, and a generated shrinkwrap bundled into every published release.

What You Get

  • An interactive terminal coding agent (pi) with file read/edit/write, bash execution, and persistent session management
  • A custom differential-rendering TUI (pi-tui) instead of a generic terminal-output loop
  • A reusable agent runtime (pi-agent-core) handling tool calling and state management independently of the CLI
  • A unified LLM API (pi-ai) abstracting OpenAI, Anthropic, Google, and other providers behind one interface
  • RPC and print modes (src/modes/rpc, src/modes/print-mode.ts) for scripting and non-interactive automation
  • Documented containerization patterns (Gondolin micro-VM, Docker, OpenShell) for sandboxing agent execution
  • Supply-chain hardening: pinned direct dependencies, generated npm shrinkwrap, and CI-enforced npm audit signatures

Common Use Cases

  • Running an interactive AI coding session in a terminal to read, edit, and test code across a real repository
  • Automating coding-agent workflows non-interactively via RPC/print mode from scripts or CI
  • Building a custom coding agent or internal tool on top of the reusable pi-agent-core runtime and pi-ai LLM abstraction
  • Sandboxing untrusted or high-autonomy agent runs inside a micro-VM, Docker container, or OpenShell policy sandbox
  • Switching between LLM providers (OpenAI, Anthropic, Google) for the same coding-agent workflow without rewriting integration code

Under The Hood

Architecture: The coding agent (packages/coding-agent) is the top-level consumer of a layered monorepo: main.ts dispatches to one of three modes — modes/interactive (the full TUI), modes/print-mode.ts (single-shot output), and modes/rpc (structured automation) — all driven by an AgentSession (core/agent-session.ts, agent-session-runtime.ts, agent-session-services.ts) that wraps the lower-level pi-agent-core tool-calling loop; session state, auth storage, bash execution, and an internal event bus are each isolated into their own core modules (bash-executor.ts, auth-storage.ts, event-bus.ts), and extensions live under core/extensions for user-defined tool/behavior additions. Tech Stack: TypeScript throughout (~93% of the codebase, 54,600+ lines in the coding-agent package alone), built with tsgo, optionally compiled to a standalone binary via Bun (build:binary), with undici dispatcher configuration for HTTP, @silvia-odwyer/photon-node for image resizing, and a custom TUI renderer (pi-tui) rather than an off-the-shelf terminal-UI library. Code Quality: The coding-agent package alone has 176+ .test.ts files run via Vitest, and the monorepo’s npm run check chains lint, format, and type-checking; the README documents an explicit, unusually detailed supply-chain-hardening policy — exact-pinned direct dependencies, min-release-age=2 in .npmrc, pre-commit lockfile-change blocking, and a generated shrinkwrap bundled into the published CLI package — treating dependency bumps as reviewed code changes. API Design: The CLI surfaces three distinct entry modes (interactive TUI, single-shot print, scriptable RPC) behind one binary, letting the same agent be driven by a human in a terminal or by another program over structured RPC without a separate integration, while the underlying pi-agent-core/pi-ai packages are published separately so the agent runtime and LLM abstraction can be reused outside the CLI entirely.

Used by 33 apps in this directory

TypeScript
98%
Apache 2.0

letta-code

AI Assistants · AI Code Assistants

3,697

A memory-first coding agent harness that learns from experience, maintains identity across models, and works across Claude, GPT, Gemini, and dozens more LLMs.

View details
86
Repo Health
84
Technical
74
Dependency
Built with
TypeScript 98%
Updated 6 days ago
Rust
60%
Apache 2.0

Magnitude

AI Development · Developer Tools

7,313

An open source inference engine that profiles your hardware, recommends the best local models, and tunes them for the coding agent you already use.

View details
79
Repo Health
83
Technical
71
Dependency
Built with
Rust 60%
TypeScript 25%
Updated 6 days ago
Rust
60%
Apache 2.0

Magnitude

AI Development · Developer Tools

7,313

An open source inference engine that profiles your hardware, recommends the best local models, and tunes them for the coding agent you already use.

View details
79
Repo Health
83
Technical
71
Dependency
Built with
Rust 60%
TypeScript 25%
Updated 6 days ago
Rust
60%
Apache 2.0

Magnitude

AI Development · Developer Tools

7,313

An open source inference engine that profiles your hardware, recommends the best local models, and tunes them for the coding agent you already use.

View details
79
Repo Health
83
Technical
71
Dependency
Built with
Rust 60%
TypeScript 25%
Updated 6 days ago
TypeScript
92%
Apache 2.0

Apache Maka

AI Agents · AI Development · Developer Tools

5,868

An Apache-incubated agent workspace that treats every model call, tool run, and permission decision as an append-only, replayable event log instead of disposable chat history.

View details
82
Repo Health
85
Technical
73
Dependency
Built with
TypeScript 92%
Updated 6 days ago
TypeScript
99%
Apache 2.0

Mastra Code

AI Code Assistants

29,041

"A coding agent that never compacts" — a terminal-based AI coding agent built on the Mastra framework, with Observational Memory instead of context compaction, multi-model support, and OAuth login for Claude Max or ChatGPT Plus.

View details
90
Repo Health
73
Technical
65
Dependency
Built with
TypeScript 99%
Updated 6 days ago
TypeScript
95%
Apache 2.0

NemoClaw

AI Agents · AI Development

22,823

Run AI coding agents like OpenClaw and Hermes securely inside NVIDIA OpenShell sandboxes with a hardened blueprint, routed inference, and lifecycle management through a single CLI.

View details
79
Repo Health
87
Technical
71
Dependency
Built with
TypeScript 95%
Updated 6 days ago
TypeScript
90%
MIT

OpenClaw

AI Agents · AI Assistants

392,894

An open-source AI assistant that runs on your own hardware and meets you in Discord, Slack, WhatsApp, iMessage, Telegram, and 20+ other channels, with native apps for every major platform.

View details
88
Repo Health
88
Technical
66
Dependency
Built with
TypeScript 90%
Updated 6 days ago
TypeScript
96%
MIT

Pi

AI Agents

117,476

An open-source, self-extensible agent harness and coding agent CLI — a modular runtime (agent core, unified multi-provider LLM API, TUI) with no built-in permission system by default, documented containerization patterns for sandboxing instead.

View details
88
Repo Health
73
Technical
73
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers