magi-code 0.97.5

Repository-aware CLI coding agent for terminal work
Documentation
# Claude subscription

Use an installed Claude Code CLI for claude.ai access while magi-code manages tools, approvals, history, and compaction.

Setup: [Provider authentication](provider-authentication.md#claude-subscription).

## Runtime ownership

| Owner | Responsibility |
| --- | --- |
| Installed Claude CLI | Subscription login, refresh, model access and authenticated Messages requests |
| Rust provider | Projection, native process, deadlines, cancellation, ordered events and tool validation |
| One-admission relay | Forward one generation to Anthropic, replace placeholder with ordered host history, validate response |
| Host agent runner | Durable history, approvals, tools, continuation and compaction |

Each request launches installed `claude -p` with one ordinary placeholder prompt. The relay replaces its messages with the complete host conversation. There is no SDK dependency, manual assistant-input protocol, mirrored Claude session, or second credential-refresh owner. Temporary system prompt, settings and inert tool inventory live in an owner-private directory. Native session persistence is disabled.

Built-in CLI tools and skills are disabled. User/project/local settings are disabled; managed policy still applies. Strict MCP configuration exposes only the inert host inventory. Magi-code replaces the system prompt and disables native compaction. The CLI and inert MCP server share a process group, terminated on completion, failure or cancellation.

The [subscription guidance](https://support.claude.com/en/articles/15036540-use-the-claude-agent-sdk-with-your-claude-plan) permits CLI, SDK and third-party usage against subscription limits. It does not specifically certify this history-rewriting relay. API-key and alternate-backend environment overrides are removed from children, but existing subscription usage credits may still be charged. Magi-code never enables credits or changes billing settings.

## Execution and failure policy

`CLAUDE_CODE_MAX_RETRIES=0` and `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK=1` constrain native retries. They are not enforcement: the relay refuses every Messages request after the first admission. Unexpected history replacement fails before upstream I/O. Both native and restored requests are capped at 8 MiB; captured response at 16 MiB.

The CLI is launched with `--thinking-display summarized` to request provider-generated thinking summaries. They use the same live reasoning display and saved-history path as other providers. Signed thinking blocks remain intact for replay; signatures and redacted thinking payloads are never displayed. Empty or provider-hidden thinking produces no reasoning card.

Text, reasoning and usage may stream before completion. Tools and the remaining ordered suffix require:

- Valid upstream stop and usage records.
- Native assistant, result and `message_stop` records.
- Successful native exit.
- A tool name in the request's host inventory.

A completed tool-use response may end the one-turn CLI with `error_max_turns` and exit 1. Only that exact subtype with a validated upstream tool call permits exit 1. Other errors, missing terminal records and incomplete streams fail without releasing tools. Accepted partial text remains durable. A later host continuation is a new request, not a retry within the same admission.

Native lines are capped at 1 MiB and cross a bounded 16-message channel. Startup allows five minutes; configured semantic inactivity applies after progress. Upstream completion starts one fixed finalization grace interval. Each generation has a 30-minute overall limit. Diagnostics exclude raw prompts, authorization headers and native stderr.

## Context capacity

| Explicit model selection | Input ceiling |
| --- | ---: |
| Opus 4.6 and newer with `[1m]`, including `claude-opus-5-5[1m]` | 1,000,000 |
| Fable 5 and newer with `[1m]`, including `claude-fable-5[1m]` and `claude-fable-5-1[1m]` | 1,000,000 |
| All other selections, including aliases | 202,000 |

Compaction uses the same settings, context reserve, model inheritance and prompt-border display as every other provider. Defaults are an 80% automatic trigger and four compactions per run; no separate Claude controls or required alternative model. Catalog windows and native `modelUsage` cannot raise transport limits. Refresh the catalog to show extended-context variants of eligible listed models, or select one explicitly. No suffix is added automatically.

The explicit suffix matters when `ANTHROPIC_BASE_URL` points at a relay: native gateway defaults can differ from direct subscription defaults. See [Claude model configuration](https://code.claude.com/docs/en/model-config). Account entitlements still decide acceptance. Estimates are not provider token counts; token-dense input can exceed them substantially. Keep headroom. Oversize rejection uses host compaction, not a hidden model or billing fallback.

## Verification limits

The input ceilings above are enforced limits, not promises that every CLI version, account, or model accepts a full window. Native observations include successful large-history replay, tool calls, cancellation, and recovery, alongside rate-limit and retry failures.

See the [archived observations](../archive/claude-subscription-observations.md) for versions, measured token counts, failures, and the direct-CLI/SDK comparison. Those observations do not establish current billing or model access.