MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / candidate_score

Function candidate_score

src/pipeline/registry.c:155–162  ·  view source on GitHub ↗

Score a candidate for tiebreaking. Higher = better. * Layer 1: Non-test code preferred over test code (+1000) * Layer 2: Namespace proximity via common prefix length (+plen) */

Source from the content-addressed store, hash-verified

153 * Layer 1: Non-test code preferred over test code (+1000)
154 * Layer 2: Namespace proximity via common prefix length (+plen) */
155static int candidate_score(const char *candidate_qn, const char *module_qn) {
156 int score = 0;
157 if (!is_test_qn(candidate_qn)) {
158 score += REG_TEST_PENALTY;
159 }
160 score += common_prefix_len(candidate_qn, module_qn);
161 return score;
162}
163
164/* Pick candidate with highest composite score (test-deprioritization + namespace proximity). */
165static const char *best_by_import_distance(const char **candidates, int count,

Callers 1

best_by_import_distanceFunction · 0.85

Calls 2

is_test_qnFunction · 0.85
common_prefix_lenFunction · 0.85

Tested by

no test coverage detected