Skip to content

Fix --thinking flag and add exclude_dynamic_sections#18

Merged
ya-luotao merged 3 commits intomainfrom
fix-thinking-flag-and-exclude-dynamic-sections
Apr 9, 2026
Merged

Fix --thinking flag and add exclude_dynamic_sections#18
ya-luotao merged 3 commits intomainfrom
fix-thinking-flag-and-exclude-dynamic-sections

Conversation

@ya-luotao
Copy link
Copy Markdown
Owner

Summary

Ports two fixes from the Python Claude Agent SDK:

  • anthropics/claude-agent-sdk-python#796 — Fix --thinking flag for adaptive/disabled modes. Previously, ThinkingConfigAdaptive mapped to --max-thinking-tokens 32000 and ThinkingConfigDisabled to --max-thinking-tokens 0, which put the CLI into fixed-budget mode. Now uses --thinking adaptive / --thinking disabled to activate the correct CLI code paths. Only ThinkingConfigEnabled uses --max-thinking-tokens.

  • anthropics/claude-agent-sdk-python#797 — Add exclude_dynamic_sections to SystemPromptPreset. When set, the CLI strips per-user dynamic sections (cwd, auto-memory, git status) from the preset system prompt and re-injects them into the first user message, making the system prompt byte-identical across users for prompt-caching hits. Forwarded via excludeDynamicSections in the initialize control message.

  • anthropics/claude-agent-sdk-python#785 — Add auto to PermissionMode — already present in Ruby SDK, no changes needed.

Test plan

  • Updated transport specs: verify --thinking adaptive, --thinking disabled, mutual exclusivity with --max-thinking-tokens
  • Added types specs for exclude_dynamic_sections storage and serialization
  • Full suite passes (522 examples, 0 failures)
  • RuboCop clean

🤖 Generated with Claude Code

…tions

Port two fixes from Python SDK PRs #796 and #797:

- Use --thinking adaptive/disabled instead of --max-thinking-tokens for
  non-budget thinking modes, matching the CLI's dedicated flag
- Add exclude_dynamic_sections to SystemPromptPreset for cross-user
  prompt caching, forwarded via initialize control message

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ya-luotao
Copy link
Copy Markdown
Owner Author

@claude review this PR

ya-luotao and others added 2 commits April 9, 2026 18:08
The || operator treats false as falsy, so
  eds = hash[:key] || hash['key']
would skip a false value from symbol keys. Use fetch with block instead.

Add Client specs covering SystemPromptPreset, Hash, false value,
and plain string paths for exclude_dynamic_sections extraction.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- CHANGELOG: add 0.14.1 entry for thinking fix and exclude_dynamic_sections
- README: fix thinking descriptions, add cross-user prompt caching section
- Skills references: update system_prompt and thinking docs in both copies

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ya-luotao ya-luotao merged commit df99723 into main Apr 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant