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

Function add_memory_neighbors

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

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