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

Function add_memory_neighbors

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

477
478/// Add all memory nodes adjacent to `node_id` as neighbor candidates.
479fn add_memory_neighbors(
480 repo: &Repository,
481 node_id: &str,
482 depth: u8,
483 candidates: &mut HashMap<String, CandidateScore>,
484) -> CliResult<()> {
485 let subgraph = repo
486 .vault_kg_neighbors(node_id, depth)
487 .map_err(CliError::Repository)?;
488 for node in subgraph.nodes {
489 if node.has_type(atomic_core::kg::ontology::Class::Memory) && node.id != node_id {
490 merge_candidate(
491 candidates,
492 &node.id,
493 memory_path_from_node(&node),
494 0.0,
495 true,
496 );
497 }
498 }
499 Ok(())
500}
501
502/// Load candidate bodies from the vault, score, and rank them.
503fn resolve_and_rank(

Callers 2

gather_candidatesMethod · 0.70
seed_from_intentMethod · 0.70

Calls 4

vault_kg_neighborsMethod · 0.80
has_typeMethod · 0.80
merge_candidateFunction · 0.70
memory_path_from_nodeFunction · 0.70

Tested by

no test coverage detected