@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.
Files changed (2) hide show
  1. package/README.md +44 -52
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,21 +1,32 @@
1
- # pi-claude
1
+ # @tduyng/pi-claude
2
2
 
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.
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
- ## What it costs
5
+ No token is copied and no API is called directly.
6
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.
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
- 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.
9
+ ## One warm process per session
10
10
 
11
- ## Requirements
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
- - Pi 1.4 or newer.
14
- - Claude Code 2.1.281 or newer on `PATH`.
15
- - A Claude Pro, Max, Team, or Enterprise login: run `claude auth login`.
16
- - `PI_CLAUDE_BIN` only when the binary is not named `claude`.
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
- 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.
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: `/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.
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
- ## What it sends
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
- 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.
53
+ Requirements:
51
54
 
52
- ## Cache behaviour
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
- 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.
60
+ ```sh
61
+ pi install npm:@tduyng/pi-claude
62
+ ```
55
63
 
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.
64
+ Local checkout: `pi install /path/to/dotfiles/pi/agent/extensions/pi-claude`
57
65
 
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.
66
+ The extension never reads `~/.claude/.credentials.json`, never copies OAuth tokens, and never talks to the Anthropic API directly.
59
67
 
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.
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
- ## Configure
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
- `PI_CLAUDE_BIN` names the executable when it is not `claude`:
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
- ## Install
80
+ - A model change, a thinking level change or a tool set change rebuilds the session on the next turn.
83
81
 
84
- ```sh
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
- Local checkout: `pi install /path/to/dotfiles/pi/agent/extensions/pi-claude`
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
- ## Tests
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
- ```sh
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tduyng/pi-claude",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
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",