322 Commits

Author SHA1 Message Date
Alex Notov
04bdceb385 Merge pull request #207 from anthropics/zh/fix-context-management-sdk-069
Fix context management for SDK 0.69.0 and improve documentation
2025-09-29 15:21:52 -06:00
Alex Notov
aaa76b9c44 Fix context management for SDK 0.69.0 and improve documentation
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>
2025-09-29 15:16:15 -06:00
Alex Notov
0a01b8c4d8 Merge pull request #206 from anthropics/zh/add-memory-ctx-mgmt-cookbook
Adds the memory + context management cookbook
2025-09-29 10:52:16 -06:00
Alex Notov
6233c16b4c Merge pull request #1 from anthropics/zh/memory-cookbook-improvements
Add memory & context management cookbook
2025-09-29 08:31:11 -06:00
Alex Notov
2182d5b6c4 Add reference to context engineering blog post in memory cookbook
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>
2025-09-28 21:26:12 -06:00
Alex Notov
be193457e4 Update tool_use/memory_cookbook.ipynb
Co-authored-by: Eric Harmeling <eric.harmeling@outlook.com>
2025-09-28 21:14:08 -06:00
Alex Notov
f9d1386c08 Fix type hint consistency: change any to Any in sample code
- 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.
2025-09-28 10:52:17 -06:00
Alex Notov
920c2ca516 Update support link from support.anthropic.com to support.claude.com 2025-09-27 14:51:29 -06:00
Alex Notov
32637b59a8 Update documentation link from docs.anthropic.com to docs.claude.com 2025-09-27 14:47:11 -06:00
Alex Notov
bca188063e Updates output to have correct model name for launch 2025-09-27 14:46:00 -06:00
Alex Notov
66b61a0a08 Fixes model string for Sonnet 4.5 2025-09-27 14:42:12 -06:00
Alex Notov
1add1373a2 Address PR review comments
- 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.
2025-09-27 14:38:48 -06:00
Alex Notov
4d3ed1f75b Add memory & context management cookbook
Interactive notebook demonstrating Claude's memory tool and context editing capabilities with code review examples.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 20:11:13 -06:00
Alex Notov
4b36a1e1f6 Merge pull request #199 from anthropics/zh/cookbook-naming-plural-update
Update references from 'Claude Cookbook' to 'Claude Cookbooks'
2025-09-17 13:52:56 -06:00
Alex Notov
8ca86af775 Fix grammatical errors from plural naming change
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>
2025-09-17 12:30:36 -06:00
Alex Notov
c94df0ce7c Update skills/retrieval_augmented_generation/guide.ipynb
Co-authored-by: Eric Harmeling <eric.harmeling@outlook.com>
2025-09-17 12:23:35 -06:00
Alex Notov
f0bf214841 Update references from 'Claude Cookbook' to 'Claude Cookbooks'
- 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>
2025-09-17 12:09:41 -06:00
Alex Notov
c0be217337 Merge pull request #198 from anthropics/zh/naming-updates
Rename Anthropic references to Claude for consistency
2025-09-17 11:21:20 -06:00
Alex Notov
4146b915de Remove temporary revert script
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 10:16:46 -06:00
Alex Notov
d2fddb6b6a Revert: Change platform.claude.com back to console.anthropic.com
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 10:15:06 -06:00
Alex Notov
92579ad489 Merge main branch and resolve conflicts
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>
2025-09-16 17:17:48 -06:00
Alex Notov
09e59d768d Fix: Revert accidental case-sensitive changes
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>
2025-09-16 17:11:14 -06:00
Alex Notov
b01dea74fe Merge pull request #196 from anthropics/sgrider/model-check
Remove duplicate model usage check from notebook-review
2025-09-16 17:06:19 -06:00
Alex Notov
8d1c93365b Revert CLAUDE_API_KEY to ANTHROPIC_API_KEY throughout the repository
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>
2025-09-16 17:02:29 -06:00
Alex Notov
27e3c055fc Fix CI: Revert CLAUDE_API_KEY to ANTHROPIC_API_KEY in GitHub Actions
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>
2025-09-16 16:59:11 -06:00
Alex Notov
bfffab4523 chore: Updates all references per new branding. 2025-09-16 16:35:49 -06:00
Alex Notov
419ee5b84e Merge pull request #197 from anthropics/jiri/small_fix
Added settings.local.json to CC SDK
2025-09-15 13:18:16 -06:00
Jiri De Jonghe
0da22d751c Added settings.local.json to CC SDK 2025-09-15 19:31:21 +01:00
Stephen Grider
d2cab04253 Remove duplicate model usage check from notebook-review
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>
2025-09-12 16:52:59 -06:00
Jiri De Jonghe
f26aa5891c Add Claude Code SDK tutorials and examples (#195)
* 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>
2025-09-12 15:04:34 -07:00
Alex Notov
fa326a49e0 Merge pull request #194 from anthropics/fix/expand-ci-notebook-coverage
fix(ci): expand CI coverage to all notebook directories
2025-09-11 15:00:08 -06:00
Alex Notov
cfb97d9066 fix: remove SAST workflow due to inaccessible action 2025-09-11 14:52:03 -06:00
Alex Notov
5e02d662d1 fix(ci): expand CI coverage to all notebook directories
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>
2025-09-11 14:46:30 -06:00
ant-ken
0164f4b5b5 Merge pull request #193 from anthropics/kenaizawa/writing_effective_tools
feat: writing effective tools blog post
2025-09-11 00:50:38 -04:00
Ken Aizawa
e205ca8903 fix: more illustrative run 2025-09-11 04:23:33 +00:00
Ken Aizawa
e9bb3e1008 feat: writing effective tools 2025-09-10 23:43:39 +00:00
Alex Notov
afb6dad5dc Merge pull request #191 from anthropics/zh/add-notebook-ci-validation
ci: add notebook CI/CD with validation and testing
2025-09-08 18:01:58 -06:00
Alex Notov
1653c3b47a fix(ci): specify PR number explicitly in gh pr comment commands
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.
2025-09-08 09:13:52 -06:00
Alex Notov
0db9450b22 fix(ci): explicitly instruct Claude to post PR comments
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.
2025-09-08 08:59:04 -06:00
Alex Notov
230133989a fix(ci): correct YAML key format to allowed-tools
Change from allowed_tools to allowed-tools (hyphen not underscore)
to match the correct YAML frontmatter format
2025-09-08 08:47:39 -06:00
Alex Notov
4cb0d11969 fix(ci): add allowed_tools to slash commands for PR commenting
Based on maintainer feedback, slash commands need allowed_tools
specified to enable PR commenting. Added gh pr tools for:
- gh pr comment: Post comments to PR
- gh pr diff: View PR diff
- gh pr view: View PR details
2025-09-08 08:43:35 -06:00
Alex Notov
46c5717029 fix(ci): simplify to v1 with built-in slash command support
Based on maintainer feedback:
- Move commands directly to .claude/commands/ (no symlinks needed)
- Use v1 with minimal configuration (auto mode detection)
- Remove unnecessary parameters (mode, use_sticky_comment, etc.)
- v1 automatically finds commands in .claude/commands/
2025-09-08 08:35:10 -06:00
Alex Notov
6cc0be8971 fix(ci): set mode to agent for automatic execution
The beta version defaults to 'tag' mode which requires manual triggering.
Set mode to 'agent' to run automatically on PR events.
2025-09-08 08:21:36 -06:00
Alex Notov
d68ef5ae51 fix(ci): use beta version for slash commands support
Switch from @v1 to @beta to enable experimental_slash_commands_dir
parameter which is required for slash commands to work properly
2025-09-08 08:17:42 -06:00
Alex Notov
bbf6a17a85 feat(ci): convert Claude prompts to reusable slash commands
- 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.
2025-09-08 08:03:45 -06:00
Alex Notov
7938498146 refactor: simplify model validation to use Claude AI
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)
2025-09-07 17:27:34 -06:00
Alex Notov
27cb34cabd fix: remove hardcoded Haiku model recommendation
- 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)
2025-09-07 16:59:22 -06:00
Alex Notov
0cbf8bdee0 perf: remove unnecessary Python matrix strategy
- 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)
2025-09-07 16:57:14 -06:00
Alex Notov
72faf94f92 fix: align lychee config with docs repo best practices
- 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
2025-09-07 16:54:27 -06:00
Alex Notov
97647e97e2 refactor: let Claude handle security checks intelligently
- 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)
2025-09-07 16:50:53 -06:00