@phi-code-admin/phi-code 0.85.0 → 0.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +92 -123
- package/config/routing.example.json +129 -0
- package/config/routing.schema.json +58 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +6 -6
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +2 -2
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +9 -8
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/pi-user-agent.d.ts.map +1 -1
- package/dist/utils/pi-user-agent.js +4 -1
- package/dist/utils/pi-user-agent.js.map +1 -1
- package/docs/compaction.md +11 -11
- package/docs/custom-provider.md +4 -4
- package/docs/development.md +2 -2
- package/docs/extensions.md +47 -47
- package/docs/fork-policy.md +63 -0
- package/docs/index.md +7 -7
- package/docs/json.md +3 -3
- package/docs/keybindings.md +5 -5
- package/docs/models.md +6 -6
- package/docs/packages.md +37 -37
- package/docs/prompt-templates.md +4 -4
- package/docs/providers.md +9 -9
- package/docs/quickstart.md +25 -25
- package/docs/rpc.md +3 -3
- package/docs/sdk.md +34 -34
- package/docs/session-format.md +4 -4
- package/docs/sessions.md +11 -11
- package/docs/settings.md +9 -9
- package/docs/shell-aliases.md +2 -2
- package/docs/skills.md +9 -9
- package/docs/terminal-setup.md +7 -7
- package/docs/termux.md +6 -6
- package/docs/themes.md +9 -9
- package/docs/tmux.md +3 -3
- package/docs/tui.md +8 -8
- package/docs/usage.md +39 -39
- package/docs/windows.md +2 -2
- package/extensions/phi/agents.ts +5 -113
- package/extensions/phi/orchestrator.ts +6 -38
- package/extensions/phi/providers/agent-def.ts +128 -0
- package/extensions/phi/skill-loader.ts +5 -5
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.86.0] - 2026-07-10
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **Single source of truth for bundled assets.** The duplicated root-level
|
|
8
|
+
`agents/`, `skills/` and `config/` directories (which had silently diverged
|
|
9
|
+
from the published copies) are gone; `packages/coding-agent/{agents,skills,config}`
|
|
10
|
+
is now the only copy. Routing defaults live in `SmartRouter.defaultConfig()`
|
|
11
|
+
with `config/routing.example.json` + `config/routing.schema.json` as
|
|
12
|
+
documentation, kept in sync by a dedicated test. Agent `.md` parsing is
|
|
13
|
+
unified in `extensions/phi/providers/agent-def.ts`, shared by the /plan
|
|
14
|
+
orchestrator and the /agents command (they previously had two drifting
|
|
15
|
+
parsers, and /agents' bundled-agents path resolved nowhere in either
|
|
16
|
+
layout).
|
|
17
|
+
- **Rebrand completed for everything user-facing** (see the new
|
|
18
|
+
[docs/fork-policy.md](docs/fork-policy.md) for what deliberately stays "pi"
|
|
19
|
+
to keep upstream merges cheap):
|
|
20
|
+
- The npm README and all docs/ now document `phi`, `~/.phi/` and
|
|
21
|
+
`@phi-code-admin/phi-code` (they still documented upstream `pi` commands,
|
|
22
|
+
`~/.pi/` paths and the upstream install).
|
|
23
|
+
- The system prompt now introduces the agent as phi (it said "operating
|
|
24
|
+
inside pi", so the model described itself as pi).
|
|
25
|
+
- `--help`/`update` texts, the config selector's `~/.pi/` label (factually
|
|
26
|
+
wrong), the tmux hint, the "Location of executable" message and the HTTP
|
|
27
|
+
User-Agent now derive from the configured app name. `phi update pi` keeps
|
|
28
|
+
working as a hidden legacy alias of `update self`.
|
|
29
|
+
- The bun-binary fallback download link pointed at upstream Pi releases; it
|
|
30
|
+
now points at phi-code releases. Cloudflare attribution UA is `phi-code`.
|
|
31
|
+
- Docs now name the runtime env vars `PHI_CODING_AGENT_DIR` /
|
|
32
|
+
`PHI_CODING_AGENT_SESSION_DIR` (the `PI_*` names they documented do not
|
|
33
|
+
exist at runtime; all other `PI_*` variables are unchanged and stay
|
|
34
|
+
supported).
|
|
35
|
+
|
|
36
|
+
### Removed
|
|
37
|
+
|
|
38
|
+
- **Dead code**: `sigma-agents` no longer ships the unused `SubAgentManager`
|
|
39
|
+
and `ModelProfiler` (never imported by anything; the orchestrator has its
|
|
40
|
+
own phase logic). Legacy root-level `_legacy/`, `pi-test.sh`, `pi-test.ps1`
|
|
41
|
+
and `test.sh` (which still targeted `~/.pi/`) are deleted.
|
|
42
|
+
|
|
3
43
|
## [0.85.0] - 2026-07-10
|
|
4
44
|
|
|
5
45
|
### Fixed
|
package/README.md
CHANGED
|
@@ -1,43 +1,16 @@
|
|
|
1
|
+
<p align="center"><strong>φ phi-code</strong></p>
|
|
1
2
|
<p align="center">
|
|
2
|
-
<a href="https://
|
|
3
|
-
|
|
4
|
-
</a>
|
|
3
|
+
<a href="https://www.npmjs.com/package/@phi-code-admin/phi-code"><img alt="npm" src="https://img.shields.io/npm/v/@phi-code-admin/phi-code?style=flat-square" /></a>
|
|
4
|
+
<a href="https://github.com/uglyswap/phi-code"><img alt="GitHub" src="https://img.shields.io/badge/github-uglyswap%2Fphi--code-181717?style=flat-square&logo=github" /></a>
|
|
5
5
|
</p>
|
|
6
|
-
<p align="center">
|
|
7
|
-
<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>
|
|
8
|
-
<a href="https://www.npmjs.com/package/@earendil-works/pi-coding-agent"><img alt="npm" src="https://img.shields.io/npm/v/@earendil-works/pi-coding-agent?style=flat-square" /></a>
|
|
9
|
-
</p>
|
|
10
|
-
<p align="center">
|
|
11
|
-
<a href="https://pi.dev">pi.dev</a> domain graciously donated by
|
|
12
|
-
<br /><br />
|
|
13
|
-
<a href="https://exe.dev"><img src="docs/images/exy.png" alt="Exy mascot" width="48" /><br />exe.dev</a>
|
|
14
|
-
</p>
|
|
15
|
-
|
|
16
|
-
> New issues and PRs from new contributors are auto-closed by default. Maintainers review auto-closed issues daily. See [CONTRIBUTING.md](../../CONTRIBUTING.md).
|
|
17
6
|
|
|
18
7
|
---
|
|
19
8
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Pi 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.
|
|
23
|
-
|
|
24
|
-
Pi 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.
|
|
25
|
-
|
|
26
|
-
## Share your OSS coding agent sessions
|
|
27
|
-
|
|
28
|
-
If you use pi for open source work, please share your coding agent sessions.
|
|
9
|
+
phi-code is a terminal coding harness with persistent memory, sub-agents, intelligent model routing, and a five-phase plan orchestrator — built as a fork of [Pi](https://github.com/earendil-works/pi-mono) (see [docs/fork-policy.md](docs/fork-policy.md)). Adapt phi to your workflows, not the other way around. Extend it with TypeScript [Extensions](#extensions), [Skills](#skills), [Prompt Templates](#prompt-templates), and [Themes](#themes). Put your extensions, skills, prompt templates, and themes in [Phi Packages](#phi-packages) and share them with others via npm or git.
|
|
29
10
|
|
|
30
|
-
|
|
11
|
+
Where upstream Pi deliberately skips sub agents and plan mode, phi-code ships them out of the box: `/plan` runs a five-phase explore → plan → code → test → review pipeline with per-phase models from `~/.phi/agent/routing.json`, a local vector memory (`memory_search`/`memory_write`), and a knowledge-graph ontology.
|
|
31
12
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
To 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`.
|
|
35
|
-
|
|
36
|
-
You can also watch [this video](https://x.com/badlogicgames/status/2041151967695634619), where I show how I publish my `pi-mono` sessions.
|
|
37
|
-
|
|
38
|
-
I regularly publish my own `pi-mono` work sessions here:
|
|
39
|
-
|
|
40
|
-
- [badlogicgames/pi-mono on Hugging Face](https://huggingface.co/datasets/badlogicgames/pi-mono)
|
|
13
|
+
phi-code runs in four modes: interactive, print or JSON, RPC for process integration, and an SDK for embedding in your own apps.
|
|
41
14
|
|
|
42
15
|
## Table of Contents
|
|
43
16
|
|
|
@@ -58,7 +31,7 @@ I regularly publish my own `pi-mono` work sessions here:
|
|
|
58
31
|
- [Skills](#skills)
|
|
59
32
|
- [Extensions](#extensions)
|
|
60
33
|
- [Themes](#themes)
|
|
61
|
-
- [
|
|
34
|
+
- [Phi Packages](#phi-packages)
|
|
62
35
|
- [Programmatic Usage](#programmatic-usage)
|
|
63
36
|
- [Philosophy](#philosophy)
|
|
64
37
|
- [CLI Reference](#cli-reference)
|
|
@@ -68,30 +41,26 @@ I regularly publish my own `pi-mono` work sessions here:
|
|
|
68
41
|
## Quick Start
|
|
69
42
|
|
|
70
43
|
```bash
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Or with npm:
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
npm install -g @earendil-works/pi-coding-agent
|
|
44
|
+
npm install -g @phi-code-admin/phi-code
|
|
78
45
|
```
|
|
79
46
|
|
|
80
47
|
Authenticate with an API key:
|
|
81
48
|
|
|
82
49
|
```bash
|
|
83
50
|
export ANTHROPIC_API_KEY=sk-ant-...
|
|
84
|
-
|
|
51
|
+
phi
|
|
85
52
|
```
|
|
86
53
|
|
|
87
54
|
Or use your existing subscription:
|
|
88
55
|
|
|
89
56
|
```bash
|
|
90
|
-
|
|
57
|
+
phi
|
|
91
58
|
/login # Then select provider
|
|
92
59
|
```
|
|
93
60
|
|
|
94
|
-
|
|
61
|
+
Run `/setup` to configure providers (OpenCode Zen/Go, Alibaba Coding Plan, OpenAI, Anthropic, Google, OpenRouter, Groq, local Ollama/LM Studio) and assign per-phase models, or `/phi-init` for the guided first-run wizard.
|
|
62
|
+
|
|
63
|
+
Then just talk to phi. By default, phi 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 [phi packages](#phi-packages).
|
|
95
64
|
|
|
96
65
|
**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)
|
|
97
66
|
|
|
@@ -99,7 +68,7 @@ Then just talk to pi. By default, pi gives the model four tools: `read`, `write`
|
|
|
99
68
|
|
|
100
69
|
## Providers & Models
|
|
101
70
|
|
|
102
|
-
For each built-in provider,
|
|
71
|
+
For each built-in provider, phi 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).
|
|
103
72
|
|
|
104
73
|
**Subscriptions:**
|
|
105
74
|
- Anthropic Claude Pro/Max
|
|
@@ -137,7 +106,7 @@ For each built-in provider, pi maintains a list of tool-capable models, updated
|
|
|
137
106
|
|
|
138
107
|
See [docs/providers.md](docs/providers.md) for detailed setup instructions.
|
|
139
108
|
|
|
140
|
-
**Custom providers & models:** Add providers via `~/.
|
|
109
|
+
**Custom providers & models:** Add providers via `~/.phi/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).
|
|
141
110
|
|
|
142
111
|
---
|
|
143
112
|
|
|
@@ -190,11 +159,11 @@ Type `/` in the editor to trigger commands. [Extensions](#extensions) can regist
|
|
|
190
159
|
| `/reload` | Reload keybindings, extensions, skills, prompts, and context files (themes hot-reload automatically) |
|
|
191
160
|
| `/hotkeys` | Show all keyboard shortcuts |
|
|
192
161
|
| `/changelog` | Display version history |
|
|
193
|
-
| `/quit` | Quit
|
|
162
|
+
| `/quit` | Quit phi |
|
|
194
163
|
|
|
195
164
|
### Keyboard Shortcuts
|
|
196
165
|
|
|
197
|
-
See `/hotkeys` for the full list. Customize via `~/.
|
|
166
|
+
See `/hotkeys` for the full list. Customize via `~/.phi/agent/keybindings.json`. See [docs/keybindings.md](docs/keybindings.md).
|
|
198
167
|
|
|
199
168
|
**Commonly used:**
|
|
200
169
|
|
|
@@ -219,7 +188,7 @@ Submit messages while the agent is working:
|
|
|
219
188
|
- **Escape** aborts and restores queued messages to editor
|
|
220
189
|
- **Alt+Up** retrieves queued messages back to editor
|
|
221
190
|
|
|
222
|
-
On Windows Terminal, `Alt+Enter` is fullscreen by default. Remap it in [docs/terminal-setup.md](docs/terminal-setup.md) so
|
|
191
|
+
On Windows Terminal, `Alt+Enter` is fullscreen by default. Remap it in [docs/terminal-setup.md](docs/terminal-setup.md) so phi can receive the follow-up shortcut.
|
|
223
192
|
|
|
224
193
|
Configure 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.
|
|
225
194
|
|
|
@@ -231,14 +200,14 @@ Sessions are stored as JSONL files with a tree structure. Each entry has an `id`
|
|
|
231
200
|
|
|
232
201
|
### Management
|
|
233
202
|
|
|
234
|
-
Sessions auto-save to `~/.
|
|
203
|
+
Sessions auto-save to `~/.phi/agent/sessions/` organized by working directory.
|
|
235
204
|
|
|
236
205
|
```bash
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
206
|
+
phi -c # Continue most recent session
|
|
207
|
+
phi -r # Browse and select from past sessions
|
|
208
|
+
phi --no-session # Ephemeral mode (don't save)
|
|
209
|
+
phi --session <path|id> # Use specific session file or ID
|
|
210
|
+
phi --fork <path|id> # Fork specific session file or ID into a new session
|
|
242
211
|
```
|
|
243
212
|
|
|
244
213
|
Use `/session` in interactive mode to see the current session ID before reusing it with `--session <id>` or `--fork <id>`.
|
|
@@ -277,14 +246,14 @@ Use `/settings` to modify common options, or edit JSON files directly:
|
|
|
277
246
|
|
|
278
247
|
| Location | Scope |
|
|
279
248
|
|----------|-------|
|
|
280
|
-
| `~/.
|
|
281
|
-
| `.
|
|
249
|
+
| `~/.phi/agent/settings.json` | Global (all projects) |
|
|
250
|
+
| `.phi/settings.json` | Project (overrides global) |
|
|
282
251
|
|
|
283
252
|
See [docs/settings.md](docs/settings.md) for all options.
|
|
284
253
|
|
|
285
254
|
### Telemetry and update checks
|
|
286
255
|
|
|
287
|
-
|
|
256
|
+
phi has two separate startup features:
|
|
288
257
|
|
|
289
258
|
- **Update check:** fetches `https://registry.npmjs.org/@phi-code-admin/phi-code/latest` to check whether a newer phi-code version exists. Disable it with `PI_SKIP_VERSION_CHECK=1`. Disabling update checks only turns off this check.
|
|
290
259
|
- **Install/update telemetry:** none. phi-code sends no telemetry pings (the inherited upstream ping to `pi.dev` was removed).
|
|
@@ -295,8 +264,8 @@ Use `--offline` or `PI_OFFLINE=1` to disable all startup network operations desc
|
|
|
295
264
|
|
|
296
265
|
## Context Files
|
|
297
266
|
|
|
298
|
-
|
|
299
|
-
- `~/.
|
|
267
|
+
phi loads `AGENTS.md` (or `CLAUDE.md`) at startup from:
|
|
268
|
+
- `~/.phi/agent/AGENTS.md` (global)
|
|
300
269
|
- Parent directories (walking up from cwd)
|
|
301
270
|
- Current directory
|
|
302
271
|
|
|
@@ -306,7 +275,7 @@ Disable context file loading with `--no-context-files` (or `-nc`).
|
|
|
306
275
|
|
|
307
276
|
### System Prompt
|
|
308
277
|
|
|
309
|
-
Replace the default system prompt with `.
|
|
278
|
+
Replace the default system prompt with `.phi/SYSTEM.md` (project) or `~/.phi/agent/SYSTEM.md` (global). Append without replacing via `APPEND_SYSTEM.md`.
|
|
310
279
|
|
|
311
280
|
---
|
|
312
281
|
|
|
@@ -317,19 +286,19 @@ Replace the default system prompt with `.pi/SYSTEM.md` (project) or `~/.pi/agent
|
|
|
317
286
|
Reusable prompts as Markdown files. Type `/name` to expand.
|
|
318
287
|
|
|
319
288
|
```markdown
|
|
320
|
-
<!-- ~/.
|
|
289
|
+
<!-- ~/.phi/agent/prompts/review.md -->
|
|
321
290
|
Review this code for bugs, security issues, and performance problems.
|
|
322
291
|
Focus on: {{focus}}
|
|
323
292
|
```
|
|
324
293
|
|
|
325
|
-
Place in `~/.
|
|
294
|
+
Place in `~/.phi/agent/prompts/`, `.phi/prompts/`, or a [phi package](#phi-packages) to share with others. See [docs/prompt-templates.md](docs/prompt-templates.md).
|
|
326
295
|
|
|
327
296
|
### Skills
|
|
328
297
|
|
|
329
298
|
On-demand capability packages following the [Agent Skills standard](https://agentskills.io). Invoke via `/skill:name` or let the agent load them automatically.
|
|
330
299
|
|
|
331
300
|
```markdown
|
|
332
|
-
<!-- ~/.
|
|
301
|
+
<!-- ~/.phi/agent/skills/my-skill/SKILL.md -->
|
|
333
302
|
# My Skill
|
|
334
303
|
Use this skill when the user asks about X.
|
|
335
304
|
|
|
@@ -338,13 +307,13 @@ Use this skill when the user asks about X.
|
|
|
338
307
|
2. Then that
|
|
339
308
|
```
|
|
340
309
|
|
|
341
|
-
Place in `~/.
|
|
310
|
+
Place in `~/.phi/agent/skills/`, `~/.agents/skills/`, `.phi/skills/`, or `.agents/skills/` (from `cwd` up through parent directories) or a [phi package](#phi-packages) to share with others. See [docs/skills.md](docs/skills.md).
|
|
342
311
|
|
|
343
312
|
### Extensions
|
|
344
313
|
|
|
345
314
|
<p align="center"><img src="docs/images/doom-extension.png" alt="Doom Extension" width="600"></p>
|
|
346
315
|
|
|
347
|
-
TypeScript modules that extend
|
|
316
|
+
TypeScript modules that extend phi with custom tools, commands, keyboard shortcuts, event handlers, and UI components.
|
|
348
317
|
|
|
349
318
|
```typescript
|
|
350
319
|
export default function (pi: ExtensionAPI) {
|
|
@@ -354,7 +323,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
354
323
|
}
|
|
355
324
|
```
|
|
356
325
|
|
|
357
|
-
The default export can also be `async`.
|
|
326
|
+
The default export can also be `async`. phi waits for async extension factories before startup continues, which is useful for one-time initialization such as fetching remote model lists before calling `pi.registerProvider()`.
|
|
358
327
|
|
|
359
328
|
**What's possible:**
|
|
360
329
|
- Custom tools (or replace built-in tools entirely)
|
|
@@ -366,47 +335,47 @@ The default export can also be `async`. pi waits for async extension factories b
|
|
|
366
335
|
- Git checkpointing and auto-commit
|
|
367
336
|
- SSH and sandbox execution
|
|
368
337
|
- MCP server integration
|
|
369
|
-
- Make
|
|
338
|
+
- Make phi look like Claude Code
|
|
370
339
|
- Games while waiting (yes, Doom runs)
|
|
371
340
|
- ...anything you can dream up
|
|
372
341
|
|
|
373
|
-
Place in `~/.
|
|
342
|
+
Place in `~/.phi/agent/extensions/`, `.phi/extensions/`, or a [phi package](#phi-packages) to share with others. See [docs/extensions.md](docs/extensions.md) and [examples/extensions/](examples/extensions/).
|
|
374
343
|
|
|
375
344
|
### Themes
|
|
376
345
|
|
|
377
|
-
Built-in: `dark`, `light`. Themes hot-reload: modify the active theme file and
|
|
346
|
+
Built-in: `dark`, `light`. Themes hot-reload: modify the active theme file and phi immediately applies changes.
|
|
378
347
|
|
|
379
|
-
Place in `~/.
|
|
348
|
+
Place in `~/.phi/agent/themes/`, `.phi/themes/`, or a [phi package](#phi-packages) to share with others. See [docs/themes.md](docs/themes.md).
|
|
380
349
|
|
|
381
|
-
###
|
|
350
|
+
### Phi Packages
|
|
382
351
|
|
|
383
352
|
Bundle 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).
|
|
384
353
|
|
|
385
|
-
> **Security:**
|
|
354
|
+
> **Security:** phi 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.
|
|
386
355
|
|
|
387
356
|
```bash
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
357
|
+
phi install npm:@foo/pi-tools
|
|
358
|
+
phi install npm:@foo/pi-tools@1.2.3 # pinned version
|
|
359
|
+
phi install git:github.com/user/repo
|
|
360
|
+
phi install git:github.com/user/repo@v1 # tag or commit
|
|
361
|
+
phi install git:git@github.com:user/repo
|
|
362
|
+
phi install git:git@github.com:user/repo@v1 # tag or commit
|
|
363
|
+
phi install https://github.com/user/repo
|
|
364
|
+
phi install https://github.com/user/repo@v1 # tag or commit
|
|
365
|
+
phi install ssh://git@github.com/user/repo
|
|
366
|
+
phi install ssh://git@github.com/user/repo@v1 # tag or commit
|
|
367
|
+
phi remove npm:@foo/pi-tools
|
|
368
|
+
phi uninstall npm:@foo/pi-tools # alias for remove
|
|
369
|
+
phi list
|
|
370
|
+
phi update # update phi and packages (skips pinned packages)
|
|
371
|
+
phi update --extensions # update packages only
|
|
372
|
+
phi update --self # update phi only
|
|
373
|
+
phi update --self --force # reinstall phi even if current
|
|
374
|
+
phi update npm:@foo/pi-tools # update one package
|
|
375
|
+
phi config # enable/disable extensions, skills, prompts, themes
|
|
407
376
|
```
|
|
408
377
|
|
|
409
|
-
Packages install to `~/.
|
|
378
|
+
Packages install to `~/.phi/agent/git/` (git) or global npm. Use `-l` for project-local installs (`.phi/git/`, `.phi/npm/`). Git packages install dependencies with `npm install --omit=dev` by default, so runtime deps must be listed under `dependencies`; when `npmCommand` is configured, git packages use plain `install` for compatibility with wrappers. 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"]`.
|
|
410
379
|
|
|
411
380
|
Create a package by adding a `pi` key to `package.json`:
|
|
412
381
|
|
|
@@ -423,7 +392,7 @@ Create a package by adding a `pi` key to `package.json`:
|
|
|
423
392
|
}
|
|
424
393
|
```
|
|
425
394
|
|
|
426
|
-
Without a `pi` manifest,
|
|
395
|
+
Without a `pi` manifest, phi auto-discovers from conventional directories (`extensions/`, `skills/`, `prompts/`, `themes/`).
|
|
427
396
|
|
|
428
397
|
See [docs/packages.md](docs/packages.md).
|
|
429
398
|
|
|
@@ -434,7 +403,7 @@ See [docs/packages.md](docs/packages.md).
|
|
|
434
403
|
### SDK
|
|
435
404
|
|
|
436
405
|
```typescript
|
|
437
|
-
import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@
|
|
406
|
+
import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@phi-code-admin/phi-code";
|
|
438
407
|
|
|
439
408
|
const authStorage = AuthStorage.create();
|
|
440
409
|
const modelRegistry = ModelRegistry.create(authStorage);
|
|
@@ -456,7 +425,7 @@ See [docs/sdk.md](docs/sdk.md) and [examples/sdk/](examples/sdk/).
|
|
|
456
425
|
For non-Node.js integrations, use RPC mode over stdin/stdout:
|
|
457
426
|
|
|
458
427
|
```bash
|
|
459
|
-
|
|
428
|
+
phi --mode rpc
|
|
460
429
|
```
|
|
461
430
|
|
|
462
431
|
RPC 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.
|
|
@@ -467,11 +436,11 @@ See [docs/rpc.md](docs/rpc.md) for the protocol.
|
|
|
467
436
|
|
|
468
437
|
## Philosophy
|
|
469
438
|
|
|
470
|
-
|
|
439
|
+
phi 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 [phi packages](#phi-packages). This keeps the core minimal while letting you shape phi to fit how you work.
|
|
471
440
|
|
|
472
441
|
**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/)
|
|
473
442
|
|
|
474
|
-
**No sub-agents.** There's many ways to do this. Spawn
|
|
443
|
+
**No sub-agents.** There's many ways to do this. Spawn phi instances via tmux, or build your own with [extensions](#extensions), or install a package that does it your way.
|
|
475
444
|
|
|
476
445
|
**No permission popups.** Run in a container, or build your own confirmation flow with [extensions](#extensions) inline with your environment and security requirements.
|
|
477
446
|
|
|
@@ -488,22 +457,22 @@ Read the [blog post](https://mariozechner.at/posts/2025-11-30-pi-coding-agent/)
|
|
|
488
457
|
## CLI Reference
|
|
489
458
|
|
|
490
459
|
```bash
|
|
491
|
-
|
|
460
|
+
phi [options] [@files...] [messages...]
|
|
492
461
|
```
|
|
493
462
|
|
|
494
463
|
### Package Commands
|
|
495
464
|
|
|
496
465
|
```bash
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
466
|
+
phi install <source> [-l] # Install package, -l for project-local
|
|
467
|
+
phi remove <source> [-l] # Remove package
|
|
468
|
+
phi uninstall <source> [-l] # Alias for remove
|
|
469
|
+
phi update [source|self] # Update phi and packages (skips pinned packages)
|
|
470
|
+
phi update --extensions # Update packages only
|
|
471
|
+
phi update --self # Update phi only
|
|
472
|
+
phi update --self --force # Reinstall phi even if current
|
|
473
|
+
phi update --extension <src> # Update one package
|
|
474
|
+
phi list # List installed packages
|
|
475
|
+
phi config # Enable/disable package resources
|
|
507
476
|
```
|
|
508
477
|
|
|
509
478
|
### Modes
|
|
@@ -516,10 +485,10 @@ pi config # Enable/disable package resources
|
|
|
516
485
|
| `--mode rpc` | RPC mode for process integration (see [docs/rpc.md](docs/rpc.md)) |
|
|
517
486
|
| `--export <in> [out]` | Export session to HTML |
|
|
518
487
|
|
|
519
|
-
In print mode,
|
|
488
|
+
In print mode, phi also reads piped stdin and merges it into the initial prompt:
|
|
520
489
|
|
|
521
490
|
```bash
|
|
522
|
-
cat README.md |
|
|
491
|
+
cat README.md | phi -p "Summarize this text"
|
|
523
492
|
```
|
|
524
493
|
|
|
525
494
|
### Model Options
|
|
@@ -586,7 +555,7 @@ Prefix files with `@` to include in the message:
|
|
|
586
555
|
|
|
587
556
|
```bash
|
|
588
557
|
pi @prompt.md "Answer this"
|
|
589
|
-
|
|
558
|
+
phi -p @screenshot.png "What's in this image?"
|
|
590
559
|
pi @code.ts @test.ts "Review these files"
|
|
591
560
|
```
|
|
592
561
|
|
|
@@ -594,39 +563,39 @@ pi @code.ts @test.ts "Review these files"
|
|
|
594
563
|
|
|
595
564
|
```bash
|
|
596
565
|
# Interactive with initial prompt
|
|
597
|
-
|
|
566
|
+
phi "List all .ts files in src/"
|
|
598
567
|
|
|
599
568
|
# Non-interactive
|
|
600
|
-
|
|
569
|
+
phi -p "Summarize this codebase"
|
|
601
570
|
|
|
602
571
|
# Non-interactive with piped stdin
|
|
603
|
-
cat README.md |
|
|
572
|
+
cat README.md | phi -p "Summarize this text"
|
|
604
573
|
|
|
605
574
|
# Different model
|
|
606
|
-
|
|
575
|
+
phi --provider openai --model gpt-4o "Help me refactor"
|
|
607
576
|
|
|
608
577
|
# Model with provider prefix (no --provider needed)
|
|
609
|
-
|
|
578
|
+
phi --model openai/gpt-4o "Help me refactor"
|
|
610
579
|
|
|
611
580
|
# Model with thinking level shorthand
|
|
612
|
-
|
|
581
|
+
phi --model sonnet:high "Solve this complex problem"
|
|
613
582
|
|
|
614
583
|
# Limit model cycling
|
|
615
|
-
|
|
584
|
+
phi --models "claude-*,gpt-4o"
|
|
616
585
|
|
|
617
586
|
# Read-only mode
|
|
618
|
-
|
|
587
|
+
phi --tools read,grep,find,ls -p "Review the code"
|
|
619
588
|
|
|
620
589
|
# High thinking level
|
|
621
|
-
|
|
590
|
+
phi --thinking high "Solve this complex problem"
|
|
622
591
|
```
|
|
623
592
|
|
|
624
593
|
### Environment Variables
|
|
625
594
|
|
|
626
595
|
| Variable | Description |
|
|
627
596
|
|----------|-------------|
|
|
628
|
-
| `
|
|
629
|
-
| `
|
|
597
|
+
| `PHI_CODING_AGENT_DIR` | Override config directory (default: `~/.phi/agent`) |
|
|
598
|
+
| `PHI_CODING_AGENT_SESSION_DIR` | Override session storage directory (overridden by `--session-dir`) |
|
|
630
599
|
| `PI_PACKAGE_DIR` | Override package directory (useful for Nix/Guix where store paths tokenize poorly) |
|
|
631
600
|
| `PI_OFFLINE` | Disable startup network operations, including update checks, package update checks, and install/update telemetry |
|
|
632
601
|
| `PI_SKIP_VERSION_CHECK` | Skip the phi-code version update check at startup. This prevents the npm registry latest-version request |
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./routing.schema.json",
|
|
3
|
+
"routes": {
|
|
4
|
+
"code": {
|
|
5
|
+
"preferredModel": "default",
|
|
6
|
+
"fallback": "default",
|
|
7
|
+
"agent": null,
|
|
8
|
+
"keywords": [
|
|
9
|
+
"code",
|
|
10
|
+
"implement",
|
|
11
|
+
"write",
|
|
12
|
+
"create",
|
|
13
|
+
"build",
|
|
14
|
+
"développer",
|
|
15
|
+
"coder",
|
|
16
|
+
"programmer",
|
|
17
|
+
"function",
|
|
18
|
+
"class",
|
|
19
|
+
"method"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"debug": {
|
|
23
|
+
"preferredModel": "default",
|
|
24
|
+
"fallback": "default",
|
|
25
|
+
"agent": null,
|
|
26
|
+
"keywords": [
|
|
27
|
+
"debug",
|
|
28
|
+
"fix",
|
|
29
|
+
"error",
|
|
30
|
+
"bug",
|
|
31
|
+
"broken",
|
|
32
|
+
"issue",
|
|
33
|
+
"problem",
|
|
34
|
+
"repair",
|
|
35
|
+
"correct",
|
|
36
|
+
"erreur",
|
|
37
|
+
"problème",
|
|
38
|
+
"réparer"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"explore": {
|
|
42
|
+
"preferredModel": "default",
|
|
43
|
+
"fallback": "default",
|
|
44
|
+
"agent": null,
|
|
45
|
+
"keywords": [
|
|
46
|
+
"explore",
|
|
47
|
+
"understand",
|
|
48
|
+
"analyze",
|
|
49
|
+
"examine",
|
|
50
|
+
"investigate",
|
|
51
|
+
"study",
|
|
52
|
+
"explorer",
|
|
53
|
+
"analyser",
|
|
54
|
+
"comprendre"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"plan": {
|
|
58
|
+
"preferredModel": "default",
|
|
59
|
+
"fallback": "default",
|
|
60
|
+
"agent": null,
|
|
61
|
+
"keywords": [
|
|
62
|
+
"plan",
|
|
63
|
+
"design",
|
|
64
|
+
"architecture",
|
|
65
|
+
"strategy",
|
|
66
|
+
"approach",
|
|
67
|
+
"structure",
|
|
68
|
+
"organize",
|
|
69
|
+
"concevoir",
|
|
70
|
+
"planifier"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"test": {
|
|
74
|
+
"preferredModel": "default",
|
|
75
|
+
"fallback": "default",
|
|
76
|
+
"agent": null,
|
|
77
|
+
"keywords": [
|
|
78
|
+
"test",
|
|
79
|
+
"testing",
|
|
80
|
+
"unit",
|
|
81
|
+
"integration",
|
|
82
|
+
"verify",
|
|
83
|
+
"validate",
|
|
84
|
+
"check",
|
|
85
|
+
"tester",
|
|
86
|
+
"vérifier",
|
|
87
|
+
"valider"
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
"review": {
|
|
91
|
+
"preferredModel": "default",
|
|
92
|
+
"fallback": "default",
|
|
93
|
+
"agent": null,
|
|
94
|
+
"keywords": [
|
|
95
|
+
"review",
|
|
96
|
+
"audit",
|
|
97
|
+
"check",
|
|
98
|
+
"validate",
|
|
99
|
+
"quality",
|
|
100
|
+
"improve",
|
|
101
|
+
"optimize",
|
|
102
|
+
"réviser",
|
|
103
|
+
"améliorer",
|
|
104
|
+
"optimiser"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"general": {
|
|
108
|
+
"preferredModel": "default",
|
|
109
|
+
"fallback": "default",
|
|
110
|
+
"agent": null,
|
|
111
|
+
"keywords": [
|
|
112
|
+
"help",
|
|
113
|
+
"explain",
|
|
114
|
+
"what",
|
|
115
|
+
"how",
|
|
116
|
+
"why",
|
|
117
|
+
"question",
|
|
118
|
+
"aide",
|
|
119
|
+
"expliquer",
|
|
120
|
+
"comment",
|
|
121
|
+
"pourquoi"
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"default": {
|
|
126
|
+
"model": "default",
|
|
127
|
+
"agent": null
|
|
128
|
+
}
|
|
129
|
+
}
|