CodeEraser
This server provides read-only CodeEraser project analysis and reporting tools over a repository tree.
Scan size/complexity/readability metrics and detect T1/T2 clone blocks, T3 near-miss clones, and documentation duplication.
Analyze reference sites, dead-code/liveness advisories, git churn, three-signal joins, and score trends.
Judge tree structure (eight axes with optional deep/split analysis), baseline score/ratchet, and intra-function dead code.
Run Datalog queries and architecture-rule checks, and get same-role unit, clone-merge, and architecture/impact advice.
Produce a dry-run erase plan and read the applied-erase audit log; this surface cannot apply erasures.
Inspect machine/core/hook/index/daemon health and check for newer CodeEraser releases over the network.
Reports are read-only or advisory where noted; no baseline writes, erase application, or update application are exposed.
Analyzes local Git repositories to report churn, score trajectories over commit history, co-change patterns, and change impact, using git windows and diffs for code and documentation auditing.
Integrates with pre-commit hooks to refuse commits that introduce duplicate code or documentation, or exceed file size budgets, via ce precommit and ce commitmsg.
CodeEraser
· English | 中文
CodeEraser keeps an agent-written repo small and clean: a write that duplicates code or bloats a file is refused before it lands.
What it does
LLM-assisted codebases drift the same way: the same function written twice, the same paragraph pasted into three files, files that only grow. CodeEraser refuses the write that would do that, before it reaches disk, with no model in the loop.
A write that copies code already in the tree is refused, and the refusal names the region it duplicates.
A write that grows a file past 750 lines is refused the same way (a write that does not lengthen a file already past the line passes, so the file can be split step by step).
Everything else is a report or a gate: CI refuses the merge, and under
[guard] mode = "deny"the Stop audit refuses the turn andce precommitthe commit (by default both record and do not refuse).
Judges Python, TypeScript/TSX, Rust, Go, Haskell, C, C++, Java, Lua, R, Markdown and HTML (thirteen language codes, twelve tree-sitter grammars); JS, CSS, Vue, Svelte, shell and YAML files for size only; .txt for documentation duplication only.
Runs as CLI · GUI (eleven screens) · Claude Code plugin (four hooks, one skill, one command, twenty-one read-only MCP tools) · pre-commit · CI.
Related MCP server: codedelta
The effect: the same task, run twice
Without CodeEraser | With CodeEraser | |
writes refused before they reached disk | 0 | 2 |
duplicate clone blocks left behind | 4 | 0 |
duplicated doc segments | 1 | 0 |
removals still owed | 1 | 0 |
check score | 752 | 1000 |
One seven-step task, two identical copies of the seed; the only variable is whether CodeEraser is in the loop — the write-time guard, the Stop audit, and, once the audit refuses, the eraser acting on its own plan. Both runs still end red — not on the same things.
A scripted agent replays one seven-step task (discounts, a compact report, CSV and JSON output, money formatting) on demo/seed, a small invoicing service, once without CodeEraser and once with it. Every number above and every refusal below is ce's verbatim output.
A copied helper, refused before the file exists. Move 1 of the run above, on its own. The reason names the region the content duplicates and the ordering that would pass, so the refusal is actionable rather than a veto.
$ Write invoicer/discount.py
✗ ce: content for <work>/invoicer/discount.py duplicates 1 indexed region(s): invoicer/money.py:6-18 (80 tokens). Reuse the existing implementation instead of re-writing it. Moving it? Trim the source region first: the probe verifies against the current tree, and the same write then passes.One line, two mouths. ce.toml puts invoicer/** on file_lines_fail = 40. The write-time guard refuses the write that would cross it, and ce scan grades the same tree against the same number — one declaration, read by the hook and by CI.
$ Write invoicer/invoice.py
✗ ce: <work>/invoicer/invoice.py is already past the hard budget of 40 at 51 lines; this write grows it to 93 (plan §4.1). A write that keeps or shrinks it passes: split it step by step.
$ ce scan .
FAIL invoicer/invoice.py:1 file-lines = 51 (limit 40) [invoicer/invoice.py]
warn invoicer/report.py:1 file-lines = 35 (limit 30) [invoicer/report.py]
scanned 9 files / 19 functions — 1 warn, 1 fail -> FAIL (failed: hard_line)The full table, both transcripts and the JSON behind them are in demo/README.md, replayed byte for byte in CI; the first real interception is recorded in T1-INTERCEPT. The precision and recall points are frozen with their evaluation ledgers (EVAL-SET, EVAL-SET-LANGS).
How it works
Zoom and pan this diagram at codeeraser.dev/how/#verdict.
Write-time clone guard: normalized tokens winnowed at k = 25, w = 26, so any shared run of 50+ tokens is caught; import and load statements (the package clause and a Haskell module header among them) and a Python docstring that holds no code give no token, and a report keeps a run only with 50 tokens of its own (the core's coverage rule); only novel duplication is charged (FPR-REPLAY).
Near-miss (T3) clones: candidates from MinHash/LSH, judged in the core by tree edit distance at TSED ≥ 0.85.
Documentation duplication that survives rewording: 5-word shingles, Jaccard ≥ 0.80 or a 50-word verbatim run.
Liveness: per-language resolution ladders feed a reference graph; a four-way verdict comes back with a confidence code, and each unreferenced file is listed under the root it falls with.
Gate score: 0–1000, the share of the tree's lines no finding names (seven axes name lines: size, complexity, clone, docdup, unreferenced, churn, cycles; six count by default, the unreferenced axis only when
[score.weights] deadcodenames it), held by the ADR-006 shrink-only ratchet (growth needsmax(+2 %, +10 lines)or a named re-establish).Deterministic: no model anywhere; text crosses only the local
ce→ce-corepipe, and the core opens no file.
The rest — same-role advice, Datalog queries and rules, intra-function dead code, merge suggestions, architecture, structure axes, tombstone residue, erase — is on codeeraser.dev/how and in the methodology booklets.
Install, run, update
Installer. Each release ships five GUI installers (NSIS / AppImage / dmg) bundling the GUI,
ceand thece-corejudgment core; the Windows installer runsce setup(AppImage / dmg users run it once), which wires Claude Code. The fifteen artifacts are unsigned by decision; verify withsha256sum -c --ignore-missing SHA256SUMS.Homebrew / winget.
brew install skymanbp/codeeraser/codeeraser;winget install skymanbp.CodeEraseronce winget-pkgs merges.Claude Code plugin.
/plugin marketplace add skymanbp/CodeEraser@release, then/plugin install codeeraser@codeeraser.CLI only, or from source. Put
ceandce-coreside by side on PATH;cargo install codeeraserbuildsceonly, so takece-corefrom a release or build it with GHC 9.14.1 + cabal;cefinds the core asCE_CORE_BIN→ ace-coresibling → PATH, and--core <path>wins.Updating.
ce updatechecks the latest release against its two-phase pins and--yesreplaces the binaries (RELEASE).
Commands
Command | What it reports / judges |
| size and complexity metrics; T1/T2 clone blocks against the budget |
| T3 near-miss clones; documentation duplication |
| reference sites and mentions; liveness verdicts |
| git-window churn; the three-signal join; score trajectory |
| same-role units, ranked by the core; advice only |
| Datalog over the index's facts; rules judged as a gate |
| dead code inside functions, from the control-flow graph |
| how a clone group would fold into one function; advice only |
| directory layers, cycle cuts, clusters, change impact; advice only |
| eight structure axes and split pricing |
| the ratchet and score floor, seven named fail conditions |
| the deterministic two-phase eraser; dry run by default |
| latest release vs this build; |
| machine state; Claude Code wiring; uninstall; the MCP server |
Output is English by default and Chinese under --lang zh, CE_LANG=zh or [ui] lang = "zh". [[rules.class]] in ce.toml gives one glob set its own lines and ratchet tolerance (ce.toml reference).
Three faces, one product
Every capability reaches the CLI, the GUI and the plugin with its MCP server, or is a named omission; the face_parity gate derives the sets from the code.
capability | report document (core catalogue) | CLI | GUI (screen · commands) | plugin (hooks · MCP · commands · skills) |
size / complexity / readability metrics |
|
|
| MCP |
T1/T2 clone blocks |
|
|
| MCP |
T3 near-miss clones |
|
|
| MCP |
the unit universe T3 judges |
|
|
| MCP |
documentation duplication |
|
|
| MCP |
reference sites |
|
|
| MCP |
the mention universe |
|
| — CLI only: the census behind the symbol advisory, which every face of | — CLI only: the MCP |
liveness verdicts + symbol advisory |
|
|
| MCP |
graph screen (canvas + liveness) |
| — GUI only: the canvas is a picture; the same judgment's CLI and MCP faces are |
| — GUI only: the MCP face of the same judgment is |
git-window churn |
|
|
| MCP |
three-signal join |
|
|
| MCP |
tree-scale structure (split pricing) |
|
|
| MCP |
score trajectory |
|
|
| MCP |
score, ratchet and floor |
|
|
| MCP |
same-role advisor (similar units, associative view) |
|
|
| MCP |
code query and architecture rules |
|
|
| MCP |
intra-function dead code (unreachable, dead stores, unused locals and parameters) |
|
|
| MCP |
clone merge suggestions (anti-unification) |
|
|
| MCP |
architecture analysis (layers, cuts, clusters, impact) |
|
|
| MCP |
baseline writes | — |
| — CLI only: a machine surface never writes a baseline | — |
erase plan |
|
|
| MCP |
erase apply | — |
|
| — no MCP face: applying is a human act |
erase audit log |
|
|
| MCP |
machine state and guard-class tiers | — |
|
| MCP |
update check | — |
|
| MCP |
update apply | — |
|
| — the plugin's copy is re-pinned by |
write-time guard | — |
| — hooks are the plugin's face; flow and tombstone judge the write inside the hook, so no report family of their own — their tiers ride every face's doctor | hook |
asked-write settlement | — |
| — hooks are the plugin's face | hook |
stop audit / git hooks | — |
| — hooks are the plugin's face; precommit and commitmsg are git's; tombstone judges the changeset inside them, its tier on every face's doctor | hook |
session health line | — |
| — hooks are the plugin's face | hook |
project daemon | — |
| — started lazily by every face | — |
read-only report server | — |
| — the plugin registers it |
|
uninstall | — |
| — CLI only | — |
Claude Code wiring | — |
| — CLI only: the Windows installer calls it, AppImage / dmg users run it once | — |
root anchoring | — | — every command and hook anchors through |
| — |
Tech stack and philosophy
Zoom and pan this diagram at codeeraser.dev/#architecture.
Rust 1.94.1 (edition 2024): tree-sitter 0.27 with twelve grammars, rusqlite 0.40 (index schema 17 / GRAPH_REV 28 / MENTION_REV 4), a per-project daemon.
Haskell (GHC 9.14.1):
ce-core, every judgment family. Tauri 2: the GUI over the same crate.One wire: NDJSON over stdio (proto 10.0.0, sixteen families); the daemon speaks its own protocol (2.4.0).
Design rules: ADR-001 … ADR-009 (Rust frontend, parse layer in Rust, lazy daemon, cheap PreToolUse, two clone layers, shrink-only ratchet, pinned distribution, policy as Haskell data, derived documentation facts) in DEVELOPMENT_PLAN.
Philosophy. Measure in Rust, decide and write in Haskell, print everywhere else. Nothing asks a model anything; hooks fail open and say so; documentation is generated or gated, including the nineteen-booklet methodology, and every push runs the seven product gates on this tree.
Known limits
PreToolUse shapes behaviour; it is not a security wall (shell writes bypass it; CI is the backstop, and the Stop audit too under [guard] mode = "deny"). The probe matches a write against the index as it stands and does not refresh it: a file created or changed outside Write/Edit (a shell command, an editor, git) becomes a duplicate source at the next whole run (ce dedup, the Stop audit). Hooks fail open on internal errors and on a hook envelope over 4 MiB (the largest writes pass unjudged), and record the degradation.
Languages. AST judgment uses the twelve grammars above; Markdown and HTML are judged by the documentation and graph rules,
.txtby documentation duplication only; T4 clones are not promised.Advice, never a verdict. Symbol-level liveness,
ce similar,ce mergeandce archnever fail a gate; a guard class staysobserveuntil it has its own false-positive record.Lines, not findings. The score counts the lines some finding names, each line once however many findings name it: one long duplicated file weighs more than many short ones, and a second finding on lines already named does not lower it further. With the unreferenced axis off (the default), an unreferenced file is an ordinary clean file: deleting one shrinks L and can lower the score;
[score.weights] deadcode = 1counts its lines as findings again.A span is first token to last. A clone block's printed span runs from its first token's line to its last, so it can name the comment, docstring and import lines between them, which carry no token (a head declaration never starts or ends a span); the score counts those lines like any other line the block names.
Lines not drawn.
cognitive_faildefaults to 0 (complexity only warns), andce structurehas no score floor.What the text names. Liveness reads the references a file spells. A load whose target is computed (
require(prefix .. name),import("./lib/" + name)) or a star import whose__all__is not all literal draws no edge for what it does not spell: the file stays unreferenced and its language cannot vouch for it. Unreferenced is not unused, so the default lists such a file and fails nothing; a project that wants new ones blocked declares[deadcode] blockand commits a baseline. Nor is it a deletion licence: a file nothing references may still be run by name or found by a tool's convention (the eight conventions the dead-file exam passed, among themsetup.py, Sphinx'sconf.py,package-info.javaand a Next.jsapp/page, are entries; a convention the product does not list is not), soce erasedeletes no whole file and erases only byte-identical documentation spans. Entry points declared insetup.cfgor a non-rootpyproject.tomlare not read, and booklet 06 lists the other reference forms and entry families the graph does not read (a file reached only byinclude!, a script run by its path, a worker loaded bynew URL(...), among others), each with its remedy:[graph] entry_globs, orce:allow(deadcode) -- <why>in the file.Distribution. A release builds five targets;
ce setupwires nothing from an elevated account that is not the logged-in user (exit 13); judging this repository needs thecli/testssubmodule seated.One wire line. A request line to the core is at most 134,217,728 bytes; larger requests split into batches, and an oversized item is refused by name, never truncated.
Scores are not comparable across a [[rules.class]] switch, across a named re-establish that moves softLine, or across these releases: v0.7.3 → v1.0.0, v1.2.0 → v1.3.0, v1.3.x → v1.4.0, v1.6.0 → v1.7.0, v1.7.4 → v1.8.0, v1.8.0 → v1.9.0 (1.9.1 and 1.9.2 are comparable with 1.9.0), v1.9.x → v1.10.0 (the score became the share of lines no finding names, and the unreferenced axis weighs 0 unless named; 1.10.1 is comparable with 1.10.0), v1.10.1 → v1.10.2 (Python docstrings give no clone token and are read past a leading comment; a docstring or a comment block, in any language, keeps the prose under a tilde title underline; 1.10.3 is comparable with 1.10.2); the reasons are in CHANGELOG.
Documentation
CLI reference · ce.toml reference (generated from the binary and the config schema; drift reddens CI) · Methodology (nineteen booklets, cited to implementation lines) · structure axes · size advisory · erase contract · GUI reference · plugin · demo
DEVELOPMENT_PLAN · EVAL-SET · EVAL-SET-SIMILAR · EVAL-SET-LANGS · EVAL-SET-FLOW · language-expansion · FIELD-TEST · PERF-BUDGET · FPR-REPLAY · FPR-TOMBSTONE · FPR-L2 · T1-INTERCEPT · contracts/VERSIONING.md · docs/RELEASE.md (wire SemVer and the two-phase release runbook)
Website: codeeraser.dev · how it works · math · stack
License
Apache-2.0; see LICENSE. Third-party inventory in NOTICE (regenerated and gated in CI). The test suite lives in skymanbp/CodeEraser-tests; clone with --recurse-submodules. "CodeEraser"™ is a trademark of skymanbp; per Apache-2.0 §6 the license covers the code, not the name.
Available Tools
21 toolsarchitectureB
The architecture of the tree (ce.arch-report schema): directory layers and the arcs to cut out of their cycles (each with the file references behind it), file clusters and the files outside their cluster's directory, per-directory fan-in / fan-out / instability, and the files a change to impact reaches. Advisory.
Inputs: path, impact.
checkC
ADR-006 baseline judgment: score, ratchet and axes (report only — this surface never writes a baseline).
Inputs: days, path, floor.
check_duplicationC
Verified T1/T2 clone blocks (ce.dedup-report schema).
Inputs: path, min_tokens, min_distinct.
churnC
Append-vs-rewrite and co-change over a git window (ce.churn-report schema).
Inputs: days, path.
cloneC
T3 near-miss clone judgment (ce.clone-report schema); units lists the cached unit universe instead.
Inputs: path, units.
deadcodeC
Liveness verdicts over the reference graph, plus the symbol-level advisory of declarations no other file spells — never a verdict (ce.deadcode-report schema).
Inputs: path.
docdupC
Documentation-duplication judgment (ce.docdup-report schema).
Inputs: path.
doctorB
This machine's state (ce.doctor-report schema): ce-core handshake, the tier of every guard class the hooks read (the write guard, flow, tombstone), index freshness, daemon, degraded-run counter. The daemon is asked without being started.
Inputs: path.
eraseA
The deterministic erase PLAN (ce.erase-plan schema) — dry-run by construction: this surface reaches the plan and nothing else, and applying it is a human act at the CLI or the GUI.
Inputs: path.
erase_logA
The applied-erase audit trail (ce.erase-trail-report schema): every record ce erase --apply or the GUI appended to .ce/erase-log.ndjson, with the lines the reader could not parse named by number. Read-only — nothing here can apply or append.
Inputs: path.
flowB
Dead code inside functions (ce.flow-report schema): unreachable statements, dead stores, unused locals and parameters, judged by the core over flow/1 and placed by path, unit, kind, lines and variable; each finding says whether it is judged or advisory (unused parameters always are). Report-only.
Inputs: kind, path.
graph_sitesC
Reference sites, resolution-free (the ce graph --sites rows).
Inputs: path.
joinC
Three-signal join: similarity, graph position, churn (ce.join-report schema).
Inputs: days, path.
merge_suggestionsB
Clone-merge suggestions (ce.merge-report schema): every clone group — T1/T2 families, T3 pairs — anti-unified by the core's merge/1: the parameters a merged function takes with each member's text at them, the member kept, the lines saved, feasible or why not. Advisory.
Inputs: path.
queryB
One question in CE Datalog over the index's facts (ce.query-report schema): files, references, units, clones, mentions, path classes, with the built-in prelude (dead, reach, depends, same_dir, dir_ref) and the project's rules file; every answer labelled, its derivation under why; prelude answers the text a question builds on instead (ce.query-prelude schema: the prelude and the [rules.pack] program). Report-only.
Inputs: why, body, file, path, +1 more.
rulesB
The project's architecture rules judged (ce.rules-report schema): every assert in the rules file with its violations, each carrying its witness and derivation. The CLI exits on counts.violations; here it is a report.
Inputs: why, file, path.
scanC
Size/complexity/readability metrics report (ce.scan-report schema).
Inputs: path.
similar_unitsC
The same-role advisor (ce.similar-report schema): the units most like one unit or a text, in the core's order with its role bit and a six-channel evidence row; widen adds the PPMI associative view. Advisory — never a verdict.
Inputs: at, path, text, unit, +1 more.
structureC
Tree-scale structure judgment, eight axes (ce.structure-report schema).
Inputs: days, deep, path, split.
trendB
Score trajectory over mainline git history (ce.trend-report schema; points cache in the index, rebuildable from history).
Inputs: path, batch, commits.
update_checkA
Whether a newer CodeEraser release exists (ce.update-report schema): the latest tag, that tag's committed SHA256 pins, and the one action for this install. Reads the release index over the network; places nothing — applying is a human act at the CLI or the GUI.
Inputs: path.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 21 tools
The set clusters into overlapping families: clone/check_duplication/docdup/join/merge_suggestions all concern duplication, and deadcode/flow/graph_sites all concern liveness, while scan/structure/architecture/trend/check all emit report-style metrics. The dense descriptions do differentiate them (T1/T2 vs T3, liveness verdicts vs in-function flow), but an agent could easily misselect within these families.
Names are uniformly lowercase, using snake_case for compounds (check_duplication, graph_sites, erase_log, merge_suggestions) and single words elsewhere (scan, erase, churn, flow, query). No camelCase or mixed verb styles, though the single-word vs compound mix means the pattern is readable rather than strictly uniform.
21 tools is at the heavy end but the domain (multi-faceted static analysis: duplication, dead code, structure, rules, query, diagnostics, updates) genuinely spans that many distinct reports. Each tool appears to earn its place rather than being redundant filler.
The surface covers the full analysis lifecycle: scanning, dedup, dead code, flow, structure, architecture, rules, Datalog query, trend, doctor, update_check, and erase audit. Applying an erase is deliberately a human act, and query/prelude fill the ad-hoc retrieval gap, so only minor workflow conveniences seem absent.
Maintenance
Related MCP Connectors
30+ deterministic dev and delivery tools: linting, metrics, diagrams, model advice, AI-text checks.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
AI-powered codebase analysis — call graphs, security, dead code, complexity. 150+ tools.
Live GitHub repo AST X-Ray, 42 coding-agent DoD gates, Git worktree guards & brownfield baselines.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceLive codebase intelligence for AI agents. Import graph PageRank for file importance, git forensics for co-change coupling and fragile code, convention detection across 16 domains, and blast radius analysis.39 npm3Business Source 1.1

codedeltaofficial
AlicenseAqualityCmaintenanceDeterministic code-churn measurement and AI-agent detection from the CodeDelta engine: measure churn between two directories or git refs, scan for code that runs AI agents, and get AI-authorship pointers. Runs fully locally.3MIT- AlicenseNot gradedqualityBmaintenanceEnables AI coding assistants to scan a repository for code that cannot prove its usefulness, attribute it to AI-assisted or human commits, prove candidate deletions against the project's own tests, and pull a payoff report or run history, all without ever writing to the repository. The test command and any model judging stay under a person's control through environment configuration.1MIT
- AlicenseAqualityBmaintenanceEvidence-backed, read-only codebase diagnostics for coding agents: secrets, dependency, RLS, and source-impact audits with a verify loop and PR review verdicts. Never writes files or uses the network by default.7101 npmMIT