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>
Links to the Effective Context Engineering blog post at the start of the introduction to provide readers with background on the engineering principles demonstrated in the cookbook.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add Any to imports in web_scraper_v1.py, api_client_v1.py, and cache_manager.py
- Replace lowercase 'any' with 'Any' in all type hints
- Fixes syntax error: 'any' is a built-in function, not a type
Addresses PR review comments from automated bot and samj.
- 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.
Address grammar issues identified in PR #199 review:
- Fix "Claude Cookbooks with its" → "with their" (possessive pronoun agreement)
- Fix "The Claude Cookbooks provides" → "provide" (subject-verb agreement)
- Fix "The Claude Cookbooks is" → "are" (subject-verb agreement)
These changes ensure proper grammar throughout the codebase following
the renaming from "Claude Cookbook" to "Claude Cookbooks".
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Changed all instances of singular 'Claude Cookbook' to plural 'Claude Cookbooks'
- Updated URLs from anthropic-cookbooks to claude-cookbooks
- Applied changes across documentation, code, and data files
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Resolved conflict in .claude/commands/notebook-review.md by accepting
the main branch version (without Model Usage section).
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
Reverted unintended case changes that occurred during the global rename:
- GitHub Actions: Changed ANTHROPIC_API_KEY back to anthropic_api_key in workflow files
- Python function: Changed ANTHROPIC_API_KEY parameter back to anthropic_api_key in ContextualVectorDB class
These changes maintain consistency with Python naming conventions (snake_case) and
the original GitHub Actions workflow configuration.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
Reverted all instances of CLAUDE_API_KEY back to ANTHROPIC_API_KEY to maintain
compatibility with existing infrastructure and GitHub secrets. This affects:
- Environment variable examples (.env.example files)
- Python scripts and notebooks
- Documentation and README files
- Evaluation scripts and test files
Other naming changes (Claude API, Claude Console, Claude Docs, Claude Cookbook) remain intact.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
The GitHub Actions workflows were updated to use CLAUDE_API_KEY but the repository
secrets still use ANTHROPIC_API_KEY. Reverting to maintain compatibility with
existing infrastructure while keeping all other Claude branding changes.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
The model-check command already handles model validation for all notebooks
and Python files. This eliminates duplication and improves separation of
concerns between the two commands.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add Claude Code SDK tutorials and examples
This PR adds comprehensive tutorials and examples for the Claude Code SDK, including:
- Research agent implementation with web search capabilities
- Chief of Staff agent with multi-agent coordination
- Observability agent with Docker configuration
- Supporting utilities and documentation
The examples demonstrate key SDK features:
- Multi-turn conversations with ClaudeSDKClient
- Custom output styles and slash commands
- Hooks for automated actions and governance
- Script execution via Bash tool
- Multi-agent orchestration patterns
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: rodrigo olivares <rodrigoolivares@anthropic.com>
Co-authored-by: Alex Notov <zh@anthropic.com>
Previously, CI workflows only monitored notebooks in the skills/ directory.
This caused PR #193 to merge without pedagogical review since its notebook
was in tool_evaluation/.
Changes:
- Update all notebook-related CI workflows to monitor **/*.ipynb
- Add SAST security monitoring workflow for code security analysis
- Update validate_notebooks.py to check all repository notebooks
- Fix notebook discovery in links.yml workflow
This ensures comprehensive CI coverage for all 9+ directories containing
notebooks (skills/, tool_evaluation/, misc/, tool_use/, third_party/, etc.)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Update all slash commands to include the PR number from GitHub Actions
context variable when posting comments. This ensures Claude knows which
PR to comment on when running in CI.
Add explicit instruction to use 'gh pr comment' command to post
reviews to the PR. Claude was performing reviews but not posting
them without this explicit direction.
- Create .github/slash-commands/ with link-review, model-check, notebook-review
- Update GitHub Actions to use slash commands instead of inline prompts
- Add symlinks in .claude/commands/ for local development
- Document slash commands in CONTRIBUTING.md
- Use claude-code-action@v1 instead of beta
This allows developers to run the same CI validations locally using
Claude Code slash commands before pushing changes.
Major simplification of CI/CD:
- Remove complex Python model validation scripts (400+ lines)
- Let Claude handle model validation intelligently via GitHub Actions
- Claude fetches latest models from docs.anthropic.com/en/docs/about-claude/models/overview.md
- Add comprehensive notebook validation script for local testing
- Interactive dashboard with progress tracking
- Auto-fix for deprecated models
- GitHub issue export format
- Idempotent with state persistence
- Simplify CI to use single Python version (3.11)
- Update workflows to use Claude for all intelligent validation
Benefits:
- No more hardcoded model lists to maintain
- Claude understands context (e.g., educational examples)
- 50% faster CI (removed matrix strategy)
- Single source of truth for models (docs site)
- Brittle check that will break with new model versions
- Claude already provides intelligent model recommendations
- Not all notebooks should use Haiku (some need more capability)
- Use Python 3.11 only (no version-specific code in notebooks)
- Reduces CI runtime by 50%
- Reduces API costs by 50% for notebook execution
- Simplifies PR checks (one instead of two identical)
- Add skip_code_blocks=true (important for notebooks with example code)
- Add require_https=false for development flexibility
- Simplify accept codes to just 403 and 429 (like docs)
- Add www.claude.ai to exclusions
- Exclude .github/ and scripts/ paths from checking
- Better comments explaining each setting
- Remove brittle hardcoded API key checks from validate_notebooks.py
- Enhance Claude review to check for any secrets (not just Anthropic)
- Claude understands context (e.g., educational 'bad examples' are OK)