Releases: lancekrogers/claude-code-go
v1.2.1
v1.2.0
v1.2.0 - Prompt Surface Refresh
This release aligns the SDK with the current wrapper-safe claude -p surface.
Highlights
- Added current prompt-surface flags for agents, effort, settings, tools, plugin directories, budget limits, input format, hook events, partial messages, replayed user messages, debug files, bare mode, brief mode, beta headers, file resources, display names, and dynamic prompt exclusion.
- Stopped emitting removed flags such as
--permission-prompt-tool,--max-turns,--config,--disable-autoupdate, and--theme. - Wired plugin lifecycle hooks, tool-use callbacks, and shared budget tracking into both JSON and stream-json execution paths.
- Updated
SubagentManagerto execute through the real--agentand--agentsprompt surface instead of a separate SDK-only shim. - Rewrote the README and examples to scope the SDK honestly to
claude -p.
Added Prompt Flags
RunOptions now covers the current wrapper-safe prompt flags below:
Agent,Agents,AgentsJSONEffortInputFormatIncludeHookEventsIncludePartialMessagesReplayUserMessagesDebugFileBareBriefBetasFilesExcludeDynamicSystemPromptSectionsAllowDangerouslySkipPermissionsMaxBudgetUSDSettingSourcesSettingsToolsNamePluginDirs
Behavior Changes
- Behavioral change, not source-breaking:
SubagentConfig.ToRunOptionsnow targets Claude's native--agentand--agentsprompt surface. The returnedRunOptionskeeps the subagent definition inAgentsand selects it withAgent; it no longer populates top-levelSystemPromptandAllowedTools. Integrators upgrading fromv1.1.0should audit call sites that inspected those top-level fields on the returned value. - Deprecated top-level fields retained for source compatibility now emit one-time warnings when set, instead of being silently ignored at argv construction time.
Compatibility Notes
PermissionTool,MaxTurns,ConfigFile,DisableAutoUpdate,Theme, andPermissionCallbackremain inRunOptionsfor source compatibility.PreprocessOptionsemits one-time warnings when they are set, and argv construction still ignores them because the current Claude CLI no longer supports them.PermissionModeDelegateis now rejected during validation because the current Claude CLI no longer supports delegate permission mode. Unlike the deprecated top-level flags above, there is no safe warn-and-ignore fallback for a permission mode selection, so the SDK fails fast instead.- The SDK still wraps the prompt-oriented
claude -pworkflow. Interactive sessions and management commands such asauth,mcp,plugins,install, andupdateare intentionally not wrapped here.
Verification
just release checkgo test ./...
Release Process
- Publish this release with
just release publish v1.2.0after the merge commit is onmain.
Full Changelog
v1.1.0
What's new
RunOptions.WorkingDirectory— run the Claude CLI subprocess from a caller-specified cwd acrossRunPrompt,RunFromStdin, andStreamPrompt, without mutating the parent process viaos.Chdir. Mirrors the existing field onSubagentConfig.- Subagent working-directory propagation —
SubagentConfig.WorkingDirectoryis now honored byToRunOptions(subagent's WD wins, else inherits from the parentRunOptions). Closes the long-standing TODO where the field was public + JSON-tagged but silently ignored. - Dangerous client working directory —
dangerous.BYPASS_ALL_PERMISSIONS_CTX(and siblings) now honorRunOptions.WorkingDirectory. Headless automation callers can finally set per-invocation cwd withoutos.Chdir.
Upgrade
client := claude.NewClient("claude")
result, err := client.RunPrompt("…", &claude.RunOptions{
WorkingDirectory: "/path/to/project",
})Backwards-compatible: the zero value keeps existing behavior (inherit the parent's cwd). Version is a minor bump because WorkingDirectory is a new exported field on RunOptions.
Release notes
- feat(claude): add WorkingDirectory to RunOptions + wire through subagent and dangerous paths (#17)
Add support for additional permission types
v1.0.1
What's Changed
Fixed minor issues in configuration files and creating verified release version
Full Changelog: v1.0.0...v1.0.1
v1.0.0
This major release brings the Go SDK to full feature parity with the Claude Code CLI, adding comprehensive SDK-level abstractions for building production applications.
Highlights
- Plugin System - Extensible hooks for logging, metrics, filtering, and auditing
- Budget Tracking - Spending limits with warnings and callbacks
- Session Management - Multi-turn conversation state
- Streaming Support - Real-time response processing
- Subagent Orchestration - Spawn and manage multiple Claude instances
- MCP Integration - Full Model Context Protocol support
- Structured Output - JSON Schema validation for reliable outputs
- Model Fallback - Automatic fallback when primary model is overloaded
- 9 Example Programs - Complete working examples for all features
New Features
Plugin System
Build extensible applications with lifecycle hooks:
client := claude.NewClient("claude")
// Add logging plugin
logging := claude.NewLoggingPlugin(log.Printf)
client.AddPlugin(logging)
// Add metrics collection
metrics := claude.NewMetricsPlugin()
client.AddPlugin(metrics)
result, _ := client.RunPrompt(ctx, "Hello", nil)
fmt.Printf("Total cost: $%.4f\n", metrics.TotalCost)Built-in Plugins:
LoggingPlugin- Configurable logging with optional secret sanitizationMetricsPlugin- Collect tool call counts, message counts, and costsToolFilterPlugin- Block specific tools from being executedAuditPlugin- Record all tool calls for compliance auditing
Budget Tracking
Control spending with configurable limits:
budget := claude.NewBudgetTracker(&claude.BudgetConfig{
MaxBudgetUSD: 10.0,
WarningThreshold: 0.8,
OnBudgetWarning: func(current, max float64) {
log.Printf("Warning: %.0f%% of budget used", (current/max)*100)
},
})
// Check before expensive operations
if budget.CanSpend(0.50) {
result, _ := client.RunPrompt(ctx, prompt, nil)
budget.AddSpend("session1", result.CostUSD)
}Session Management
Maintain conversation state across multiple turns:
sessions := claude.NewSessionManager()
// First turn
result1, _ := client.RunPrompt(ctx, "My name is Alice", nil)
sessions.SaveSession("chat1", result1.SessionID)
// Later turn - resume the conversation
opts := &claude.RunOptions{
ResumeID: sessions.GetSession("chat1"),
}
result2, _ := client.RunPrompt(ctx, "What's my name?", opts)
// Claude remembers: "Your name is Alice"Streaming Support
Process responses in real-time:
msgChan, errChan := client.StreamPrompt(ctx, "Write a story", nil)
for msg := range msgChan {
switch msg.Type {
case "assistant":
fmt.Print(msg.Message) // Print as it arrives
case "result":
fmt.Printf("\nCost: $%.4f\n", msg.CostUSD)
}
}Subagent Orchestration
Spawn and coordinate multiple Claude instances:
manager := claude.NewSubagentManager(client, &claude.SubagentConfig{
MaxConcurrent: 3,
})
tasks := []claude.SubagentTask{
{ID: "research", Prompt: "Research topic A"},
{ID: "analyze", Prompt: "Analyze topic B"},
{ID: "summarize", Prompt: "Summarize topic C"},
}
results := manager.ExecuteAll(ctx, tasks)
for _, r := range results {
fmt.Printf("%s: %s\n", r.TaskID, r.Result)
}MCP Integration
Use Model Context Protocol tools:
opts := &claude.RunOptions{
MCPConfigPath: "./mcp-config.json",
AllowedTools: []string{
"mcp__filesystem__read_file",
"mcp__filesystem__write_file",
},
}
result, _ := client.RunPrompt(ctx, "Read config.json", opts)Structured Output & Reliability
New options for production reliability:
// Structured output with JSON Schema validation
result, err := client.RunPrompt(ctx, "Generate user profile", &claude.RunOptions{
Format: claude.JSONOutput,
JSONSchema: `{"type":"object","properties":{"name":{"type":"string"},"age":{"type":"integer"}},"required":["name"]}`,
})
// Automatic fallback when primary model is overloaded
result, err := client.RunPrompt(ctx, "Analyze code", &claude.RunOptions{
Model: "opus",
FallbackModel: "sonnet", // Use sonnet if opus is overloaded
})
// Debug mode with category filtering
result, err := client.RunPrompt(ctx, "Test", &claude.RunOptions{
Debug: "api,mcp", // Only debug api and mcp categories
})Examples
Complete working examples are included in examples/:
| Example | Description |
|---|---|
budget/ |
Budget tracking with warnings |
mcp/ |
MCP server integration |
permissions/ |
Permission modes (default, accept-edits, full-auto) |
plugins/ |
Plugin system with all built-ins |
retry/ |
Exponential backoff with jitter |
sessions/ |
Multi-turn conversation management |
streaming/ |
Real-time response streaming |
subagents/ |
Parallel agent execution |
workflow/ |
Complex multi-step workflows |
Installation
go get github.com/lancekrogers/claude-code-go@v2.0.0Upgrade Notes
This release is fully backward compatible with v0.1.x. No code changes required to upgrade.
Stats
- 89 files changed
- 12,837 insertions(+), 1,235 deletions(-)
- 28 commits
- 2,500+ lines of new tests
Full Changelog
v0.1.3
What's Changed
- Refactor JSON response structure to use 'total_cost_usd' instead of '… by @cingram16 in #5
Full Changelog: v0.1.2...v0.1.3
v0.1.2
What's Changed
This release achieves 100% feature parity with the Claude Code CLI, adding support for all previously missing CLI flags and introducing powerful new features.
✨ New Features
Complete CLI Flag Support
--config- Configuration file support--help,--version- Informational flags--disable-autoupdate- Auto-update control--theme- UI theme configuration
Enhanced Tool Permissions
// Granular permission syntax now supported
AllowedTools: []string{
"Bash(git log:*)", // Allow only git log commands
"Write(src/**/*.go)", // Write only to Go files in src
"Read", // Unrestricted read access
}
Structured Error Handling
- 9 distinct error types with intelligent classification
- Automatic retry logic with exponential backoff
- Contextual error messages with helpful suggestions
- Rate limit handling with retry-after support
New Client Methods
- RunPromptWithRetry() - Automatic retry for transient failures
- RunPromptEnhanced() - All features enabled by default
- Enhanced timeout and context support
📊 Improvements
- Test coverage increased to 84.7%
- Zero breaking changes - full backward compatibility
- Enhanced dangerous package using new features
- Comprehensive examples demonstrating all featuresv0.1.1
What's Changed
- Develop by @lancekrogers in #1
- chore: add model argument by @cingram16 in #3
New Contributors
- @lancekrogers made their first contribution in #1
- @cingram16 made their first contribution in #3
Full Changelog: v0.1.0...v0.1.1