Luigit
repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

extensions/klaus/README.md

Raw
Rendered preview

klaus

Exposes every current Claude model from Pi's Anthropic catalog as a Pi provider through Anthropic's Claude Agent SDK. Dated snapshot ids stay hidden; new catalog models appear without klaus changes. Pi remains responsible for context, tools, compaction, hooks, and UI.

Install / load

Klaus is loaded through the root pi-ext package. Log in to Anthropic through Pi, then select a klaus/* model.

Klaus uses Anthropic's proprietary Claude Agent SDK and native Claude Code runtime under Anthropic's commercial terms. It accepts only Pi-managed Anthropic OAuth.

On Termux Android ARM64, Klaus installs the exact matched Linux ARM64 runtime into user state and launches it through glibc-runner. Install the runner with pkg install glibc-repo && pkg install glibc-runner.

Behavior

Persisted primary Pi sessions mirror opaque Claude cache entries under .klaus/ in the configured Pi session directory. Klaus does not use normal ~/.claude sessions. The plaintext cache duplicates conversation data, uses private file permissions, and grows until manually removed.

Klaus forwards Pi tools to Claude without changing their names, descriptions, order, or schemas. Required JSON-schema constrained sampling is rejected.

When a cached resume point is invalid or corrupted, Klaus replays canonical visible conversation history. Replay excludes private reasoning, signatures, usage accounting, timestamps, and tool-result details.

Reported cost is API-equivalent spend calculated with Pi's Anthropic rates, not the subscription charge. Fable may consume separate usage credits and warns before first use in each Pi session.

Commands / tools / settings

  • Slash command: /klaus-setup-token mints a long-lived Claude OAuth token with your Claude subscription, natively inside Pi. In the TUI the whole visit runs in one animated Bureau of Tokens counter: it opens the sign-in page in the browser, shows a live link (c copies it) and code field, exchanges the pasted code, copies the token to the clipboard, and stamps APPROVED or DENIED in place (r retries, Esc cancels). The counter is sized to the terminal in three width tiers and prints the token when no clipboard tool is available. Outside the TUI it falls back to a plain input dialog and notifications.
  • Global ~/.pi/agent/settings.json setting: "pi-ext": { "debug": true } enables private Klaus JSONL diagnostics after Pi restarts. Use "debug": "klaus" or "debug": ["klaus"] to select Klaus only. PI_KLAUS_DEBUG=1|0 overrides that setting when set before Pi starts. Files are per-process under the OS user log directory, capped at 8 MiB, and contain only safe metadata. See the debug contract; remove logs manually when no longer needed.
  • Tools and hooks: none registered by the extension.

Historical design: /system view PX-RESEARCH-F52C8906. Current behavior is defined here and in source.

# klaus

Exposes every current Claude model from Pi's Anthropic catalog as a Pi provider through Anthropic's Claude Agent SDK.
Dated snapshot ids stay hidden; new catalog models appear without klaus changes.
Pi remains responsible for context, tools, compaction, hooks, and UI.

## Install / load

Klaus is loaded through the [root pi-ext package](../../README.md).
Log in to Anthropic through Pi, then select a `klaus/*` model.

Klaus uses Anthropic's proprietary Claude Agent SDK and native Claude Code runtime under Anthropic's commercial terms.
It accepts only Pi-managed Anthropic OAuth.

On Termux Android ARM64, Klaus installs the exact matched Linux ARM64 runtime into user state and launches it through `glibc-runner`.
Install the runner with `pkg install glibc-repo && pkg install glibc-runner`.

## Behavior

Persisted primary Pi sessions mirror opaque Claude cache entries under `.klaus/` in the configured Pi session directory.
Klaus does not use normal `~/.claude` sessions.
The plaintext cache duplicates conversation data, uses private file permissions, and grows until manually removed.

Klaus forwards Pi tools to Claude without changing their names, descriptions, order, or schemas.
Required JSON-schema constrained sampling is rejected.

When a cached resume point is invalid or corrupted, Klaus replays canonical visible conversation history.
Replay excludes private reasoning, signatures, usage accounting, timestamps, and tool-result details.

Reported cost is API-equivalent spend calculated with Pi's Anthropic rates, not the subscription charge.
Fable may consume separate usage credits and warns before first use in each Pi session.

## Commands / tools / settings

- Slash command:
  `/klaus-setup-token` mints a long-lived Claude OAuth token with your Claude subscription, natively inside Pi.
  In the TUI the whole visit runs in one animated Bureau of Tokens counter: it opens the sign-in page in the browser, shows a live link (`c` copies it) and code field, exchanges the pasted code, copies the token to the clipboard, and stamps `APPROVED` or `DENIED` in place (`r` retries, Esc cancels).
  The counter is sized to the terminal in three width tiers and prints the token when no clipboard tool is available.
  Outside the TUI it falls back to a plain input dialog and notifications.
- Global `~/.pi/agent/settings.json` setting:
  `"pi-ext": { "debug": true }` enables private Klaus JSONL diagnostics after Pi restarts.
  Use `"debug": "klaus"` or `"debug": ["klaus"]` to select Klaus only.
  `PI_KLAUS_DEBUG=1|0` overrides that setting when set before Pi starts.
  Files are per-process under the OS user log directory, capped at 8 MiB, and contain only safe metadata.
  See the [debug contract](../DEBUG.md); remove logs manually when no longer needed.
- Tools and hooks:
  none registered by the extension.

Historical design: `/system view PX-RESEARCH-F52C8906`.
Current behavior is defined here and in source.