← Back to home@civaapple-alt

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.

License: MIT Cordis: v4.0.1 TypeScript: Strict Tests: 3500+ Passing PRs Welcome

English | δΈ­ζ–‡θ―΄ζ˜Ž | Architecture Notes | Contributing Guide


πŸ“– Table of Contents


🌟 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?

  1. 100% Pi Parity: Retains the complete interactive full-screen TUI, diff view, session branching tree, and prompt templates with zero user-facing regressions.
  2. "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.
  3. Native Plugin Workspace & Standalone Presets: Modular packages/plugins/* packages with declarative presets/<name>/ directories (each with preset.yml and cordis.yml) for instant zero-code profile additions.
  4. Live TUI Switching (/profile): Switch safety levels and capability bundles on the fly during active sessions.
  5. Ecosystem Compatible: Fully supports the pi.dev/packages community marketplace. Install extensions via npm:, git:, or local paths out of the box.
  6. 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

CapabilityNative PiPi-CordisHighlights
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 PluginsN/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 automatic git stash checkpoints before critical actions.
  • πŸ“‹ @pi-cordis/plugin-todo-tracker: Registers todo_write/todo_read tools and dynamically injects active tasks into system prompts.
  • πŸ“œ @pi-cordis/plugin-rules-injector: Auto-scans AGENTS.md, .claude/rules/*.md, .cursorrules and 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

ServiceContext PropertyResponsibility
SettingsServicectx.settingsUser global (~/.pi/agent/settings.json) and project local (.pi/settings.json) configuration
AuthServicectx.authAPI keys, OAuth tokens, and credential storage
AIServicectx.aiMulti-model runtime with 1307+ model definitions and token usage telemetry
ToolRegistryServicectx.toolsUnified registry for 7 built-in coding tools and dynamic custom tools
SessionServicectx.sessionSQLite and in-memory session persistence, branching tree switcher
SkillsServicectx.skillsAuto-discovery and parsing of prompt and directory skills
PromptsServicectx.promptsPrompt template engine and parameter interpolation
ExtensionServicectx.extensionsPi extension loader bridging ExtensionAPI to Cordis events
PackageManagerServicectx.packageManagerCross-source package management (pi.dev, npm, git, local)
AgentServicectx.agentMulti-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)

DateTitleFocus
2026-08-19Pi-Cordis Microkernel Architecture"Everything is a plugin" philosophy, Vendored Cordis v4.0.1, 100% Pi parity
2026-08-19Services and Plugin Ecosystem10 Cordis core services, pi.dev marketplace, ExtensionAPI event bridge
2026-08-19TUI and Control Plane Trade-offsControl plane costs, TUI silent boot, UI plugin constraints, 7-slot TUI evolution
2026-08-19Repository Simplification and DecouplingCleaned 1200+ duplicate files, direct upstream npm packages, 85%+ size reduction
2026-08-19Pi AgentHarness Specification IntegrationThree Stores model, Effect Sandwich crash safety, Lanes concurrency
2026-08-19Native Cordis Plugins & Presets DirectoryModular packages/plugins/*, declarative presets/<name>/ directory layout, /profile TUI command

πŸ“„ License

MIT Β© 2026 civaapple-alt & Earendil Works.