Skip to content

Request: Embedded Prime RecallEngine documentation + integration guide #127

@decebal

Description

@decebal

Context

We're building Longhand, a Tauri 2 desktop app that uses allsource-core (currently 0.13.1) with embedded + embedded-projections features for all persistence. We want to upgrade to 0.17.1 and adopt Prime for agent memory.

Current Pain

Our cross-project context retrieval does O(n) brute-force cosine similarity over all workflow outputs on every skill execution:

  • Generates embedding via external OpenAI API call
  • Loads all outputs from an AllSource projection
  • Computes cosine similarity against every one
  • Returns top 5

This works at small scale but degrades at thousands of outputs, and depends on an external embedding API.

What We Want From Prime

  1. Embedded RecallEngine — use prime-full or prime-recall feature to get tiered retrieval (L0/L1/L2) without running a separate MCP server
  2. Replace O(n) cosine search with HNSW via VectorIndexProjection
  3. Local embeddings via fastembed to eliminate external API dependency
  4. Cross-execution learning via graph projections

Requests

  1. Documentation for embedded Prime usage — the current docs focus on the MCP server (allsource-prime crate). We need a guide for using Prime::open() + RecallEngine as an embedded library within a Tauri app.

  2. Migration guide from EmbeddedCore to Prime — can Prime::from_core() wrap an existing EmbeddedCore instance? Or do we need to initialize Prime separately and register its projections alongside our existing 39 domain projections?

  3. VectorIndexProjection usage example — how to ingest embeddings, query by similarity, and integrate with the existing projection system.

  4. fastembed model selection — which model is recommended for short-form content (skill outputs, 100-500 chars)? What's the cache size impact?

  5. Tiered recall configuration — how to configure L0/L1/L2 token budgets and what IndexConfig options are available?

Environment

  • allsource-core 0.13.1 → upgrading to 0.17.1
  • allframe-core 0.1.25 / allframe-tauri 0.1.25
  • Rust 1.94.0, edition 2021
  • 39 domain-specific projections registered on EmbeddedCore
  • macOS desktop app (Tauri 2)

Relevant Code

Our current brute-force search (~70 lines we want to replace with a single RecallEngine call):

pub(crate) async fn retrieve_cross_project_context(
    skill_prompt: &str,
    project_scope: Option<&[String]>,
) -> Option<String> {
    let all_outputs = workflow_outputs_store::list_all_outputs();
    if all_outputs.is_empty() { return None; }
    
    let embed_config = embedding::EmbeddingConfig::from_env_async().await;
    let query_embedding = embedding::generate_embedding(skill_prompt, &embed_config).await?;
    
    // O(n) cosine similarity over ALL outputs
    let mut candidates: Vec<(f64, String)> = Vec::new();
    for output in all_outputs {
        if output.embedding.is_empty() { continue; }
        let similarity = cosine_similarity(&query_embedding, &output.embedding);
        candidates.push((similarity, output.content));
    }
    candidates.sort_by(|a, b| b.0.partial_cmp(&a.0).unwrap());
    candidates.truncate(5);
    // ... format as context string
}

We'd love to replace this with:

let context = recall.context(skill_prompt, ContextTier::L2).await?;

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