Repository navigation
v0.32.0
Syncs the gem with Python SDK 0.2.153 (previously 0.2.147). The intervening Python releases 0.2.148–0.2.152 only bump the CLI binary Python bundles; this gem does not vendor a CLI, so they carry no Ruby-side change.
Added
snapshotonSystemPromptPreset, and a newSystemPromptCustomtype (port of Python #1268, v0.2.153). By default the CLI records the system prompt on a session's first request and reuses it on every later request, including after resume, so a changedappendor custom prompt has no effect until the session is compacted or a new one starts.snapshot: falsemakes the CLI rebuild the prompt on every request instead — useful while iterating on prompt text across calls that resume the same session.SystemPromptCustom(prompt:,snapshot:) is the object form of a String prompt, sosnapshotcan travel with it. The{ type: 'custom', prompt: '...', snapshot: false }and{ type: 'preset', ..., snapshot: false }Hash forms are accepted too.- The value rides on the control-protocol
initializerequest assystemPromptSnapshot(never as a CLI flag), so it applies to bothquery()andClient.falseis sent explicitly; only an unset value is omitted.SystemPromptFilehas nosnapshot. - Requires Claude Code CLI 2.1.257 or later; before 2.1.265 a session with an
appendor custom prompt recorded it only whensnapshotwastrue. Older CLIs silently ignore the field.
Compatibility
A { type: 'custom', ... } Hash previously fell through the command builder unrecognised — pushing no flag at all — and so silently activated the default Claude Code system prompt. It now forwards --system-prompt <prompt> exactly like a String, and a custom prompt without a String prompt raises ArgumentError at command-build time rather than falling through.
Usage
options = ClaudeAgentSDK::ClaudeAgentOptions.new(
system_prompt: ClaudeAgentSDK::SystemPromptCustom.new(
prompt: 'You are a release bot.',
snapshot: false # rebuild the prompt on every request, even after resume
)
)What's changed
- #59 Sync with Python SDK 0.2.153: system prompt snapshot (Python #1268) — @ya-luotao
- #58 Add a Ruby-themed README hero banner — @ya-luotao
Full Changelog: v0.31.0...v0.32.0
gem install claude-agent-sdk -v 0.32.0