Skip to content

refactor(app): decouple embedding, remove Rust, split flows, narrow DB protocol#437

Open
sairin1202 wants to merge 2 commits into
feat/memory-fs-synthesisfrom
refactor/decouple-embedding-and-cleanup
Open

refactor(app): decouple embedding, remove Rust, split flows, narrow DB protocol#437
sairin1202 wants to merge 2 commits into
feat/memory-fs-synthesisfrom
refactor/decouple-embedding-and-cleanup

Conversation

@sairin1202

Copy link
Copy Markdown
Contributor

Summary

Architecture cleanup stacked on top of #436 (base: feat/memory-fs-synthesis).

  • Decouple embedding from the chat LLM: all vectorization now goes through the dedicated memu.embedding clients with a separate per-profile cache; embed() is removed from the sdk/httpx chat clients. Added grok + openrouter embedding backends so provider coverage is preserved (lazyllm_backend stays unified, as it has no standalone embedding client).
  • Remove Rust scaffolding: delete lib.rs / Cargo.toml / Cargo.lock / tests/rust_entry_test.py and the _core/_rust_entry references; switch the build backend from maturin to hatchling.
  • Delete legacy retrieve dead code: _embedding_based_retrieve / _llm_based_retrieve and their now-orphaned helpers.
  • Narrow the Database protocol: expose repositories only (no raw record dicts), so business logic can't bypass scope (where) filtering; drop the redundant mirror attributes on the concrete backends.
  • Split oversized flow files: extract the LLM retrieve pipeline into retrieve_llm.py (RetrieveLlmMixin) and the memorize parsers into memorize_parse.py (MemorizeParseMixin), composed as sibling mixins on MemoryService. retrieve.py 1210→640, memorize.py 1420→1220.
  • Finish skill/ decoupling in memory_fs: skills are always synthesized from the per-source descriptions, independent of memory-item extraction; docs/tests updated.

Test plan

  • uv run ruff check src/memu
  • uv run ruff format --check src/memu
  • uv run mypy src
  • uv run python -m pytest tests/ --ignore=tests/test_lazyllm.py (97 passed, 1 skipped)
  • uv lock --locked consistent; uv run deptry src clean
  • Note: build backend changed to hatchling — update any CI steps that assume a maturin/Rust toolchain.

Made with Cursor

sairin1202 and others added 2 commits June 18, 2026 14:32
…B protocol

- Decouple embedding from chat LLM: route all vectorization through the
  dedicated memu.embedding clients (separate per-profile cache), drop embed()
  from the sdk/httpx llm clients, and add grok/openrouter embedding backends.
- Remove the unused Rust scaffolding (lib.rs/Cargo/maturin) and switch the
  build backend to hatchling.
- Delete legacy retrieve dead code (_embedding_based_retrieve/_llm_based_retrieve
  and their orphaned helpers).
- Narrow the Database protocol to repositories only (no raw record dicts) so
  scope filtering cannot be bypassed.
- Split oversized flows: extract the LLM retrieve pipeline into retrieve_llm.py
  and the memorize parsers into memorize_parse.py.
- Finish skill/ decoupling in memory_fs (always synthesized from descriptions,
  independent of memory-item extraction) and update docs/tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
… skill/ with root indexes

Split the memory file system output so each root index points at a sibling
payload directory:
- resource/<file_name>: raw source bytes copied verbatim from Resource.local_path
- memory/<slug>.md: one file per MemoryCategory (description + summary)
- skill/<slug>/SKILL.md: unchanged

INDEX.md now links into resource/, MEMORY.md is an overview that links to each
memory/<slug>.md, and _sync/_content_hash are bytes-aware so binary raw copies
diff correctly. Docs (README, architecture), settings, the example, and tests
are updated to the new layout.

Also folds in the in-progress branch work (embedding decoupling, folder
memorize, examples/prompts cleanup).

Co-authored-by: Cursor <cursoragent@cursor.com>
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