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
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
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
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
Python
55%
Other

PostHog

Ab Testing Experimentation · Analytics · Developer Tools

40,397

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
65
Dependency
Built with
Python 55%
TypeScript 36%
Updated 6 days ago
Python
55%
Other

PostHog

Ab Testing Experimentation · Analytics · Developer Tools

40,397

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
65
Dependency
Built with
Python 55%
TypeScript 36%
Updated 6 days ago
Rust
89%
MIT

Prime Agent

AI Agents · AI Code Assistants · Developer Tools

22,296

An open-source coding and research agent built around a Recursive Language Model that treats context as variables and a persistent Python REPL as its only tool.

View details
85
Repo Health
89
Technical
69
Dependency
Built with
Rust 89%
Updated 6 days ago
Rust
89%
MIT

Prime Agent

AI Agents · AI Code Assistants · Developer Tools

22,296

An open-source coding and research agent built around a Recursive Language Model that treats context as variables and a persistent Python REPL as its only tool.

View details
85
Repo Health
89
Technical
69
Dependency
Built with
Rust 89%
Updated 6 days ago
Rust
89%
MIT

Prime Agent

AI Agents · AI Code Assistants · Developer Tools

22,296

An open-source coding and research agent built around a Recursive Language Model that treats context as variables and a persistent Python REPL as its only tool.

View details
85
Repo Health
89
Technical
69
Dependency
Built with
Rust 89%
Updated 6 days ago
Rust
89%
MIT

Prime Agent

AI Agents · AI Code Assistants · Developer Tools

22,296

An open-source coding and research agent built around a Recursive Language Model that treats context as variables and a persistent Python REPL as its only tool.

View details
85
Repo Health
89
Technical
69
Dependency
Built with
Rust 89%
Updated 6 days 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