pi-agent
它能做什么
Pi Agent 是一个帮你使用和开发 Pi 的工具。Pi 是一个在终端里编写代码的系统。借助 Pi Agent,你可以安装、配置并使用 Pi 完成各种编程任务。
适用场景
- ✓当你想安装或配置 Pi 时。
- ✓当你想为 Pi 创建新的扩展或工具时。
- ✓当你想把 Pi 和其他程序或系统集成起来时。
技能链接
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/pi-agent/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我该如何安装 Pi,并设置我的第一个服务商?”
每周 5 个新技能,1 分钟读完。
工作原理
Pi Agent 会理解你的指令,并帮你管理 Pi。它可以安装 Pi、调整设置、添加新功能,或者通过不同的通信方式把 Pi 连接到其他系统。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Pi Agent
Use this skill when the user wants to operate Pi or build on top of Pi. Pi is a minimal terminal coding harness extended through TypeScript extensions, skills, prompt templates, themes, packages, custom models/providers, SDK integrations, RPC mode, JSON event streams, and TUI components.
First Decision
Pick the reference before answering or coding:
| User intent | Read |
|---|---|
| What Pi is, docs map, install methods | references/overview.md |
| Install, authenticate, first run | references/quickstart.md |
| Day-to-day CLI usage, commands, modes, flags, project trust | references/usage.md |
| Provider auth, API keys, cloud provider setup | references/providers.md |
| Custom model entries, local models, proxies, compat flags | references/models.md |
Local llama.cpp router, /llama, model download/load |
references/llama-cpp.md |
| Settings keys and defaults | references/settings.md |
PI_* and other environment variables |
references/environment-variables.md |
| Extension development, custom tools, events, commands | references/extensions.md |
| Custom provider implementation, OAuth, custom streaming | references/custom-provider.md |
| Embed Pi in Node/TypeScript | references/sdk.md |
| Integrate from another process/language | references/rpc.md |
| Consume JSONL event output | references/json.md |
| Build terminal UI components | references/tui.md |
| Package extensions/skills/prompts/themes | references/packages.md |
| Delegate to subagents, chains, parallel runs, orchestration | references/pi-subagents.md |
| Connect MCP servers, codemode, MCP tool discovery/config | references/mcp.md (built-in), references/pi-mcp-adapter.md (optional adapter) |
| Interactive interview forms, structured user input | references/pi-interview.md |
| Web search, URL/PDF/repo fetching, video understanding | references/pi-web-access.md |
| Author Pi skills | references/skills.md |
| Prompt templates or themes | references/prompt-templates.md, references/themes.md |
| Sessions, branching, compaction, parsing JSONL | references/sessions.md, references/compaction.md, references/session-format.md |
| Security, sandboxing, trust | references/security.md, references/containerization.md |
| Keyboard or terminal issues | references/keybindings.md, references/terminal-setup.md, references/tmux.md, references/windows.md, references/termux.md, references/shell-aliases.md |
| Working on Pi itself | references/development.md |
Build-On-Pi Defaults
Prefer the SDK for Node/TypeScript apps that need type safety, direct state access, in-process custom tools/extensions, or custom resource loading. Use createAgentSession() for a single stable session; use createAgentSessionRuntime() when the app must replace sessions through new/resume/fork/clone/import flows. Auth and model lookup go through ModelRuntime.create().
Prefer RPC mode when the client is not Node.js, needs process isolation, or wants a language-agnostic JSONL protocol. Start with pi --mode rpc --no-session for stateless subprocess integration, then add session flags when persistence matters. Split records on \n only — Node readline is not protocol-compliant.
For RPC clients, correlate responses by unique request id, not arrival order,
and keep consuming events after a successful prompt response. Success means
accepted, queued, or handled; it is not completion. Subscribe before sending the
prompt, and wait for agent_settled for runs that actually start, because
agent_end may precede retries or queued work. If the response reports
disposition: "handled", no run started and no settled event is owed. See the
upstream RPC lifecycle.
Prefer JSON mode for one-shot command-line pipelines that only need streamed events, not bidirectional control: pi --mode json "prompt".
Use extensions for Pi-native behavior: custom tools, command handlers, event hooks, provider registration, custom compaction, path protection, project trust policy, UI prompts, widgets, and TUI components.
Use packages when sharing or installing reusable extensions, skills, prompt templates, or themes across machines or projects.
Safety Defaults
…
常见问题
什么是 Pi?
Pi 是一个直接在终端里编写代码的系统,并且可以通过新增功能来扩展。
什么是“服务商”(provider)?
服务商就像 Pi 用来连接不同语言模型或服务的通道,通常需要配置 API 密钥。
“RPC”或“JSON 事件流”是什么意思?
它们是 Pi 与其他程序通信的技术方式,会以特定格式收发信息。
详情
作者的原始描述
Builds with and operates Pi, the minimal terminal coding harness. Use for installing Pi, configuring providers/models/settings/environment variables, creating Pi skills/extensions/packages/themes/prompt templates, embedding Pi through the SDK, integrating over RPC or JSON event streams, parsing sessions, running local models through the llama.cpp router, developing custom Pi providers and TUI comp
热度
- GitHub 星标
- 51k
- 排名
- #3527
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …