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
| Package | What it is |
|---|---|
@klein-kit/core | Protocol-native clients: unified sessions, streaming events, permissions, plans/todos, usage, resume. Zero runtime dependencies. |
@klein-kit/orchestrate | Cross-agent workflows: DAG dependencies, task-state handoffs, reviewer loops, verify/repair, conflict reconciliation, subagents on every provider. |
@klein-kit/react | React 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.
| Provider | Built against | Live-verified end to end |
|---|---|---|
| codex | 0.146.0 | ✅ turn, tools, usage, resume |
| claude | 2.1.220 | ✅ incl. permission round-trip |
| pi | latest | ✅ incl. permission gate |
| opencode | 1.3.0 | protocol verified; end-to-end pending a configured model provider |
| cursor | docs only | ⚠️ experimental — never run against the real binary |
See Providers for known limits and per-provider quirks.