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

Function add_memory_neighbors

atomic-cli/src/commands/vault/context.rs:451–472  ·  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

449
450/// Add all memory nodes adjacent to `node_id` as neighbor candidates.
451fn add_memory_neighbors(
452 repo: &Repository,
453 node_id: &str,
454 depth: u8,
455 candidates: &mut HashMap<String, CandidateScore>,
456) -> CliResult<()> {
457 let subgraph = repo
458 .vault_kg_neighbors(node_id, depth)
459 .map_err(CliError::Repository)?;
460 for node in subgraph.nodes {
461 if node.kind == "memory" && node.id != node_id {
462 merge_candidate(
463 candidates,
464 &node.id,
465 memory_path_from_node(&node),
466 0.0,
467 true,
468 );
469 }
470 }
471 Ok(())
472}
473
474/// Load candidate bodies from the vault, score, and rank them.
475fn 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