Skip to content

⛰️ LifeOS — The AI-powered Life Operating System that helps you hill climb to wherever you're going.

Add PAI on Pi v1.0.0 — model-agnostic scaffold for local/multi-provider AI

Daniel Miesslera544ea2e1db3
diff --git a/Releases/Pi/INSTALL.md b/Releases/Pi/INSTALL.md
new file mode 100644
index 00000000..b9c5cbf0
--- /dev/null
+++ b/Releases/Pi/INSTALL.md
@@ -0,0 +1,222 @@
+# Installing PAI on Pi — Step by Step
+
+This guide takes you from zero to a working PAI system on Pi. Total time: ~15 minutes.
+
+## Prerequisites
+
+- **Node.js 18+** — [nodejs.org](https://nodejs.org/) or via your package manager
+- **A model provider** — at least one of:
+ - [Ollama](https://ollama.ai/) for local models (free, private)
+ - An API key for Anthropic, OpenAI, or OpenRouter
+
+## Step 1: Install Pi
+
+```bash
+npm install -g @mariozechner/pi-coding-agent
+```
+
+Verify it's installed:
+
+```bash
+pi --version
+```
+
+## Step 2: Set Up a Model Provider
+
+### Option A: Ollama (Local Models — Free)
+
+```bash
+# Install Ollama
+curl -fsSL https://ollama.ai/install.sh | sh
+
+# Pull a model (pick one)
+ollama pull llama3.1:8b # Fast, good for simple tasks (~4.7GB)
+ollama pull llama3.1:70b # Powerful, needs 48GB+ RAM (~40GB)
+ollama pull qwen2.5:32b # Good balance of speed and quality (~19GB)
+ollama pull deepseek-r1:32b # Strong reasoning (~19GB)
+
+# Ollama runs automatically at http://localhost:11434
+```
+
+### Option B: Cloud API (Anthropic, OpenAI, OpenRouter)
+
+Get an API key from your provider and have it ready for Step 4.
+
+## Step 3: Copy the PAI Scaffold
+
+```bash
+# Create the config directory
+mkdir -p ~/.config/PAI-pi
+
+# From this directory (Releases/Pi/), copy everything
+cp -r config/* ~/.config/PAI-pi/
+mkdir -p ~/.config/PAI-pi/extensions
+cp -r extensions/* ~/.config/PAI-pi/extensions/
+mkdir -p ~/.config/PAI-pi/skills
+cp -r skills/* ~/.config/PAI-pi/skills/
+mkdir -p ~/.config/PAI-pi/memory
+cp -r memory/* ~/.config/PAI-pi/memory/
+```
+
+## Step 4: Configure Your Model Provider
+
+Edit `~/.config/PAI-pi/models.json`. Here are working examples:
+
+### Ollama (Local)
+
+```json
+{
+ "providers": {
+ "ollama": {
+ "type": "ollama",
+ "baseUrl": "http://localhost:11434",
+ "models": {
+ "default": "llama3.1:8b"
+ }
+ }
+ }
+}
+```
+
+### Anthropic
+
+```json
+{
+ "providers": {
+ "anthropic": {
+ "type": "anthropic",
+ "apiKey": "sk-ant-...",
+ "models": {
+ "default": "claude-sonnet-4-6"
+ }
+ }
+ }
+}
+```
+
+### OpenRouter (Access Many Models)
+
+```json
+{
+ "providers": {
+ "openrouter": {
+ "type": "openai",
+ "baseUrl": "https://openrouter.ai/api/v1",
+ "apiKey": "sk-or-...",
+ "models": {
+ "default": "anthropic/claude-sonnet-4-6"
+ }
+ }
+ }
+}
+```
+
+### Multiple Providers
+
+```json
+{
+ "providers": {
+ "local": {
+ "type": "ollama",
+ "baseUrl": "http://localhost:11434",
+ "models": {
+ "default": "llama3.1:8b",
+ "thinking": "qwen2.5:32b"
+ }
+ },
+ "cloud": {
+ "type": "anthropic",
+ "apiKey": "sk-ant-...",
+ "models": {
+ "default": "claude-sonnet-4-6"
+ }
+ }
+ }
+}
+```
+
+## Step 5: Customize Your Identity
+
+Edit `~/.config/PAI-pi/SYSTEM.md` and replace the placeholders:
+
+- `{{YOUR_NAME}}` → Your name (e.g., "Alex")
+- `{{YOUR_AI_NAME}}` → Your AI's name (e.g., "Nova", "Atlas", "Friday")
+
+Also update:
+- The **Projects** table with your actual projects
+- The **Environment** section with your setup
+- Any **Behavioral Rules** you want to add or modify
+
+Edit `~/.config/PAI-pi/AGENTS.md` with your context and preferences.
+
+## Step 6: Launch
+
+```bash
+pi
+```
+
+You should see the PAI status line and your AI is ready.
+
+### Test the Algorithm
+
+Try a complex request to see the 7-phase Algorithm in action:
+
+```
+Create a TypeScript function that parses CSV files with proper error handling
+```
+
+Your AI should enter Algorithm mode, generate ISC criteria, and work through all 7 phases.
+
+### Test Skills
+
+```
+/status # Check PAI system status
+/algorithm # Force Algorithm mode for next task
+research quick: what is Pi coding agent
+```
+
+## Step 7: Optional — Voice Notifications
+
+If you want your AI to speak:
+
+1. Set up a TTS server (ElevenLabs, Coqui, or any HTTP-based TTS)
+2. Set environment variables:
+
+```bash
+export PAI_VOICE_ENABLED=true
+export PAI_VOICE_ENDPOINT=http://localhost:8888/notify
+export PAI_VOICE_ID=your-voice-id
+```
+
+3. Restart Pi. Voice will announce Algorithm phase transitions.
+
+## Troubleshooting
+
+### Pi can't find the extension
+
+Make sure the extension is at `~/.config/PAI-pi/extensions/pai-core/index.ts`. Pi looks for extensions in the `extensions/` subdirectory of its config path.
+
+### Ollama connection refused
+
+```bash
+# Check if Ollama is running
+curl http://localhost:11434/api/tags
+
+# Start it if not
+ollama serve
+```
+
+### Model too slow
+
+Use a smaller model for everyday tasks and a larger one for complex work. Configure multiple models in `models.json` and switch between them.
+
+### Skills not loading
+
+Skills are loaded from `~/.config/PAI-pi/skills/`. Each skill needs a `SKILL.md` file with proper frontmatter (the `---` delimited header).
+
+## Next Steps
+
+1. **Add your own skills** — Create new directories in `skills/` for your domains
+2. **Build your memory** — The `memory/` directory grows with usage
+3. **Customize the Algorithm** — Adjust effort levels and ISC rules in SYSTEM.md
+4. **Explore full PAI** — For the complete experience with 63+ skills, try [PAI v4.0.3 on Claude Code](../v4.0.3/)
diff --git a/Releases/Pi/README.md b/Releases/Pi/README.md
new file mode 100644
index 00000000..3c9f119c
--- /dev/null
+++ b/Releases/Pi/README.md
@@ -0,0 +1,158 @@
+# PAI on Pi v1.0.0 — Model-Agnostic Personal AI Infrastructure
+
+> **PAI** (Personal AI Infrastructure) is a methodology and toolkit for building your own AI assistant. The primary PAI releases are built on [Claude Code](https://docs.anthropic.com/en/docs/claude-code), which is the most powerful AI coding harness available today. But many people want to use **local models**, **open-source models**, or a **mix of providers** — and that's what this scaffold is for.
+
+**[Pi](https://github.com/mariozechner/pi-coding-agent)** is a model-agnostic coding agent that works with any LLM provider: Ollama (local), OpenAI, Anthropic, OpenRouter, or any OpenAI-compatible API. This directory contains everything you need to run PAI's core methodology inside Pi.
+
+## Why Pi?
+
+| Feature | Claude Code (PAI Default) | Pi (This Scaffold) |
+|---------|--------------------------|---------------------|
+| Model lock-in | Anthropic only | Any provider |
+| Local models | No | Yes (Ollama, llama.cpp, etc.) |
+| Cost | API pricing | Free with local models |
+| Privacy | Cloud-based | Fully local option |
+| PAI methodology | Full (63+ skills, 21 hooks) | Core (9 skills, 5 tools) |
+| Extensibility | Hooks + Skills | Extensions + Skills |
+| Open source | Yes | Yes |
+
+**This scaffold gives you the PAI Algorithm, skills, and core tooling** — adapted for Pi's extension system. It's the foundation you build on.
+
+## What's Included
+
+```
+Releases/Pi/
+├── config/
+│ ├── SYSTEM.md # System prompt — your AI's identity + PAI methodology
+│ ├── AGENTS.md # Context about you + optional voice config
+│ ├── settings.json # Pi runtime settings
+│ └── models.json # Model provider configuration (examples included)
+├── extensions/
+│ └── pai-core/
+│ └── index.ts # Core extension: security, PRD tracking, voice, learning
+├── skills/ # 9 skill categories with SKILL.md definitions
+│ ├── agents/ # Agent composition and team coordination
+│ ├── content-analysis/ # Extract wisdom from any content
+│ ├── investigation/ # OSINT and research
+│ ├── media/ # Diagrams, images, infographics
+│ ├── research/ # Multi-mode research methodology
+│ ├── scraping/ # Progressive web scraping
+│ ├── security/ # Security assessment frameworks
+│ ├── telos/ # Life OS — goals, projects, wisdom tracking
+│ └── thinking/ # First principles, red team, council debate
+└── memory/ # Persistent memory across sessions
+ ├── learning/ # Session logs and learning signals
+ ├── state/ # Current work state
+ └── work/ # PRD files for Algorithm sessions
+```
+
+## The PAI Algorithm
+
+The core of PAI is the **7-phase Algorithm** — a structured methodology for complex work:
+
+1. **OBSERVE** — Reverse-engineer the request. Generate testable success criteria (ISC).
+2. **THINK** — Identify risks, run a premortem, check prerequisites.
+3. **PLAN** — Design the approach. Choose depth vs breadth.
+4. **BUILD** — Prepare artifacts, invoke capabilities.
+5. **EXECUTE** — Do the work. Mark criteria as they pass.
+6. **VERIFY** — Test every criterion with evidence.
+7. **LEARN** — Reflect on what worked and what didn't.
+
+This methodology works with **any model** — it's a thinking framework, not a model capability. Even smaller local models benefit from this structured approach.
+
+## Architecture
+
+```
+┌─────────────────────────────────┐
+│ Pi Coding Agent │
+│ (model-agnostic runtime) │
+├─────────────────────────────────┤
+│ PAI Core Extension │
+│ Security │ PRD │ Voice │ Learn │
+├─────────────────────────────────┤
+│ SYSTEM.md (Identity + Algo) │
+├──────────┬──────────────────────┤
+│ Skills │ Memory │
+│ (9 cat) │ learning/state/work│
+├──────────┴──────────────────────┤
+│ Your Model Provider │
+│ Ollama │ OpenAI │ Anthropic │
+│ OpenRouter │ Any compatible │
+└─────────────────────────────────┘
+```
+
+## Quick Start
+
+See **[INSTALL.md](INSTALL.md)** for the full setup guide. The short version:
+
+```bash
+# 1. Install Pi
+npm install -g @mariozechner/pi-coding-agent
+
+# 2. Copy this scaffold to Pi's config directory
+cp -r config/* ~/.config/PAI-pi/
+cp -r extensions/* ~/.config/PAI-pi/extensions/
+cp -r skills/* ~/.config/PAI-pi/skills/
+cp -r memory/* ~/.config/PAI-pi/memory/
+
+# 3. Configure your model provider in models.json
+# Edit ~/.config/PAI-pi/models.json
+
+# 4. Customize your identity in SYSTEM.md
+# Replace {{YOUR_NAME}} and {{YOUR_AI_NAME}} placeholders
+
+# 5. Launch
+pi
+```
+
+## Customization
+
+### Naming Your AI
+
+Edit `config/SYSTEM.md` and replace:
+- `{{YOUR_NAME}}` — Your name
+- `{{YOUR_AI_NAME}}` — What you want to call your AI assistant
+
+### Adding Skills
+
+Create a new directory under `skills/` with a `SKILL.md` file:
+
+```markdown
+---
+name: my-skill
+description: What this skill does. USE WHEN trigger words here.
+metadata:
+ author: you
+ version: 1.0.0
+---
+
+# My Skill
+
+Instructions for the AI when this skill is activated.
+```
+
+### Voice Integration (Optional)
+
+Set environment variables to enable TTS:
+
+```bash
+export PAI_VOICE_ENABLED=true
+export PAI_VOICE_ENDPOINT=http://localhost:8888/notify
+export PAI_VOICE_ID=your-voice-id
+```
+
+Works with ElevenLabs, Coqui, or any TTS server that accepts HTTP POST with JSON body.
+
+## Relationship to PAI Releases
+
+This scaffold is derived from [PAI v4.0.3](../v4.0.3/). The full PAI system on Claude Code has 63+ skills, 21 hooks, and 338 workflows. This Pi version provides the core methodology and 9 foundational skill categories — enough to build a powerful personal AI system that you extend over time.
+
+**To upgrade from Pi to full PAI:** Install PAI v4.0.3 on Claude Code. The methodology is the same — your skills and memory structure will transfer.
+
+## Contributing
+
+This scaffold is part of the [PAI open-source project](https://github.com/danielmiessler/PAI). Issues and PRs welcome.
+
+## License
+
+Same as the PAI project — see [LICENSE](../../LICENSE).
diff --git a/Releases/Pi/VERSION b/Releases/Pi/VERSION
new file mode 100644
index 00000000..3eefcb9d
--- /dev/null
+++ b/Releases/Pi/VERSION
@@ -0,0 +1 @@
+1.0.0
diff --git a/Releases/Pi/config/AGENTS.md b/Releases/Pi/config/AGENTS.md
new file mode 100644
index 00000000..8660d0a7
--- /dev/null
+++ b/Releases/Pi/config/AGENTS.md
@@ -0,0 +1,32 @@
+# Context: You
+
+## Who You Are
+
+Customize this file with your own context — role, expertise, preferences.
+
+## Key Preferences
+
+- Concise responses for simple tasks
+- Verification over claims of completion
+- Direct language, no hedging
+- CLI-first approach
+- Simple solutions over clever ones
+- Evidence over claims
+
+## Voice Server (Optional)
+
+If you set up a TTS voice server, configure it here:
+
+```bash
+# Example: ElevenLabs or local TTS at a given endpoint
+curl -s -X POST http://localhost:8888/notify \
+ -H "Content-Type: application/json" \
+ -d '{"message": "MESSAGE_HERE", "voice_id": "YOUR_VOICE_ID", "voice_enabled": true}'
+```
+
+## Memory Location
+
+Persistent memory files at the configured memory directory:
+- `learning/` — Signals and patterns from interactions
+- `state/` — Current work tracking
+- `work/` — PRD files for Algorithm sessions
diff --git a/Releases/Pi/config/SYSTEM.md b/Releases/Pi/config/SYSTEM.md
new file mode 100644
index 00000000..4e2fa223
--- /dev/null
+++ b/Releases/Pi/config/SYSTEM.md
@@ -0,0 +1,120 @@
+# PAI on Pi — Personal AI Infrastructure
+
+You are **{{YOUR_AI_NAME}}**, {{YOUR_NAME}}'s personal AI assistant. You run on the Pi coding agent framework with the full PAI methodology.
+
+## Identity
+
+- **Name:** {{YOUR_AI_NAME}}
+- **Principal:** {{YOUR_NAME}}
+- **Personality:** Customize your AI's personality traits below
+- **Traits:** Enthusiasm 60, Energy 70, Expressiveness 65, Precision 90, Curiosity 85
+- First person ("I"), user by name ("{{YOUR_NAME}}", never "the user")
+
+## Modes
+
+Every response uses exactly one mode. BEFORE ANY WORK, classify the request and select a mode.
+
+**Routing priority (check in this order):**
+
+1. **MINIMAL** — Greetings, ratings, simple acknowledgments ("ok", "thanks", "8")
+2. **ALGORITHM** (DEFAULT) — All real and complex work. Use when the task involves ANY of: designing, building, creating, planning, investigating, debugging, troubleshooting, refactoring, researching, analyzing, writing, multi-step work, multiple components, creative output, or anything requiring sustained thought. **When in doubt, ALWAYS use ALGORITHM.**
+3. **NATIVE** (rare exception) — ONLY for simple single-action tasks that require no planning or creativity.
+
+## NATIVE MODE
+
+```
+==== PAI | NATIVE MODE ===============================
+TASK: [8 word description]
+```
+
+Then do the work, then:
+
+```
+CHANGE: [8-word bullets on what changed]
+VERIFY: [8-word bullets on how we know what happened]
+{{YOUR_AI_NAME}}: [8-16 word summary]
+```
+
+## ALGORITHM MODE
+
+```
+=== Entering the PAI ALGORITHM (v3.6.0) =============
+TASK: [8 word description]
+```
+
+### The 7 Phases
+
+**1. OBSERVE** — Reverse engineer the request:
+- Explicit wants, implied wants, explicit not-wanted, implied not-wanted
+- Select EFFORT LEVEL: Standard (<2min, 8-16 ISC) | Extended (<8min, 16-32 ISC) | Advanced (<16min, 24-48 ISC) | Deep (<32min, 40-80 ISC) | Comprehensive (<120min, 64-150 ISC)
+- Generate ISC (Ideal State Criteria) — atomic, binary, testable. Each criterion = one verifiable thing.
+- Select CAPABILITIES (skills, tools, approaches to use)
+
+**2. THINK** — Pressure test the ISC:
+- Riskiest assumptions
+- Premortem (how this could fail)
+- Prerequisites check
+
+**3. PLAN** — Design the approach:
+- Prerequisite validation
+- Technical approach and key decisions
+
+**4. BUILD** — Preparation and creation:
+- Invoke selected capabilities
+- Create artifacts
+
+**5. EXECUTE** — Perform the work:
+- Execute the plan
+- Mark ISC criteria as they're satisfied
+
+**6. VERIFY** — Validate against ISC:
+- Test EACH criterion
+- Evidence-based verification
+
+**7. LEARN** — Reflect:
+- What should I have done differently?
+- What would a smarter algorithm have done?
+
+### ISC Rules
+
+- Every criterion must be ATOMIC — one verifiable end-state, 8-12 words, binary testable
+- Apply the Splitting Test: "and"/"with" test, independent failure test, scope word test, domain boundary test
+- Anti-criteria (ISC-A prefix): what must NOT happen
+
+## MINIMAL MODE
+
+```
+=== PAI ==============================
+CHANGE: [8-word bullets]
+VERIFY: [8-word bullets]
+{{YOUR_AI_NAME}}: [summary in 8-16 words]
+```
+
+## Critical Behavioral Rules
+
+**Surgical fixes only.** When debugging, make precise targeted corrections. Never delete or rearchitect existing components as a fix.
+
+**Never assert without verification.** NEVER tell {{YOUR_NAME}} something "is" a certain way unless you have verified it. After changes, verify before claiming success.
+
+**First principles over bolt-ons.** Most problems are symptoms. Understand > Simplify > Reduce > Add (last resort).
+
+**Read before modifying.** Understand existing code before suggesting modifications.
+
+**One change when debugging.** Isolate, verify, proceed.
+
+**Minimal scope.** Only change what was asked. No bonus refactoring.
+
+## Projects
+
+Add your projects here:
+
+| Project | Path | Stack |
+|---------|------|-------|
+| Example | ~/Projects/MyProject | Your stack here |
+
+## Environment
+
+- **Machine:** Your machine
+- **Terminal:** Your terminal
+- **Runtime:** Your preferred runtime
+- **Language:** Your preferred language
diff --git a/Releases/Pi/config/models.json b/Releases/Pi/config/models.json
new file mode 100644
index 00000000..a399ade0
--- /dev/null
+++ b/Releases/Pi/config/models.json
@@ -0,0 +1,43 @@
+{
+ "providers": {
+ "_comment": "Configure your model providers here. Examples below — uncomment and fill in the ones you use.",
+
+ "_example_ollama": {
+ "type": "ollama",
+ "baseUrl": "http://localhost:11434",
+ "models": {
+ "default": "llama3.1:70b",
+ "fast": "llama3.1:8b",
+ "thinking": "qwen2.5:72b"
+ }
+ },
+
+ "_example_openai_compatible": {
+ "type": "openai",
+ "baseUrl": "http://localhost:1234/v1",
+ "apiKey": "your-api-key-here",
+ "models": {
+ "default": "your-model-name"
+ }
+ },
+
+ "_example_anthropic": {
+ "type": "anthropic",
+ "apiKey": "your-api-key-here",
+ "models": {
+ "default": "claude-sonnet-4-6",
+ "thinking": "claude-opus-4-6"
+ }
+ },
+
+ "_example_openrouter": {
+ "type": "openai",
+ "baseUrl": "https://openrouter.ai/api/v1",
+ "apiKey": "your-openrouter-key",
+ "models": {
+ "default": "anthropic/claude-sonnet-4-6",
+ "fast": "anthropic/claude-haiku-4-5"
+ }
+ }
+ }
+}
diff --git a/Releases/Pi/config/settings.json b/Releases/Pi/config/settings.json
new file mode 100644
index 00000000..2f0c2793
--- /dev/null
+++ b/Releases/Pi/config/settings.json
@@ -0,0 +1,14 @@
+{
+ "thinkingLevel": "high",
+ "theme": "dark",
+ "steeringMode": "one-at-a-time",
+ "followUpMode": "one-at-a-time",
+ "transport": "auto",
+ "enableSkillCommands": true,
+ "quietStartup": true,
+ "compaction": {
+ "enabled": true,
+ "proactive": true,
+ "contextThreshold": 0.85
+ }
+}
diff --git a/Releases/Pi/extensions/pai-core/index.ts b/Releases/Pi/extensions/pai-core/index.ts
new file mode 100644
index 00000000..f5b34a5e
--- /dev/null
+++ b/Releases/Pi/extensions/pai-core/index.ts
@@ -0,0 +1,335 @@
+/**
+ * PAI Core Extension for Pi
+ *
+ * Ports the key PAI capabilities to Pi's extension system:
+ * - Voice notifications (optional TTS integration)
+ * - Security validation (blocks dangerous commands)
+ * - Session lifecycle (startup greeting, shutdown logging)
+ * - PRD work tracking (Algorithm methodology support)
+ * - Learning signal capture (cross-session improvement)
+ *
+ * Based on PAI v4.0.3 — https://github.com/danielmiessler/PAI
+ */
+
+import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
+import { Type } from "@sinclair/typebox";
+import { execSync, spawn } from "child_process";
+import { existsSync, mkdirSync, writeFileSync, readFileSync, appendFileSync } from "fs";
+import { homedir } from "os";
+import { join } from "path";
+
+// ─── Configuration via environment variables ────────────────
+const PAI_PI_DIR = process.env.PAI_PI_DIR || join(homedir(), ".config", "PAI-pi");
+const MEMORY_DIR = join(PAI_PI_DIR, "memory");
+const WORK_DIR = join(MEMORY_DIR, "work");
+const LEARNING_DIR = join(MEMORY_DIR, "learning");
+const STATE_DIR = join(MEMORY_DIR, "state");
+
+// Voice configuration — set these env vars to enable TTS
+const VOICE_ENDPOINT = process.env.PAI_VOICE_ENDPOINT || "http://localhost:8888/notify";
+const VOICE_ID = process.env.PAI_VOICE_ID || "";
+const VOICE_ENABLED = process.env.PAI_VOICE_ENABLED === "true";
+
+// Ensure directories exist
+for (const dir of [MEMORY_DIR, WORK_DIR, LEARNING_DIR, STATE_DIR]) {
+ if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
+}
+
+export default function (pi: ExtensionAPI) {
+ // ─── Voice Notification Tool ─────────────────────────
+ pi.registerTool({
+ name: "voice_notify",
+ label: "Voice",
+ description: "Send a voice notification via TTS server (requires PAI_VOICE_ENDPOINT and PAI_VOICE_ID env vars)",
+ parameters: Type.Object({
+ message: Type.String({ description: "Text to speak" }),
+ }),
+ async execute(_toolCallId, params) {
+ if (!VOICE_ENABLED || !VOICE_ID) {
+ return { content: [{ type: "text", text: "Voice disabled (set PAI_VOICE_ENABLED=true and PAI_VOICE_ID)" }] };
+ }
+
+ try {
+ execSync(
+ `curl -s -X POST ${VOICE_ENDPOINT} -H "Content-Type: application/json" -d '${JSON.stringify({
+ message: params.message,
+ voice_id: VOICE_ID,
+ voice_enabled: true,
+ })}'`,
+ { timeout: 5000 }
+ );
+ return { content: [{ type: "text", text: `Voice: "${params.message}"` }] };
+ } catch {
+ return { content: [{ type: "text", text: "Voice server unavailable" }] };
+ }
+ },
+ promptSnippet: "voice_notify - Speak text aloud via TTS",
+ promptGuidelines: "Use for Algorithm phase transitions and task completion announcements.",
+ });
+
+ // ─── Security: Block dangerous commands ──────────────
+ pi.on("tool_call", async (event) => {
+ if (event.toolName !== "bash") return;
+ const cmd = (event.input as { command?: string })?.command || "";
+
+ const dangerous = [
+ /rm\s+(-rf?|--recursive)\s+[\/~]/,
+ /rm\s+-rf?\s+\./,
+ /git\s+push\s+.*--force/,
+ /git\s+reset\s+--hard/,
+ /git\s+clean\s+-f/,
+ /git\s+checkout\s+\./,
+ /drop\s+table/i,
+ /truncate\s+table/i,
+ /:(){ :\|:& };:/,
+ /mkfs\./,
+ /dd\s+if=/,
+ ];
+
+ for (const pattern of dangerous) {
+ if (pattern.test(cmd)) {
+ return {
+ block: true,
+ reason: `BLOCKED: Dangerous command detected. Pattern: ${pattern.source}. Ask before proceeding.`,
+ };
+ }
+ }
+ });
+
+ // ─── Session Start: Voice (non-blocking) ─────────────
+ pi.on("session_start", async () => {
+ if (!VOICE_ENABLED || !VOICE_ID) return;
+
+ const child = spawn("curl", [
+ "-s", "-X", "POST", VOICE_ENDPOINT,
+ "-H", "Content-Type: application/json",
+ "--connect-timeout", "1",
+ "-m", "3",
+ "-d", JSON.stringify({
+ message: "PAI online. Ready for work.",
+ voice_id: VOICE_ID,
+ voice_enabled: true,
+ }),
+ ], { stdio: "ignore", detached: true });
+ child.unref();
+ });
+
+ // ─── Session Shutdown: Capture learnings ─────────────
+ pi.on("session_shutdown", async () => {
+ const timestamp = new Date().toISOString();
+ const logPath = join(LEARNING_DIR, "session-log.jsonl");
+
+ const entry = {
+ timestamp,
+ event: "session_end",
+ sessionName: pi.getSessionName() || "unnamed",
+ };
+
+ try {
+ appendFileSync(logPath, JSON.stringify(entry) + "\n");
+ } catch {
+ // Best effort
+ }
+ });
+
+ // ─── PRD Management Tool ─────────────────────────────
+ pi.registerTool({
+ name: "prd_create",
+ label: "PRD",
+ description: "Create a PRD (Product Requirements Document) for Algorithm work tracking",
+ parameters: Type.Object({
+ task: Type.String({ description: "8 word task description" }),
+ slug: Type.String({ description: "kebab-case slug for the work directory" }),
+ effort: Type.String({ description: "standard|extended|advanced|deep|comprehensive" }),
+ phase: Type.String({ description: "observe|think|plan|build|execute|verify|learn|complete" }),
+ criteria: Type.Optional(Type.Array(Type.String(), { description: "ISC criteria list" })),
+ progress: Type.Optional(Type.String({ description: "e.g. 3/8" })),
+ }),
+ async execute(_toolCallId, params) {
+ const workDir = join(WORK_DIR, params.slug);
+ if (!existsSync(workDir)) mkdirSync(workDir, { recursive: true });
+
+ const timestamp = new Date().toISOString();
+ const criteriaBlock = params.criteria
+ ? params.criteria.map((c, i) => `- [ ] ISC-${i + 1}: ${c}`).join("\n")
+ : "";
+
+ const content = `---
+task: ${params.task}
+slug: ${params.slug}
+effort: ${params.effort}
+phase: ${params.phase}
+progress: ${params.progress || "0/0"}
+started: ${timestamp}
+updated: ${timestamp}
+---
+
+## Context
+
+${params.task}
+
+## Criteria
+
+${criteriaBlock}
+
+## Decisions
+
+## Verification
+`;
+
+ const prdPath = join(workDir, "PRD.md");
+ writeFileSync(prdPath, content);
+
+ return {
+ content: [{ type: "text", text: `PRD created at ${prdPath}` }],
+ details: { path: prdPath, slug: params.slug },
+ };
+ },
+ promptSnippet: "prd_create - Create Algorithm PRD for work tracking",
+ promptGuidelines:
+ "Create a PRD at the start of every Algorithm session. Update phase and progress as work proceeds.",
+ });
+
+ // ─── PRD Update Tool ─────────────────────────────────
+ pi.registerTool({
+ name: "prd_update",
+ label: "PRD Update",
+ description: "Update PRD phase, progress, or mark criteria complete",
+ parameters: Type.Object({
+ slug: Type.String({ description: "PRD slug" }),
+ phase: Type.Optional(Type.String({ description: "New phase" })),
+ progress: Type.Optional(Type.String({ description: "e.g. 5/8" })),
+ complete_criteria: Type.Optional(
+ Type.Array(Type.Number(), { description: "ISC numbers to mark complete" })
+ ),
+ }),
+ async execute(_toolCallId, params) {
+ const prdPath = join(WORK_DIR, params.slug, "PRD.md");
+ if (!existsSync(prdPath)) {
+ return { content: [{ type: "text", text: `PRD not found: ${params.slug}` }] };
+ }
+
+ let content = readFileSync(prdPath, "utf-8");
+ const timestamp = new Date().toISOString();
+
+ if (params.phase) {
+ content = content.replace(/^phase: .+$/m, `phase: ${params.phase}`);
+ }
+ if (params.progress) {
+ content = content.replace(/^progress: .+$/m, `progress: ${params.progress}`);
+ }
+ content = content.replace(/^updated: .+$/m, `updated: ${timestamp}`);
+
+ if (params.complete_criteria) {
+ for (const num of params.complete_criteria) {
+ content = content.replace(
+ new RegExp(`^- \\[ \\] ISC-${num}:`, "m"),
+ `- [x] ISC-${num}:`
+ );
+ }
+ }
+
+ writeFileSync(prdPath, content);
+ return { content: [{ type: "text", text: `PRD updated: ${params.slug}` }] };
+ },
+ promptSnippet: "prd_update - Update Algorithm PRD phase/progress/criteria",
+ });
+
+ // ─── Learning Signal Tool ────────────────────────────
+ pi.registerTool({
+ name: "capture_learning",
+ label: "Learn",
+ description: "Capture a learning signal or reflection from this session",
+ parameters: Type.Object({
+ signal_type: Type.String({ description: "rating|reflection|failure|pattern" }),
+ content: Type.String({ description: "The learning content" }),
+ score: Type.Optional(Type.Number({ description: "Rating 1-10 if applicable" })),
+ }),
+ async execute(_toolCallId, params) {
+ const timestamp = new Date().toISOString();
+ const entry = {
+ timestamp,
+ type: params.signal_type,
+ content: params.content,
+ score: params.score,
+ session: pi.getSessionName() || "unnamed",
+ };
+
+ const logPath = join(LEARNING_DIR, "signals.jsonl");
+ appendFileSync(logPath, JSON.stringify(entry) + "\n");
+
+ return {
+ content: [{ type: "text", text: `Learning captured: ${params.signal_type}` }],
+ details: entry,
+ };
+ },
+ promptSnippet: "capture_learning - Store learning signals for cross-session improvement",
+ });
+
+ // ─── Status Line ─────────────────────────────────────
+ pi.on("agent_start", async (_event, ctx) => {
+ ctx.ui.setStatus("pai", "PAI on Pi | Algorithm v3.6.0");
+ });
+
+ // ─── Slash Commands ──────────────────────────────────
+ pi.registerCommand("algorithm", {
+ description: "Start an Algorithm session for complex work",
+ handler: async (_args, ctx) => {
+ ctx.ui.notify(
+ "Algorithm mode activated. Use the 7-phase methodology for this task.",
+ "info"
+ );
+ await pi.sendUserMessage("Use ALGORITHM mode for the next task. Follow all 7 phases.");
+ },
+ });
+
+ pi.registerCommand("status", {
+ description: "Show PAI system status",
+ handler: async (_args, ctx) => {
+ const sessionCount = (() => {
+ try {
+ const logPath = join(LEARNING_DIR, "session-log.jsonl");
+ if (!existsSync(logPath)) return 0;
+ return readFileSync(logPath, "utf-8").trim().split("\n").length;
+ } catch {
+ return 0;
+ }
+ })();
+
+ const signalCount = (() => {
+ try {
+ const logPath = join(LEARNING_DIR, "signals.jsonl");
+ if (!existsSync(logPath)) return 0;
+ return readFileSync(logPath, "utf-8").trim().split("\n").length;
+ } catch {
+ return 0;
+ }
+ })();
+
+ ctx.ui.notify(
+ `PAI on Pi | Sessions: ${sessionCount} | Signals: ${signalCount}`,
+ "info"
+ );
+ },
+ });
+
+ pi.registerCommand("voice", {
+ description: "Send a voice notification",
+ handler: async (args, _ctx) => {
+ if (!VOICE_ENABLED || !VOICE_ID) return;
+ const message = args || "Hello from PAI";
+ try {
+ execSync(
+ `curl -s -X POST ${VOICE_ENDPOINT} -H "Content-Type: application/json" -d '${JSON.stringify({
+ message,
+ voice_id: VOICE_ID,
+ voice_enabled: true,
+ })}'`,
+ { timeout: 5000 }
+ );
+ } catch {
+ // Voice server may not be running
+ }
+ },
+ });
+}
diff --git a/Releases/Pi/memory/learning/.gitkeep b/Releases/Pi/memory/learning/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/Releases/Pi/memory/state/.gitkeep b/Releases/Pi/memory/state/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/Releases/Pi/memory/work/.gitkeep b/Releases/Pi/memory/work/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/Releases/Pi/skills/agents/SKILL.md b/Releases/Pi/skills/agents/SKILL.md
new file mode 100644
index 00000000..e36e6eef
--- /dev/null
+++ b/Releases/Pi/skills/agents/SKILL.md
@@ -0,0 +1,36 @@
+---
+name: agents
+description: Compose custom agents from base traits, voices, and specializations for specialized perspectives. Create agent teams for parallel work. USE WHEN create custom agents, spin up agents, specialized agents, agent personalities, available traits, compose agent, agent profile, spawn parallel agents, launch agents, agent teams, swarm.
+metadata:
+ author: pai
+ version: 1.0.0
+---
+
+# Agents Skill
+
+## Agent Composition
+
+Create specialized agents by combining:
+1. **Base Trait** — Core expertise (Engineer, Researcher, Designer, etc.)
+2. **Voice** — Communication style (Academic, Practitioner, Contrarian, etc.)
+3. **Specialization** — Domain focus (Security, Frontend, Data, etc.)
+
+## Available Base Traits
+
+- **Engineer** — Implementation-focused, TDD, clean code
+- **Architect** — System design, trade-offs, scalability
+- **Researcher** — Evidence-based, multi-source, thorough
+- **Designer** — User-centered, accessible, beautiful
+- **Analyst** — Data-driven, pattern recognition, synthesis
+- **Strategist** — Long-term thinking, competitive analysis
+
+## Team Coordination
+
+For complex tasks, spawn multiple agents with:
+- Shared context (the task description)
+- Independent execution
+- Results synthesis at the end
+
+## Usage
+
+Describe the kind of agent(s) you need and the task. Agents will be composed and deployed.
diff --git a/Releases/Pi/skills/content-analysis/SKILL.md b/Releases/Pi/skills/content-analysis/SKILL.md
new file mode 100644
index 00000000..3aceea9b
--- /dev/null
+++ b/Releases/Pi/skills/content-analysis/SKILL.md
@@ -0,0 +1,44 @@
+---
+name: content-analysis
+description: Content extraction and analysis for video, podcast, article, and YouTube content. Extracts structured insights, key takeaways, and wisdom. USE WHEN extract wisdom, content analysis, analyze content, insight report, analyze video, analyze podcast, extract insights, key takeaways, what did I miss, extract from YouTube.
+metadata:
+ author: pai
+ version: 1.0.0
+---
+
+# Content Analysis Skill
+
+## Extraction Framework
+
+For any content (article, video, podcast, document):
+
+1. **Summary** — 25-50 word overview
+2. **Key Ideas** — 5-15 most important ideas
+3. **Insights** — Non-obvious observations
+4. **Quotes** — Notable direct quotes
+5. **Habits** — Actionable habits mentioned
+6. **Facts** — Surprising or important facts
+7. **Recommendations** — Books, tools, resources mentioned
+8. **Action Items** — What to do with this knowledge
+
+## Output Format
+
+```
+## Content Analysis: [Title]
+
+### One-Sentence Summary
+[25-50 words]
+
+### Key Ideas (ranked by importance)
+1. [Idea]
+2. [Idea]
+
+### Insights
+- [Non-obvious observation]
+
+### Notable Quotes
+> "Quote" — Speaker
+
+### Action Items
+- [ ] [Actionable takeaway]
+```
diff --git a/Releases/Pi/skills/investigation/SKILL.md b/Releases/Pi/skills/investigation/SKILL.md
new file mode 100644
index 00000000..9ee6243c
--- /dev/null
+++ b/Releases/Pi/skills/investigation/SKILL.md
@@ -0,0 +1,25 @@
+---
+name: investigation
+description: OSINT and investigation including people search, company intel, domain lookup, social media discovery, and threat intel. USE WHEN OSINT, due diligence, company intel, background check, find person, people search, domain lookup, entity lookup, threat intel, who is.
+metadata:
+ author: pai
+ version: 1.0.0
+---
+
+# Investigation Skill
+
+## Capabilities
+
+- People search and public records
+- Company intelligence and filings
+- Domain and infrastructure lookup
+- Social media discovery
+- Threat intelligence correlation
+- Entity relationship mapping
+
+## Methods
+
+1. **Surface scan** — Quick public data aggregation
+2. **Deep dive** — Cross-referencing multiple data sources
+3. **Pattern analysis** — Identifying connections and anomalies
+4. **Timeline reconstruction** — Building event chronology
diff --git a/Releases/Pi/skills/media/SKILL.md b/Releases/Pi/skills/media/SKILL.md
new file mode 100644
index 00000000..c95d0c20
--- /dev/null
+++ b/Releases/Pi/skills/media/SKILL.md
@@ -0,0 +1,28 @@
+---
+name: media
+description: Visual and video content creation. AI images, technical diagrams, mermaid flowcharts, infographics, comics, and special effects. USE WHEN art, diagrams, mermaid, flowcharts, infographics, video, animation, thumbnails, visualizations, generate image, technical diagrams.
+metadata:
+ author: pai
+ version: 1.0.0
+---
+
+# Media Skill
+
+## Capabilities
+
+### Diagrams & Charts
+- Mermaid flowcharts, sequence diagrams, class diagrams
+- Technical architecture diagrams
+
+### AI Image Generation
+- Prompt engineering for image models
+- Style guidance and iteration
+
+### Infographics
+- Data visualization
+- Comparison frameworks
+- Timeline graphics
+
+## Usage
+
+Describe what you need visually. For diagrams, Mermaid is preferred. For complex visuals, provide the data and desired style.
diff --git a/Releases/Pi/skills/research/SKILL.md b/Releases/Pi/skills/research/SKILL.md
new file mode 100644
index 00000000..11e4da1c
--- /dev/null
+++ b/Releases/Pi/skills/research/SKILL.md
@@ -0,0 +1,51 @@
+---
+name: research
+description: Comprehensive research and content extraction. Quick, standard, extensive, and deep modes with multi-source parallel investigation, content retrieval, and analysis. USE WHEN research, investigate, find information, analyze content, retrieve content, extract knowledge, web scraping, standard research, map landscape, competitive analysis, deep investigation.
+metadata:
+ author: pai
+ version: 1.0.0
+---
+
+# Research Skill
+
+## Modes
+
+| Mode | Depth | Sources | Time |
+|------|-------|---------|------|
+| Quick | Surface scan | 2-3 sources | <1 min |
+| Standard | Balanced coverage | 4-6 sources | 2-5 min |
+| Extensive | Broad sweep | 8-12 sources | 5-10 min |
+| Deep | Exhaustive | 15+ sources | 10-30 min |
+
+## Workflow
+
+1. **Decompose** the research question into 3-10 sub-queries
+2. **Search** using web search across multiple angles
+3. **Extract** key findings, data points, and insights
+4. **Synthesize** into a structured report
+5. **Verify** claims with cross-referencing
+
+## Output Format
+
+```
+## Research: [Topic]
+
+### Key Findings
+- [Finding 1 with source]
+- [Finding 2 with source]
+
+### Analysis
+[Synthesis of findings]
+
+### Sources
+- [Source 1](url)
+- [Source 2](url)
+```
+
+## Rules
+
+- Always cite sources
+- Flag conflicting information
+- Distinguish facts from opinions
+- Note confidence levels
+- Prefer primary sources over secondary
diff --git a/Releases/Pi/skills/scraping/SKILL.md b/Releases/Pi/skills/scraping/SKILL.md
new file mode 100644
index 00000000..2a68fc20
--- /dev/null
+++ b/Releases/Pi/skills/scraping/SKILL.md
@@ -0,0 +1,24 @@
+---
+name: scraping
+description: Web scraping via progressive escalation and social media platform scrapers. USE WHEN scraping, crawl, scrape URL, bot detection, CAPTCHA, spider.
+metadata:
+ author: pai
+ version: 1.0.0
+---
+
+# Scraping Skill
+
+## Progressive Escalation
+
+1. **Direct fetch** — curl/fetch with standard headers
+2. **Browser rendering** — Headless browser for JS-heavy sites
+3. **Proxy rotation** — For rate-limited or geo-restricted content
+4. **Specialized APIs** — Platform-specific scrapers
+
+## Rules
+
+- Respect robots.txt
+- Rate limit requests
+- Handle pagination
+- Extract structured data
+- Store raw + processed versions
diff --git a/Releases/Pi/skills/security/SKILL.md b/Releases/Pi/skills/security/SKILL.md
new file mode 100644
index 00000000..cdd2ebdf
--- /dev/null
+++ b/Releases/Pi/skills/security/SKILL.md
@@ -0,0 +1,49 @@
+---
+name: security
+description: Security assessment including reconnaissance, web assessment (OWASP), vulnerability analysis, threat modeling, and security news analysis. USE WHEN recon, reconnaissance, port scan, subdomain, DNS, WHOIS, web assessment, OWASP, pentest, vulnerability analysis, threat modeling, security trends, security research.
+metadata:
+ author: pai
+ version: 1.0.0
+---
+
+# Security Skill
+
+## Capabilities
+
+### Reconnaissance
+- Subdomain enumeration
+- DNS analysis
+- WHOIS lookup
+- Port scanning
+- ASN mapping
+- Technology fingerprinting
+
+### Web Assessment (OWASP)
+- Authentication testing
+- Authorization testing
+- Input validation
+- Session management
+- Error handling
+- Cryptography review
+
+### Threat Modeling
+- STRIDE framework
+- Attack surface mapping
+- Risk assessment matrix
+- Mitigation recommendations
+
+## Tools
+
+Use these CLI tools when available:
+- `nmap` — Port scanning
+- `ffuf` — Web fuzzing
+- `dig` / `whois` — DNS/WHOIS
+- `curl` — HTTP testing
+- `jq` — JSON parsing
+
+## Rules
+
+- Only perform authorized testing
+- Document all findings with evidence
+- Rate severity: Critical > High > Medium > Low > Info
+- Provide remediation for each finding
diff --git a/Releases/Pi/skills/telos/SKILL.md b/Releases/Pi/skills/telos/SKILL.md
new file mode 100644
index 00000000..394f371e
--- /dev/null
+++ b/Releases/Pi/skills/telos/SKILL.md
@@ -0,0 +1,37 @@
+---
+name: telos
+description: Life OS and project analysis. Goals, dependencies, beliefs, wisdom, books, movies, narrative points, project dashboards, and life direction analysis. USE WHEN Telos, life goals, projects, dependencies, beliefs, wisdom, books, movies, project analysis, dashboard.
+metadata:
+ author: pai
+ version: 1.0.0
+---
+
+# Telos — Life Operating System
+
+## Framework
+
+Telos is a structured system for tracking:
+- **Mission** — Core life purpose
+- **Goals** — Active objectives with timelines
+- **Projects** — Active work mapped to goals
+- **Dependencies** — What each goal requires
+- **Beliefs** — Core beliefs that drive decisions
+- **Wisdom** — Accumulated insights from experience
+- **Books** — Reading list and key takeaways
+- **Movies/Media** — Cultural consumption log
+
+## Dashboard
+
+Generate a structured overview showing:
+1. Active goals and their status
+2. Projects and which goals they serve
+3. Recent wisdom additions
+4. Dependency blockers
+
+## Reports
+
+Structured reports with:
+- Executive summary
+- Key findings
+- Recommendations
+- Data exhibits
diff --git a/Releases/Pi/skills/thinking/SKILL.md b/Releases/Pi/skills/thinking/SKILL.md
new file mode 100644
index 00000000..1a9025b1
--- /dev/null
+++ b/Releases/Pi/skills/thinking/SKILL.md
@@ -0,0 +1,52 @@
+---
+name: thinking
+description: Analytical and creative thinking frameworks. First principles decomposition, iterative depth analysis, council debate with multiple perspectives, red team stress testing, brainstorming, world and threat models, and scientific method. USE WHEN first principles, decompose, challenge assumptions, iterative depth, be creative, brainstorm, council, debate, red team, stress test, devil's advocate, threat model, world model, think about, experiment, hypothesis, deep exploration, figure out, optimize, improve, weigh options, creative solutions, critique, counterarguments.
+metadata:
+ author: pai
+ version: 1.0.0
+---
+
+# Thinking Skill
+
+## Available Frameworks
+
+### First Principles
+Decompose problem to fundamental truths, then rebuild from ground up.
+1. Identify assumptions
+2. Break down to irreducible elements
+3. Rebuild solution from fundamentals
+
+### Council (Multi-perspective Debate)
+3-round debate with 3-5 distinct perspectives:
+- Round 1: Each perspective states position
+- Round 2: Challenge and counter-argue
+- Round 3: Synthesize and find consensus
+
+### Red Team
+Adversarial analysis:
+1. Identify the plan/system to attack
+2. Generate 5-10 attack vectors
+3. Rate severity and likelihood
+4. Propose mitigations
+
+### Iterative Depth
+Explore topic from 2-8 angles, each adding depth:
+1. Surface understanding
+2. Mechanism understanding
+3. Edge cases and failures
+4. Systemic implications
+
+### Science Method
+1. Observe the phenomenon
+2. Form hypothesis
+3. Design experiment
+4. Execute and measure
+5. Analyze results
+6. Iterate
+
+### World/Threat Model
+Analyze threats, opportunities, and second-order effects across multiple time horizons.
+
+## Usage
+
+Specify which framework to use, or describe the problem and the appropriate framework will be selected.