Competitor Analysis: pi (pi.dev) — Minimal Terminal Coding Agent #123
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Competitor
Kind/Documentation
Kind/Enhancement
Kind/Epic
Kind/Feature
Kind/Security
Kind/Story
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Scope/Core
Scope/Cross-Plugin
Scope/Plugin-System
Scope/Single-Plugin
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ultanio/cobot#123
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
pi (
@mariozechner/pi-coding-agent) by Mario Zechner (badlogic) is a minimal terminal coding harness for LLM-assisted coding.npm install -g @mariozechner/pi-coding-agentCore Architecture
pi is a terminal-first interactive coding agent with 4 default tools:
read,write,edit,bash. It supports 15+ LLM providers (Anthropic, OpenAI, Google, Azure, Bedrock, Mistral, Groq, xAI, OpenRouter, Ollama, etc.) with mid-session model switching.4 modes: interactive (TUI), print/JSON (one-shot), RPC (process integration), SDK (embedding). Notably, OpenClaw is listed as a real-world SDK integration in their README.
Extension System (TypeScript)
This is pi's most differentiated feature. Extensions are TypeScript modules loaded via jiti (no compilation step), exporting a default function that receives an
ExtensionAPIobject:Extension Capabilities
pi.registerTool()with TypeBox schema for parameters. Can replace built-in tools entirely.session_start,before_agent_start,agent_start,turn_start,context,tool_call,tool_result,agent_end,session_compact, etc. Events can block (e.g., block dangerousrm -rf), modify (transform tool results), or inject (add context before agent start)./mycommandregistered viapi.registerCommand()pi.registerShortcut()ctx.ui.custom()for full TUI components (select, confirm, input, notify, status line, widgets, overlays)pi.appendEntry()for state that survives restartssession_before_compacteventExtension Discovery
~/.pi/agent/extensions/*.ts.pi/extensions/*.tsPi Packages
Bundled extensions, skills, prompts, and themes distributed via npm or git:
Skills System
Follows the Agent Skills standard — same standard OpenClaw uses. Skills are Markdown-based
SKILL.mdfiles invoked via/skill:nameor auto-loaded. Placed in~/.pi/agent/skills/,.pi/skills/, or shared via pi packages.Other Notable Features
id/parentIdbranching,/treefor navigation,/forkfor branchingAGENTS.md(orCLAUDE.md) from cwd up to home{{variables}}Comparison with OpenClaw/Cobot
ExtensionAPIKey Takeaways
agentskills.io), creating potential ecosystem overlap.Deep Dive: What Can We Learn from pi's Extension System
1. The Event-Driven Lifecycle Model
pi's core insight: everything is an interceptable event. The agent lifecycle is decomposed into ~20 fine-grained events, each with block/modify/continue semantics:
Key design patterns:
tool_callcan block (return{ block: true, reason }) — enables permission gatestool_resultcan modify results — enables output filtering/enrichmentcontextcan rewrite messages before LLM sees them — enables dynamic context injectionbefore_agent_startcan inject messages and modify the system prompt per-turninputcan transform user input before skill/template expansionLesson for Cobot: OpenClaw currently has skills (prompt injection) and tools (function calling) but lacks a formal event bus with interception. A lifecycle hook system would enable:
2. Extension Registration API
The
ExtensionAPIsurface is small but powerful:Notable: Tools can replace built-in tools entirely, not just add new ones. Extensions can override
read,write,edit,bash— enabling SSH delegation, sandboxing, etc.Lesson for Cobot: Our tools are currently defined in the system prompt or hard-coded. A
registerTool()API would let skills provide callable functions, not just prompt instructions.3. State Persistence via Session Entries
pi.appendEntry(customType, data)lets extensions persist state in the session JSONL. On session restore, extensions reconstruct state by scanningctx.sessionManager.getBranch()for their custom entries.This means extension state survives restarts AND respects branching — if you fork a session, the extension state forks with it.
Lesson for Cobot: Our agents use flat files (MEMORY.md, daily notes) for state. A structured session-scoped persistence layer would enable stateful tools that survive restarts without polluting the filesystem.
4. Message Delivery Modes
Three delivery modes for injected messages:
"steer"— interrupts after current tool, skips remaining"followUp"— waits for agent to finish all tools"nextTurn"— queued for next user promptLesson for Cobot: Our
sessions_sendis fire-and-forget. Delivery modes would give inter-agent communication more precision — e.g., "inject this context but don't interrupt the current tool chain."5. Package Distribution
pi packages bundle extensions + skills + prompts + themes in a single
package.json:Distributed via npm or git. Installed with
pi install npm:@foo/bar. Package filtering lets users cherry-pick which resources to load.Lesson for Cobot: ClewHub skills are currently standalone. A package format that bundles skills + tools + config would make distribution more composable. The filtering mechanism (
"skills": []to disable, glob patterns,!exclusions) is worth adopting.6. Custom Tool Rendering
Extensions can define
renderCall()andrenderResult()to control how tool invocations appear in the TUI. This separates tool behavior from tool presentation.Lesson for Cobot: Less relevant for our channel-based (Telegram/Discord) agents, but relevant for any future web UI or CLI surface.
7. Context Manipulation
The
contextevent fires before every LLM call with a deep copy of all messages. Extensions can filter, reorder, inject, or transform messages without affecting the session history.This is powerful: an extension can dynamically prune old messages, inject RAG results, or add system context — all transparently.
Lesson for Cobot: This is essentially programmable context engineering. Our system prompt + AGENTS.md approach is static. A context manipulation hook would let skills dynamically adjust what the LLM sees each turn.
8. Cross-Harness Skill Compatibility
pi explicitly supports loading skills from Claude Code (
~/.claude/skills/) and OpenAI Codex (~/.codex/skills/) directories. They all share the Agent Skills standard.Lesson for Cobot: OpenClaw already follows this standard. We should document cross-compatibility and make it easy to use pi/Claude Code skills in Cobot.
9. Example Extension Ecosystem (60+ examples)
Their examples reveal what users actually want:
Summary: What to Steal
registerTool()API — Let skills register callable tools, not just prompt text.What They Don't Have (Our Advantage)
pi is a great coding harness. Cobot is an autonomous agent framework. We can learn from their extension architecture without competing on their turf.