aarondb/rag

rag — supported semantic-intent query macros

This module is the authoritative semantic-intent convenience layer for the local MCP recall tool. It compiles a small closed set of SemanticIntent values into ordinary AaronDB query ASTs; it owns no storage, transport, or ranking engine. Execution remains in the normal Cognitive and graph clause solvers.

It is not a separate “Graph RAG engine”, a remote retrieval service, or an adaptive-learning system. Add a new intent only with an engine-backed AST contract and direct regression coverage.

Types

Rich Hickey 🧙🏾‍♂️: A macro expands high-level declarative intent into fundamental, composable data structures. This module avoids a separate retrieval engine by mapping semantic intents purely into Datalog ASTs which AaronDB already computes efficiently.

pub type SemanticIntent {
  ConceptRecall(context: String, threshold: Float, limit: Int)
  ConnectedConcept(
    from_entity_id: Int,
    target_context: String,
    edge: String,
  )
  EvidenceGraph(
    entity_a_id: Int,
    entity_b_id: Int,
    max_depth: Int,
  )
}

Constructors

  • ConceptRecall(context: String, threshold: Float, limit: Int)

    Basic vector similarity recall

  • ConnectedConcept(
      from_entity_id: Int,
      target_context: String,
      edge: String,
    )

    Find shortest path between a known entity and a semantic concept

  • EvidenceGraph(entity_a_id: Int, entity_b_id: Int, max_depth: Int)

    Find evidence/reasoning supporting a connection

Values

pub fn build_query(intent: SemanticIntent) -> ast.Query

Compiles a semantic intent into a pure AaronDB Query AST. Time Complexity: O(1) AST generation. Space Complexity: O(1) AST size.

Search Document