@phi-code-admin/phi-code 0.85.0 → 0.87.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 +83 -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 +81 -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 +12 -117
- package/extensions/phi/benchmark.ts +129 -49
- package/extensions/phi/browser.ts +10 -37
- package/extensions/phi/btw/btw.ts +1 -7
- package/extensions/phi/chrome/index.ts +1283 -741
- package/extensions/phi/commit.ts +9 -14
- package/extensions/phi/goal/index.ts +10 -33
- package/extensions/phi/init.ts +37 -47
- package/extensions/phi/keys.ts +2 -7
- package/extensions/phi/mcp/callback-server.ts +162 -165
- package/extensions/phi/mcp/config.ts +122 -136
- package/extensions/phi/mcp/errors.ts +18 -23
- package/extensions/phi/mcp/index.ts +322 -355
- package/extensions/phi/mcp/oauth-provider.ts +289 -289
- package/extensions/phi/mcp/server-manager.ts +390 -413
- package/extensions/phi/mcp/tool-bridge.ts +381 -415
- package/extensions/phi/memory.ts +2 -2
- package/extensions/phi/models.ts +27 -26
- package/extensions/phi/orchestrator.ts +343 -266
- package/extensions/phi/productivity.ts +4 -2
- package/extensions/phi/providers/agent-def.ts +128 -0
- package/extensions/phi/providers/alibaba.ts +56 -7
- package/extensions/phi/providers/context-window.ts +4 -1
- package/extensions/phi/providers/live-models.ts +5 -20
- package/extensions/phi/providers/orchestrator-helpers.ts +19 -5
- package/extensions/phi/providers/phase-machine.ts +220 -0
- package/extensions/phi/setup.ts +196 -169
- package/extensions/phi/skill-loader.ts +18 -21
- package/extensions/phi/smart-router.ts +6 -6
- package/extensions/phi/web-search.ts +90 -50
- package/package.json +2 -1
package/docs/packages.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
>
|
|
1
|
+
> phi can help you create phi packages. Ask it to bundle your extensions, skills, prompt templates, or themes.
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# Phi Packages
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
phi packages bundle extensions, skills, prompt templates, and themes so you can share them through npm or git. A package can declare resources in `package.json` under the `pi` key, or use conventional directories.
|
|
6
6
|
|
|
7
7
|
## Table of Contents
|
|
8
8
|
|
|
9
9
|
- [Install and Manage](#install-and-manage)
|
|
10
10
|
- [Package Sources](#package-sources)
|
|
11
|
-
- [Creating a
|
|
11
|
+
- [Creating a phi Package](#creating-a-pi-package)
|
|
12
12
|
- [Package Structure](#package-structure)
|
|
13
13
|
- [Dependencies](#dependencies)
|
|
14
14
|
- [Package Filtering](#package-filtering)
|
|
@@ -17,37 +17,37 @@ Pi packages bundle extensions, skills, prompt templates, and themes so you can s
|
|
|
17
17
|
|
|
18
18
|
## Install and Manage
|
|
19
19
|
|
|
20
|
-
> **Security:**
|
|
20
|
+
> **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.
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
phi install npm:@foo/bar@1.0.0
|
|
24
|
+
phi install git:github.com/user/repo@v1
|
|
25
|
+
phi install https://github.com/user/repo # raw URLs work too
|
|
26
|
+
phi install /absolute/path/to/package
|
|
27
|
+
phi install ./relative/path/to/package
|
|
28
|
+
|
|
29
|
+
phi remove npm:@foo/bar
|
|
30
|
+
phi list # show installed packages from settings
|
|
31
|
+
phi update # update phi and all non-pinned packages
|
|
32
|
+
phi update --extensions # update all non-pinned packages only
|
|
33
|
+
phi update --self # update phi only
|
|
34
|
+
phi update --self --force # reinstall phi even if current
|
|
35
|
+
phi update npm:@foo/bar # update one package
|
|
36
|
+
phi update --extension npm:@foo/bar
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
By default, `install` and `remove` write to global settings (`~/.
|
|
39
|
+
By default, `install` and `remove` write to global settings (`~/.phi/agent/settings.json`). Use `-l` to write to project settings (`.phi/settings.json`) instead. Project settings can be shared with your team, and phi installs any missing packages automatically on startup.
|
|
40
40
|
|
|
41
41
|
To try a package without installing it, use `--extension` or `-e`. This installs to a temporary directory for the current run only:
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
phi -e npm:@foo/bar
|
|
45
|
+
phi -e git:github.com/user/repo
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
## Package Sources
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
phi accepts three source types in settings and `phi install`.
|
|
51
51
|
|
|
52
52
|
### npm
|
|
53
53
|
|
|
@@ -56,9 +56,9 @@ npm:@scope/pkg@1.2.3
|
|
|
56
56
|
npm:pkg
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
- Versioned specs are pinned and skipped by package updates (`
|
|
59
|
+
- Versioned specs are pinned and skipped by package updates (`phi update`, `phi update --extensions`).
|
|
60
60
|
- Global installs use `npm install -g`.
|
|
61
|
-
- Project installs go under `.
|
|
61
|
+
- Project installs go under `.phi/npm/`.
|
|
62
62
|
- Set `npmCommand` in `settings.json` to pin npm package lookup and install operations to a specific wrapper command such as `mise` or `asdf`.
|
|
63
63
|
|
|
64
64
|
Example:
|
|
@@ -83,20 +83,20 @@ ssh://git@github.com/user/repo@v1
|
|
|
83
83
|
- HTTPS and SSH URLs are both supported.
|
|
84
84
|
- SSH URLs use your configured SSH keys automatically (respects `~/.ssh/config`).
|
|
85
85
|
- For non-interactive runs (for example CI), you can set `GIT_TERMINAL_PROMPT=0` to disable credential prompts and set `GIT_SSH_COMMAND` (for example `ssh -o BatchMode=yes -o ConnectTimeout=5`) to fail fast.
|
|
86
|
-
- Refs pin the package and skip package updates (`
|
|
87
|
-
- Cloned to `~/.
|
|
86
|
+
- Refs pin the package and skip package updates (`phi update`, `phi update --extensions`).
|
|
87
|
+
- Cloned to `~/.phi/agent/git/<host>/<path>` (global) or `.phi/git/<host>/<path>` (project).
|
|
88
88
|
- Runs `npm install` after clone or pull if `package.json` exists.
|
|
89
89
|
|
|
90
90
|
**SSH examples:**
|
|
91
91
|
```bash
|
|
92
92
|
# git@host:path shorthand (requires git: prefix)
|
|
93
|
-
|
|
93
|
+
phi install git:git@github.com:user/repo
|
|
94
94
|
|
|
95
95
|
# ssh:// protocol format
|
|
96
|
-
|
|
96
|
+
phi install ssh://git@github.com/user/repo
|
|
97
97
|
|
|
98
98
|
# With version ref
|
|
99
|
-
|
|
99
|
+
phi install git:git@github.com:user/repo@v1.0.0
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
### Local Paths
|
|
@@ -106,9 +106,9 @@ pi install git:git@github.com:user/repo@v1.0.0
|
|
|
106
106
|
./relative/path/to/package
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
Local paths point to files or directories on disk and are added to settings without copying. Relative paths are resolved against the settings file they appear in. If the path is a file, it loads as a single extension. If it is a directory,
|
|
109
|
+
Local paths point to files or directories on disk and are added to settings without copying. Relative paths are resolved against the settings file they appear in. If the path is a file, it loads as a single extension. If it is a directory, phi loads resources using package rules.
|
|
110
110
|
|
|
111
|
-
## Creating a
|
|
111
|
+
## Creating a phi Package
|
|
112
112
|
|
|
113
113
|
Add a `pi` manifest to `package.json` or use conventional directories. Include the `pi-package` keyword for discoverability.
|
|
114
114
|
|
|
@@ -152,7 +152,7 @@ If both are set, video takes precedence.
|
|
|
152
152
|
|
|
153
153
|
### Convention Directories
|
|
154
154
|
|
|
155
|
-
If no `pi` manifest is present,
|
|
155
|
+
If no `pi` manifest is present, phi auto-discovers resources from these directories:
|
|
156
156
|
|
|
157
157
|
- `extensions/` loads `.ts` and `.js` files
|
|
158
158
|
- `skills/` recursively finds `SKILL.md` folders and loads top-level `.md` files as skills
|
|
@@ -161,11 +161,11 @@ If no `pi` manifest is present, pi auto-discovers resources from these directori
|
|
|
161
161
|
|
|
162
162
|
## Dependencies
|
|
163
163
|
|
|
164
|
-
Third party runtime dependencies belong in `dependencies` in `package.json`. Dependencies that do not register extensions, skills, prompt templates, or themes also belong in `dependencies`. When
|
|
164
|
+
Third party runtime dependencies belong in `dependencies` in `package.json`. Dependencies that do not register extensions, skills, prompt templates, or themes also belong in `dependencies`. When phi installs a package from npm or git, it runs `npm install`, so those dependencies are installed automatically.
|
|
165
165
|
|
|
166
|
-
Pi bundles core packages for extensions and skills. If you import any of these, list them in `peerDependencies` with a `"*"` range and do not bundle them: `@earendil-works/pi-ai`, `@earendil-works/pi-agent-core`, `@
|
|
166
|
+
Pi bundles core packages for extensions and skills. If you import any of these, list them in `peerDependencies` with a `"*"` range and do not bundle them: `@earendil-works/pi-ai`, `@earendil-works/pi-agent-core`, `@phi-code-admin/phi-code`, `@earendil-works/pi-tui`, `typebox`.
|
|
167
167
|
|
|
168
|
-
Other
|
|
168
|
+
Other phi packages must be bundled in your tarball. Add them to `dependencies` and `bundledDependencies`, then reference their resources through `node_modules/` paths. phi loads packages with separate module roots, so separate installs do not collide or share modules.
|
|
169
169
|
|
|
170
170
|
Example:
|
|
171
171
|
|
|
@@ -212,7 +212,7 @@ Filter what a package loads using the object form in settings:
|
|
|
212
212
|
|
|
213
213
|
## Enable and Disable Resources
|
|
214
214
|
|
|
215
|
-
Use `
|
|
215
|
+
Use `phi config` to enable or disable extensions, skills, prompt templates, and themes from installed packages and local directories. Works for both global (`~/.phi/agent`) and project (`.phi/`) scopes.
|
|
216
216
|
|
|
217
217
|
## Scope and Deduplication
|
|
218
218
|
|
package/docs/prompt-templates.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
>
|
|
1
|
+
> phi can create prompt templates. Ask it to build one for your workflow.
|
|
2
2
|
|
|
3
3
|
# Prompt Templates
|
|
4
4
|
|
|
@@ -6,10 +6,10 @@ Prompt templates are Markdown snippets that expand into full prompts. Type `/nam
|
|
|
6
6
|
|
|
7
7
|
## Locations
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
phi loads prompt templates from:
|
|
10
10
|
|
|
11
|
-
- Global: `~/.
|
|
12
|
-
- Project: `.
|
|
11
|
+
- Global: `~/.phi/agent/prompts/*.md`
|
|
12
|
+
- Project: `.phi/prompts/*.md`
|
|
13
13
|
- Packages: `prompts/` directories or `pi.prompts` entries in `package.json`
|
|
14
14
|
- Settings: `prompts` array with files or directories
|
|
15
15
|
- CLI: `--prompt-template <path>` (repeatable)
|
package/docs/providers.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Providers
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
phi supports subscription-based providers via OAuth and API key providers via environment variables or auth file. For each provider, phi knows all available models. The list is updated with every phi release.
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ Use `/login` in interactive mode, then select a provider:
|
|
|
19
19
|
- Claude Pro/Max
|
|
20
20
|
- GitHub Copilot
|
|
21
21
|
|
|
22
|
-
Use `/logout` to clear credentials. Tokens are stored in `~/.
|
|
22
|
+
Use `/logout` to clear credentials. Tokens are stored in `~/.phi/agent/auth.json` and auto-refresh when expired.
|
|
23
23
|
|
|
24
24
|
### OpenAI Codex
|
|
25
25
|
|
|
@@ -79,7 +79,7 @@ Reference for environment variables and `auth.json` keys: [`const envMap`](https
|
|
|
79
79
|
|
|
80
80
|
#### Auth File
|
|
81
81
|
|
|
82
|
-
Store credentials in `~/.
|
|
82
|
+
Store credentials in `~/.phi/agent/auth.json`:
|
|
83
83
|
|
|
84
84
|
```json
|
|
85
85
|
{
|
|
@@ -156,14 +156,14 @@ export AWS_REGION=us-west-2
|
|
|
156
156
|
Also supports ECS task roles (`AWS_CONTAINER_CREDENTIALS_*`) and IRSA (`AWS_WEB_IDENTITY_TOKEN_FILE`).
|
|
157
157
|
|
|
158
158
|
```bash
|
|
159
|
-
|
|
159
|
+
phi --provider amazon-bedrock --model us.anthropic.claude-sonnet-4-20250514-v1:0
|
|
160
160
|
```
|
|
161
161
|
|
|
162
162
|
Prompt caching is enabled automatically for Claude models whose ID contains a recognizable model name (base models and system-defined inference profiles). For application inference profiles (whose ARNs don't contain the model name), set `AWS_BEDROCK_FORCE_CACHE=1` to enable cache points:
|
|
163
163
|
|
|
164
164
|
```bash
|
|
165
165
|
export AWS_BEDROCK_FORCE_CACHE=1
|
|
166
|
-
|
|
166
|
+
phi --provider amazon-bedrock --model arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abc123
|
|
167
167
|
```
|
|
168
168
|
|
|
169
169
|
If you are connecting to a Bedrock API proxy, the following environment variables can be used:
|
|
@@ -187,7 +187,7 @@ export AWS_BEDROCK_FORCE_HTTP1=1
|
|
|
187
187
|
export CLOUDFLARE_API_KEY=... # or use /login
|
|
188
188
|
export CLOUDFLARE_ACCOUNT_ID=...
|
|
189
189
|
export CLOUDFLARE_GATEWAY_ID=... # create at dash.cloudflare.com → AI → AI Gateway
|
|
190
|
-
|
|
190
|
+
phi --provider cloudflare-ai-gateway --model "claude-sonnet-4-5"
|
|
191
191
|
```
|
|
192
192
|
|
|
193
193
|
Routes to OpenAI, Anthropic, and Workers AI through Cloudflare AI Gateway. Workers AI uses the Unified API (`/compat`) and prefixed model IDs (`workers-ai/@cf/...`). OpenAI uses the OpenAI passthrough route (`/openai`) with native OpenAI model IDs such as `gpt-5.1`. Anthropic uses the Anthropic passthrough route (`/anthropic`) with native Anthropic model IDs such as `claude-sonnet-4-5`.
|
|
@@ -201,7 +201,7 @@ AI Gateway authentication uses `CLOUDFLARE_API_KEY` as `cf-aig-authorization`. U
|
|
|
201
201
|
| Stored BYOK | Cloudflare token only | Cloudflare injects provider keys stored in the AI Gateway dashboard |
|
|
202
202
|
| Inline BYOK | Cloudflare token plus upstream `Authorization` header | The request supplies the upstream provider key |
|
|
203
203
|
|
|
204
|
-
For normal
|
|
204
|
+
For normal phi usage, prefer unified billing or stored BYOK. Inline BYOK requires configuring an additional upstream `Authorization` header for the Cloudflare AI Gateway provider, for example via a `models.json` provider/model override.
|
|
205
205
|
|
|
206
206
|
### Cloudflare Workers AI
|
|
207
207
|
|
|
@@ -210,10 +210,10 @@ For normal pi usage, prefer unified billing or stored BYOK. Inline BYOK requires
|
|
|
210
210
|
```bash
|
|
211
211
|
export CLOUDFLARE_API_KEY=... # or use /login
|
|
212
212
|
export CLOUDFLARE_ACCOUNT_ID=...
|
|
213
|
-
|
|
213
|
+
phi --provider cloudflare-workers-ai --model "@cf/moonshotai/kimi-k2.6"
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
phi automatically sets `x-session-affinity` for [prefix caching](https://developers.cloudflare.com/workers-ai/features/prompt-caching/) discounts.
|
|
217
217
|
|
|
218
218
|
### Google Vertex AI
|
|
219
219
|
|
package/docs/quickstart.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# Quickstart
|
|
2
2
|
|
|
3
|
-
This page gets you from install to a useful first
|
|
3
|
+
This page gets you from install to a useful first phi session.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
phi is distributed as an npm package:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install -g @
|
|
10
|
+
npm install -g @phi-code-admin/phi-code
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Then start
|
|
13
|
+
Then start phi in the project directory you want it to work on:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
cd /path/to/project
|
|
@@ -19,11 +19,11 @@ pi
|
|
|
19
19
|
|
|
20
20
|
## Authenticate
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
phi can use subscription providers through `/login`, or API-key providers through environment variables or the auth file.
|
|
23
23
|
|
|
24
24
|
### Option 1: subscription login
|
|
25
25
|
|
|
26
|
-
Start
|
|
26
|
+
Start phi and run:
|
|
27
27
|
|
|
28
28
|
```text
|
|
29
29
|
/login
|
|
@@ -33,37 +33,37 @@ Then select a provider. Built-in subscription logins include Claude Pro/Max, Cha
|
|
|
33
33
|
|
|
34
34
|
### Option 2: API key
|
|
35
35
|
|
|
36
|
-
Set an API key before launching
|
|
36
|
+
Set an API key before launching phi:
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
39
|
export ANTHROPIC_API_KEY=sk-ant-...
|
|
40
40
|
pi
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
You can also run `/login` and select an API-key provider to store the key in `~/.
|
|
43
|
+
You can also run `/login` and select an API-key provider to store the key in `~/.phi/agent/auth.json`.
|
|
44
44
|
|
|
45
45
|
See [Providers](providers.md) for all supported providers, environment variables, and cloud-provider setup.
|
|
46
46
|
|
|
47
47
|
## First session
|
|
48
48
|
|
|
49
|
-
Once
|
|
49
|
+
Once phi starts, type a request and press Enter:
|
|
50
50
|
|
|
51
51
|
```text
|
|
52
52
|
Summarize this repository and tell me how to run its checks.
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
By default,
|
|
55
|
+
By default, phi gives the model four tools:
|
|
56
56
|
|
|
57
57
|
- `read` - read files
|
|
58
58
|
- `write` - create or overwrite files
|
|
59
59
|
- `edit` - patch files
|
|
60
60
|
- `bash` - run shell commands
|
|
61
61
|
|
|
62
|
-
Additional built-in read-only tools (`grep`, `find`, `ls`) are available through tool options.
|
|
62
|
+
Additional built-in read-only tools (`grep`, `find`, `ls`) are available through tool options. phi runs in your current working directory and can modify files there. Use git or another checkpointing workflow if you want easy rollback.
|
|
63
63
|
|
|
64
|
-
## Give
|
|
64
|
+
## Give phi project instructions
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
phi loads context files at startup. Add an `AGENTS.md` file to tell it how to work in a project:
|
|
67
67
|
|
|
68
68
|
```markdown
|
|
69
69
|
# Project Instructions
|
|
@@ -73,12 +73,12 @@ Pi loads context files at startup. Add an `AGENTS.md` file to tell it how to wor
|
|
|
73
73
|
- Keep responses concise.
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
phi loads:
|
|
77
77
|
|
|
78
|
-
- `~/.
|
|
78
|
+
- `~/.phi/agent/AGENTS.md` for global instructions
|
|
79
79
|
- `AGENTS.md` or `CLAUDE.md` from parent directories and the current directory
|
|
80
80
|
|
|
81
|
-
Restart
|
|
81
|
+
Restart phi, or run `/reload`, after changing context files.
|
|
82
82
|
|
|
83
83
|
## Common things to try
|
|
84
84
|
|
|
@@ -112,31 +112,31 @@ Use `/model` or Ctrl+L to choose a model. Use Shift+Tab to cycle thinking level.
|
|
|
112
112
|
Sessions are saved automatically:
|
|
113
113
|
|
|
114
114
|
```bash
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
phi -c # Continue most recent session
|
|
116
|
+
phi -r # Browse previous sessions
|
|
117
|
+
phi --session <path|id> # Open a specific session
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
Inside
|
|
120
|
+
Inside phi, use `/resume`, `/new`, `/tree`, `/fork`, and `/clone` to manage sessions.
|
|
121
121
|
|
|
122
122
|
### Non-interactive mode
|
|
123
123
|
|
|
124
124
|
For one-shot prompts:
|
|
125
125
|
|
|
126
126
|
```bash
|
|
127
|
-
|
|
128
|
-
cat README.md |
|
|
129
|
-
|
|
127
|
+
phi -p "Summarize this codebase"
|
|
128
|
+
cat README.md | phi -p "Summarize this text"
|
|
129
|
+
phi -p @screenshot.png "What's in this image?"
|
|
130
130
|
```
|
|
131
131
|
|
|
132
132
|
Use `--mode json` for JSON event output or `--mode rpc` for process integration.
|
|
133
133
|
|
|
134
134
|
## Next steps
|
|
135
135
|
|
|
136
|
-
- [Using
|
|
136
|
+
- [Using phi](usage.md) - interactive mode, slash commands, sessions, context files, and CLI reference.
|
|
137
137
|
- [Providers](providers.md) - authentication and model setup.
|
|
138
138
|
- [Settings](settings.md) - global and project configuration.
|
|
139
139
|
- [Keybindings](keybindings.md) - shortcuts and customization.
|
|
140
|
-
- [
|
|
140
|
+
- [Phi Packages](packages.md) - install shared extensions, skills, prompts, and themes.
|
|
141
141
|
|
|
142
142
|
Platform notes: [Windows](windows.md), [Termux](termux.md), [tmux](tmux.md), [Terminal setup](terminal-setup.md), [Shell aliases](shell-aliases.md).
|
package/docs/rpc.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
RPC mode enables headless operation of the coding agent via a JSON protocol over stdin/stdout. This is useful for embedding the agent in other applications, IDEs, or custom UIs.
|
|
4
4
|
|
|
5
|
-
**Note for Node.js/TypeScript users**: If you're building a Node.js application, consider using `AgentSession` directly from `@
|
|
5
|
+
**Note for Node.js/TypeScript users**: If you're building a Node.js application, consider using `AgentSession` directly from `@phi-code-admin/phi-code` instead of spawning a subprocess. See [`src/core/agent-session.ts`](../src/core/agent-session.ts) for the API. For a subprocess-based TypeScript client, see [`src/modes/rpc/rpc-client.ts`](../src/modes/rpc/rpc-client.ts).
|
|
6
6
|
|
|
7
7
|
## Starting RPC Mode
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
phi --mode rpc [options]
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Common options:
|
|
@@ -730,7 +730,7 @@ Each command has:
|
|
|
730
730
|
- `"prompt"`: Loaded from a prompt template `.md` file
|
|
731
731
|
- `"skill"`: Loaded from a skill directory (name is prefixed with `skill:`)
|
|
732
732
|
- `location`: Where it was loaded from (optional, not present for extensions):
|
|
733
|
-
- `"user"`: User-level (`~/.
|
|
733
|
+
- `"user"`: User-level (`~/.phi/agent/`)
|
|
734
734
|
- `"project"`: Project-level (`./.pi/agent/`)
|
|
735
735
|
- `"path"`: Explicit path via CLI or settings
|
|
736
736
|
- `path`: Absolute file path to the command source (optional)
|