{"type":"session","version":3,"id":"019d9853-526b-76a8-918f-b098ef98807b","timestamp":"2026-04-16T22:04:50.667Z","cwd":"/home/sebas"}
{"type":"model_change","id":"3f888ff7","parentId":null,"timestamp":"2026-04-16T22:04:51.324Z","provider":"openai-codex","modelId":"gpt-5.4"}
{"type":"thinking_level_change","id":"df7e3a0f","parentId":"3f888ff7","timestamp":"2026-04-16T22:04:51.324Z","thinkingLevel":"off"}
{"type":"message","id":"81409427","parentId":"df7e3a0f","timestamp":"2026-04-16T22:05:15.628Z","message":{"role":"user","content":[{"type":"text","text":"explain pi"}],"timestamp":1776377115621}}
{"type":"message","id":"4d31cd5b","parentId":"81409427","timestamp":"2026-04-16T22:05:18.456Z","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_uU8PMzF0TVjmhvx4r8rwL9NG|fc_060e64be6ffbb3130169e15d1e4f608193acedcc2ef2656608","name":"read","arguments":{"path":"/home/sebas/.agents/skills/caveman/SKILL.md"}},{"type":"toolCall","id":"call_xCYhKQkSsq7wjTZOaQTxjM4e|fc_060e64be6ffbb3130169e15d1e4f7081938ffa7f5a147fd24a","name":"read","arguments":{"path":"/home/sebas/.npm-global/lib/node_modules/@mariozechner/pi-coding-agent/README.md"}}],"api":"openai-codex-responses","provider":"openai-codex","model":"gpt-5.4","usage":{"input":2831,"output":81,"cacheRead":0,"cacheWrite":0,"totalTokens":2912,"cost":{"input":0.0070775000000000005,"output":0.001215,"cacheRead":0,"cacheWrite":0,"total":0.008292500000000001}},"stopReason":"toolUse","timestamp":1776377115644,"responseId":"resp_060e64be6ffbb3130169e15d1bec008193bde94dd8fdf0b346"}}
{"type":"message","id":"b67bf040","parentId":"4d31cd5b","timestamp":"2026-04-16T22:05:18.517Z","message":{"role":"toolResult","toolCallId":"call_uU8PMzF0TVjmhvx4r8rwL9NG|fc_060e64be6ffbb3130169e15d1e4f608193acedcc2ef2656608","toolName":"read","content":[{"type":"text","text":"---\nname: caveman\ndescription: >\n  Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman\n  while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra,\n  wenyan-lite, wenyan-full, wenyan-ultra.\n  Use when user says \"caveman mode\", \"talk like caveman\", \"use caveman\", \"less tokens\",\n  \"be brief\", or invokes /caveman. Also auto-triggers when token efficiency is requested.\n---\n\nRespond terse like smart caveman. All technical substance stay. Only fluff die.\n\n## Persistence\n\nACTIVE EVERY RESPONSE. No revert after many turns. No filler drift. Still active if unsure. Off only: \"stop caveman\" / \"normal mode\".\n\nDefault: **full**. Switch: `/caveman lite|full|ultra`.\n\n## Rules\n\nDrop: articles (a/an/the), filler (just/really/basically/actually/simply), pleasantries (sure/certainly/of course/happy to), hedging. Fragments OK. Short synonyms (big not extensive, fix not \"implement a solution for\"). Technical terms exact. Code blocks unchanged. Errors quoted exact.\n\nPattern: `[thing] [action] [reason]. [next step].`\n\nNot: \"Sure! I'd be happy to help you with that. The issue you're experiencing is likely caused by...\"\nYes: \"Bug in auth middleware. Token expiry check use `<` not `<=`. Fix:\"\n\n## Intensity\n\n| Level | What change |\n|-------|------------|\n| **lite** | No filler/hedging. Keep articles + full sentences. Professional but tight |\n| **full** | Drop articles, fragments OK, short synonyms. Classic caveman |\n| **ultra** | Abbreviate (DB/auth/config/req/res/fn/impl), strip conjunctions, arrows for causality (X → Y), one word when one word enough |\n| **wenyan-lite** | Semi-classical. Drop filler/hedging but keep grammar structure, classical register |\n| **wenyan-full** | Maximum classical terseness. Fully 文言文. 80-90% character reduction. Classical sentence patterns, verbs precede objects, subjects often omitted, classical particles (之/乃/為/其) |\n| **wenyan-ultra** | Extreme abbreviation while keeping classical Chinese feel. Maximum compression, ultra terse |\n\nExample — \"Why React component re-render?\"\n- lite: \"Your component re-renders because you create a new object reference each render. Wrap it in `useMemo`.\"\n- full: \"New object ref each render. Inline object prop = new ref = re-render. Wrap in `useMemo`.\"\n- ultra: \"Inline obj prop → new ref → re-render. `useMemo`.\"\n- wenyan-lite: \"組件頻重繪，以每繪新生對象參照故。以 useMemo 包之。\"\n- wenyan-full: \"物出新參照，致重繪。useMemo .Wrap之。\"\n- wenyan-ultra: \"新參照→重繪。useMemo Wrap。\"\n\nExample — \"Explain database connection pooling.\"\n- lite: \"Connection pooling reuses open connections instead of creating new ones per request. Avoids repeated handshake overhead.\"\n- full: \"Pool reuse open DB connections. No new connection per request. Skip handshake overhead.\"\n- ultra: \"Pool = reuse DB conn. Skip handshake → fast under load.\"\n- wenyan-full: \"池reuse open connection。不每req新開。skip handshake overhead。\"\n- wenyan-ultra: \"池reuse conn。skip handshake → fast。\"\n\n## Auto-Clarity\n\nDrop caveman for: security warnings, irreversible action confirmations, multi-step sequences where fragment order risks misread, user asks to clarify or repeats question. Resume caveman after clear part done.\n\nExample — destructive op:\n> **Warning:** This will permanently delete all rows in the `users` table and cannot be undone.\n> ```sql\n> DROP TABLE users;\n> ```\n> Caveman resume. Verify backup exist first.\n\n## Boundaries\n\nCode/commits/PRs: write normal. \"stop caveman\" or \"normal mode\": revert. Level persist until changed or session end."}],"isError":false,"timestamp":1776377118493}}
{"type":"message","id":"6bb49e1b","parentId":"b67bf040","timestamp":"2026-04-16T22:05:18.567Z","message":{"role":"toolResult","toolCallId":"call_xCYhKQkSsq7wjTZOaQTxjM4e|fc_060e64be6ffbb3130169e15d1e4f7081938ffa7f5a147fd24a","toolName":"read","content":[{"type":"text","text":"<p align=\"center\">\n  <a href=\"https://shittycodingagent.ai\">\n    <img src=\"https://shittycodingagent.ai/logo.svg\" alt=\"pi logo\" width=\"128\">\n  </a>\n</p>\n<p align=\"center\">\n  <a href=\"https://discord.com/invite/3cU7Bz4UPx\"><img alt=\"Discord\" src=\"https://img.shields.io/badge/discord-community-5865F2?style=flat-square&logo=discord&logoColor=white\" /></a>\n  <a href=\"https://www.npmjs.com/package/@mariozechner/pi-coding-agent\"><img alt=\"npm\" src=\"https://img.shields.io/npm/v/@mariozechner/pi-coding-agent?style=flat-square\" /></a>\n  <a href=\"https://github.com/badlogic/pi-mono/actions/workflows/ci.yml\"><img alt=\"Build status\" src=\"https://img.shields.io/github/actions/workflow/status/badlogic/pi-mono/ci.yml?style=flat-square&branch=main\" /></a>\n</p>\n<p align=\"center\">\n  <a href=\"https://pi.dev\">pi.dev</a> domain graciously donated by\n  <br /><br />\n  <a href=\"https://exe.dev\"><img src=\"docs/images/exy.png\" alt=\"Exy mascot\" width=\"48\" /><br />exe.dev</a>\n</p>\n\n> New issues and PRs from new contributors are auto-closed by default. Maintainers review auto-closed issues daily. See [CONTRIBUTING.md](../../CONTRIBUTING.md).\n\n---\n\nPi is a minimal terminal coding harness. Adapt pi to your workflows, not the other way around, without having to fork and modify pi internals. Extend it with TypeScript [Extensions](#extensions), [Skills](#skills), [Prompt Templates](#prompt-templates), and [Themes](#themes). Put your extensions, skills, prompt templates, and themes in [Pi Packages](#pi-packages) and share them with others via npm or git.\n\nPi ships with powerful defaults but skips features like sub agents and plan mode. Instead, you can ask pi to build what you want or install a third party pi package that matches your workflow.\n\nPi runs in four modes: interactive, print or JSON, RPC for process integration, and an SDK for embedding in your own apps. See [openclaw/openclaw](https://github.com/openclaw/openclaw) for a real-world SDK integration.\n\n## Share your OSS coding agent sessions\n\nIf you use pi for open source work, please share your coding agent sessions.\n\nPublic OSS session data helps improve models, prompts, tools, and evaluations using real development workflows.\n\nFor the full explanation, see [this post on X](https://x.com/badlogicgames/status/2037811643774652911).\n\nTo publish sessions, use [`badlogic/pi-share-hf`](https://github.com/badlogic/pi-share-hf). Read its README.md for setup instructions. All you need is a Hugging Face account, the Hugging Face CLI, and `pi-share-hf`.\n\nYou can also watch [this video](https://x.com/badlogicgames/status/2041151967695634619), where I show how I publish my `pi-mono` sessions.\n\nI regularly publish my own `pi-mono` work sessions here:\n\n- [badlogicgames/pi-mono on Hugging Face](https://huggingface.co/datasets/badlogicgames/pi-mono)\n\n## Table of Contents\n\n- [Quick Start](#quick-start)\n- [Providers & Models](#providers--models)\n- [Interactive Mode](#interactive-mode)\n  - [Editor](#editor)\n  - [Commands](#commands)\n  - [Keyboard Shortcuts](#keyboard-shortcuts)\n  - [Message Queue](#message-queue)\n- [Sessions](#sessions)\n  - [Branching](#branching)\n  - [Compaction](#compaction)\n- [Settings](#settings)\n- [Context Files](#context-files)\n- [Customization](#customization)\n  - [Prompt Templates](#prompt-templates)\n  - [Skills](#skills)\n  - [Extensions](#extensions)\n  - [Themes](#themes)\n  - [Pi Packages](#pi-packages)\n- [Programmatic Usage](#programmatic-usage)\n- [Philosophy](#philosophy)\n- [CLI Reference](#cli-reference)\n\n---\n\n## Quick Start\n\n```bash\nnpm install -g @mariozechner/pi-coding-agent\n```\n\nAuthenticate with an API key:\n\n```bash\nexport ANTHROPIC_API_KEY=sk-ant-...\npi\n```\n\nOr use your existing subscription:\n\n```bash\npi\n/login  # Then select provider\n```\n\nThen just talk to pi. By default, pi gives the model four tools: `read`, `write`, `edit`, and `bash`. The model uses these to fulfill your requests. Add capabilities via [skills](#skills), [prompt templates](#prompt-templates), [extensions](#extensions), or [pi packages](#pi-packages).\n\n**Platform notes:** [Windows](docs/windows.md) | [Termux (Android)](docs/termux.md) | [tmux](docs/tmux.md) | [Terminal setup](docs/terminal-setup.md) | [Shell aliases](docs/shell-aliases.md)\n\n---\n\n## Providers & Models\n\nFor each built-in provider, pi maintains a list of tool-capable models, updated with every release. Authenticate via subscription (`/login`) or API key, then select any model from that provider via `/model` (or Ctrl+L).\n\n**Subscriptions:**\n- Anthropic Claude Pro/Max\n- OpenAI ChatGPT Plus/Pro (Codex)\n- GitHub Copilot\n- Google Gemini CLI\n- Google Antigravity\n\n**API keys:**\n- Anthropic\n- OpenAI\n- Azure OpenAI\n- Google Gemini\n- Google Vertex\n- Amazon Bedrock\n- Mistral\n- Groq\n- Cerebras\n- xAI\n- OpenRouter\n- Vercel AI Gateway\n- ZAI\n- OpenCode Zen\n- OpenCode Go\n- Hugging Face\n- Kimi For Coding\n- MiniMax\n\nSee [docs/providers.md](docs/providers.md) for detailed setup instructions.\n\n**Custom providers & models:** Add providers via `~/.pi/agent/models.json` if they speak a supported API (OpenAI, Anthropic, Google). For custom APIs or OAuth, use extensions. See [docs/models.md](docs/models.md) and [docs/custom-provider.md](docs/custom-provider.md).\n\n---\n\n## Interactive Mode\n\n<p align=\"center\"><img src=\"docs/images/interactive-mode.png\" alt=\"Interactive Mode\" width=\"600\"></p>\n\nThe interface from top to bottom:\n\n- **Startup header** - Shows shortcuts (`/hotkeys` for all), loaded AGENTS.md files, prompt templates, skills, and extensions\n- **Messages** - Your messages, assistant responses, tool calls and results, notifications, errors, and extension UI\n- **Editor** - Where you type; border color indicates thinking level\n- **Footer** - Working directory, session name, total token/cache usage, cost, context usage, current model\n\nThe editor can be temporarily replaced by other UI, like built-in `/settings` or custom UI from extensions (e.g., a Q&A tool that lets the user answer model questions in a structured format). [Extensions](#extensions) can also replace the editor, add widgets above/below it, a status line, custom footer, or overlays.\n\n### Editor\n\n| Feature | How |\n|---------|-----|\n| File reference | Type `@` to fuzzy-search project files |\n| Path completion | Tab to complete paths |\n| Multi-line | Shift+Enter (or Ctrl+Enter on Windows Terminal) |\n| Images | Ctrl+V to paste (Alt+V on Windows), or drag onto terminal |\n| Bash commands | `!command` runs and sends output to LLM, `!!command` runs without sending |\n\nStandard editing keybindings for delete word, undo, etc. See [docs/keybindings.md](docs/keybindings.md).\n\n### Commands\n\nType `/` in the editor to trigger commands. [Extensions](#extensions) can register custom commands, [skills](#skills) are available as `/skill:name`, and [prompt templates](#prompt-templates) expand via `/templatename`.\n\n| Command | Description |\n|---------|-------------|\n| `/login`, `/logout` | OAuth authentication |\n| `/model` | Switch models |\n| `/scoped-models` | Enable/disable models for Ctrl+P cycling |\n| `/settings` | Thinking level, theme, message delivery, transport |\n| `/resume` | Pick from previous sessions |\n| `/new` | Start a new session |\n| `/name <name>` | Set session display name |\n| `/session` | Show session info (path, tokens, cost) |\n| `/tree` | Jump to any point in the session and continue from there |\n| `/fork` | Create a new session from the current branch |\n| `/compact [prompt]` | Manually compact context, optional custom instructions |\n| `/copy` | Copy last assistant message to clipboard |\n| `/export [file]` | Export session to HTML file |\n| `/share` | Upload as private GitHub gist with shareable HTML link |\n| `/reload` | Reload keybindings, extensions, skills, prompts, and context files (themes hot-reload automatically) |\n| `/hotkeys` | Show all keyboard shortcuts |\n| `/changelog` | Display version history |\n| `/quit` | Quit pi |\n\n### Keyboard Shortcuts\n\nSee `/hotkeys` for the full list. Customize via `~/.pi/agent/keybindings.json`. See [docs/keybindings.md](docs/keybindings.md).\n\n**Commonly used:**\n\n| Key | Action |\n|-----|--------|\n| Ctrl+C | Clear editor |\n| Ctrl+C twice | Quit |\n| Escape | Cancel/abort |\n| Escape twice | Open `/tree` |\n| Ctrl+L | Open model selector |\n| Ctrl+P / Shift+Ctrl+P | Cycle scoped models forward/backward |\n| Shift+Tab | Cycle thinking level |\n| Ctrl+O | Collapse/expand tool output |\n| Ctrl+T | Collapse/expand thinking blocks |\n\n### Message Queue\n\nSubmit messages while the agent is working:\n\n- **Enter** queues a *steering* message, delivered after the current assistant turn finishes executing its tool calls\n- **Alt+Enter** queues a *follow-up* message, delivered only after the agent finishes all work\n- **Escape** aborts and restores queued messages to editor\n- **Alt+Up** retrieves queued messages back to editor\n\nOn Windows Terminal, `Alt+Enter` is fullscreen by default. Remap it in [docs/terminal-setup.md](docs/terminal-setup.md) so pi can receive the follow-up shortcut.\n\nConfigure delivery in [settings](docs/settings.md): `steeringMode` and `followUpMode` can be `\"one-at-a-time\"` (default, waits for response) or `\"all\"` (delivers all queued at once). `transport` selects provider transport preference (`\"sse\"`, `\"websocket\"`, or `\"auto\"`) for providers that support multiple transports.\n\n---\n\n## Sessions\n\nSessions are stored as JSONL files with a tree structure. Each entry has an `id` and `parentId`, enabling in-place branching without creating new files. See [docs/session.md](docs/session.md) for file format.\n\n### Management\n\nSessions auto-save to `~/.pi/agent/sessions/` organized by working directory.\n\n```bash\npi -c                  # Continue most recent session\npi -r                  # Browse and select from past sessions\npi --no-session        # Ephemeral mode (don't save)\npi --session <path>    # Use specific session file or ID\npi --fork <path>       # Fork specific session file or ID into a new session\n```\n\n### Branching\n\n**`/tree`** - Navigate the session tree in-place. Select any previous point, continue from there, and switch between branches. All history preserved in a single file.\n\n<p align=\"center\"><img src=\"docs/images/tree-view.png\" alt=\"Tree View\" width=\"600\"></p>\n\n- Search by typing, fold/unfold and jump between branches with Ctrl+←/Ctrl+→ or Alt+←/Alt+→, page with ←/→\n- Filter modes (Ctrl+O): default → no-tools → user-only → labeled-only → all\n- Press Shift+L to label entries as bookmarks and Shift+T to toggle label timestamps\n\n**`/fork`** - Create a new session file from the current branch. Opens a selector, copies history up to the selected point, and places that message in the editor for modification.\n\n**`--fork <path|id>`** - Fork an existing session file or partial session UUID directly from the CLI. This copies the full source session into a new session file in the current project.\n\n### Compaction\n\nLong sessions can exhaust context windows. Compaction summarizes older messages while keeping recent ones.\n\n**Manual:** `/compact` or `/compact <custom instructions>`\n\n**Automatic:** Enabled by default. Triggers on context overflow (recovers and retries) or when approaching the limit (proactive). Configure via `/settings` or `settings.json`.\n\nCompaction is lossy. The full history remains in the JSONL file; use `/tree` to revisit. Customize compaction behavior via [extensions](#extensions). See [docs/compaction.md](docs/compaction.md) for internals.\n\n---\n\n## Settings\n\nUse `/settings` to modify common options, or edit JSON files directly:\n\n| Location | Scope |\n|----------|-------|\n| `~/.pi/agent/settings.json` | Global (all projects) |\n| `.pi/settings.json` | Project (overrides global) |\n\nSee [docs/settings.md](docs/settings.md) for all options.\n\nTo opt out of anonymous install/update telemetry tied to changelog detection, set `enableInstallTelemetry` to `false` in `settings.json`, or set `PI_TELEMETRY=0`.\n\n---\n\n## Context Files\n\nPi loads `AGENTS.md` (or `CLAUDE.md`) at startup from:\n- `~/.pi/agent/AGENTS.md` (global)\n- Parent directories (walking up from cwd)\n- Current directory\n\nUse for project instructions, conventions, common commands. All matching files are concatenated.\n\nDisable context file loading with `--no-context-files` (or `-nc`).\n\n### System Prompt\n\nReplace the default system prompt with `.pi/SYSTEM.md` (project) or `~/.pi/agent/SYSTEM.md` (global). Append without replacing via `APPEND_SYSTEM.md`.\n\n---\n\n## Customization\n\n### Prompt Templates\n\nReusable prompts as Markdown files. Type `/name` to expand.\n\n```markdown\n<!-- ~/.pi/agent/prompts/review.md -->\nReview this code for bugs, security issues, and performance problems.\nFocus on: {{focus}}\n```\n\nPlace in `~/.pi/agent/prompts/`, `.pi/prompts/`, or a [pi package](#pi-packages) to share with others. See [docs/prompt-templates.md](docs/prompt-templates.md).\n\n### Skills\n\nOn-demand capability packages following the [Agent Skills standard](https://agentskills.io). Invoke via `/skill:name` or let the agent load them automatically.\n\n```markdown\n<!-- ~/.pi/agent/skills/my-skill/SKILL.md -->\n# My Skill\nUse this skill when the user asks about X.\n\n## Steps\n1. Do this\n2. Then that\n```\n\nPlace in `~/.pi/agent/skills/`, `~/.agents/skills/`, `.pi/skills/`, or `.agents/skills/` (from `cwd` up through parent directories) or a [pi package](#pi-packages) to share with others. See [docs/skills.md](docs/skills.md).\n\n### Extensions\n\n<p align=\"center\"><img src=\"docs/images/doom-extension.png\" alt=\"Doom Extension\" width=\"600\"></p>\n\nTypeScript modules that extend pi with custom tools, commands, keyboard shortcuts, event handlers, and UI components.\n\n```typescript\nexport default function (pi: ExtensionAPI) {\n  pi.registerTool({ name: \"deploy\", ... });\n  pi.registerCommand(\"stats\", { ... });\n  pi.on(\"tool_call\", async (event, ctx) => { ... });\n}\n```\n\n**What's possible:**\n- Custom tools (or replace built-in tools entirely)\n- Sub-agents and plan mode\n- Custom compaction and summarization\n- Permission gates and path protection\n- Custom editors and UI components\n- Status lines, headers, footers\n- Git checkpointing and auto-commit\n- SSH and sandbox execution\n- MCP server integration\n- Make pi look like Claude Code\n- Games while waiting (yes, Doom runs)\n- ...anything you can dream up\n\nPlace in `~/.pi/agent/extensions/`, `.pi/extensions/`, or a [pi package](#pi-packages) to share with others. See [docs/extensions.md](docs/extensions.md) and [examples/extensions/](examples/extensions/).\n\n### Themes\n\nBuilt-in: `dark`, `light`. Themes hot-reload: modify the active theme file and pi immediately applies changes.\n\nPlace in `~/.pi/agent/themes/`, `.pi/themes/`, or a [pi package](#pi-packages) to share with others. See [docs/themes.md](docs/themes.md).\n\n### Pi Packages\n\nBundle and share extensions, skills, prompts, and themes via npm or git. Find packages on [npmjs.com](https://www.npmjs.com/search?q=keywords%3Api-package) or [Discord](https://discord.com/channels/1456806362351669492/1457744485428629628).\n\n> **Security:** Pi packages run with full system access. Extensions execute arbitrary code, and skills can instruct the model to perform any action including running executables. Review source code before installing third-party packages.\n\n```bash\npi install npm:@foo/pi-tools\npi install npm:@foo/pi-tools@1.2.3      # pinned version\npi install git:github.com/user/repo\npi install git:github.com/user/repo@v1  # tag or commit\npi install git:git@github.com:user/repo\npi install git:git@github.com:user/repo@v1  # tag or commit\npi install https://github.com/user/repo\npi install https://github.com/user/repo@v1      # tag or commit\npi install ssh://git@github.com/user/repo\npi install ssh://git@github.com/user/repo@v1    # tag or commit\npi remove npm:@foo/pi-tools\npi uninstall npm:@foo/pi-tools          # alias for remove\npi list\npi update                               # skips pinned packages\npi config                               # enable/disable extensions, skills, prompts, themes\n```\n\nPackages install to `~/.pi/agent/git/` (git) or global npm. Use `-l` for project-local installs (`.pi/git/`, `.pi/npm/`). If you use a Node version manager and want package installs to reuse a stable npm context, set `npmCommand` in `settings.json`, for example `[\"mise\", \"exec\", \"node@20\", \"--\", \"npm\"]`.\n\nCreate a package by adding a `pi` key to `package.json`:\n\n```json\n{\n  \"name\": \"my-pi-package\",\n  \"keywords\": [\"pi-package\"],\n  \"pi\": {\n    \"extensions\": [\"./extensions\"],\n    \"skills\": [\"./skills\"],\n    \"prompts\": [\"./prompts\"],\n    \"themes\": [\"./themes\"]\n  }\n}\n```\n\nWithout a `pi` manifest, pi auto-discovers from conventional directories (`extensions/`, `skills/`, `prompts/`, `themes/`).\n\nSee [docs/packages.md](docs/packages.md).\n\n---\n\n## Programmatic Usage\n\n### SDK\n\n```typescript\nimport { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from \"@mariozechner/pi-coding-agent\";\n\nconst authStorage = AuthStorage.create();\nconst modelRegistry = ModelRegistry.create(authStorage);\nconst { session } = await createAgentSession({\n  sessionManager: SessionManager.inMemory(),\n  authStorage,\n  modelRegistry,\n});\n\nawait session.prompt(\"What files are in the current directory?\");\n```\n\nFor advanced multi-session runtime replacement, use `createAgentSessionRuntime()` and `AgentSessionRuntime`.\n\nSee [docs/sdk.md](docs/sdk.md) and [examples/sdk/](examples/sdk/).\n\n### RPC Mode\n\nFor non-Node.js integrations, use RPC mode over stdin/stdout:\n\n```bash\npi --mode rpc\n```\n\nRPC mode uses strict LF-delimited JSONL framing. Clients must split records on `\\n` only. Do not use generic line readers like Node `readline`, which also split on Unicode separators inside JSON payloads.\n\nSee [docs/rpc.md](docs/rpc.md) for the protocol.\n\n---\n\n## Philosophy\n\nPi is aggressively extensible so it doesn't have to dictate your workflow. Features that other tools bake in can be built with [extensions](#extensions), [skills](#skills), or installed from third-party [pi packages](#pi-packages). This keeps the core minimal while letting you shape pi to fit how you work.\n\n**No MCP.** Build CLI tools with READMEs (see [Skills](#skills)), or build an extension that adds MCP support. [Why?](https://mariozechner.at/posts/2025-11-02-what-if-you-dont-need-mcp/)\n\n**No sub-agents.** There's many ways to do this. Spawn pi instances via tmux, or build your own with [extensions](#extensions), or install a package that does it your way.\n\n**No permission popups.** Run in a container, or build your own confirmation flow with [extensions](#extensions) inline with your environment and security requirements.\n\n**No plan mode.** Write plans to files, or build it with [extensions](#extensions), or install a package.\n\n**No built-in to-dos.** They confuse models. Use a TODO.md file, or build your own with [extensions](#extensions).\n\n**No background bash.** Use tmux. Full observability, direct interaction.\n\nRead the [blog post](https://mariozechner.at/posts/2025-11-30-pi-coding-agent/) for the full rationale.\n\n---\n\n## CLI Reference\n\n```bash\npi [options] [@files...] [messages...]\n```\n\n### Package Commands\n\n```bash\npi install <source> [-l]     # Install package, -l for project-local\npi remove <source> [-l]      # Remove package\npi uninstall <source> [-l]   # Alias for remove\npi update [source]           # Update packages (skips pinned)\npi list                      # List installed packages\npi config                    # Enable/disable package resources\n```\n\n### Modes\n\n| Flag | Description |\n|------|-------------|\n| (default) | Interactive mode |\n| `-p`, `--print` | Print response and exit |\n| `--mode json` | Output all events as JSON lines (see [docs/json.md](docs/json.md)) |\n| `--mode rpc` | RPC mode for process integration (see [docs/rpc.md](docs/rpc.md)) |\n| `--export <in> [out]` | Export session to HTML |\n\nIn print mode, pi also reads piped stdin and merges it into the initial prompt:\n\n```bash\ncat README.md | pi -p \"Summarize this text\"\n```\n\n### Model Options\n\n| Option | Description |\n|--------|-------------|\n| `--provider <name>` | Provider (anthropic, openai, google, etc.) |\n| `--model <pattern>` | Model pattern or ID (supports `provider/id` and optional `:<thinking>`) |\n| `--api-key <key>` | API key (overrides env vars) |\n| `--thinking <level>` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh` |\n| `--models <patterns>` | Comma-separated patterns for Ctrl+P cycling |\n| `--list-models [search]` | List available models |\n\n### Session Options\n\n| Option | Description |\n|--------|-------------|\n| `-c`, `--continue` | Continue most recent session |\n| `-r`, `--resume` | Browse and select session |\n| `--session <path>` | Use specific session file or partial UUID |\n| `--fork <path>` | Fork specific session file or partial UUID into a new session |\n| `--session-dir <dir>` | Custom session storage directory |\n| `--no-session` | Ephemeral mode (don't save) |\n\n### Tool Options\n\n| Option | Description |\n|--------|-------------|\n| `--tools <list>` | Enable specific built-in tools (default: `read,bash,edit,write`) |\n| `--no-tools` | Disable all built-in tools (extension tools still work) |\n\nAvailable built-in tools: `read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`\n\n### Resource Options\n\n| Option | Description |\n|--------|-------------|\n| `-e`, `--extension <source>` | Load extension from path, npm, or git (repeatable) |\n| `--no-extensions` | Disable extension discovery |\n| `--skill <path>` | Load skill (repeatable) |\n| `--no-skills` | Disable skill discovery |\n| `--prompt-template <path>` | Load prompt template (repeatable) |\n| `--no-prompt-templates` | Disable prompt template discovery |\n| `--theme <path>` | Load theme (repeatable) |\n| `--no-themes` | Disable theme discovery |\n| `--no-context-files`, `-nc` | Disable AGENTS.md and CLAUDE.md context file discovery |\n\nCombine `--no-*` with explicit flags to load exactly what you need, ignoring settings.json (e.g., `--no-extensions -e ./my-ext.ts`).\n\n### Other Options\n\n| Option | Description |\n|--------|-------------|\n| `--system-prompt <text>` | Replace default prompt (context files and skills still appended) |\n| `--append-system-prompt <text>` | Append to system prompt |\n| `--verbose` | Force verbose startup |\n| `-h`, `--help` | Show help |\n| `-v`, `--version` | Show version |\n\n### File Arguments\n\nPrefix files with `@` to include in the message:\n\n```bash\npi @prompt.md \"Answer this\"\npi -p @screenshot.png \"What's in this image?\"\npi @code.ts @test.ts \"Review these files\"\n```\n\n### Examples\n\n```bash\n# Interactive with initial prompt\npi \"List all .ts files in src/\"\n\n# Non-interactive\npi -p \"Summarize this codebase\"\n\n# Non-interactive with piped stdin\ncat README.md | pi -p \"Summarize this text\"\n\n# Different model\npi --provider openai --model gpt-4o \"Help me refactor\"\n\n# Model with provider prefix (no --provider needed)\npi --model openai/gpt-4o \"Help me refactor\"\n\n# Model with thinking level shorthand\npi --model sonnet:high \"Solve this complex problem\"\n\n# Limit model cycling\npi --models \"claude-*,gpt-4o\"\n\n# Read-only mode\npi --tools read,grep,find,ls -p \"Review the code\"\n\n# High thinking level\npi --thinking high \"Solve this complex problem\"\n```\n\n### Environment Variables\n\n| Variable | Description |\n|----------|-------------|\n| `PI_CODING_AGENT_DIR` | Override config directory (default: `~/.pi/agent`) |\n| `PI_PACKAGE_DIR` | Override package directory (useful for Nix/Guix where store paths tokenize poorly) |\n| `PI_SKIP_VERSION_CHECK` | Skip version check at startup |\n| `PI_TELEMETRY` | Override install telemetry. Use `1`/`true`/`yes` to enable or `0`/`false`/`no` to disable |\n| `PI_CACHE_RETENTION` | Set to `long` for extended prompt cache (Anthropic: 1h, OpenAI: 24h) |\n| `VISUAL`, `EDITOR` | External editor for Ctrl+G |\n\n---\n\n## Contributing & Development\n\nSee [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines and [docs/development.md](docs/development.md) for setup, forking, and debugging.\n\n---\n\n## License\n\nMIT\n\n## See Also\n\n- [@mariozechner/pi-ai](https://www.npmjs.com/package/@mariozechner/pi-ai): Core LLM toolkit\n- [@mariozechner/pi-agent](https://www.npmjs.com/package/@mariozechner/pi-agent): Agent framework\n- [@mariozechner/pi-tui](https://www.npmjs.com/package/@mariozechner/pi-tui): Terminal UI components\n"}],"isError":false,"timestamp":1776377118518}}
{"type":"message","id":"bb45500a","parentId":"6bb49e1b","timestamp":"2026-04-16T22:05:28.569Z","message":{"role":"assistant","content":[{"type":"text","text":"Pi simple coding agent in terminal.\n\nBig idea:\n- Small core\n- You shape it\n- Not giant opinionated app\n\nWhat Pi does:\n- Chat with model in terminal\n- Model can use tools like `read`, `bash`, `edit`, `write`\n- Works on codebase directly\n- Saves sessions\n- Lets you resume, fork, compact history\n\nWhy Pi different:\n- Very extensible\n- Add behavior with:\n  - **Skills** = markdown instructions/capabilities\n  - **Extensions** = TypeScript code, can add tools/UI/commands\n  - **Prompt templates** = reusable prompts\n  - **Themes** = look/feel\n  - **Pi packages** = bundle/share all above\n\nPhilosophy:\n- Core stays minimal\n- Missing features on purpose\n- If you want subagents, MCP, plan mode, permission system, custom UI, etc:\n  - build with extension\n  - or install package\n- Tool tries not to force workflow\n\nMain modes:\n- **Interactive** terminal app\n- **Print/JSON** for scripting\n- **RPC** for process integration\n- **SDK** for embedding in apps\n\nCommon use:\n```bash\npi\n```\n\nThen tell it things like:\n- “find bug in auth flow”\n- “refactor this file”\n- “add tests”\n- “explain this repo”\n\nUseful built-ins:\n- `/login` authenticate\n- `/model` switch model\n- `/resume` open old session\n- `/new` new session\n- `/tree` jump around session history\n- `/compact` shrink old context\n- `/settings` configure behavior\n\nCustomization locations:\n- `~/.pi/agent/...` for global\n- `.pi/...` for project-local\n- `AGENTS.md` files inject repo/user instructions\n\nTiny example:\n- You open repo with Pi\n- Pi reads `AGENTS.md`\n- You ask “add endpoint”\n- Pi reads files, edits code, runs bash/tests\n- You keep iterating in same saved session\n\nIn one sentence:\nPi = hackable terminal coding harness for LLM agents.\n\nIf you want, I can also explain one of these:\n1. **Pi for normal users**\n2. **Pi architecture**\n3. **How skills/extensions work**\n4. **How Pi compares to Claude Code / Codex / Aider**","textSignature":"{\"v\":1,\"id\":\"msg_060e64be6ffbb3130169e15d1f879481939b6d374bf17699a3\",\"phase\":\"final_answer\"}"}],"api":"openai-codex-responses","provider":"openai-codex","model":"gpt-5.4","usage":{"input":7216,"output":494,"cacheRead":2816,"cacheWrite":0,"totalTokens":10526,"cost":{"input":0.01804,"output":0.00741,"cacheRead":0.000704,"cacheWrite":0,"total":0.026154}},"stopReason":"stop","timestamp":1776377118569,"responseId":"resp_060e64be6ffbb3130169e15d1f11308193bed527740729ce10"}}
{"type":"message","id":"3039804b","parentId":"bb45500a","timestamp":"2026-04-16T22:05:57.060Z","message":{"role":"user","content":[{"type":"text","text":"Explica paí para usuarios no técnicos"}],"timestamp":1776377157059}}
{"type":"message","id":"d1d5008d","parentId":"3039804b","timestamp":"2026-04-16T22:06:04.738Z","message":{"role":"assistant","content":[{"type":"text","text":"Pi para gente no técnica:\n\nPi es asistente de IA que vive en terminal y puede trabajar con archivos, herramientas y automatizaciones. Pero idea útil para usuario no técnico:\n\n- le hablas en lenguaje normal\n- entiende contexto de proyecto\n- puede hacer trabajo repetitivo por ti\n- puede conectarse con herramientas hechas a medida\n\nPi no es “app cerrada”.\nPi es más como base flexible para construir tu propio asistente.\n\nEjemplos simples:\n- “ordena estos archivos”\n- “resume este documento”\n- “busca dónde está este dato”\n- “prepara borrador de correo”\n- “revisa este CSV”\n- “haz checklist de pendientes”\n- “explícame este proyecto”\n- “automatiza tarea que hago cada día”\n\nQué lo hace especial:\n- Se puede personalizar mucho\n- Puede aprender reglas de tu empresa o proyecto\n- Se le pueden añadir capacidades nuevas\n- Puede guardar sesiones y seguir luego\n- No obliga una sola forma de trabajar\n\nCómo pensarlo:\n- ChatGPT = hablas con IA\n- Pi = hablas con IA que además puede actuar dentro de entorno de trabajo\n\nPara usuario no técnico, valor real:\n- menos trabajo manual\n- menos copiar/pegar entre apps\n- más automatización\n- asistente adaptado a tu forma de trabajar\n\nLimitación importante:\n- Normalmente corre en entorno más técnico que app de consumo\n- O sea, suele necesitar que alguien técnico lo configure al principio\n\nFrase corta:\nPi es plataforma para crear asistente de IA práctico y personalizable, no solo chatbot.\n\nSi quieres, te lo explico también:\n- en versión “para jefe/negocio”\n- en versión “como si tuviera 10 años”\n- o con ejemplos reales de uso diario.","textSignature":"{\"v\":1,\"id\":\"msg_060e64be6ffbb3130169e15d45c9d8819391d8df4582af3c40\",\"phase\":\"final_answer\"}"}],"api":"openai-codex-responses","provider":"openai-codex","model":"gpt-5.4","usage":{"input":172,"output":369,"cacheRead":10368,"cacheWrite":0,"totalTokens":10909,"cost":{"input":0.00043000000000000004,"output":0.005535,"cacheRead":0.0025919999999999997,"cacheWrite":0,"total":0.008556999999999999}},"stopReason":"stop","timestamp":1776377157060,"responseId":"resp_060e64be6ffbb3130169e15d4565dc8193a64426461a9d13fd"}}
