Skip to content

feat: auto-detect embedder — ship all-minilm default, respect existing #361

Closed

Description

@hurttlocker

Vision

Cortex should just work for semantic search on first run, with zero setup. But if the user already has an embedder, use theirs.

Embedder Resolution Order

  1. User config — if embed.provider is set in config, use it. Period.
  2. Ollama detected — if Ollama is running and has an embedding model pulled, use it. Prefer: all-minilm > nomic-embed-text > mxbai-embed-large > first available.
  3. API key detected — if OPENAI_API_KEY is set, offer text-embedding-3-small as option.
  4. Built-in ONNX fallback — ship all-minilm-l6-v2 (80MB, 384d) as ONNX model inside the binary. Zero deps. This is the default for Cortex IDE.

Commands

  • cortex doctor — shows detected embedders, chosen default, and why
  • cortex embed --status — shows resolved provider/model/source
  • cortex embed onnx/all-minilm-l6-v2 — explicit ONNX path

Success Criteria

  • Fresh IDE install can do semantic search with zero manual setup
  • If user already has an embedder, Cortex picks it automatically
  • cortex doctor shows detected embedders, chosen default, and why
  • cortex embed --status shows the resolved provider/model/source

Benchmark Reference

Local comparison (2026-03-23, 40 memories, 12 queries):

  • all-minilm: 33% accuracy, 6.9 emb/s, 384d, 44MB
  • nomic-embed-text: 25% accuracy, 0.7 emb/s, 768d, 262MB

all-minilm wins on speed (10x), size (6x), and accuracy for agent memory content.

Note

Cortex Memory (open source) and Cortex IDE memory layer may diverge later. The embedder abstraction needs to support both paths cleanly.

Relates to #360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions