Skip to content

Add semantic memory skill with LanceDB + Gemini embeddings#1013

Closed
5queezer wants to merge 3 commits intoqwibitai:mainfrom
5queezer:claude/review-pr-979-YLR17
Closed

Add semantic memory skill with LanceDB + Gemini embeddings#1013
5queezer wants to merge 3 commits intoqwibitai:mainfrom
5queezer:claude/review-pr-979-YLR17

Conversation

@5queezer
Copy link
Copy Markdown

Type of Change

  • Skill - adds a new skill in .claude/skills/

Description

This PR adds the add-lancedb-memory skill, which enables container agents to store and retrieve semantic memories across sessions using LanceDB for vector storage and Gemini embeddings for semantic similarity search.

What's included

Skill documentation (.claude/skills/add-lancedb-memory/SKILL.md):

  • 4-phase installation guide (pre-flight checks, code merge, configuration, verification)
  • Tool descriptions and usage examples
  • Troubleshooting and migration instructions

Implementation:

  • container/agent-runner/src/memory.ts — LanceDB + Gemini embedding logic with functions for storing, searching, deleting, and counting memories
  • 4 new MCP tools in container/agent-runner/src/ipc-mcp-stdio.ts:
    • memory_store — persist facts/decisions with category and importance
    • memory_search — semantic similarity search via natural language
    • memory_delete — remove memories by ID
    • memory_count — total memory count
  • Environment variable passthrough in src/container-runner.ts for GEMINI_API_KEY, LANCEDB_URI, LANCEDB_API_KEY
  • Dependencies: @lancedb/lancedb and apache-arrow in container/agent-runner/package.json
  • Optional migration tool (scripts/migrate-memories.mjs) for importing OpenClaw JSONL backups

Key features

  • Local storage by default — memories stored in each group's workspace at /workspace/group/memory/lancedb
  • Cloud support — optional LanceDB Cloud via LANCEDB_URI + LANCEDB_API_KEY
  • 3072-dimensional embeddings — using Gemini embedding-001 model
  • Persistent across sessions — memories survive agent restarts within the same group
  • Semantic search — find memories by meaning, not keyword matching
  • Categorization — organize memories by type (preference, decision, entity, event, general)
  • Importance weighting — prioritize which memories matter most

Installation flow

The skill guide walks users through:

  1. Checking prerequisites (Gemini API key)
  2. Merging the skill branch into their fork
  3. Configuring environment variables
  4. Restarting the service
  5. Testing via agent messaging

For Skills

  • I have not made any changes to source code
  • My skill contains instructions for Claude to follow (not pre-built code)
  • I tested this skill on a fresh clone

https://claude.ai/code/session_01SuTggdU3v9wdy5cjTn77Qw

Christian Pojoni and others added 3 commits March 12, 2026 00:06
Adds persistent semantic memory to container agents via 4 MCP tools
(memory_store, memory_search, memory_delete, memory_count). Uses
LanceDB for vector storage (local or cloud via LANCEDB_URI) and
Gemini embedding-001 for 3072-dim embeddings. Includes migration
script for importing memories from OpenClaw JSONL backups.

Security: sanitized filter inputs, crypto.randomUUID for IDs,
30s fetch timeout, race-safe singleton initialization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SKILL.md for adding semantic memory (LanceDB + Gemini embeddings)
to container agents. Provides 4 MCP tools: memory_store,
memory_search, memory_delete, memory_count.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move Gemini API key from URL query param to x-goog-api-key header
- Sort package.json dependencies alphabetically
- Use consistent single-quote SQL in memoryDelete filter
- Move memory import to top of ipc-mcp-stdio.ts with other imports
- Require explicit args in migrate script (remove hardcoded defaults)
- Add exponential backoff retry on 429/5xx in migrate script

https://claude.ai/code/session_01SuTggdU3v9wdy5cjTn77Qw
@5queezer
Copy link
Copy Markdown
Author

Duplicate of #979 — review fixes merged into the original PR branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants