pi-cordis
π₯§ Developer-first terminal coding agent rebuilt on Cordis (v4.0.1) microkernel with an "Everything is a plugin" architecture. 100% Pi parity & marketplace compatible.
- Stars
- 0
- Language
- TypeScript
- Created
- Aug 19, 2026
- Updated
- Aug 19, 2026
Introduction
π₯§ Pi-Cordis
The Developer-First Terminal Coding Agent, Rebuilt on the Cordis (v4.0.1) Microkernel with an "Everything is a Plugin" Architecture.
English | δΈζθ―΄ζ | Architecture Notes | Contributing Guide
π Table of Contents
- Overview
- Quick Start
- Core Feature Matrix
- Native Cordis Plugins & Presets Matrix
- Interactive TUI /profile Slash Command
- Architecture & Control Plane
- Cordis Service Matrix
- Plugin & Extension Ecosystem
- Repository Structure
- Quality Gates & Testing
- Architecture Decision Records (ADRs)
- License
π Overview
Pi-Cordis combines the raw speed, distraction-free terminal user interface (TUI), and coding power of earendil-works/pi with the modular Inversion-of-Control (IoC) microkernel of Cordis v4.0.1.
Why Pi-Cordis?
- 100% Pi Parity: Retains the complete interactive full-screen TUI, diff view, session branching tree, and prompt templates with zero user-facing regressions.
- "Everything is a Plugin": All 10 core capabilities (settings, auth, AI runtime, tool registry, session persistence, skills, prompt templates, extension runner, package manager, and agent inference loop) are decoupled into first-class Cordis services.
- Native Plugin Workspace & Standalone Presets: Modular
packages/plugins/*packages with declarativepresets/<name>/directories (each withpreset.ymlandcordis.yml) for instant zero-code profile additions. - Live TUI Switching (
/profile): Switch safety levels and capability bundles on the fly during active sessions. - Ecosystem Compatible: Fully supports the
pi.dev/packagescommunity marketplace. Install extensions vianpm:,git:, or local paths out of the box. - Strict Isolation: 100% standalone. Zero dependencies on proprietary DSH plugins.
β‘ Quick Start
1. Prerequisites
- Node.js:
>= 20.0.0 - pnpm:
>= 9.0.0
2. Clone and Install
git clone https://github.com/civaapple-alt/pi-cordis.git
cd pi-cordis
pnpm install
3. Configure API Key
Set your preferred LLM provider in your environment or root .env:
# DeepSeek (Recommended)
DEEPSEEK_API_KEY=sk-your-deepseek-api-key
# Or OpenAI / Anthropic / Gemini / Ollama
OPENAI_API_KEY=sk-your-openai-api-key
ANTHROPIC_API_KEY=sk-your-anthropic-api-key
4. Launch
# Launch interactive full-screen TUI
pnpm pi
# Switch profiles live in TUI via slash commands
/profile safe
/profile full
# Or run a single task non-interactively (print mode)
pnpm pi -p "Inspect the repository and list the 10 Cordis core services"
# Install a real community plugin from the ecosystem
pnpm pi install npm:@juicesharp/rpiv-todo
π― Core Feature Matrix
| Capability | Native Pi | Pi-Cordis | Highlights |
|---|---|---|---|
| Interactive Terminal TUI | β | β | Full-screen canvas, double-buffered diffs, branching tree selector, status dashboard |
| Core Coding Tools | β | β | Built-in read, write, edit, bash + optional grep, find, ls |
| Multi-Model Support | β | β | 1307+ models indexed (DeepSeek, OpenAI, Anthropic, Gemini, Ollama, Bedrock, etc.) |
| Microkernel IoC Architecture | β | β | Reversible lifecycle effects (ctx.effect), service auto-injection (static provide) |
| Native Cordis Plugins | β | β | Modular packages under packages/plugins/* (Safety Gate, Git Guard, Todo, Rules) |
| Standalone Presets Directory | β | β | Declarative YAML presets under presets/<name>/ (preset.yml + cordis.yml) |
Interactive /profile Switch | β | β | Live TUI profile switching with Tab autocompletions and interactive dropdowns |
| Extension Marketplace | β | β | 100% compatible with pi.dev/packages via transparent ExtensionAPI event bridging |
| Zero DSH Business Plugins | N/A | β | Self-contained, vendored Cordis framework under vendor/ |
π§© Native Cordis Plugins & Presets Matrix
1. Four Native Cordis Plugins (packages/plugins/*)
- π
@pi-cordis/plugin-safety-gate: Blocks destructive shell commands (rm -rf /,mkfs) and sensitive file modifications (.env,.git/,id_rsa). - π‘οΈ
@pi-cordis/plugin-git-guard: Detects dirty repository state and creates automaticgit stashcheckpoints before critical actions. - π
@pi-cordis/plugin-todo-tracker: Registerstodo_write/todo_readtools and dynamically injects active tasks into system prompts. - π
@pi-cordis/plugin-rules-injector: Auto-scansAGENTS.md,.claude/rules/*.md,.cursorrulesand injects them into agent context.
2. Five Built-in Profile Presets (presets/)
presets/
βββ default/ # Rules injector + Todo tracker
βββ safe/ # Safety gate + Git guard + Rules injector + Todo tracker
βββ strict/ # Read-only safety gate + Git guard + Rules injector
βββ full/ # All 4 native Cordis plugins active
βββ minimal/ # Zero extra plugins, pure 10-service microkernel
πΉοΈ Interactive TUI /profile Slash Command
During active interactive sessions in pnpm pi, use /profile to inspect and switch presets:
/profile safe ββ Switch to Safe Engineering mode immediately
/profile full ββ Switch to Full Power-User mode
/profile default ββ Switch to Default mode
/profile minimal ββ Switch to Minimal mode
Typing /profile with no arguments opens an interactive dropdown menu:
ββ Select Cordis Profile βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β > default - Standard coding agent with rule injection and todo task tracking β
β safe - Safe engineering mode with destructive action blocking & git stashβ
β strict - Strict security mode with read-only inspection & dangerous block β
β full - Power user mode with all native Cordis plugins activated β
β minimal - Zero extra plugins for raw, lightweight execution β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ποΈ Architecture & Control Plane
Pi-Cordis adopts the Strangler Fig Pattern, wrapping Pi's core runtime with the Cordis IoC microkernel:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Cordis Microkernel Control Plane (v4.0.1) β
β Context Container / static provide / Event Bus / Plugin Loader β
ββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββ
β β
ββββββββββββββββΌββββββββββββββ βββββββββββββββΌβββββββββββββββ
β Service Adapters Layer β β ExtensionAPI Event Bridge β
β (Settings, AI, Tools...) β β (pi.on <-> ctx.on) β
ββββββββββββββββ¬ββββββββββββββ βββββββββββββββ¬βββββββββββββββ
β β
ββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββΌβββββββββββββββββββ
β Pi Underlying Data Plane β
β LLM Stream Processing / Session Branching / TUI Canvas Engine β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ποΈ Cordis Service Matrix
| Service | Context Property | Responsibility |
|---|---|---|
SettingsService | ctx.settings | User global (~/.pi/agent/settings.json) and project local (.pi/settings.json) configuration |
AuthService | ctx.auth | API keys, OAuth tokens, and credential storage |
AIService | ctx.ai | Multi-model runtime with 1307+ model definitions and token usage telemetry |
ToolRegistryService | ctx.tools | Unified registry for 7 built-in coding tools and dynamic custom tools |
SessionService | ctx.session | SQLite and in-memory session persistence, branching tree switcher |
SkillsService | ctx.skills | Auto-discovery and parsing of prompt and directory skills |
PromptsService | ctx.prompts | Prompt template engine and parameter interpolation |
ExtensionService | ctx.extensions | Pi extension loader bridging ExtensionAPI to Cordis events |
PackageManagerService | ctx.packageManager | Cross-source package management (pi.dev, npm, git, local) |
AgentService | ctx.agent | Multi-turn agent inference cycle orchestration |
π Repository Structure
pi-cordis/
βββ vendor/ # Vendored Cordis (v4.0.1) core framework
β βββ cordis/ # @deepseek-ai/cordis
β βββ cosmokit/ # @deepseek-ai/cosmokit
β βββ schemastery/ # @deepseek-ai/schemastery
β
βββ presets/ # π Standalone Agent Presets & Profiles Directory
β βββ default/ # preset.yml + cordis.yml
β βββ safe/ # preset.yml + cordis.yml
β βββ strict/ # preset.yml + cordis.yml
β βββ full/ # preset.yml + cordis.yml
β βββ minimal/ # preset.yml + cordis.yml
β
βββ packages/
β βββ coding-agent/ # CLI entry point, TUI terminal, and Cordis bootstrap
β β βββ src/core/cordis/ # 10 core services + createPiContext + profile command
β βββ plugins/ # π Native Cordis Plugin Packages
β βββ safety-gate/ # @pi-cordis/plugin-safety-gate
β βββ git-guard/ # @pi-cordis/plugin-git-guard
β βββ todo-tracker/ # @pi-cordis/plugin-todo-tracker
β βββ rules-injector/ # @pi-cordis/plugin-rules-injector
β βββ profiles/ # @pi-cordis/profiles (YAML & directory assembler)
β
βββ .agents/notes/ # Architecture Decision Records (ADRs)
β βββ implemented/architecture/ # Technical architecture notes
β βββ implemented/simplification/ # Decoupling and cleanup notes
β βββ README.md # Bilingual ADR index
β
βββ CHANGELOG.md # Keep a Changelog updates
βββ pnpm-workspace.yaml # pnpm workspace configuration
βββ tsconfig.json # TypeScript path aliases
π§ͺ Quality Gates & Testing
# Run unit tests across all Cordis services, plugins, and profiles
npx vitest run packages/coding-agent/test/cordis-plugins-and-profiles.test.ts packages/coding-agent/test/cordis-bootstrap.test.ts
# TypeScript typechecking
pnpm run check
# Launch interactive terminal
pnpm pi
π Architecture Decision Records (ADRs)
| Date | Title | Focus |
|---|---|---|
2026-08-19 | Pi-Cordis Microkernel Architecture | "Everything is a plugin" philosophy, Vendored Cordis v4.0.1, 100% Pi parity |
2026-08-19 | Services and Plugin Ecosystem | 10 Cordis core services, pi.dev marketplace, ExtensionAPI event bridge |
2026-08-19 | TUI and Control Plane Trade-offs | Control plane costs, TUI silent boot, UI plugin constraints, 7-slot TUI evolution |
2026-08-19 | Repository Simplification and Decoupling | Cleaned 1200+ duplicate files, direct upstream npm packages, 85%+ size reduction |
2026-08-19 | Pi AgentHarness Specification Integration | Three Stores model, Effect Sandwich crash safety, Lanes concurrency |
2026-08-19 | Native Cordis Plugins & Presets Directory | Modular packages/plugins/*, declarative presets/<name>/ directory layout, /profile TUI command |
π License
MIT Β© 2026 civaapple-alt & Earendil Works.