@tduyng/pi-claude 0.0.3 → 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 +44 -52
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,21 +1,32 @@
|
|
|
1
|
-
# pi-claude
|
|
1
|
+
# @tduyng/pi-claude
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
No tools, no prompt block, no schema
|
|
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
|
-
|
|
9
|
+
## One warm process per session
|
|
10
10
|
|
|
11
|
-
|
|
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.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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.
|
|
14
|
+
|
|
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.
|
|
18
|
+
|
|
19
|
+
## Pi's tools are the only tools
|
|
17
20
|
|
|
18
|
-
|
|
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 |
|
|
19
30
|
|
|
20
31
|
## Use
|
|
21
32
|
|
|
@@ -29,7 +40,7 @@ Inside pi:
|
|
|
29
40
|
/model claude/claude-opus-5
|
|
30
41
|
```
|
|
31
42
|
|
|
32
|
-
The provider id is `claude`, and model ids are the ones pi already uses for Anthropic:
|
|
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.
|
|
33
44
|
|
|
34
45
|
| Command | Effect |
|
|
35
46
|
| --- | --- |
|
|
@@ -37,60 +48,41 @@ The provider id is `claude`, and model ids are the ones pi already uses for Anth
|
|
|
37
48
|
| `/claude models` | Every model id |
|
|
38
49
|
| `/claude clear` | Close the warm processes |
|
|
39
50
|
|
|
40
|
-
##
|
|
41
|
-
|
|
42
|
-
| Pi | Claude Code |
|
|
43
|
-
| --- | --- |
|
|
44
|
-
| Pi system prompt | `--system-prompt-file`, replacing the default |
|
|
45
|
-
| Pi tools | An MCP server named `pi`, exposed as `mcp__pi__<tool>` |
|
|
46
|
-
| Pi tool execution | The MCP call parks until pi runs the tool, then the result resolves it |
|
|
47
|
-
| Pi compaction | `DISABLE_AUTO_COMPACT=1`, so pi decides when |
|
|
48
|
-
| Pi approvals | Every tool call returns to pi and runs there |
|
|
51
|
+
## Install
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
Requirements:
|
|
51
54
|
|
|
52
|
-
|
|
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`.
|
|
53
59
|
|
|
54
|
-
|
|
60
|
+
```sh
|
|
61
|
+
pi install npm:@tduyng/pi-claude
|
|
62
|
+
```
|
|
55
63
|
|
|
56
|
-
|
|
64
|
+
Local checkout: `pi install /path/to/dotfiles/pi/agent/extensions/pi-claude`
|
|
57
65
|
|
|
58
|
-
|
|
66
|
+
The extension never reads `~/.claude/.credentials.json`, never copies OAuth tokens, and never talks to the Anthropic API directly.
|
|
59
67
|
|
|
60
|
-
|
|
68
|
+
```sh
|
|
69
|
+
PI_CLAUDE_BIN=/home/you/.nix-profile/bin/claude pi
|
|
70
|
+
```
|
|
61
71
|
|
|
62
72
|
## Limits
|
|
63
73
|
|
|
64
74
|
- Every request counts against the subscription limits, exactly like the CLI itself.
|
|
65
|
-
- Anthropic may treat a third-party harness prompt differently from the CLI's own.
|
|
66
|
-
If a turn fails with a third-party or extra-usage message, the rejection is about the prompt shape, not the transport.
|
|
67
|
-
- One process per pi session. Subagents with a different prompt get their own, up to eight alive at once.
|
|
68
|
-
- A model change, a thinking level change, or a tool set change rebuilds the session on the next turn.
|
|
69
|
-
- Images in replayed history are attached to the replay message, and new user images are sent normally.
|
|
70
|
-
- Claude Code needs a model id it recognizes, so a brand new model may need a newer CLI than the one installed.
|
|
71
|
-
- The CLI caps MCP tool output and may move very large text to a file. Pi tools normally truncate before that cap.
|
|
72
|
-
- Usage comes from the CLI's stream events. The monetary cost is pi's API-equivalent estimate, not the subscription bill.
|
|
73
75
|
|
|
74
|
-
|
|
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.
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
```sh
|
|
79
|
-
PI_CLAUDE_BIN=/home/you/.nix-profile/bin/claude pi
|
|
80
|
-
```
|
|
78
|
+
- One process per pi session. Subagents with a different prompt get their own, up to eight alive at once.
|
|
81
79
|
|
|
82
|
-
|
|
80
|
+
- A model change, a thinking level change or a tool set change rebuilds the session on the next turn.
|
|
83
81
|
|
|
84
|
-
|
|
85
|
-
pi install npm:@tduyng/pi-claude
|
|
86
|
-
```
|
|
82
|
+
- Images in replayed history are attached to the replay message, and new user images are sent normally.
|
|
87
83
|
|
|
88
|
-
|
|
84
|
+
- Claude Code needs a model id it recognizes, so a brand new model may need a newer CLI than the one installed.
|
|
89
85
|
|
|
90
|
-
|
|
86
|
+
- The CLI caps MCP tool output and may move very large text to a file. Pi tools normally truncate before that cap.
|
|
91
87
|
|
|
92
|
-
|
|
93
|
-
bun run test -- extensions/pi-claude
|
|
94
|
-
bun run typecheck
|
|
95
|
-
bun run lint:anti-slop
|
|
96
|
-
```
|
|
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