@tduyng/pi-claude 0.0.2 → 0.0.4
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/README.md +53 -52
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
# pi-claude
|
|
1
|
+
# @tduyng/pi-claude
|
|
2
2
|
|
|
3
|
-
Claude Pro
|
|
3
|
+
Claude Pro, Max, Team and Enterprise models inside pi, through the official Claude Code CLI. Pi keeps the system prompt, the tools, the approvals, compaction and the session tree. The CLI keeps authentication and billing.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
No token is copied and no API is called directly.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
No tools, no prompt block, no schema, since this is only a provider. What it saves is the replay: one warm process means a normal turn writes only the new user message, so the prefix stays cached between turns.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- Claude Code 2.1.281 or newer on `PATH`.
|
|
11
|
-
- A Claude Pro, Max, Team or Enterprise login: run `claude auth login`.
|
|
12
|
-
- `PI_CLAUDE_BIN` only when the binary is not named `claude`.
|
|
9
|
+
## One warm process per session
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
`--input-format stream-json` keeps a process alive, and a normal turn writes only the new user message to stdin. A tool round parks the MCP calls, returns one pi assistant message with the tool calls, then the next provider call delivers the results into the same process. Nothing respawns, nothing is replayed, and the cached prefix survives.
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
The extension deliberately does not use `--resume`. Claude Code 2.1.69 changed how a resumed conversation rebuilds `messages[0]`, which invalidates the conversation cache on every turn. A live streaming process avoids that path entirely.
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
An abort sends an `interrupt` control request instead of killing the process, so the process and its cache survive. An abort during tool execution keeps the parked calls, and pi's `Operation aborted` results resolve them on the next turn. An idle process lives 60 minutes, the length of the prompt cache.
|
|
16
|
+
|
|
17
|
+
When pi's history diverges from the live process, after editing an earlier message, changing the model, changing the tool set, or resuming a pi session after a restart, the extension replaces the process and replays the existing conversation once as a single user message. That turn is a cold cache, and later turns are warm again.
|
|
21
18
|
|
|
22
|
-
|
|
19
|
+
## Pi's tools are the only tools
|
|
20
|
+
|
|
21
|
+
The extension disables Claude Code's own system prompt, `CLAUDE.md`, rules, skills, slash commands, hooks, plugins, project MCP servers, auto memory, git snapshot, title generation and auto compaction with flags and environment variables. What is left is a model that reaches pi's tools.
|
|
22
|
+
|
|
23
|
+
| Pi | Claude Code |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| Pi system prompt | `--system-prompt-file`, replacing the default |
|
|
26
|
+
| Pi tools | MCP server `pi`, exposed as `mcp__pi__<tool>` |
|
|
27
|
+
| Pi tool execution | The MCP call parks until pi runs the tool, then the result resolves it |
|
|
28
|
+
| Pi compaction | `DISABLE_AUTO_COMPACT=1`, so pi decides when |
|
|
29
|
+
| Pi approvals | Every tool call returns to pi and runs there |
|
|
23
30
|
|
|
24
31
|
## Use
|
|
25
32
|
|
|
@@ -27,61 +34,55 @@ For this repository the workspace already registers the extension in the root `p
|
|
|
27
34
|
pi --provider claude --model claude-opus-5
|
|
28
35
|
```
|
|
29
36
|
|
|
30
|
-
Inside
|
|
37
|
+
Inside pi:
|
|
31
38
|
|
|
32
39
|
```text
|
|
33
40
|
/model claude/claude-opus-5
|
|
34
41
|
```
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
The provider id is `claude`, and model ids are the ones pi already uses for Anthropic: `claude/claude-opus-5` and `anthropic/claude-opus-5` name the same model. The catalog comes from `@earendil-works/pi-ai`, so new Claude models appear when pi updates, with no edit here.
|
|
37
44
|
|
|
38
|
-
|
|
45
|
+
| Command | Effect |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `/claude status` | Binary, login, MCP port, live processes |
|
|
48
|
+
| `/claude models` | Every model id |
|
|
49
|
+
| `/claude clear` | Close the warm processes |
|
|
39
50
|
|
|
40
|
-
|
|
41
|
-
| ----------------- | ------------------------------------------------------------------------- |
|
|
42
|
-
| Pi system prompt | `--system-prompt-file`, replaces the default prompt |
|
|
43
|
-
| Pi tools | MCP server named `pi`, exposed as `mcp__pi__<tool>` |
|
|
44
|
-
| Pi tool execution | MCP call parked until Pi runs the tool, then the result resolves the call |
|
|
45
|
-
| Pi compaction | `DISABLE_AUTO_COMPACT=1`, Pi decides when to compact |
|
|
46
|
-
| Pi approvals | every tool call returns to Pi and runs there |
|
|
51
|
+
## Install
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
Requirements:
|
|
49
54
|
|
|
50
|
-
|
|
55
|
+
- Pi 1.4 or newer.
|
|
56
|
+
- Claude Code 2.1.281 or newer on `PATH`.
|
|
57
|
+
- A Claude Pro, Max, Team or Enterprise login: run `claude auth login`.
|
|
58
|
+
- `PI_CLAUDE_BIN` only when the binary is not named `claude`.
|
|
51
59
|
|
|
52
|
-
|
|
60
|
+
```sh
|
|
61
|
+
pi install npm:@tduyng/pi-claude
|
|
62
|
+
```
|
|
53
63
|
|
|
54
|
-
|
|
64
|
+
Local checkout: `pi install /path/to/dotfiles/pi/agent/extensions/pi-claude`
|
|
55
65
|
|
|
56
|
-
|
|
66
|
+
The extension never reads `~/.claude/.credentials.json`, never copies OAuth tokens, and never talks to the Anthropic API directly.
|
|
57
67
|
|
|
58
|
-
|
|
68
|
+
```sh
|
|
69
|
+
PI_CLAUDE_BIN=/home/you/.nix-profile/bin/claude pi
|
|
70
|
+
```
|
|
59
71
|
|
|
60
|
-
##
|
|
72
|
+
## Limits
|
|
61
73
|
|
|
62
|
-
- Every request counts against the
|
|
63
|
-
- Anthropic may treat a third-party harness prompt differently from Claude Code own prompt. If a turn fails with a third-party or extra-usage message, the rejection is about the prompt shape, not the CLI transport.
|
|
64
|
-
- One process per Pi session. Subagents with different prompts get their own process, up to eight alive at once.
|
|
65
|
-
- A model change, a thinking level change or a tool set change rebuilds the session on the next turn.
|
|
66
|
-
- Images in replayed history are attached to the replay message. New user images are sent normally.
|
|
67
|
-
- Claude Code needs a model id it recognizes. New models may need a newer Claude Code than the one installed.
|
|
68
|
-
- Claude Code caps MCP tool output and may move very large text to a file. Pi tools normally truncate before that cap.
|
|
69
|
-
- Usage is reported from Claude Code stream events. Monetary cost is Pi's API-equivalent estimate, not the subscription bill.
|
|
74
|
+
- Every request counts against the subscription limits, exactly like the CLI itself.
|
|
70
75
|
|
|
71
|
-
|
|
76
|
+
- Anthropic may treat a third-party harness prompt differently from the CLI's own prompt. A turn failing with a third-party or extra-usage message is about the prompt shape, not the transport.
|
|
72
77
|
|
|
73
|
-
|
|
74
|
-
| --------------- | ----------------------------------------- |
|
|
75
|
-
| `PI_CLAUDE_BIN` | Claude Code executable. Default `claude`. |
|
|
78
|
+
- One process per pi session. Subagents with a different prompt get their own, up to eight alive at once.
|
|
76
79
|
|
|
77
|
-
|
|
78
|
-
PI_CLAUDE_BIN=/home/you/.nix-profile/bin/claude pi
|
|
79
|
-
```
|
|
80
|
+
- A model change, a thinking level change or a tool set change rebuilds the session on the next turn.
|
|
80
81
|
|
|
81
|
-
|
|
82
|
+
- Images in replayed history are attached to the replay message, and new user images are sent normally.
|
|
82
83
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
- Claude Code needs a model id it recognizes, so a brand new model may need a newer CLI than the one installed.
|
|
85
|
+
|
|
86
|
+
- The CLI caps MCP tool output and may move very large text to a file. Pi tools normally truncate before that cap.
|
|
87
|
+
|
|
88
|
+
- Usage comes from the CLI's stream events. The monetary cost is pi's API-equivalent estimate, not the subscription bill.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tduyng/pi-claude",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "Claude Pro and Max models in Pi through the official Claude Code CLI: one warm streaming process, Pi's own prompt and tools, no credential copy.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi",
|
|
7
7
|
"pi-package",
|