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

Function add_memory_neighbors

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

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