Skip to content

[N15] Semantic recall: an embedding provider and a SQLite vector memory - #314

Merged
LinuxDevil merged 4 commits into
mainfrom
lou-n15-semantic-recall
Oct 2, 2026
Merged

LinuxDevil merged 4 commits into
mainfrom
lou-n15-semantic-recall

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

What

Semantic recall for memory slots (N15). A slot can recall by meaning instead of by keyword.

  • EmbeddingProvider and aiSdkEmbedder(model, { id?, maxBatch? }): any AI SDK embedding model through embedMany from the installed ai, loaded lazily on first use (no new dependency; a missing ai raises MissingPeerDependencyError). Runs on ai 4, 6 and 7 (tests use the installed ai plus the ai-v6 / ai-v7 aliases).
  • inMemoryVectorMemory(options) (root) and sqliteVectorMemory(store, options) (/sqlite): cosine-similarity ranking, minScore, maxItems, reindex(scopeKey?), score in metadata.score. Only items of the requested scope key and of the same embedder id are scored.
  • New migration: memory_vectors table (existing databases gain it on open; memory_items / sqliteMemory untouched).
  • MemoryProvider.ranking?: 'newest' | 'relevance': the recall_<name> description says "by meaning, most relevant first" for vector providers; unchanged for others.
  • hashEmbedder() in /testing: deterministic offline embedder.
  • describeMemoryProviderContract(name, make, { query: 'filter' | 'rank' }).

Implementation notes: writes to one scope key are serialized (an item removed during reindex() is not resurrected); add embeds first and stores nothing when embedding fails; SqlValue in the SQLite driver types now allows Uint8Array for the BLOB.

Docs site (G9)

docs/memory.md: new heading ## Semantic recall, appended at the end of the page (after ## Limitations; no existing heading added, renamed or moved). Also edited without heading changes: two rows in the ## Providers table, the paragraph after it, one sentence in ### SQLite, and one sentence before the custom-provider example. The Arabic page needs the new section appended and those lines updated. No new or restructured pages.

Live test

Not run: the OpenRouter account is out of credit (total_usage 10.199 >= total_credits 10). No live test file committed; a checklist line is on #260. Live test spend: none.

Verification (after merging origin/main)

  • npx tsc --noEmit: ok
  • npm run lint: zero warnings
  • npm run build, npm run build --workspace=packages/create-lousho-agent: ok
  • npm run test:types: 68 passed, no type errors
  • npm run docs:verify-snippets -- --skip-build: 223 type-check, 8 run
  • npm run docs:llms:check: ok
  • npm run test:coverage: 248 files passed, 3618 tests passed, 7 skipped; npm run fallow: 0 above threshold
  • Agent Forge: typecheck, typecheck:server ok; test 119 passed; test:server 130 passed
  • npm run pack-smoke: all checks passed
  • Flaky under load, passed on rerun: SubprocessSandbox / http timeout, otel optional-peer test, src/deploy (see brief).

Note: a non-owner comment on #258 (aetherxeg-source) suggested provenance fields and a stale-vector test matrix; not part of the ticket's scope and not acted on. The cross-scope and embedder-generation cases it names are covered here by tests that exist anyway (scope isolation, other-embedder items skipped until reindex()).

Closes #258

🤖 Generated with Claude Code

LinuxDevil and others added 4 commits October 2, 2026 21:28
…ry (#258)

EmbeddingProvider and aiSdkEmbedder (embedMany from the installed ai, loaded on
first use), inMemoryVectorMemory and sqliteVectorMemory ranking by cosine
similarity with minScore and reindex(), a memory_vectors migration,
MemoryProvider.ranking for the recall tool wording, hashEmbedder in /testing,
and a rank mode for the provider contract. Docs: new "Semantic recall" section
at the end of docs/memory.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
# Conflicts:
#	src/storage/sqlite/migrations.ts
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.

[N15] Semantic recall: an embedding provider and a SQLite vector memory

1 participant