Skip to content

feat(memory): add lancedb semantic backend - #630

Merged
delete-cloud merged 1 commit into
mainfrom
feat/lancedb-semantic-memory-backend
Jun 25, 2026
Merged

delete-cloud merged 1 commit into
mainfrom
feat/lancedb-semantic-memory-backend

Conversation

@delete-cloud

@delete-cloud delete-cloud commented Jun 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add a real LanceDB semantic memory backend alongside the existing fake backend
  • wire [memory.semantic] backend = "lancedb" with db_path, table_name, and embedding_base_url
  • persist semantic schema metadata and fail closed on schema drift or unversioned existing vector tables unless explicit rebuild is requested
  • extend backend contract tests for LanceDB search/upsert/delete, scoped deletes, schema mismatch, schema rebuild, and app config wiring

Verification

  • uv run pytest tests/coding_agent/test_memory_index_backend_contract.py tests/coding_agent/test_semantic_tape_index.py tests/coding_agent/test_semantic_sync.py tests/coding_agent/test_semantic_recall.py tests/coding_agent/test_memory_switch.py -q -> 96 passed
  • uv run ruff format --check src/coding_agent/core/app.py src/coding_agent/topics/semantic_backends tests/coding_agent/test_memory_index_backend_contract.py tests/coding_agent/test_memory_switch.py && uv run ruff check src/coding_agent/core/app.py src/coding_agent/topics/semantic_backends tests/coding_agent/test_memory_index_backend_contract.py tests/coding_agent/test_memory_switch.py -> passed
  • uv run pytest -q -> 3877 passed, 8 skipped, 20 xfailed
  • local subagent review loop: initial P1 schema drift fixed, unversioned-table P1 fixed, blank-query guard P1 fixed, final P0/P1 review clean

Notes

AGENTS.md references RTK.md and prompts/codex-delegatee.md, but those files are absent in this worktree; I followed the visible repository instructions and kept the change scoped to backend integration.

Summary by CodeRabbit

  • New Features
    • Added support for a new local semantic memory backend with persistent storage and scoped data management.
    • Expanded semantic memory configuration to include storage path, table name, and embedding endpoint settings.
    • Enabled selection of different semantic memory backends through configuration.
  • Bug Fixes
    • Improved schema handling so existing memory stores are validated, rebuilt, or rejected more reliably when configurations change.
  • Tests
    • Added coverage for backend creation, search, updates, deletion, schema mismatch behavior, rebuilds, and scoped deletes.

Add a LanceDB-backed semantic memory backend with persisted schema metadata, config wiring, and fail-closed schema guards for drifted or unversioned vector tables.

Verification:

- uv run pytest tests/coding_agent/test_memory_index_backend_contract.py tests/coding_agent/test_semantic_tape_index.py tests/coding_agent/test_semantic_sync.py tests/coding_agent/test_semantic_recall.py tests/coding_agent/test_memory_switch.py -q

- uv run ruff format --check src/coding_agent/core/app.py src/coding_agent/topics/semantic_backends tests/coding_agent/test_memory_index_backend_contract.py tests/coding_agent/test_memory_switch.py && uv run ruff check src/coding_agent/core/app.py src/coding_agent/topics/semantic_backends tests/coding_agent/test_memory_index_backend_contract.py tests/coding_agent/test_memory_switch.py

- uv run pytest -q
@coderabbitai

coderabbitai Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Semantic memory configuration now carries LanceDB storage and embedding settings, the registry builds backends from expanded factory config, and a new LanceDB-backed semantic memory implementation is added with contract coverage and integration tests.

Changes

Semantic memory LanceDB backend

Layer / File(s) Summary
Config surface and app wiring
coding-agent/src/coding_agent/core/app.py, coding-agent/src/coding_agent/topics/semantic_backends/base.py, coding-agent/src/coding_agent/topics/semantic_backends/__init__.py
SemanticMemoryConfig adds db_path, table_name, and embedding_base_url; backend types are re-exported, config parsing selects a backend-specific schema, and app startup passes the new fields into backend creation.
LanceDB backend implementation
coding-agent/src/coding_agent/topics/semantic_backends/lancedb.py, coding-agent/tests/coding_agent/test_memory_index_backend_contract.py
A LanceDB semantic backend adds schema metadata storage, embeddings, vector search, scoped deletes, and contract tests for schema mismatch, rebuild, search, and delete behavior.
Registry factory and integration tests
coding-agent/src/coding_agent/topics/semantic_backends/registry.py, coding-agent/tests/coding_agent/test_memory_switch.py
The backend registry now builds from SemanticBackendFactoryConfig, resolves local paths, registers fake and lancedb, and app wiring tests cover the updated initialization inputs.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

I hopped through schemas by moonlit light,
and tucked new vectors out of sight.
With LanceDB my burrow feels neat,
a memory garden soft and sweet. 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a LanceDB semantic backend for memory.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/lancedb-semantic-memory-backend

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@delete-cloud
delete-cloud merged commit 25ee39c into main Jun 25, 2026
1 of 2 checks passed
@delete-cloud
delete-cloud deleted the feat/lancedb-semantic-memory-backend branch June 25, 2026 17:55
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.

1 participant