Skip to content

[Bug]: memory indexing deletes current state if indexing fails + gemini/openai endpoint no longer works #1151

Description

@gumadeiras

Summary

This issue tracks two improvements to the memory system:

  1. Add native Gemini API embeddings support
  2. 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

  1. Index to temporary files/location first
  2. Verify indexing completed successfully
  3. Only then swap/replace the existing memory files
  4. If any step fails, clean up temporary files and preserve the original data

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions