rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
chenyinrusi/dsh-repo-health
Read-only repository health scanners for DeepSeek Harness and any repo: definition drift, unwired-module reachability, prompt bloat, evidence-gate calibration, registration completeness. CLI + MCP server.
PROJECT TOPICS
PROJECT README
Read-only repository health scanners: definition drift, unwired-module reachability, prompt bloat, evidence-gate calibration, and registration completeness — as a CLI and an MCP server.
A codebase rots silently. The most damaging defects are the ones no test, type checker, or linter catches:
repo-health is five read-only scanners that watch for exactly these. It is the extracted, generalized core of the quality-guard tooling behind a large production agent system, repackaged so any repository can run it.
pip install "dsh-repo-health" # CLI
pip install "dsh-repo-health[mcp]" # + MCP server
Requires Python 3.11+ (the registration scanner uses tomllib; the others run on 3.10+).
repo-health drift --root /path/to/repo # definition drift report
repo-health reach --root /path/to/repo # unwired-module report
repo-health prompt-bloat --root /path/to/repo # prompt segment shares
repo-health evidence --path logs/evidence_gate.jsonl
repo-health registration --root /path/to/repo --config registration.toml
repo-health all --root /path/to/repo # run every scanner
Every scanner also ships a --selftest that verifies the tool itself against a
synthetic fixture before it is trusted to judge your code — the predecessor of
these scanners shipped versions that produced pretty-but-wrong numbers, and
only known-answer fixtures caught them.
drift — multi-source definition driftDetects the same name defined in more than one place with overlapping member structure, and flags it when one copy changes but the other does not.
repo-health drift --root . # report
repo-health drift --root . --write-baseline # freeze a baseline
repo-health drift --root . --check # exit 1 on drift / new pairs
reach — unwired-module reachabilityBuilds the import graph and BFS-searches from startup entrypoints
(__main__.py, if __name__ == "__main__" guards, main.py, launch scripts).
Modules that cannot be reached are "wired but dead".
Its baseline carries auditable reasons: every unreachable module needs a
structured {verdict, anchor} entry, validated deterministically (V1–V7) so a
single wrong reason can never permanently hide code from every mechanism.
repo-health reach --root . # report
repo-health reach --root . --write-baseline # freeze
repo-health reach --root . --check # exit 1 on new unwired modules
repo-health reach --root . --audit-reasons # validate baseline reasons
prompt-bloat — prompt segment share baselineReads prompt-inspection JSONL logs ({segments: [{name, pct, kind}]}) and
watches the median share per segment, not the absolute size (absolute size
varies naturally with task complexity; share reflects structural bloat).
repo-health prompt-bloat --root . --check --json
evidence — evidence-gate decision log calibrationSummarizes a decision log ({passed, suggested_action, tool, issues} JSONL) to
answer "is the gate calibrated yet?" — insufficient samples or a
false-positive-prone tool block any conclusion.
registration — config-driven registration completenessDeclares your architecture's extension points in a TOML config and verifies
every defined item appears in its registry. See
config/registration.example.toml for an
annotated example covering agent roles, checkers, API routers, sidebar pages,
and LLM providers.
pip install "dsh-repo-health[mcp]"
python -m repo_health.mcp_server
Exposes the scanners as read-only MCP tools (drift_scan, reach_scan,
reach_reason_audit, prompt_bloat, evidence_calibration, registration).
Register it in DeepSeek Harness's MCP settings (or any MCP client) to let an
agent diagnose its own repository. Large repositories may exceed MCP's default
tool timeout — pass narrower root values or raise the client timeout.
The scanners share a discipline learned the hard way:
{verdict, anchor}.drift scans Python only (.py under the configured package dirs).reach is module-granular: a reachable module whose functions are never
called is not reported; dynamic imports (importlib, plugin loaders) are
invisible and belong in the baseline.evidence and prompt-bloat consume a specific JSONL schema; adapt your
logger to emit it (examples in the docstrings).MIT © 2026 Chen (Jarry) Pan
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: mcp-server、deepseek-harness。