Skip to content

Releases: lancekrogers/claude-code-go

v1.2.1

11 May 21:05
87b3f15

Choose a tag to compare

What's Changed

  • Fix Claude stream assistant content normalization (#20)
  • Add GitHub Sponsors FUNDING.yml (#19)

Full Changelog: v1.2.0...v1.2.1

v1.2.0

18 Apr 17:01
2332dbc

Choose a tag to compare

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 SubagentManager to execute through the real --agent and --agents prompt 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, AgentsJSON
  • Effort
  • InputFormat
  • IncludeHookEvents
  • IncludePartialMessages
  • ReplayUserMessages
  • DebugFile
  • Bare
  • Brief
  • Betas
  • Files
  • ExcludeDynamicSystemPromptSections
  • AllowDangerouslySkipPermissions
  • MaxBudgetUSD
  • SettingSources
  • Settings
  • Tools
  • Name
  • PluginDirs

Behavior Changes

  • Behavioral change, not source-breaking: SubagentConfig.ToRunOptions now targets Claude's native --agent and --agents prompt surface. The returned RunOptions keeps the subagent definition in Agents and selects it with Agent; it no longer populates top-level SystemPrompt and AllowedTools. Integrators upgrading from v1.1.0 should 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, and PermissionCallback remain in RunOptions for source compatibility. PreprocessOptions emits one-time warnings when they are set, and argv construction still ignores them because the current Claude CLI no longer supports them.
  • PermissionModeDelegate is 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 -p workflow. Interactive sessions and management commands such as auth, mcp, plugins, install, and update are intentionally not wrapped here.

Verification

  • just release check
  • go test ./...

Release Process

  • Publish this release with just release publish v1.2.0 after the merge commit is on main.

Full Changelog

v1.1.0...v1.2.0

v1.1.0

17 Apr 10:25
310bc57

Choose a tag to compare

What's new

  • RunOptions.WorkingDirectory — run the Claude CLI subprocess from a caller-specified cwd across RunPrompt, RunFromStdin, and StreamPrompt, without mutating the parent process via os.Chdir. Mirrors the existing field on SubagentConfig.
  • Subagent working-directory propagationSubagentConfig.WorkingDirectory is now honored by ToRunOptions (subagent's WD wins, else inherits from the parent RunOptions). Closes the long-standing TODO where the field was public + JSON-tagged but silently ignored.
  • Dangerous client working directorydangerous.BYPASS_ALL_PERMISSIONS_CTX (and siblings) now honor RunOptions.WorkingDirectory. Headless automation callers can finally set per-invocation cwd without os.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

12 Jan 18:03

Choose a tag to compare

What's Changed

Full Changelog: v1.0.1...v1.0.2

v1.0.1

02 Jan 08:53
5d8c055

Choose a tag to compare

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

02 Jan 04:24
8ebda5c

Choose a tag to compare

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 sanitization
  • MetricsPlugin - Collect tool call counts, message counts, and costs
  • ToolFilterPlugin - Block specific tools from being executed
  • AuditPlugin - 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.0

Upgrade 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...v1.0.0

v0.1.3

12 Aug 04:06
d211af5

Choose a tag to compare

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

09 Jun 19:21
352503c

Choose a tag to compare

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 features

v0.1.1

29 May 19:40
b9eccec

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.1.0...v0.1.1