topos.mcp.evaluation

Shared evaluation helpers used by the evaluate / assess / inspect tools.

Keeps the core pipeline in one place:

  1. Build a ProgramMorphism.

  2. Attach CFG / academic PDG / CPG (always — they’re derived from the morphism itself and require no external tooling).

  3. Optionally attach a module-level ModuleDependencyGraph from GitNexus.

  4. Call CharacteristicMorphism.classify_detailed.

The classifier then assembles χ_S : P → Ω over the three generators SIMPLE (← CFG), COMPOSABLE (← ModuleDependencyGraph), SECURE (← CPG).

topos.mcp.evaluation.last_dep_graph_error()[source]

Return the most recent MDG load failure message, if any.

topos.mcp.evaluation.clear_dep_graph_error()[source]

Reset the stored MDG load failure message (primarily for tests).

topos.mcp.evaluation.resolve_gitnexus_dir(override, project_root)[source]

Return the gitnexus dir to use, or None if not available.

Preference: explicit override > <project_root>/.gitnexus if it exists.

topos.mcp.evaluation.gitnexus_warnings(override, project_root, gitnexus_dir, *, dep_graph_loaded)[source]

Explain why COMPOSABLE is unavailable or risky.

topos.mcp.evaluation.load_dep_graph(gitnexus_dir, target_file)[source]

Load the cached dep graph for a file, or None if not available.

topos.mcp.evaluation.classify_morphism(morphism, priority, dep_graph=None)[source]

Run the classifier with CFG/PDG/CPG plus an optional ModuleDependencyGraph.

topos.mcp.evaluation.classify_code_string(code, language, priority)[source]

Classify raw source. CFG / PDG / CPG always run; the COMPOSABLE generator is unreachable without a ModuleDependencyGraph.

topos.mcp.evaluation.classify_file(path, priority, gitnexus_dir)[source]

Classify a file, attaching every available representation.

Returns (result, dep_graph) so callers can cache the dep graph for subsequent proposed-code evaluations.