This commit fixes the memory cookbook to work with anthropic SDK 0.69.0
and improves documentation around context clearing behavior.
Changes:
- Update context_management parameter usage for SDK 0.69.0
- Pass as direct parameter instead of extra_body
- Update response handling to use getattr() for Pydantic objects
- Fix context clearing configuration in notebook
- Lower clear_at_least threshold from 3000 to 50 tokens
- Memory tool operations have small results (~50-150 tokens)
- Add documentation explaining why threshold is low
- Add explanatory notes about context clearing behavior
- Explain why token savings are small in the demo
- Provide guidance for production configurations
- Document that larger tool results would save more tokens
The notebook now works correctly with SDK 0.69.0 and provides clear
guidance for users configuring context management in their applications.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Update .env.example to use claude-sonnet-4-5 model
- Remove "Always check memory first" from system prompts
- Add warning to clear_all_memory() about demonstration purposes
- Add path validation assertion in _delete() for safety
- Add notebook cell warning about memory clearing
- Clarify "Pattern Stored" section to show what Claude learns
All changes verified against official memory tool documentation.