Skip to content

feat: v0.17.0 Agent Memory vector storage + embedding externalization - #30

Merged
juice094 merged 6 commits into
mainfrom
feat/embedding-externalization
May 13, 2026
Merged

juice094 merged 6 commits into
mainfrom
feat/embedding-externalization

Conversation

@juice094

Copy link
Copy Markdown
Owner

Summary

v0.17.0 核心架构迁移:devbase 从 LLM Runtime 退化为向量数据库层。Embedding 生成完全外置,devbase 仅负责存储、索引和相似性查询执行。

Changes

  • Schema v34: agent_memories 新增 embedding BLOB, embedding_model TEXT, indexed_at DATETIME
  • Feature Flags: embedding 从 default 移除;Candle/Ollama 降级为 opt-in --features embedding
  • SQLite UDF: cosine_similarity(blob, blob) -> real — 纯 SQL 向量搜索,零外部依赖
  • MCP Tools +2: devkit_session_recall, devkit_session_index(60 total)
  • Skill Runtime Auto-Recall: Tiered 召回策略
    • Tier 1: Semantic(cosine similarity via UDF)— 本地或外部 endpoint
    • Tier 2: Keyword(LIKE fallback)
  • Env Injection: DEVBASE_CONTEXT_MEMORIES 改为注入 top-k 相关 memories(含 score + model)

Testing

  • cargo test --lib: 442 passed / 0 failed / 3 ignored
  • cargo check --all-targets: 0 errors / 0 warnings

RFC

  • docs/RFC/agent-memory-vector-storage.md

Breaking Changes

  • 默认构建不再包含 Candle;需要语义生成能力的用户请添加 --features embedding
  • insert_memory 签名扩展:新增可选 embedding: Option<&[f32]> 和 embedding_model: Option<&str>

juice094 added 6 commits May 13, 2026 11:13
…ector UDF

- Remove 'embedding' from default Cargo features (Candle/Ollama now opt-in)
- Schema v34: agent_memories.embedding BLOB + embedding_model + indexed_at
- Add cosine_similarity SQLite UDF (little-endian f32 BLOB)
- Add search_memories_semantic() — pure SQL vector search, no LLM runtime
- New MCP tools: devkit_session_recall, devkit_session_index (60 total)
- AgentMemory struct expanded with optional embedding fields
- insert_memory signature updated with optional embedding/model args
- test_helpers.rs SCHEMA_DDL synced to v34
- RFC: docs/RFC/agent-memory-vector-storage.md

Refs: v0.17.0 design — devbase acts as vector database layer only,
never generates embeddings. External providers (Ollama/OpenAI) produce
vectors; devbase stores, indexes, and searches them.
… + keyword fallback

- Replace naive 'list all memories' injection with tiered recall strategy
- Tier 1: semantic recall via cosine_similarity UDF when embedding available
  - embedding feature enabled: use local Candle/Ollama
  - embedding feature disabled: call external endpoint (Ollama API format)
- Tier 2: keyword fallback (LIKE search) when semantic unavailable
- New env vars injected into skill runtime:
  - DEVBASE_CONTEXT_MEMORIES (now top-k relevant only, with score + model)
  - DEVBASE_CONTEXT_MEMORY_COUNT
  - DEVBASE_CONTEXT_RECALL_METHOD (semantic | keyword)
- build_recall_query: skill_id + args concatenation as query text
- call_external_embedding_endpoint: reqwest::blocking POST to /api/embeddings

Refs: RFC docs/RFC/agent-memory-vector-storage.md §5.3
…eritance

- Root Cargo.toml: 0.15.0 → 0.17.0-dev
- 13 workspace crates: hardcoded version → version.workspace = true
- CHANGELOG: add v0.17.0-dev, v0.16.1, v0.16.0 sections
- End-to-end tests: mock Ollama /api/embeddings endpoint (2 cases)
- MainView: add Session variant (3-state cycle: Repo → Vault → Session)
- render/session.rs: left panel context list (status icon + id + name)
- render/session.rs: right panel memory detail (type icon + model + indexed tag)
- state/mod.rs: load_sessions() + load_session_memories() on navigation
- state/navigation.rs: next/previous/jump_to_top/jump_to_bottom for Session
- event.rs: Enter refreshes selected session memories
- render/mod.rs: Session detail rendered directly in ui() dispatcher
- render/list.rs: delegate Session to session::render_session_list
- render/detail.rs: Session branch (no-op, detail rendered at top level)
- Fix test_main_view_toggle for 3-state cycle

Refs: RFC docs/RFC/agent-memory-vector-storage.md §8 task list
…egration

- Ollama installation (Windows/macOS/Linux)
- Model pull instructions (nomic-embed-text / all-minilm)
- config.toml [embedding] configuration examples
- Verification steps: curl test + devbase session workflow
- OpenAI API alternative (with compatibility notes)
- Backward compatibility: --features embedding
- Troubleshooting section for common errors

Refs: RFC §8 external provider configuration documentation
@juice094
juice094 merged commit b5bbfd6 into main May 13, 2026
5 of 6 checks passed
@juice094
juice094 deleted the feat/embedding-externalization branch May 13, 2026 04:59
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