Klein Kit

Introduction

One TypeScript SDK for every local coding agent

Klein Kit drives the coding agents already installed and logged in on your machine — Codex, Claude Code, OpenCode, Cursor, and Pi — through a single, protocol-native session API. Build your own AI coding product without picking a vendor or re-implementing five protocols.

Think AI SDK, but for local agent CLIs: no API keys, no cloud proxy. Each adapter spawns the user's own binary and inherits whatever auth is already on the machine (ChatGPT login for Codex, Claude subscription for Claude Code, and so on).

Packages

PackageWhat it is
@klein-kit/coreProtocol-native clients: unified sessions, streaming events, permissions, plans/todos, usage, resume. Zero runtime dependencies.
@klein-kit/orchestrateCross-agent workflows: DAG dependencies, task-state handoffs, reviewer loops, verify/repair, conflict reconciliation, subagents on every provider.
@klein-kit/reactReact hooks: stream sessions, permissions, plans, todos, and workflows into your UI.

Why protocol-native?

Every backend message becomes a typed AgentEvent — plans, todos, tool calls with live output, file diffs, permission requests, reasoning streams, token/context usage — with the untouched native payload always on event.raw. Anything Klein Kit can't classify still reaches you as an unknown event.

Per-provider capabilities tell you at runtime what's native, emulated, or absent, and session.raw() hands you the underlying protocol client when you need provider-only features. Fidelity, not lowest common denominator.

Status

Early (0.1). Each adapter is built against a researched protocol contract, with fixture-based tests that replay recorded protocol traffic, plus a live smoke suite.

ProviderBuilt againstLive-verified end to end
codex0.146.0✅ turn, tools, usage, resume
claude2.1.220✅ incl. permission round-trip
pilatest✅ incl. permission gate
opencode1.3.0protocol verified; end-to-end pending a configured model provider
cursordocs only⚠️ experimental — never run against the real binary

See Providers for known limits and per-provider quirks.

On this page