| name | pi-coding-agent-extensions |
| description | Build and use custom extensions for Pi Coding Agent, the open-source alternative to Claude Code with UI customization, multi-agent orchestration, and safety controls |
| triggers | ["customize pi coding agent ui","create pi agent extension","pi vs claude code comparison","multi-agent orchestration with pi","pi agent safety auditing","pi agent cross-agent integration","pi to pi agent communication"] |
Pi Coding Agent Extensions
Skill by ara.so — Claude Code Skills collection.
Pi Coding Agent is an open-source agentic coding assistant that competes with Claude Code. This skill focuses on the pi-vs-claude-code repository, which provides 15+ production-ready extensions showcasing UI customization, multi-agent orchestration, safety auditing, and agent-to-agent communication.
What This Project Does
The pi-vs-claude-code repository demonstrates how to:
- Customize the Pi UI: Replace the default footer/widgets with custom displays (context meters, tool counters, task trackers)
- Multi-agent orchestration: Run multiple Pi agents in parallel (teams, chains, subagents)
- Safety controls: Intercept dangerous commands with real-time auditing
- Cross-agent integration: Import commands/skills from Claude, Gemini, Codex directories
- Agent-to-agent communication: Enable Pi agents to message each other (local or networked)
- Session management: Replay session history, switch agent personas, cycle themes
Installation
Prerequisites
All three required:
curl -fsSL https://bun.sh/install | bash
brew install just
Setup
git clone https://github.com/disler/pi-vs-claude-code.git
cd pi-vs-claude-code
bun install
cp .env.sample .env
Loading Environment Variables
Pi doesn't auto-load .env. Choose one approach:
source .env && pi
alias pi='source $(pwd)/.env && pi'
just pi
just ext-minimal
Running Extensions
Single Extension
pi -e extensions/minimal.ts
Stack Multiple Extensions
pi -e extensions/minimal.ts -e extensions/cross-agent.ts -e extensions/tool-counter.ts
Using Just Recipes
just
just pi
just ext-minimal
just ext-tool-counter
just ext-purpose-gate
just ext-damage-control
just ext-agent-team
just ext-pi-pi
just ext-session-replay
just all
just open purpose-gate minimal tool-counter-widget
Key Extensions
UI Customization
minimal.ts — Compact footer with model name and context usage:
pi -e extensions/minimal.ts
pure-focus.ts — Removes all footer/status UI:
just ext-pure-focus
theme-cycler.ts — Switch themes with keyboard shortcuts (Ctrl+X/Ctrl+Q) or /theme command:
just ext-theme-cycler
Tool Monitoring
tool-counter.ts — Two-line footer with per-tool call statistics:
just ext-tool-counter
tool-counter-widget.ts — Live widget above editor:
just ext-tool-counter-widget
Multi-Agent Orchestration
subagent-widget.ts — Spawn background Pi agents:
just ext-subagent-widget
/sub implement user authentication with JWT
/sub write unit tests for the API endpoints
Each /sub command creates a headless Pi agent with streaming progress display.
agent-team.ts — Dispatcher-only orchestrator:
just ext-agent-team
agent-chain.ts — Sequential pipeline:
just ext-agent-chain
pi-pi.ts — Meta-agent that builds Pi agents using parallel research experts:
just ext-pi-pi
Safety Controls
damage-control.ts — Real-time command auditing (aborts on violation):
just ext-damage-control
damage-control-continue.ts — Same rules, but blocked calls return feedback instead of aborting:
just ext-damage-control-continue
Cross-Agent Integration
cross-agent.ts — Import commands/skills from other agent directories:
just ext-cross-agent
system-select.ts — Switch agent personas:
just ext-system-select
Session Management
purpose-gate.ts — Declare session intent on startup:
just ext-purpose-gate
tilldone.ts — Task discipline system:
just ext-tilldone
session-replay.ts — Scrollable timeline overlay:
just ext-session-replay
Agent-to-Agent Communication
Local Communication (Same Machine)
coms.ts — Peer-to-peer via Unix sockets:
just local-coms
pi -e extensions/coms.ts
pi -e extensions/coms.ts
Available tools in coms.ts:
coms_list() — List all registered agents
coms_send(target_agent, message) — Send message to another agent
coms_get(count) — Retrieve pending messages (non-blocking)
coms_await(timeout_seconds) — Wait for next message (blocking)
Networked Communication (Multi-Machine)
coms-net.ts — HTTP/SSE hub for LAN or remote Pi agents:
just coms-net-server
export PI_COMS_NET_AUTH_TOKEN="your-secret-token"
just coms-net-server-lan
PI_COMS_NET_URL=http://192.168.1.100:3141 \
PI_COMS_NET_AUTH_TOKEN="your-secret-token" \
just coms
just coms1
just coms2
Available tools in coms-net.ts:
coms_net_list() — List all connected agents
coms_net_send(target_agent, message) — Send to specific agent
coms_net_broadcast(message) — Send to all agents
coms_net_get(count) — Poll for messages
coms_net_await(timeout_seconds) — Wait for next message
Creating Custom Extensions
Basic Extension Template
import type { PiEnv, PiExtension } from "@pi/core";
export default {
name: "my-custom",
init(env: PiEnv) {
env.addTool({
name: "my_tool",
description: "Does something useful",
parameters: {
type: "object",
properties: {
param1: { type: "string", description: "First parameter" }
},
required: ["param1"]
},
handler: async (args) => {
return { result: "success" };
}
});
},
cleanup(env: PiEnv) {
}
} satisfies PiExtension;
UI Widget Example
import type { PiEnv, PiExtension } from "@pi/core";
export default {
name: "custom-widget",
init(env: PiEnv) {
const widgetId = env.ui.addWidget({
position: "above-editor",
height: 3,
render: () => {
return [
{ text: "╔═══ Custom Widget ═══╗", style: { fg: "cyan" } },
{ text: "║ Status: Active ║", style: { fg: "green" } },
{ text: "╚═════════════════════╝", style: { fg: "cyan" } }
];
}
});
const interval = setInterval(() => {
env.ui.updateWidget(widgetId);
}, 5000);
env.onCleanup(() => clearInterval(interval));
}
} satisfies PiExtension;
Footer Customization
import type { PiEnv, PiExtension } from "@pi/core";
export default {
name: "custom-footer",
init(env: PiEnv) {
env.ui.setFooter({
render: (context) => {
const model = context.currentModel || "unknown";
const usage = Math.round((context.tokensUsed / context.tokenLimit) * 100);
return [
{ text: `Model: ${model} | Usage: ${usage}%`, style: { fg: "white", bg: "blue" } }
];
}
});
}
} satisfies PiExtension;
Intercepting Tool Calls
import type { PiEnv, PiExtension } from "@pi/core";
export default {
name: "tool-interceptor",
init(env: PiEnv) {
env.onBeforeToolCall(async (toolName, args) => {
console.log(`Tool called: ${toolName}`, args);
if (toolName === "bash" && args.command?.includes("rm -rf")) {
return {
blocked: true,
reason: "Destructive command blocked for safety"
};
}
return { blocked: false };
});
env.onAfterToolCall(async (toolName, args, result) => {
console.log(`Tool completed: ${toolName}`, result);
});
}
} satisfies PiExtension;
Configuration Files
Agent Definitions
Create agent personas in .pi/agents/:
<!-- .pi/agents/typescript-expert.md -->
You are a TypeScript expert specializing in type-safe development.
Core principles:
- Prefer strict type checking
- Use discriminated unions over enums
- Leverage const assertions
- Avoid `any` type
When reviewing code:
1. Check type safety
2. Identify potential runtime errors
3. Suggest idiomatic patterns
Team Configuration
team-name: fullstack-team
agents:
- frontend-specialist
- backend-specialist
- database-specialist
- devops-specialist
dispatch-strategy: auto
Chain Pipeline
name: feature-development
steps:
- agent: requirements-analyst
prompt: "Analyze requirements for: {task}"
- agent: architect
prompt: "Design architecture based on: {previous_output}"
- agent: implementer
prompt: "Implement the design: {previous_output}"
- agent: tester
prompt: "Write tests for: {previous_output}"
- agent: reviewer
prompt: "Review and suggest improvements: {previous_output}"
Safety Rules
banned_patterns:
- pattern: "rm -rf /"
reason: "Catastrophic deletion prevented"
- pattern: ":(){ :|:& };:"
reason: "Fork bomb detected"
- pattern: "chmod 777"
reason: "Insecure permissions"
- pattern: "curl .* | bash"
reason: "Unsafe remote script execution"
path_restrictions:
- pattern: "^/etc/"
allowed: false
reason: "System directory modification denied"
- pattern: "^/var/log/"
allowed: false
reason: "Log tampering prevented"
- pattern: "^~/.ssh/"
allowed: false
reason: "SSH key modification blocked"
allowed_commands:
- git
- npm
- bun
- node
- python
- cargo
Custom Themes
{
"name": "monokai",
"colors": {
"primary": "#F92672",
"secondary": "#66D9EF",
"success": "#A6E22E",
"warning": "#FD971F",
"error": "#F92672",
"info": "#66D9EF",
"muted": "#75715E",
"background": "#272822",
"foreground": "#F8F8F2"
}
}
Common Patterns
Multi-Agent Research Pattern
just ext-pi-pi
"Research the best approach for implementing real-time collaboration in a React app"
Sequential Pipeline Pattern
just ext-agent-chain
Safety-First Development Pattern
just ext-damage-control-continue
Cross-Team Collaboration Pattern
PI_COMS_NET_URL=http://hub.local:3141 \
PI_COMS_NET_AUTH_TOKEN=$AUTH_TOKEN \
pi -e extensions/coms-net.ts -e extensions/agent-team.ts
PI_COMS_NET_URL=http://hub.local:3141 \
PI_COMS_NET_AUTH_TOKEN=$AUTH_TOKEN \
pi -e extensions/coms-net.ts -e extensions/agent-team.ts
Environment Variables
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GEMINI_API_KEY=...
OPENROUTER_API_KEY=sk-or-...
PI_COMS_NET_URL=http://127.0.0.1:3141
PI_COMS_NET_AUTH_TOKEN=your-secret-token
PI_MODEL=gpt-4o-mini
PI_WORKSPACE=.pi
Troubleshooting
Extensions Not Loading
ls -la extensions/minimal.ts
bun run extensions/minimal.ts
bun install
pi -e $(pwd)/extensions/minimal.ts
API Keys Not Recognized
cat .env
echo $OPENAI_API_KEY
just ext-minimal
source .env && pi -e extensions/minimal.ts
Coms-Net Connection Failures
curl http://127.0.0.1:3141/health
echo $PI_COMS_NET_AUTH_TOKEN
PI_COMS_NET_URL=http://127.0.0.1:3141 \
PI_COMS_NET_AUTH_TOKEN=test-token \
pi -e extensions/coms-net.ts
just coms-net-server
Agent-Team Dispatch Failures
cat .pi/agents/teams.yaml
ls -la .pi/agents/
bun run -e "console.log(require('yaml').parse(require('fs').readFileSync('.pi/agents/teams.yaml', 'utf8')))"
Tool Counter Not Updating
pi -e extensions/tool-counter.ts
just ext-tool-counter
Damage Control Too Restrictive
cat .pi/damage-control-rules.yaml
just ext-damage-control-continue
Additional Resources