topos.mcp.tools.assess¶
Assessment tool — compare current vs. proposed code on the lattice.
This is the main tool for agent refactor loops. When filepath is provided,
the baseline is evaluated against the cached ModuleDependencyGraph and the
proposed AST is scored against that same graph (approximating coupling under
the refactor). Anti-gaming guardrail: if scores moved meaningfully while AST
edit distance is near zero, status becomes SUSPICIOUS_NO_STRUCTURAL_CHANGE.
- topos.mcp.tools.assess.topos_assess_improvement(params)[source]
Compare proposed code against the current baseline.
Preferred usage — pass
filepath(code loaded from disk + coupling scored against the cachedModuleDependencyGraph). The proposed code is parsed, but coupling is an approximation: it uses the current dep graph for the target file, so inbound edges from other files reflect the pre-refactor state. That’s fine for tight iteration loops.Legacy usage — pass
current_code+proposed_code. Coupling is NOT computed (AST-only).Anti-gaming: when scores move meaningfully but AST edit distance is near zero, status becomes
SUSPICIOUS_NO_STRUCTURAL_CHANGEandsuspicion_reasonis populated.
- topos.mcp.tools.assess.render_assessment_md(r)[source]
Compact markdown for a refactor assessment.
Summarizes current vs. proposed rather than dumping both full evaluations; the structured_content channel still carries everything.