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

Function add_memory_neighbors

libatomic/src/daemon/services_agent.rs:124–145  ·  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

122
123 /// Add all memory nodes adjacent to `node_id` as neighbor candidates.
124 fn add_memory_neighbors(
125 repo: &Repository,
126 node_id: &str,
127 depth: u8,
128 candidates: &mut HashMap<String, CandidateScore>,
129 ) -> Result<(), Status> {
130 let subgraph = repo
131 .vault_kg_neighbors(node_id, depth)
132 .map_err(repository_error)?;
133 for node in subgraph.nodes {
134 if node.has_type(atomic_core::kg::ontology::Class::Memory) && node.id != node_id {
135 merge_candidate(
136 candidates,
137 &node.id,
138 memory_path_from_node(&node),
139 0.0,
140 true,
141 );
142 }
143 }
144 Ok(())
145 }
146
147 /// Rank-derived score for the `rank`-th KG search result (0-based).
148 fn rank_score(rank: usize) -> f64 {

Callers 2

gather_candidatesFunction · 0.70
seed_from_intentFunction · 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