topos.mcp.cache

LRU caches for the Topos MCP server.

Two caches:

  • dep_graph_for: parsed ModuleDependencyGraph, keyed by (gitnexus_dir, target_file, mtime). mtime invalidates automatically when gitnexus re-runs.

  • baseline_result_for: ClassificationResult for a file’s current on-disk state, keyed by (filepath, content sha256, priority, gitnexus_mtime). Lets topos_assess_improvement skip re-evaluating the baseline across a loop of proposed variants.

Both caches are process-local; stdio servers are single-process so no cross-process coordination is needed.

topos.mcp.cache.dep_graph_for(gitnexus_dir, target_file)[source]

Return a cached ModuleDependencyGraph for the given gitnexus dir + file.

topos.mcp.cache.baseline_key(filepath, priority, gitnexus_dir)[source]

Cache key for a file’s current on-disk baseline evaluation.

topos.mcp.cache.clear_caches()[source]

Clear all caches. Primarily for tests.