MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / add_memory_neighbors

Function add_memory_neighbors

atomic-cli/src/commands/vault/context.rs:412–433  ·  view source on GitHub ↗

Add all memory nodes adjacent to `node_id` as neighbor candidates.

(
    repo: &Repository,
    node_id: &str,
    depth: u8,
    candidates: &mut HashMap<String, CandidateScore>,
)

Source from the content-addressed store, hash-verified

410
411/// Add all memory nodes adjacent to `node_id` as neighbor candidates.
412fn add_memory_neighbors(
413 repo: &Repository,
414 node_id: &str,
415 depth: u8,
416 candidates: &mut HashMap<String, CandidateScore>,
417) -> CliResult<()> {
418 let subgraph = repo
419 .vault_kg_neighbors(node_id, depth)
420 .map_err(CliError::Repository)?;
421 for node in subgraph.nodes {
422 if node.kind == "memory" && node.id != node_id {
423 merge_candidate(
424 candidates,
425 &node.id,
426 memory_path_from_node(&node),
427 0.0,
428 true,
429 );
430 }
431 }
432 Ok(())
433}
434
435/// Load candidate bodies from the vault, score, and rank them.
436fn resolve_and_rank(

Callers 2

gather_candidatesMethod · 0.85
seed_from_intentMethod · 0.85

Calls 3

merge_candidateFunction · 0.85
memory_path_from_nodeFunction · 0.85
vault_kg_neighborsMethod · 0.80

Tested by

no test coverage detected