Summary
This issue tracks two improvements to the memory system:
- Add native Gemini API embeddings support
- Implement safe indexing that preserves existing memory files on failure
Goal 1: Add Gemini API Embeddings Provider
The memory system currently supports two embedding providers:
- OpenAI - via OpenAI API
- Local - via
node-llama-cpp
Add native support for Google Gemini API embeddings as a third provider.
Goal 2: Safe Memory Indexing (Atomic Operations)
Problem
Currently, when running clawdbot memory index, the command deletes the current memory setup even if the indexing fails for any reason. This can result in data loss if:
- The embedding API is unavailable
- There's a network error
- The process is interrupted
- Any other failure occurs during indexing
Expected Behavior
The indexing process should be atomic/transactional:
- On success: Replace old memory files with newly indexed data
- On failure: Keep existing memory files intact and error out gracefully
Implementation Approach
- Index to temporary files/location first
- Verify indexing completed successfully
- Only then swap/replace the existing memory files
- If any step fails, clean up temporary files and preserve the original data
Summary
This issue tracks two improvements to the memory system:
Goal 1: Add Gemini API Embeddings Provider
The memory system currently supports two embedding providers:
node-llama-cppAdd native support for Google Gemini API embeddings as a third provider.
Goal 2: Safe Memory Indexing (Atomic Operations)
Problem
Currently, when running
clawdbot memory index, the command deletes the current memory setup even if the indexing fails for any reason. This can result in data loss if:Expected Behavior
The indexing process should be atomic/transactional:
Implementation Approach