Skip to content

Support verified local embedding endpoints and safe model switching - #12

Merged
JasonDocton merged 2 commits into
mainfrom
codex/verified-embedding-endpoints
Nov 3, 2026
Merged

JasonDocton merged 2 commits into
mainfrom
codex/verified-embedding-endpoints

Conversation

@JasonDocton

@JasonDocton JasonDocton commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Changes

Maintainer implementation of the local embedding endpoints proposed in #10. Set LUCID_EMBEDDING_URL to the OpenAI-compatible API base and LUCID_EMBEDDING_MODEL to a model served there.

  • Probe the configured model with a bounded embedding request before choosing it. Report the skip reason and continue through native BGE, configured OpenAI, legacy Ollama, and recency on failure.
  • Keep separate text and visual cache entries per memory, endpoint/model identity, and vector width. Clients that fall back to different providers can share a database without overwriting one another’s indexes. The migration preserves existing vectors and rolls both tables back together on failure.
  • Match the query’s space in retrieval, reconsolidation, and associations. Invalidate all variants on a content edit, reject late writes for stale content, and commit a reconsolidated memory and vector together.
  • Check batch indices, cardinality, usable Float32 values, and the model identity reported behind an alias. Isolate rejected inputs, share the query embedding across text and visual context, and prevent overlapping background batches.

Verification

  • Reproduced the original cache loss and wrong-memory reinforcement on feat(embeddings): OpenAI-compatible local endpoint support #10. A fresh independent review reproduced additional failures in the first maintainer commit, including two servers replacing each other’s cached vectors.
  • The independent reviewer approved exact commit de31e78de1f2be1bc72e3c669e5232afb1d76732 for integration. All 241 server tests and the typecheck passed. The 26 focused tests also passed using TypeScript retrieval.
  • Six concurrent processes upgraded a legacy SQLite database and retained all 200 vectors. Additional checks covered rollback when a copy fails, opening an already-current database during another writer’s transaction, late workers, and two-process reconsolidation.
  • Verified the real MCP server with local Ollama bge-m3 and a disposable database. Text and visual semantic retrieval survived restart. A missing endpoint model yielded recency and preserved both cached vectors.

Operations

Upgrade clients sharing a database together. Cache storage grows with the number of distinct embedding spaces. If an endpoint changes weights without changing its reported model name or width, give it a versioned name.

@JasonDocton
JasonDocton merged commit 0e69fc0 into main Nov 3, 2026
3 of 6 checks passed
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