mirror of
https://github.com/anthropics/claude-cookbooks.git
synced 2025-10-06 01:00:28 +03:00
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.
This commit is contained in:
@@ -11,4 +11,4 @@ ANTHROPIC_API_KEY=your_api_key_here
|
||||
# - claude-opus-4-1-20250805
|
||||
# - claude-sonnet-4-5-20250929
|
||||
|
||||
ANTHROPIC_MODEL=claude-sonnet-4-20250514
|
||||
ANTHROPIC_MODEL=claude-sonnet-4-5
|
||||
File diff suppressed because it is too large
Load Diff
@@ -82,10 +82,9 @@ class CodeReviewAssistant:
|
||||
return """You are an expert code reviewer focused on finding bugs and suggesting improvements.
|
||||
|
||||
MEMORY PROTOCOL:
|
||||
1. ALWAYS check your /memories directory FIRST using the memory tool
|
||||
2. Look for relevant debugging patterns or insights from previous reviews
|
||||
3. When you find a bug or pattern, update your memory with what you learned
|
||||
4. Keep your memory organized - use descriptive file names and clear content
|
||||
1. Check your /memories directory for relevant debugging patterns or insights
|
||||
2. When you find a bug or pattern, update your memory with what you learned
|
||||
3. Keep your memory organized - use descriptive file names and clear content
|
||||
|
||||
When reviewing code:
|
||||
- Identify bugs, security issues, and code quality problems
|
||||
|
||||
@@ -289,6 +289,16 @@ class MemoryToolHandler:
|
||||
|
||||
full_path = self._validate_path(path)
|
||||
|
||||
# Verify the path is within /memories to prevent accidental deletion outside the memory directory
|
||||
# This provides an additional safety check beyond _validate_path
|
||||
try:
|
||||
full_path.relative_to(self.memory_root.resolve())
|
||||
except ValueError:
|
||||
return {
|
||||
"error": f"Invalid operation: Path '{path}' is not within /memories directory. "
|
||||
"Only paths within /memories can be deleted."
|
||||
}
|
||||
|
||||
if not full_path.exists():
|
||||
return {"error": f"Path not found: {path}"}
|
||||
|
||||
@@ -339,6 +349,11 @@ class MemoryToolHandler:
|
||||
"""
|
||||
Clear all memory files (useful for testing or starting fresh).
|
||||
|
||||
⚠️ WARNING: This method is for demonstration and testing purposes only.
|
||||
In production, you should carefully consider whether you need to delete
|
||||
all memory files, as this will permanently remove all learned patterns
|
||||
and stored knowledge. Consider using selective deletion instead.
|
||||
|
||||
Returns:
|
||||
Dict with success message
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user