Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,30 @@ All notable changes to this project are documented here. The format is based on
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.9.0] - 2026-10-27

### Added
- Every Claude model in OMP's bundled Anthropic catalog is registered, instead of
a hardcoded list: Opus 5.5, Opus 5, Sonnet 5.5, Haiku 5.5, Fable 5.1,
Mythos 5 / 5.1, Opus 4.5 and Sonnet 4.5 are now available, and future catalog
models appear without a code change. Dated snapshot aliases stay hidden.
- Opus 5.5 / Opus 5 / Sonnet 5.5 default to 1M (`[1m]`) with a `-200k` alternate.
Unmeasured 1M-capable models default to 200K with a `-1m` alternate.
- `max` thinking level, for both the provider and AskClaude's `thinking` parameter.

### Changed
- Thinking levels map onto each model's catalog effort ladder (e.g. `xhigh`
stays `xhigh` on Opus 5.5), clamping down where a level is unsupported.
- AskClaude `opus` / `sonnet` / `haiku` shortcuts resolve to the newest model in
that family.
- OMP 18 compatibility: imports go through the host-shimmed `@earendil-works/*`
packages.

### Fixed
- Unsuffixed picker entries whose preferred window has no runtime (Haiku 4.5
under `"1m"`, Opus 4.7 under `"200k"`) no longer throw on request; they use
the model's only window, matching what the picker shows.

## [0.8.1] - 2026-07-07

### Fixed
Expand Down
50 changes: 34 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

---

`omp-claude-bridge` lets you drive **Claude Code** — Opus, Sonnet, Haiku, and Fable — from inside Oh My Pi, with every tool call flowing through OMP's native TUI. It also exposes an **AskClaude** tool so any other provider can delegate a task or a second opinion to Claude Code, and it gives you **direct control over the context window** each model requests.
`omp-claude-bridge` lets you drive **Claude Code** — every Claude model in OMP's catalog (Opus, Sonnet, Haiku, Fable, Mythos) — from inside Oh My Pi, with every tool call flowing through OMP's native TUI. It also exposes an **AskClaude** tool so any other provider can delegate a task or a second opinion to Claude Code, and it gives you **direct control over the context window** each model requests.

