claude-wire
Health Warn
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 5 GitHub stars
Code Pass
- Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Pass
- Permissions — No dangerous permissions requested
This tool is a TypeScript SDK that allows developers to programmatically spawn, stream, and control the Claude Code CLI. It provides a typed interface for running multi-turn sessions, managing costs, and handling structured JSON responses.
Security Assessment
The code does not request dangerous system permissions, contains no hardcoded secrets, and a scan of 12 files found no dangerous patterns. However, because the core function of this SDK is to wrap the Claude CLI and manage tool execution, it inherently facilitates running tools and scripts on your local machine. It acts as a bridge to the CLI rather than making direct external network requests itself. Overall risk: Low.
Quality Assessment
The repository is very new and active (last updated today), licensed under the permissive MIT standard, and offers an impressive feature set including 267 tests and full documentation. The main drawback is its extremely low community visibility, currently sitting at only 5 GitHub stars. Additionally, the author explicitly notes that it relies on an undocumented, unofficial streaming protocol from Anthropic, meaning future CLI updates could easily break the SDK.
Verdict
Use with caution — the code itself appears clean and well-structured, but its heavy reliance on an unofficial, undocumented CLI protocol combined with very low community adoption means it may require frequent maintenance to prevent unexpected breakages.
TypeScript SDK for Claude Code - spawn, stream, and control the CLI programmatically
claude-wire
Run Claude Code programmatically from TypeScript.
import { claude } from "@pivanov/claude-wire";
const result = await claude.ask("Fix the bug in main.ts", {
model: "haiku",
maxCostUsd: 0.50,
});
console.log(result.text); // "Fixed the undefined variable..."
console.log(result.costUsd); // 0.0084
Features
- Simple API -
claude.ask()returns a typed result,claude.stream()yields events - Structured JSON -
claude.askJson(prompt, schema)with Standard Schema (Zod/Valibot/ArkType) validation - Tool control - allow, block, or intercept any tool at runtime
- Multi-turn sessions - persistent process across multiple prompts
- Cost tracking - per-request budgets with auto-abort and projection primitives
- Typed errors - rate-limit, overload, context-length, retry-exhausted as
KnownErrorcodes - Fully typed - discriminated union events, full IntelliSense
- Resilient - auto-respawn with backoff, transient error detection, AbortSignal
- Zero dependencies - ~29 kB gzipped
Install
bun add @pivanov/claude-wire
# or
npm install @pivanov/claude-wire
Requires Claude Code CLI installed and authenticated. Runs on Bun >= 1.0 or Node.js >= 22.
Platform: POSIX only (macOS, Linux, WSL). Native Windows isn't supported yet -- binary resolution relies on
whichand POSIX path conventions.
This SDK wraps Claude Code's
--output-format stream-jsonprotocol, which is not officially documented by Anthropic and may change between releases.
Documentation
Full docs, API reference, and protocol guide at pivanov.github.io/claude-wire
Try the Examples
git clone https://github.com/pivanov/claude-wire
cd claude-wire && bun install
bun run examples
Interactive menu with 9 runnable demos covering ask, askJson, streaming, sessions, tool control, cost budgets, abort, system prompts, and session resume.
Project Structure
packages/claude-wire/ the npm package
apps/docs/ VitePress documentation site
apps/examples/ interactive example runner
Development
bun install
bun run test # 267 tests
bun run typecheck
bun run lint
bun run docs:dev # local docs server
bun run examples # try the examples
Sponsors
Supported by LogicStar AI
License
MIT
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found