Claude Code plugin for AST-driven refactoring of large Rust, Python, and TypeScript/TSX repos. A native Rust scanner (clactor-scan) finds candidates deterministically; agents judge each one; you approve; writer agents make the edits and re-verify. Nothing is written without approval. MIT.
dedup — duplicated and drifted bodies. Compares function/type ASTs with TSED (tree edit distance), so it catches copy-paste after renames and reformatting, not just text matches. Ranks by duplicated-LOC volume. Verdicts: DUPE-EXTRACT, PARAMETRIZE, DIVERGED, INHERENT, FALSE-POSITIVE. DIVERGED means same structure but drifted attributes / fields / wire-format, which is usually a latent bug (two serializers that no longer agree; a fix applied to one copy only).
shape — misshapen signatures. ASSEMBLE: a function's loose params match an existing struct's fields, so pass the struct. CLUMP: the same param-tuple threads through many functions with no home, so introduce a struct. This is the "too many arguments / missing data object" smell that dedup can't see.
Both loops: scan → agents adjudicate at file:line → human gate → one writer agent per approved item (rewrites call sites, runs build/lint/test) → re-scan and report the delta.
| language | files | module boundary |
|---|---|---|
| Rust | .rs |
nearest Cargo.toml |
| Python | .py |
nearest package root |
| TypeScript / TSX | .ts .tsx |
nearest package.json |
TSX/JSX parses natively, so it runs on React apps. node_modules and .d.ts are skipped. On TypeScript, shape sees arrow-function components and hooks; dedup sees named functions and methods.
/plugin marketplace add copiumnicus/clactor
/plugin install clactor@clactor
/clactor:dedup all # or: /clactor:shape all
Fetches a checksum-verified prebuilt clactor-scan for your platform; no Rust toolchain needed. Both skills take [rust|python|typescript|all] [--scan-only].
Point Claude Code at the plugin folder, plugins/clactor:
git clone https://github.com/copiumnicus/clactor && cd clactor && cargo build --release
claude --plugin-dir ./plugins/clactor # run on clactor itself
To run on your own repo, launch Claude from there and pass the folder by absolute path:
cd /path/to/your/project
claude --plugin-dir /abs/path/to/clactor/plugins/clactor
After cargo build --release the skills find target/release/clactor-scan automatically (override with CLACTOR_SCAN_BIN=/abs/path).
clactor.toml in the target repo sets roots, excludes, per-language similarity floors, and the build/lint/test commands writers run. If it's missing, the skill scaffolds one. See examples/clactor.toml. The scanner also runs standalone:
clactor-scan scan --config ./clactor.toml --out ./runs/latest
clactor-scan shape --config ./clactor.toml --out ./runs/latest
Architecture, scanner design, and roadmap: PLAN.md.
MIT © 2026 copiumnicus. See LICENSE.