Add Filesystem Memory Tool And Chat Demo#10
Open
a1594834522-coder wants to merge 34 commits intopowerdrillai:mainfrom
Open
Add Filesystem Memory Tool And Chat Demo#10a1594834522-coder wants to merge 34 commits intopowerdrillai:mainfrom
a1594834522-coder wants to merge 34 commits intopowerdrillai:mainfrom
Conversation
This commit includes the complete Claude Memory system with: ✅ Core Features: - FastAPI-based server with memory capabilities - Python SDK for easy integration - Session management with intelligent context handling - File-based memory storage with CRUD operations ✅ Architecture: - Server: claude-memory-server/ - SDK: claude-memory-sdk/ - Examples and documentation ✅ Key Components: - Memory management with automatic context retrieval - Session tracking with timeout and cleanup - Advanced search and backup capabilities - RESTful API with comprehensive endpoints ✅ Development Setup: - Virtual environment configuration - Requirements and dependencies - Interactive testing tools - Comprehensive .gitignore 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
Combined comprehensive Python gitignore with existing remote gitignore: - Kept detailed Python-specific ignores (pycache, dist, eggs, etc.) - Added Claude Memory Server specific ignores - Maintained IDE and development file ignores - Preserved coverage and testing file patterns 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
WenbinHou
requested changes
Oct 15, 2025
cicd/test-all.sh
Outdated
| TEST_SCOPE="${1:-memorylake}" | ||
| python3 -m pytest -n logical --cov=. --cov-append --cov-report="" "${TEST_SCOPE}" | ||
|
|
||
| PYTEST_ARGS=() |
Collaborator
There was a problem hiding this comment.
为何需要增加 test-all.sh 里的这些改动?正常的开发环境 setup 之后这些包都是有的
WenbinHou
reviewed
Oct 15, 2025
memorylake/__init__.py
Outdated
| MemoryToolOperationError, | ||
| MemoryToolPathError, | ||
| ) | ||
| except ModuleNotFoundError as exc: |
Collaborator
Author
There was a problem hiding this comment.
- 测试需要:仓库里已有 test_memorytool_example.py::test_memorylake_init_missing_anthropic,就是为了验证当环境里缺少 anthropic 时,包仍能被导入且暴露出清晰的错误信息。如果删除
try/except,该测试会失效。- 用户体验:哪怕 SDK 的主用例确实要求安装 anthropic,这个兜底逻辑能在“忘记安装”或“精简环境里先装 memorylake 再装 anthropic”的情形下提供友好的提示,而不是让整个 import memorylake
直接崩掉。 - 兼容性:一些用户可能只想安装 memorylake 看 API 或运行自定义的轻量操作(例如先处理路径、文件系统逻辑),延迟安装 anthropic。当前做法允许这种按需安装。
- 用户体验:哪怕 SDK 的主用例确实要求安装 anthropic,这个兜底逻辑能在“忘记安装”或“精简环境里先装 memorylake 再装 anthropic”的情形下提供友好的提示,而不是让整个 import memorylake
WenbinHou
reviewed
Oct 15, 2025
| TEST_SCOPE="${1:-memorylake}" | ||
| python3 -m pytest -n logical --cov=. --cov-append --cov-report="" "${TEST_SCOPE}" | ||
|
|
||
| # Generate coverage.xml, and print to console too |
Add HTTP-based memory tool clients that communicate with remote MemoryLake
server, supporting both synchronous and asynchronous operations.
New features:
- MemoryLakeMemoryTool: Sync HTTP client for remote memory operations
- AsyncMemoryLakeMemoryTool: Async HTTP client with context manager support
- Remote API endpoint: POST /public/v1/memory-tool
- Request structure: {memory_id, request, payload}
- Response structure: {content} or {error}
- Extended API: memory_exists(), list_memories(), stats()
- Client version header: x-memorylake-client-version
Example files:
- example/chat_remote.py: Interactive chat demo with remote server
- example/async_chat_remote.py: Async version of chat demo
- Both support verbose mode for debugging tool calls
- Fixed multi-tool handling to prevent 400 BadRequest errors
Test coverage:
- Full test suite for sync and async remote tools
- Mock server for testing without real backend
- Tests for all memory operations and error cases
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix integration test race condition by changing fixture scope to session - Add type safety improvements using cast and helper functions - Fix async generator return type annotation in test fixtures - Update test files with proper type annotations - Remove deprecated safe_cast implementation in favor of standard cast - Fix flake8 and isort formatting issues - All tests passing (28/28 unit tests, 0 errors in basedpyright) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Replace object | None with Optional[object] in test_memorylake_remote.py - Ensures compatibility with Python 3.9 as per project requirements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Reorder isinstance check and cast to avoid Unknown type in len() - Split compound condition for better type inference - Achieves 0 errors, 0 warnings in basedpyright for Python 3.9 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
4f37e3b to
0469569
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce MemoryTool with filesystem-backed implementations and export it from the package entrypoint.
Add example/chat.py to demonstrate Anthropic chat integration plus local memory management commands.
Refresh README.md with setup guidance, usage examples, and configuration notes.
Validation steps: (1) install or activate dependencies, (2) run python example/chat.py, (3) exercise local memory commands and ensure tool callbacks succeed.