Authentication and billing run through Claude Code and your Anthropic subscription via the official [Claude Agent SDK](https://github.com/anthropics/claude-agent-sdk-typescript) — this extension never stores credentials.

Expand All @@ -45,12 +45,12 @@ Authentication and billing run through Claude Code and your Anthropic subscripti

## Features

- **Claude Code as a provider** — pick Opus / Sonnet / Haiku / Fable from `/model`; tool calls render in OMP's TUI like any native provider.
- **Claude Code as a provider** — pick any Claude model (Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.1, …) from `/model`; tool calls render in OMP's TUI like any native provider.
- **AskClaude delegation tool** — from any other provider, hand a task or question to Claude Code (read-only, no-tools, or full read/write/bash), optionally in an isolated session.
- **Switchable context window** — force **1M** or **200K** globally, or leave it on measured per-model defaults. This is the headline addition in this fork.
- **Session resume & persistence** — conversations survive across turns and reconnects.
- **Skills + AGENTS.md forwarding** — your OMP skills and context files are passed into Claude Code's system prompt.
- **Thinking support** — effort levels map through to Claude Code, including `xhigh` on Sonnet models.
- **Thinking support** — effort levels map through to Claude Code, clamped to each model's effort ladder, including `xhigh` and `max`.
- **MCP tool bridging** with strict-config isolation by default.

## Install
Expand Down Expand Up @@ -114,18 +114,30 @@ Both windows stay in the picker regardless of this setting (wherever a runtime e

### Windows offered per model

Every Claude model in OMP's bundled Anthropic catalog is registered automatically — new releases show up without a code change.

| Model | 200K entry | 1M entry | `auto` default |
| ----- | :--------: | :------: | :------------: |
| `claude-fable-5-1` | ✓ | ✓ | 200K |
| `claude-fable-5` | ✓ | ✓ | 200K |
| `claude-mythos-5-1` | ✓ | ✓ | 200K³ |
| `claude-mythos-5` | ✓ | ✓ | 200K³ |
| `claude-opus-5-5` | ✓ | ✓ | 1M |
| `claude-opus-5` | ✓ | ✓ | 1M |
| `claude-opus-4-8` | ✓ | ✓ | 1M |
| `claude-opus-4-7` | — | ✓ | 1M |
| `claude-opus-4-6` | ✓ | ✓ | 200K¹ |
| `claude-fable-5` | ✓ | ✓ | 200K |
| `claude-opus-4-5` | ✓ | — | 200K |
| `claude-sonnet-5-5` | ✓ | ✓ | 1M |
| `claude-sonnet-5` | ✓ | ✓ | 1M |
| `claude-sonnet-4-6` | ✓ | ✓ | 200K² |
| `claude-sonnet-4-5` | ✓ | — | 200K |
| `claude-haiku-5-5` | ✓ | ✓ | 200K³ |
| `claude-haiku-4-5` | ✓ | — | 200K |

¹ Opus 4.6's `auto` default is 1M when `plan: "max"` or `longContextExtraUsage: true`.
² Sonnet 4.6's `auto` default is 1M when `longContextExtraUsage: true`.
³ Not yet measured: models without a measured `[1m]` entitlement default to the bare id at 200K (an unentitled `[1m]` request fails outright). The 1M entry is still pickable. Catalog models not listed here follow the same rule: 1M offered when the catalog advertises it.

The suffixed alternate exists only for the window that isn't the default — e.g. under `auto` you get `claude-opus-4-8` (1M) + `claude-opus-4-8-200k`, and under `"200k"` you get `claude-opus-4-8` (200K) + `claude-opus-4-8-1m`.

Expand All @@ -139,19 +151,25 @@ Pick any of these from `/model` — each entry shows a `(1M)` or `(200K)` label.

| Picker id (auto) | Window |
| --------- | ------ |
| `claude-bridge/claude-fable-5` | 200K |
| `claude-bridge/claude-fable-5-1m` | 1M |
| `claude-bridge/claude-opus-4-8` | 1M |
| `claude-bridge/claude-opus-4-8-200k` | 200K |
| `claude-bridge/claude-fable-5-1` / `-1m` | 200K / 1M |
| `claude-bridge/claude-fable-5` / `-1m` | 200K / 1M |
| `claude-bridge/claude-mythos-5-1` / `-1m` | 200K / 1M |
| `claude-bridge/claude-mythos-5` / `-1m` | 200K / 1M |
| `claude-bridge/claude-opus-5-5` / `-200k` | 1M / 200K |
| `claude-bridge/claude-opus-5` / `-200k` | 1M / 200K |
| `claude-bridge/claude-opus-4-8` / `-200k` | 1M / 200K |
| `claude-bridge/claude-opus-4-7` | 1M |
| `claude-bridge/claude-opus-4-6` | 200K (1M on Max / Extra Usage) |
| `claude-bridge/claude-opus-4-6-1m` | 1M |
| `claude-bridge/claude-sonnet-5` | 1M (supports `xhigh`) |
| `claude-bridge/claude-sonnet-5-200k` | 200K |
| `claude-bridge/claude-sonnet-4-6` | 200K (supports `xhigh`) |
| `claude-bridge/claude-sonnet-4-6-1m` | 1M |
| `claude-bridge/claude-opus-4-6` / `-1m` | 200K (1M on Max / Extra Usage) / 1M |
| `claude-bridge/claude-opus-4-5` | 200K |
| `claude-bridge/claude-sonnet-5-5` / `-200k` | 1M / 200K |
| `claude-bridge/claude-sonnet-5` / `-200k` | 1M / 200K |
| `claude-bridge/claude-sonnet-4-6` / `-1m` | 200K / 1M |
| `claude-bridge/claude-sonnet-4-5` | 200K |
| `claude-bridge/claude-haiku-5-5` / `-1m` | 200K / 1M |
| `claude-bridge/claude-haiku-4-5` | 200K (cheapest) |

Thinking levels follow each model's effort ladder from the catalog, including `max`; a level a model lacks is clamped to the highest one it supports.

Bash commands issued by Claude Code get a 120-second default timeout (matching Claude Code's default), since OMP's bash has no timeout by default.

## AskClaude tool
Expand All @@ -172,8 +190,8 @@ You can also bake it into a skill or AGENTS.md, e.g. *"Always call AskClaude to
| --------- | ------ | ----------- |
| `prompt` | string | The question or task for Claude Code. |
| `mode` | `read` (default), `none`, `full` | `read` = read files + web; `full` = read/write/bash. Lock `full` out with `allowFullMode: false`. |
| `model` | `opus` (default), `sonnet`, `haiku`, or a full id | Which Claude model handles the delegation. |
| `thinking` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh` | Effort level. |
| `model` | `opus` (default), `sonnet`, `haiku`, or a full id | Which Claude model handles the delegation. Family shortcuts resolve to the newest model (e.g. `opus` → `claude-opus-5-5`). |
| `thinking` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max` | Effort level. |
| `isolated` | boolean (default `false`) | When `true`, Claude gets a clean session with no conversation history. |

## Configuration reference
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "omp-claude-bridge",
"version": "0.8.1",
"version": "0.9.0",
"private": false,
"description": "Oh My Pi extension that runs Claude Code (via the Claude Agent SDK) as a model provider, adds an AskClaude delegation tool, and lets you force the 1M / 200K context window per provider.",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import type { SettingSource } from "@anthropic-ai/claude-agent-sdk";
import type { ContextWindowMode } from "./models.js";
import { CONFIG_DIR_NAME } from "@oh-my-pi/pi-utils";
import { CONFIG_DIR_NAME } from "@earendil-works/pi-coding-agent";
import { existsSync, readFileSync } from "fs";
import { homedir } from "os";
import { join } from "path";
Expand Down
2 changes: 1 addition & 1 deletion src/convert.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Pure pi→Anthropic message conversion helpers.
// Extracted so they can be tested without pulling in the full extension runtime.

import type { Message as PiMessage } from "@oh-my-pi/pi-coding-agent/extensibility/legacy-pi-ai-shim";
import type { Message as PiMessage } from "@earendil-works/pi-ai";
import type { Message as SessionMessage } from "cc-session-io";
import { pascalCase } from "change-case";

Expand Down
39 changes: 14 additions & 25 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import { StringEnum, Type, getModels, type AssistantMessage, type AssistantMessageEventStream, type Context, type Model, type SimpleStreamOptions, type Tool, type Usage } from "@oh-my-pi/pi-coding-agent/extensibility/legacy-pi-ai-shim";
import * as piAi from "@oh-my-pi/pi-coding-agent/extensibility/legacy-pi-ai-shim";
import { type ExtensionAPI, type ExtensionUIContext } from "@oh-my-pi/pi-coding-agent";
import { keyHint } from "@oh-my-pi/pi-coding-agent/modes/components/keybinding-hints";
import { buildSessionContext } from "@oh-my-pi/pi-coding-agent/session/session-context";
import type { CompactionEntry } from "@oh-my-pi/pi-coding-agent/session/session-entries";
import { compact } from "@oh-my-pi/pi-agent-core/compaction";
import { StringEnum, type AssistantMessage, type AssistantMessageEventStream, type Context, type Model, type SimpleStreamOptions, type Tool, type Usage } from "@earendil-works/pi-ai";
import * as piAi from "@earendil-works/pi-ai";
import { getModels } from "@earendil-works/pi-ai/compat";
import { buildSessionContext, compact, keyHint, type CompactionEntry, type ExtensionAPI, type ExtensionUIContext } from "@earendil-works/pi-coding-agent";
import { createSdkMcpServer, query, type EffortLevel, type SDKMessage, type SDKUserMessage, type SettingSource } from "@anthropic-ai/claude-agent-sdk";
import type { Base64ImageSource, ContentBlockParam, MessageParam } from "@anthropic-ai/sdk/resources";
import { Text } from "@oh-my-pi/pi-tui";
import { Type } from "typebox";
import { Text } from "@earendil-works/pi-tui";
import { createSession, deleteSession, repairToolPairing } from "cc-session-io";
import { appendFileSync, mkdirSync, realpathSync, statSync } from "fs";
import { homedir } from "os";
import { dirname, join } from "path";
import { PROVIDER_ID, messageContentToText, convertPiMessages } from "./convert.js";
import { buildVariantModels, buildModels, claudeCodeModelId, type ContextWindowMode, type LongContextSettings, resolveModel as _resolveModel } from "./models.js";
import { buildVariantModels, buildModels, claudeCodeEffort, claudeCodeModelId, type ContextWindowMode, type LongContextSettings, resolveModel as _resolveModel } from "./models.js";
import { MCP_SERVER_NAME, MCP_TOOL_PREFIX, extractSkillsBlock } from "./skills.js";
import { verifyWrittenSession as _verifyWrittenSession } from "./session-verify.js";
import { extractAllToolResults as _extractAllToolResults, type McpResult } from "./extract-tool-results.js";
Expand Down Expand Up @@ -784,13 +782,6 @@ function logServedContextWindow(label: string, message: SDKMessage, model: Model
}
}

// --- Effort level mapping ---
// OMP reasoning levels → CC SDK effort levels

const REASONING_TO_EFFORT: Record<string, EffortLevel> = {
minimal: "low", low: "low", medium: "medium", high: "high", xhigh: "max",
};

// --- Provider helpers: misc ---

function mapStopReason(reason: string | undefined): "stop" | "length" | "toolUse" {
Expand Down Expand Up @@ -1235,12 +1226,10 @@ function streamClaudeAgentSdk(model: Model<any>, context: Context, options?: Sim
const strictMcpConfigEnabled = providerSettings.strictMcpConfig !== false;
const claudeExecutable = providerSettings.pathToClaudeCodeExecutable;

// Prefer the model's own thinkingLevelMap when present (pi-ai 0.72+ ships
// per-model overrides — e.g. opus-4-7 wants xhigh→xhigh, not xhigh→max).
// Fall back to our generic table for older pi-ai or unmapped levels.
const effort = options?.reasoning
? ((model as any).thinkingLevelMap?.[options.reasoning] as EffortLevel | undefined)
?? REASONING_TO_EFFORT[options.reasoning]
// OMP reasoning level → CC effort, clamped to the model's catalog effort ladder
// (see claudeCodeEffort; thinkingLevelMap overrides win).
const effort: EffortLevel | undefined = options?.reasoning
? claudeCodeEffort(model as any, options.reasoning)
: undefined;

// cliModel is the actual id sent to Claude Code (may carry [1m]); model.id is the
Expand Down Expand Up @@ -1485,8 +1474,8 @@ async function promptAndWait(
? extractSkillsBlock(options.systemPrompt) : undefined;

// Effort
const effort = options?.thinking && options.thinking !== "off"
? REASONING_TO_EFFORT[options.thinking] : undefined;
const effort: EffortLevel | undefined = options?.thinking
? claudeCodeEffort(model ?? {}, options.thinking) : undefined;

const claudeExecutable = providerSettings.pathToClaudeCodeExecutable;

Expand Down Expand Up @@ -1766,7 +1755,7 @@ export default function (pi: ExtensionAPI) {
prompt: Type.String({ description: "The question or task for Claude Code. By default Claude sees the full conversation history. Don't research up front, let Claude explore." }),
mode: Type.Optional(StringEnum(modeValues, { description: modeDesc })),
model: Type.Optional(Type.String({ description: 'Claude model (e.g. "opus", "sonnet", "haiku", or full ID). Defaults to "opus".' })),
thinking: Type.Optional(StringEnum(["off", "minimal", "low", "medium", "high", "xhigh"] as const, { description: "Thinking effort level. Omit to use Claude Code's default." })),
thinking: Type.Optional(StringEnum(["off", "minimal", "low", "medium", "high", "xhigh", "max"] as const, { description: "Thinking effort level. Omit to use Claude Code's default." })),
isolated: Type.Optional(Type.Boolean({ description: "When true, Claude sees only this prompt (clean session). When false (default), Claude sees the full conversation history." })),
});
pi.registerTool<typeof askClaudeParams>({
Expand Down
Loading