Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
fix(graph): route the new scratch through the memory core
Martin Vogel24afb562dc65
diff --git a/internal/cbm/cbm.c b/internal/cbm/cbm.cindex 8b319adda..538d940c7 100644--- a/internal/cbm/cbm.c+++ b/internal/cbm/cbm.c@@ -1450,7 +1450,8 @@ static uint32_t *cbm_line_offsets(const char *src, int src_len, uint32_t *out_lilines++;}}- uint32_t *offs = (uint32_t *)malloc((size_t)(lines + 1) * sizeof(uint32_t));+ uint32_t *offs =+ (uint32_t *)cbm_alloc(CBM_MEM_CLASS_EXTRACT, (size_t)(lines + 1) * sizeof(uint32_t));if (!offs) {*out_lines = 0;return NULL;@@ -1768,7 +1769,7 @@ static void cbm_subtract_recovered_regions(cbm_error_regions_t *regs, const CBMDfor (int i = 0; i < regs->count; i++) {cbm_region_uncovered_gaps(regs->starts[i], regs->ends[i], defs, src, offs, nlines, &out);}- free(offs);+ cbm_free(CBM_MEM_CLASS_EXTRACT, offs);*regs = out;}diff --git a/scripts/memory-core-baseline.txt b/scripts/memory-core-baseline.txtindex 19fdd363d..ee54b498b 100644--- a/scripts/memory-core-baseline.txt+++ b/scripts/memory-core-baseline.txt@@ -52,7 +52,7 @@ src/git/git_context.c 18src/main.c 32src/mcp/compact_out.c 39src/mcp/index_supervisor.c 8-src/mcp/mcp.c 785+src/mcp/mcp.c 784src/pipeline/artifact.c 38src/pipeline/fqn.c 23src/pipeline/lsp_resolve.h 4diff --git a/src/cypher/cypher.c b/src/cypher/cypher.cindex dd2544fd0..234f49087 100644--- a/src/cypher/cypher.c+++ b/src/cypher/cypher.c@@ -5100,12 +5100,15 @@ static void cypher_plan_seed_from_selective_end(cbm_query_t *q) {p->nodes[0] = p->nodes[1];p->nodes[1] = tmp;cbm_rel_pattern_t *r = &p->rels[0];+ const char *inverted = NULL;if (r->direction && strcmp(r->direction, "outbound") == 0) {- free((void *)r->direction);- r->direction = heap_strdup("inbound");+ inverted = "inbound";} else if (r->direction && strcmp(r->direction, "inbound") == 0) {- free((void *)r->direction);- r->direction = heap_strdup("outbound");+ inverted = "outbound";+ }+ if (inverted) {+ safe_str_free(&r->direction);+ r->direction = heap_strdup(inverted);}}diff --git a/src/mcp/mcp.c b/src/mcp/mcp.cindex ca88bdb52..75ff8e396 100644--- a/src/mcp/mcp.c+++ b/src/mcp/mcp.c@@ -63,6 +63,7 @@ enum {#include "cli/cli.h"#include "watcher/watcher.h"#include "foundation/mem.h"+#include "foundation/mem_core.h"#include "foundation/diagnostics.h"#include "foundation/platform.h"#include "foundation/compat.h"@@ -3880,7 +3881,7 @@ static void bm25_output_rows_free(bm25_output_row_t *rows, int count) {free(rows[i].label);free(rows[i].file_path);}- free(rows);+ cbm_free(CBM_MEM_CLASS_OTHER, rows);}static void bm25_lines_str(char *out, size_t size, int start, int end) {@@ -4177,7 +4178,8 @@ static char *bm25_search(cbm_store_t *store, const char *project, const char *qu}int row_cap = limit > 0 ? limit : BM25_DEFAULT_LIMIT;- bm25_output_row_t *rows = calloc((size_t)row_cap, sizeof(*rows));+ bm25_output_row_t *rows =+ (bm25_output_row_t *)cbm_calloc(CBM_MEM_CLASS_OTHER, (size_t)row_cap * sizeof(*rows));int row_count = 0;while (rows && row_count < row_cap && sqlite3_step(stmt) == SQLITE_ROW) {const char *qn = (const char *)sqlite3_column_text(stmt, BM25_COL_QN);