@tduyng/pi-claude 0.0.1 → 0.0.3
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 +49 -40
- package/package.json +2 -2
- package/src/session.ts +1 -1
package/README.md
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
# pi-claude
|
|
2
2
|
|
|
3
|
-
Claude Pro
|
|
3
|
+
Your Claude Pro or Max subscription, inside pi. The official Claude Code CLI is the transport, and pi keeps the prompt, the tools, the approvals, the compaction, and the session tree.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## What it costs
|
|
6
|
+
|
|
7
|
+
No tools, no prompt block, no schema. It is a model provider, so it adds nothing to the context and nothing to the cold start.
|
|
8
|
+
|
|
9
|
+
The saving is the subscription itself. One warm process per session, streaming, means a normal turn writes only the new user message to stdin instead of replaying the conversation, and the prompt cache stays intact between turns.
|
|
6
10
|
|
|
7
11
|
## Requirements
|
|
8
12
|
|
|
9
13
|
- Pi 1.4 or newer.
|
|
10
14
|
- Claude Code 2.1.281 or newer on `PATH`.
|
|
11
|
-
- A Claude Pro, Max, Team or Enterprise login: run `claude auth login`.
|
|
15
|
+
- A Claude Pro, Max, Team, or Enterprise login: run `claude auth login`.
|
|
12
16
|
- `PI_CLAUDE_BIN` only when the binary is not named `claude`.
|
|
13
17
|
|
|
14
|
-
This extension never reads `~/.claude/.credentials.json`, never copies OAuth tokens, and never talks to the Anthropic API directly. Authentication and billing stay with the
|
|
15
|
-
|
|
16
|
-
## Install
|
|
17
|
-
|
|
18
|
-
```sh
|
|
19
|
-
pi install /path/to/extensions/pi-claude
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
For this repository the workspace already registers the extension in the root `package.json`.
|
|
18
|
+
This extension never reads `~/.claude/.credentials.json`, never copies OAuth tokens, and never talks to the Anthropic API directly. Authentication and billing stay with the CLI.
|
|
23
19
|
|
|
24
20
|
## Use
|
|
25
21
|
|
|
@@ -27,57 +23,70 @@ For this repository the workspace already registers the extension in the root `p
|
|
|
27
23
|
pi --provider claude --model claude-opus-5
|
|
28
24
|
```
|
|
29
25
|
|
|
30
|
-
Inside
|
|
26
|
+
Inside pi:
|
|
31
27
|
|
|
32
28
|
```text
|
|
33
29
|
/model claude/claude-opus-5
|
|
34
30
|
```
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
The provider id is `claude`, and model ids are the ones pi already uses for Anthropic: `/model claude/claude-opus-5` and `/model 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
|
+
|
|
34
|
+
| Command | Effect |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `/claude status` | Binary, login, MCP port, live processes |
|
|
37
|
+
| `/claude models` | Every model id |
|
|
38
|
+
| `/claude clear` | Close the warm processes |
|
|
37
39
|
|
|
38
40
|
## What it sends
|
|
39
41
|
|
|
40
|
-
| Pi
|
|
41
|
-
|
|
|
42
|
-
| Pi system prompt
|
|
43
|
-
| Pi tools
|
|
44
|
-
| Pi tool execution | MCP call
|
|
45
|
-
| Pi compaction
|
|
46
|
-
| Pi approvals
|
|
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 |
|
|
47
49
|
|
|
48
|
-
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 are disabled with flags and environment variables.
|
|
50
|
+
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 are disabled with flags and environment variables.
|
|
49
51
|
|
|
50
|
-
##
|
|
52
|
+
## Cache behaviour
|
|
51
53
|
|
|
52
|
-
One
|
|
54
|
+
One process runs per pi session with `--input-format stream-json`. A normal turn writes only the new user message. 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 is respawned, nothing is replayed, and the cached prefix survives.
|
|
53
55
|
|
|
54
|
-
`--resume` is not used. 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
|
|
56
|
+
`--resume` is not used. 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.
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
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.
|
|
57
59
|
|
|
58
|
-
When
|
|
60
|
+
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 process is replaced and the existing conversation is replayed once as a single user message. That one turn is a cold cache, and later turns are warm again.
|
|
59
61
|
|
|
60
|
-
##
|
|
62
|
+
## Limits
|
|
61
63
|
|
|
62
|
-
- Every request counts against the
|
|
63
|
-
- Anthropic may treat a third-party harness prompt differently from
|
|
64
|
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
- Claude Code
|
|
69
|
-
-
|
|
64
|
+
- 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.
|
|
70
73
|
|
|
71
|
-
##
|
|
74
|
+
## Configure
|
|
72
75
|
|
|
73
|
-
|
|
74
|
-
| --------------- | ----------------------------------------- |
|
|
75
|
-
| `PI_CLAUDE_BIN` | Claude Code executable. Default `claude`. |
|
|
76
|
+
`PI_CLAUDE_BIN` names the executable when it is not `claude`:
|
|
76
77
|
|
|
77
78
|
```sh
|
|
78
79
|
PI_CLAUDE_BIN=/home/you/.nix-profile/bin/claude pi
|
|
79
80
|
```
|
|
80
81
|
|
|
82
|
+
## Install
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
pi install npm:@tduyng/pi-claude
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Local checkout: `pi install /path/to/dotfiles/pi/agent/extensions/pi-claude`
|
|
89
|
+
|
|
81
90
|
## Tests
|
|
82
91
|
|
|
83
92
|
```sh
|
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.3",
|
|
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",
|