Repository navigation
Releases
v0.9.4
On Pi 1.6.0, a connection that breaks after the request was sent is now retried. This release documents why and how to turn it off.
Changed
- Pi 1.6.0 retries Claude Native's errors that name a socket code, such as
ECONNRESETorETIMEDOUT, including a connection that broke after the request was sent. 0.9.3 said such a connection is not retried; on Pi 1.6.0 it is, the same as with Pi's own Anthropic provider. Claude Native now leaves this decision to Pi instead of wording errors to avoid it. A retry never runs a tool twice. If Anthropic had already started on the broken request, the retry can use your plan twice. To avoid such retries, setretry.enabledtofalsein Pi's settings. The decision and the measurements are in ADR 0004 (#106, #107, #108).
Maintenance
- Development dependencies moved to Pi 1.6.0 (
@earendil-works/pi-ai,@earendil-works/pi-coding-agent). The rest of Pi 1.6.0, including therender()change and default-on Anthropic message threads, needs no change in this provider. - Checked with the test suite on Pi 1.6.0 packages and with installed Pi 1.6.0 and Claude Code 2.1.327 against loopback upstreams: Pi retried a reset after sending, the retried request did not carry the failed attempt, and a
tool_usecut off by a reset never ran. - Paid measurement (18 small Claude Opus 5.5 requests, transport-measurements.md): when Anthropic saw the connection close before the response started, a later retry did not find the request's input in the cache. When the connection failed silently, as in the
read ETIMEDOUTbehind #106, or closed after the response started, Anthropic processed the request and the retry read its input from the cache. Whether plan usage counts such requests was not measured.
Pinning
To stay on this release, install npm:pi-claude-native@0.9.4, or from Git git:github.com/yamatakeru/pi-claude-native@v0.9.4. pi update does not move a pinned version or tag.
v0.9.3
Calls on a poor network connection now recover on their own instead of failing.
Fixed
- The relay gives each address of
api.anthropic.com2 seconds to connect, instead of Node's 250 ms. When IPv4 connected slowly and IPv6 was unreachable, calls failed within a second withAggregateError ETIMEDOUT during connect(#101, #104). - Pi's auto-retry now retries a connection that failed before the request was sent. Its error ends with
[upstream connect failed before the request was sent]. A connection that breaks after the request was sent is still not retried, because Anthropic may already be generating and a retry could use your plan twice. A timeout is the exception, because a silent connection is already dead. Error responses from Anthropic, such as overloaded or server errors, are retried as before (#99, #100, #102, #104).
Maintenance
- Lint findings in
src/admission.tswere cleaned up without changing behavior (#103). - No paid checks were run for this release. The changes were checked with the test suite, loopback relays, and a local reproduction of Node's address fallback on macOS. A slow IPv4 handshake on a real poor network, and Pi's auto-retry running end to end on these errors, were not reproduced.
Pinning
To stay on this release, install npm:pi-claude-native@0.9.3, or from Git git:github.com/yamatakeru/pi-claude-native@v0.9.3. pi update does not move a pinned version or tag.
v0.9.2
Pi's cache warming now follows the 1-hour prompt cache Claude Code writes, a revoked access token recovers without starting Claude Code by hand, and error messages say what to do next.
Changed
- Refusal errors show the reason and category Anthropic gives, and the request id. Logged-out errors name the
claudecommand and config directory Pi used. A rejection for third-party use points to thePI_CLAUDE_NATIVE_ENTRYPOINTfallback in troubleshooting (#92, #95). - A request without tools, such as a compaction summary, no longer starts the inert MCP helper, so it finishes about 0.1 s sooner. The request sent to Anthropic is unchanged (#93, #97).
- The README lists a known upstream issue: text Claude writes before a tool call often arrives as thinking that paraphrases it, so Pi shows it as thinking (#90, #95).
Fixed
- Models declare the prompt cache lifetime Claude Code actually writes, 1 hour by default. Pi assumed 5 minutes and scheduled a cache refresh 4.5 minutes after each request. A refresh could also fail, because a one-token reply that ended in thinking was reported as an error; it now ends as
length. The design is recorded in ADR 0003 (#89, #94). - After a 401
authentication_error, such as a revoked access token, Claude Code refreshes its login and sends the request again. That one retry is now let through instead of every turn failing until Claude Code is started interactively (#91, #96).
Maintenance
- This is the first release staged on npm by the Release workflow through trusted publishing; it goes live after approval with 2FA (maintaining guide).
- No paid checks were run for this release. The changes were checked with the test suite and with Claude Code 2.1.322 against a loopback upstream. The real API's answer to a one-token cache refresh and the retry after a revoked access token were not reproduced.
Pinning
To stay on this release, install npm:pi-claude-native@0.9.2, or from Git git:github.com/yamatakeru/pi-claude-native@v0.9.2. pi update does not move a pinned version or tag.
v0.9.1
Claude Native is now published on npm as pi-claude-native and can be installed with pi install npm:pi-claude-native. Nothing else changed.
Changed
- To move a Git installation to npm, run
pi remove git:github.com/yamatakeru/pi-claude-native, thenpi install npm:pi-claude-native. Installing from both loads the extension twice. For a project installation (pi install -l), add-lto both commands. The provider id is unchanged, so saved sessions continue.
Maintenance
- 0.9.1 was published to npm by hand from the release commit. Later releases are staged on npm by the new Release workflow through trusted publishing and go live after approval with 2FA (#88, maintaining guide).
- The code is the same as 0.9.0, so no paid checks were run for this release.
Pinning
To stay on this release, install npm:pi-claude-native@0.9.1, or from Git git:github.com/yamatakeru/pi-claude-native@v0.9.1. pi update does not move a pinned version or tag.
v0.9.0
Checked with Pi 1.5.2 and Claude Code 2.1.322. /model lists the models your account can use, and changing the thinking level during a session keeps the prompt cache.
Changed
- The model list comes from the picker Claude Code serves your account, so
/modelalso shows the older models the account still runs and thefablealias. To get that picker, discovery talks to Anthropic directly with Claude Code's nonessential traffic and feature flags left on; error reports and self-updates stay off, and a value you export is kept. Discovery never starts a model turn. BehindANTHROPIC_BASE_URLor another backend it keeps the generic list (#57, #84). - The
pi-claude-native/metadiagnostic keeps the upstream HTTP status asupstreamStatus, so a saved session shows whether a failed turn was, for example, a 429 or a 400 (#64, #83).
Fixed
- Changing the thinking level during a session no longer makes the next request miss the whole prompt cache, on models where Claude Code states the effort per turn. Each earlier turn's level is stated where Claude Code places it in its own sessions, and
nativeContextreportsturnEffortsPlaced. The design is recorded in ADR 0002 (#5, #85). - On Windows,
PI_CLAUDE_NATIVE_ENTRYPOINTis read under any letter case instead of being ignored (#29, #83).
Maintenance
- Paid checks for this release used Pi 1.5.2 and Claude Code 2.1.322.
- Discovery: a request each on Haiku 4.5 and Sonnet 5 through models listed from the served picker. A real handshake listed 14 picker rows, and stdout carried only
control_response. - Thinking-level change: two runs on Haiku 5.5 at high, high, medium in one session, the second with signed thinking in every reply. In both, the third request read from the cache everything the second request had read and written.
- An existing
openai-codex/gpt-6.1-solsession (18 assistant turns) continued on Claude Native. - Warm cache was not re-run. The README's pinned Claude Code version stays 2.1.322.
- Discovery: a request each on Haiku 4.5 and Sonnet 5 through models listed from the served picker. A real handshake listed 14 picker rows, and stdout carried only
executeCallwas split intorequest-plan.ts,native-output.tsandcompletion.ts, and the provider tests run through one offline harness (#79, #82).- The plan-usage weighting of SDK client labels (anthropics/claude-code#97074) is still open with no response from Anthropic, so the custom client label and the replacement
<docs>section stay.
Pinning
To stay on this release, install git:github.com/yamatakeru/pi-claude-native@v0.9.0. pi update does not move a pinned tag.
v0.8.0
Checked with Pi 1.5.2 and Claude Code 2.1.322 (a fresh request, and a session written by another provider continued on Claude Native). Replay now accepts every history that Pi's own Anthropic provider can send. Switching models during a session, extensions that edit the history, and side requests such as an advisor no longer fail replay.
Changed
- Parts of a history that Claude cannot take natively are adjusted without losing content, and each adjustment is listed under
replayAdjustmentsin thepi-claude-native/metadiagnostic. The rule is recorded in ADR 0001 (#76, #78).
Fixed
- A request that declares fewer tools than the history used no longer fails with "Tool call outside the current inventory". This covers a tool-less side request, a session that started on another provider, and a removed tool on a model without mid-conversation tool changes. Those calls and their results are replayed as text (#72, #73).
- An assistant turn with nothing left to send is omitted instead of failing with "Empty assistant message cannot be replayed". For example, an advisor called with no text before it leaves such a turn (#74, #78).
- A tool call left without a result, as after a failed or interrupted turn, gets the result
No result providedinstead of making the request invalid. A result that arrives after a user message is kept as text (#75, #78). - Pi's docs section is replaced in every request, including sessions that started on another provider and side requests made while another model is active (#28, #77).
Maintenance
- An end-to-end test now checks that fresh tool calls are emitted, and that a tool outside the active tools is rejected. It runs through a shared offline harness,
tests/support/native.ts(#80). SplittingexecuteCalland moving the other tests to that harness are tracked in #79. - Paid checks for this release used Pi 1.5.2 and Claude Code 2.1.322: a fresh request, and an existing
openai-codex/gpt-6.1-solsession continued on Claude Native. Warm cache was not re-run. The README's pinned Claude Code version stays 2.1.318. - Replay was compared with v0.7.1 on ten existing Claude Native sessions: 800 cases sampled at 40 request points per session, under both declared and current tool sets. Every case produced identical frames, so existing sessions keep their prompt cache.
- The design is recorded in ADR 0001 and the new GLOSSARY.md.
Pinning
To stay on this release, install git:github.com/yamatakeru/pi-claude-native@v0.8.0. pi update does not move a pinned tag.
v0.7.1
Fixes a prompt-cache miss on Fable 5.1 that rewrote the whole conversation whenever a tool-result step and a new user turn alternated.
Fixed
- On Fable 5.1, switching between a tool-result step and a new user turn no longer writes the whole conversation to the prompt cache again. On tool-result steps Claude Code sends a batching reminder after the date line, and the date was then left out of the start of the conversation. The same applies on any model where Anthropic turns that reminder on (#41, #70).
Maintenance
- The fix follows Hermes (hermes-official-plugins#253). It was checked offline against Claude Code 2.1.322 with a loopback capture on Fable 5.1, Fable 5.2 and Opus 5.5; no paid checks were repeated for this release, and the README's pinned Claude Code version stays 2.1.318.
- The alternative of taking the date out of the environment message, which would also keep the cache across date changes, is tracked in #69.
Pinning
To stay on this release, install git:github.com/yamatakeru/pi-claude-native@v0.7.1. pi update does not move a pinned tag.
v0.7.0
Checked with Pi 1.5.0 and Claude Code 2.1.318 (startup, a fresh request, warm cache and replayed thinking). An ANTHROPIC_API_KEY set for Pi's own Anthropic provider no longer blocks Claude Native, and on models that support them, mid-conversation tool changes work again and keep the cache when a tool is redefined.
Changed
- API credentials in Pi's environment (
ANTHROPIC_API_KEY,ANTHROPIC_AUTH_TOKEN,ANTHROPIC_FOUNDRY_API_KEY) are left out of Claude Code instead of refusing every turn, so Claude Code always signs in with your subscription (#55, #65). Backend overrides such asANTHROPIC_BASE_URLare still refused. - On models that support mid-conversation tool changes, a tool redefined under the same name no longer makes the next request miss the whole cache. Later tools are now sent by value, as Pi's own Anthropic provider does (#56, #66).
Fixed
- Mid-conversation tool changes were turned off, with a warning on every catalog refresh, after Anthropic reworded the page that lists the supported models (#51, #59).
- A reply cut off at the output limit inside a tool call no longer fails with a JSON error. The turn ends as
lengthwhen the reply already has text or another call; otherwise the error names the tool that was cut off (#52, #60). - When a failed upstream request makes Claude Code end without a result, for example at a usage limit, the error shows Anthropic's reason instead of "Expected exactly one native result" (#54, #62).
Maintenance
- The upstream watch script takes the tracker issue's number from
gh issue create, and saves its state only after the comment is posted, so a failed first run no longer loses the items it found (#53, #61). - The paid checks in
docs/testing.mdwere repeated on Pi 1.5.0 with Claude Code 2.1.318, and the README's pinned Claude Code version is now 2.1.318 (#58, #67).
Pinning
To stay on this release, install git:github.com/yamatakeru/pi-claude-native@v0.7.0. pi update does not move a pinned tag.
v0.6.0
Verified with Pi 1.5.0 and Claude Code 2.1.316. Sessions saved by pi-claude-directsdk no longer replay their signed thinking.
Changed
- The prose that replaces Pi's
<docs>section again says that the codemode guide covers classifiers and image models, and that Pi's docs are needed only for questions about Pi itself. Both were in Pi's section but had been dropped (#47). - Pi shows this changelog on the first fresh launch after an update (#48).
Removed
- Signed thinking saved by pi-claude-directsdk (carrier type
pi-claude-directsdk/native) is no longer restored, as announced in 0.4.0. Such sessions still continue: their earlier turns replay as the visible text and tool calls, without the thinking.
Maintenance
- Types are checked against Pi 1.5.0: the devDependencies pin
@earendil-works/pi-aiand@earendil-works/pi-coding-agent1.5.0, and the local type stub is gone. The offline model snapshot is restored as chat models only, matching Pi's store type since 1.4.0 (#46). - The paid checks in
docs/testing.mdwere repeated on Pi 1.5.0 with Claude Code 2.1.316, and the README's pinned Claude Code version is now 2.1.316 (#47).
Pinning
To stay on this release, install git:github.com/yamatakeru/pi-claude-native@v0.6.0. pi update does not move a pinned tag.
v0.5.0
Replayed thinking now reaches the model, and the cache keeps the conversation after long thinking loops.
Changes
- Signed thinking from earlier turns is sent again (#42, #43). Through v0.4.0 the extension restored it from the session but Claude Code dropped it before the request, so in a tool loop the model did not see its earlier reasoning. The restored assistant message now keeps the model that wrote it.
- After a tool loop longer than the cache lookback, the next user turn reads the conversation before the loop from the cache instead of only the system prompt and tools (#10, #44). The relay keeps one extra cache marker at the start of the finished turn, within the API's limit of four. This applies now that thinking is replayed.
What to expect
Requests in tool loops now carry the earlier thinking, so their input grows by those tokens. Those tokens are part of the previous request, so after the first write they are mostly read from the cache. The model has less reason to work out the same steps again. The net effect on subscription usage has not been measured. The turn-start marker has been checked against real Claude Code request shapes but has no paid cache measurement here yet; the Hermes reference reported the next turn's cache read rising from 54% to 94%.
Maintenance
- The daily
Upstream watchworkflow is enabled. It reports Claude Code issues that mention identifiers this extension depends on, now including the setting that decides whether replayed thinking is sent (CLAUDE_CODE_RUSTLING_PIXEL). - #41 tracks a Fable-only cache issue reported for the Hermes reference; it is not handled yet.
Pinning
To stay on this release, install git:github.com/yamatakeru/pi-claude-native@v0.5.0. pi update does not move a pinned tag.