This adds experimental support for virtual models. A virtual model is a catalog entry that an extension registers with pi.registerVirtualModel(). It does not talk to a provider itself; for every request it picks a physical model and thinking level. The motivation is to make routing policies pluggable: plan on a strong model and implement on a cheap one, pick a model with a classifier, or move to a larger window when the context grows. Today this needs model switching by hand or hacks in prepareRequest. The selection stays virtual: model_change records it, resume restores it, and each response records the physical model and thinking level that produced it. Router state can be stored on the session branch, so it follows /tree and forks and survives compaction. Context limits, compaction and image sizing use the physical model a request was routed to. examples/extensions/jev-router.ts shows a full router that uses the Jev classifier to pick Sol or Terra for planning and hands off to Luna after the first edit. docs/virtual-models.md describes the API. |
||
|---|---|---|
| .. | ||
| docs | ||
| examples | ||
| install-lock | ||
| scripts | ||
| src | ||
| test | ||
| .gitignore | ||
| CHANGELOG.md | ||
| npm-shrinkwrap.json | ||
| package.json | ||
| README.md | ||
| tsconfig.build.json | ||
| tsconfig.examples.json | ||
| vitest.config.ts | ||
New issues and PRs from new contributors are closed automatically. Maintainers review closed submissions daily. See CONTRIBUTING.md.
Pi
Pi is a minimal, extensible AI agent for the terminal. Adapt Pi to your workflow, not the other way around.
Ask Pi to create the prompt templates, skills, extensions, and themes you need, or install a Pi package. Use Pi directly, automate it in print, JSON, or RPC mode, or build applications with the TypeScript SDK.
Getting started
Install the command-line interface with npm:
npm install -g --ignore-scripts @earendil-works/pi-coding-agent
This requires Node.js 22.19 or newer. Pi does not require dependency lifecycle scripts for a normal npm installation.
On macOS or Linux, you can instead use the installer:
curl -fsSL https://pi.dev/install.sh | sh
Start Pi in the directory where you want it to work:
cd /path/to/project
pi
For a built-in AI provider, run /login inside Pi to connect a subscription or API key. Then give Pi a task.
See the documentation for full setup and usage instructions.
Development
Clone the repository, install its dependencies, and run Pi from source:
git clone https://github.com/earendil-works/pi
cd pi
npm install --ignore-scripts
./pi-test.sh
pi-test.sh can be called from any directory and preserves the caller's working directory.
Before submitting changes, run:
npm run check
./test.sh
Read CONTRIBUTING.md before opening an issue or pull request. It defines the contribution gate, issue quality bar, and required checks. Read AGENTS.md for repository-specific implementation, testing, dependency, and release rules.
License
MIT