npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

open-claude-agent-sdk

v0.31.0

Published

Open-source alternative to Claude Agent SDK - readable source, debuggable, uses local CLI

Readme

Open Claude Agent SDK

A compatible open-source replacement for @anthropic-ai/claude-agent-sdk — thin wrapper that uses your local Claude CLI.

Why?

| | Open SDK | Official SDK | |---|---|---| | Source | Open, readable TypeScript | Closed, minified | | How it works | Spawns local CLI | Bundles CLI | | Debuggable | Breakpoints, source maps | Minified blob | | AI-friendly | Agents can read source | Agents can't parse minified code | | Type compatible | Yes (re-exports) | - | | Streaming | Yes | Yes | | Multi-turn | Yes | Yes | | MCP servers | Yes | Yes | | Subagents | Yes | Yes | | Hooks | Yes | Yes |

Same API, same types — open and debuggable.

Install

bun add open-claude-agent-sdk

# Requires Claude CLI
npm install -g @anthropic-ai/claude-code

Usage

import { query } from 'open-claude-agent-sdk';

for await (const msg of query({
  prompt: 'Write a haiku about coding',
  options: { maxTurns: 3 }
})) {
  if (msg.type === 'assistant') {
    console.log(msg.message.content);
  }
  if (msg.type === 'result') break;
}

Drop-in replacement — just change the import:

- import { query } from '@anthropic-ai/claude-agent-sdk';
+ import { query } from 'open-claude-agent-sdk';

Features

Core

  • Query modes — one-shot, multi-turn (AsyncIterable + streamInput), streaming
  • Control methods — interrupt, close, setModel, setPermissionMode, setMaxThinkingTokens
  • Query methods — supportedCommands, supportedModels, accountInfo, mcpServerStatus
  • Structured outputs — JSON schema with outputFormat
  • Extended thinkingmaxThinkingTokens option
  • System prompts — string, preset (claude_code), preset with append
  • Permission callbackscanUseTool with allow/deny/selective/async
  • AbortController — signal-based cancellation
  • Session management — resume, fork, continue, custom sessionId
  • Cost trackingtotal_cost_usd, usage, modelUsage

MCP Servers

  • In-process SDK serverscreateSdkMcpServer() + tool() helper with Zod schemas
  • Process-based servers — stdio MCP server config via mcpServers option
  • Control methodsreconnectMcpServer(), toggleMcpServer(), setMcpServers()

Subagents & Hooks

  • Programmatic subagentsagents option, Task tool invocation, parent_tool_use_id
  • Hooks — 10 of 15 events tested E2E (PreToolUse, PostToolUse, PostToolUseFailure, UserPromptSubmit, Stop, SubagentStart, SubagentStop, plus matchers)
  • Skills & commands — via settingSources + .claude/ directories
  • Output styles — custom styles via .claude/output-styles/
  • Sandbox — sandbox configuration pass-through

Open SDK Extensions

Extra convenience methods beyond the official SDK:

import { query, type ExtendedQuery } from 'open-claude-agent-sdk';

const q = query({ prompt: '...' }) as ExtendedQuery;

await q.availableOutputStyles(); // string[]
await q.currentOutputStyle();    // string

Not Yet Implemented

  • rewindFiles() — no CLI protocol support
  • Agent teams — experimental, no env var support
  • V2 API (unstable_v2_*) — experimental preview

See FEATURES.md for full status matrix.

Demos

Three demo apps ported from the official SDK, running on both SDKs:

# Hello world
bun demos/open/hello-world/hello-world.ts

# Interactive chat (has its own dev server)
cd demos/open/simple-chatapp && npm install && npm run dev

# Resume generator
bun demos/open/resume-generator/resume-generator.ts

Testing

# Integration tests (primary)
bun test tests/integration/

# Unit tests (SDK compatibility)
bun test tests/unit/

# Type check
bun run typecheck

Documentation

License

MIT