원클릭으로
topos
Structural code quality metrics, lattice verification, and refactor loops for agent-written code.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Structural code quality metrics, lattice verification, and refactor loops for agent-written code.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | topos |
| description | Structural code quality metrics, lattice verification, and refactor loops for agent-written code. |
| version | 0.4.2 |
| homepage | https://docs.krv.ai/topos/ |
| metadata | {"openclaw":{"requires":{"bins":["topos"]},"homepage":"https://docs.krv.ai/topos/","os":["macos","linux"],"emoji":"📐"},"hermes":{"tags":["code-quality","refactoring","security","metrics"],"category":"software-development","requires_toolsets":["terminal"]}} |
Topos scores code on three pillars — SIMPLE, COMPOSABLE, SECURE — and maps results to a medal lattice (SLOP → GOLD). Use it in a closed loop: measure, edit, re-measure.
Developers and AI coding agents use this skill to improve structural code quality, reduce complexity, verify refactors, and optimize toward GOLD or SILVER medals. It supports both CLI and MCP agent loops on local repositories.
Deployment geography: Global (local execution; no region-restricted services).
Load this skill when the user asks to improve code quality, reduce complexity, check structural security footguns, verify a refactor, or optimize toward GOLD/SILVER medals.
Requires API Key or External Credential: No
Credential Type(s): None
Runtime dependencies:
curl -fsSL https://docs.krv.ai/topos/install.sh | bash
npm install -g gitnexus # enables COMPOSABLE / GOLD scoring
topos CLI on PATH (install via docs.krv.ai/topos/install.sh)topos assess_worktree_change, untracked baselines via snapshot flow).gitnexus dependency graph for COMPOSABLE / GOLD scoring (generated automatically when gitnexus is installed; force refresh with topos depgraph generate or topos_generate_depgraph)COMPOSABLE is scored by default: evaluate / inspect and the MCP evaluate
tools detect a missing or stale .gitnexus and regenerate it before scoring.
Run topos depgraph generate only to force a refresh.
Optional MCP setup (for tool-based agents, not required for CLI-only use):
claude mcp add --transport stdio topos -- topos mcp
Do not include secrets in prompts, logs, or output. Topos reads local source files and git state only; it does not transmit code to external services.
Risk: The skill may guide agents to apply structural refactors that change behavior; Topos measures structure, not functional correctness.
Mitigation: Run project tests or linters after each edit; treat Topos verdicts as structural signals, not proof of correctness.
Risk: Agents may trust SECURE medal findings as full security assurance; Topos SECURE checks are structural heuristics, not full SAST.
Mitigation: Pair with dedicated security tooling for high-stakes code; acknowledge remaining SECURE findings explicitly.
Risk: Without GitNexus installed, COMPOSABLE scores are unavailable and GOLD is unreachable.
Mitigation: Install gitnexus (npm install -g gitnexus); check MCP warnings and coupling_available before trusting composability scores.
Risk: Cosmetic edits (whitespace, rename-only) may appear as improvements but do not move the lattice.
Mitigation: Stop when MCP returns SUSPICIOUS_NO_STRUCTURAL_CHANGE; require IMPROVEMENT or IMPROVEMENT_SCORE before accepting a change.
Output type(s): Analysis, markdown reports, JSON (MCP), shell commands
Output format: CLI tables and ranked file lists; MCP structured payloads with agent_contract fields; per-function inspect detail
Output parameters: Medal verdict (SLOP → GOLD), pillar scores (SIMPLE, COMPOSABLE, SECURE), ranked refactor targets, assessment status (IMPROVEMENT, REGRESSION, etc.)
Other properties: Writes .gitnexus graph artifacts when depgraph is generated; does not modify source files unless the agent chooses to edit based on guidance
topos evaluate <path> -r (CLI) or topos_evaluate_file / topos_evaluate_project (MCP). COMPOSABLE is included by default; pass gitnexus_dir only to point at a non-default graph.topos inspect <file> or topos_inspect_code for per-function complexity and metric detail.topos_assess_worktree_change (baseline HEAD) for MCP loops. For untracked baselines: topos_begin_refactor → edit → topos_assess_snapshot.Stop when the target medal is reached, the priority pillar passes, or further iterations plateau. Prefer structured agent_contract fields over parsing prose.
| Command | Purpose |
|---|---|
topos evaluate <path> -r | Rank files; show worst offenders and cheapest fixes |
topos inspect <file> | Deep per-file metrics and suggestions |
topos compare <a> <b> | AST edit distance between two versions |
topos coverage <put>... --tests <test> | Structural test coverage (UAST + k-gram recall) |
topos depgraph generate | Build GitNexus graph for COMPOSABLE scoring |
topos graphify generate|orphans | Advisory orphan / fragile-edge hints (does not affect evaluate) |
topos mcp | Start the MCP server for tool-based agent loops |
Pass --gitnexus-dir .gitnexus when the graph lives outside the default path, or --no-composable to score SIMPLE/SECURE only. Preference ranking is an MCP-only input (preferences.ranking); the CLI has no --preferences flag. Advisory cycles/dependencies/process hints are likewise MCP-only, via topos_refactor.
| Tool | Purpose |
|---|---|
topos_get_doc(topic="agent-contract") | Compact loop contract — read first |
topos_evaluate_file | Score one file; returns 3 ranked edit spans (refactor_targets, gate failures first) |
topos_evaluate_project | Project rollup and worst-file list |
topos_inspect_code | Deep per-function complexity and metrics |
topos_assess_worktree_change | Compare working tree to a git baseline |
topos_begin_refactor / topos_assess_snapshot | Snapshot flow for untracked baselines |
topos_assess_improvement | Side-by-side variant comparison |
topos_assess_changeset | Assess several edited files at once against a git baseline |
topos_generate_depgraph / topos_depgraph_status | Force-refresh, or read-only diagnose, the GitNexus graph |
topos_calculate_coverage | Structural test coverage (separate from lattice) |
topos_evaluate_code | Score a source string when there is no file on disk |
topos_inspect_code / topos_compare_code / topos_compare_files | Deep metrics; AST edit distance between two versions |
topos_preference_walk | Resolve target / fallback / next-step verdicts for a ranking |
topos_refactor | Advisory hotspots (cycles, dependencies, process, graphify) — never affects the medal |
topos_generate_graphify_graph | Build the Graphify knowledge graph for topos_refactor(target="graphify") |
MCP tool arguments are flat objects — {"filepath": "..."}, not {"params": {...}}.
gitnexus is installed. If it isn't, coupling_available is false and GOLD is unreachable — check warnings.SUSPICIOUS_NO_STRUCTURAL_CHANGE.topos refactor is advisory. It does not replace topos evaluate for scoring.A change is ready when:
IMPROVEMENT or IMPROVEMENT_SCORE (MCP), or the evaluate verdict improved (CLI).SUSPICIOUS_NO_STRUCTURAL_CHANGE or REGRESSION.Users should review agent-proposed code changes before committing, especially when refactoring production systems. Topos is an advisory structural quality tool; organizations should apply their own security, compliance, and code-review policies before deployment.