Refactory
About
Hybrid decomp tool — AI decides WHERE to split your monolith, deterministic engine COPIES the code. Minimize tokens, maximize syntax validity.
Details
- Author
- codedrop-codes
- Categories
- Developer Tools, AI
Jump to
Setup
Install Refactory in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/codedrop-codes/refactory
Follow the installation instructions in the repository README, then restart your MCP client.
Hybrid code decomposition. AI plans the boundaries. A deterministic engine handles the routine extractions. Minimize tokens, maximize syntax validity.
Refactory splits monolith source files into clean modules. It uses an LLM for one thing — deciding which functions group together. Everything else is mechanical: function boundary detection, import resolution, module assembly, syntax validation, scoring.
JavaScript and Python extraction is mostly mechanical.The deterministic engine handles the straightforward moves — the routine 80% that's a waste of AI time and tokens. The LLM still handles complex edge cases where judgment matters. Other languages use LLM extraction with adaptive compression.
Works with Claude Code, Cursor, Windsurf, VS Code Copilot — any MCP client. Or use the CLI directly.
{ "mcpServers": { "refactory": { "command": "npx", "args": ["@refactory/mcp"], "env": { "GROQ_API_KEY": "your-key-here" } } } }
Then tell your AI tool:"Analyze and decompose src/big-file.js into modules"
One free API key (Groq or Gemini) is needed for the PLAN step only. Extraction is mechanical — no key required for JS/Python.
git clone https://github.com/codedrop-codes/refactory.git cd refactory && npm install node src/cli.js decompose src/big-file.js
refactory analyze src/big-file.js # Health check + function map refactory plan src/big-file.js # Generate module boundaries (needs LLM key) refactory verify lib/modules/ # Check extracted modules refactory languages # Show supported languages refactory providers # Show configured LLM providers refactory test submit broken.js # Submit a file that breaks extraction refactory test run # Validate preprocessors against test corpus
1. ANALYZE Scan functions, dependencies, health — mechanical | 2. CHARACTERIZE Snapshot exports before touching anything — mechanical | 3. PLAN LLM decides module boundaries — the only AI step | 4. EXTRACT Copy functions by line range, resolve imports — mechanical | (LLM fallback for unsupported languages) 5. FIX-IMPORTS Rewrite require()/import paths — mechanical | 6. VERIFY Syntax check, load check, export comparison — mechanical | 7. METRICS Refactory Score + HTML report — mechanical
6 of 7 steps are deterministic. The LLM only decideswhereto split — it never touches your code.
Mechanical extraction handles the routine cases: the preprocessor finds function boundaries by parsing, copies them by line range, and resolves imports deterministically. Complex patterns (dynamic exports, deeply interleaved logic) still go through the LLM.
Contribute a preprocessorfor your language.
A single number (0.0 to 1.0) that measures decomposition quality.
- clean_rate— modules that load without errors / total modules
- size_reduction— 1 − (largest module / original file)
A score of1.0means every module loads cleanly and no module is bigger than the original.
You only need one free key for the PLAN step. Extraction is mechanical for supported languages.
Set at least one:GROQ_API_KEY,GOOGLE_API_KEY,OPENROUTER_API_KEY, orSAMBANOVA_API_KEY.
Found a file that breaks extraction? Submit it:
refactory test submit broken-file.js -d "what went wrong"
Secrets are stripped automatically. Every submission becomes a permanent test case. The extractor gets stronger with every report.
- Discord— Help, ideas, show your results
- Discussions— Feature requests, language requests
- Issues— Bug reports
- Contributing— Build a preprocessor, submit test files
Premium language packs available under commercial license. Seerefactory.codedrop.codes.
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
AI-to-AI code review platform — Claude, Codex, and Gemini cross-check each other via MCP, REST API, and CLI for consensus-based results.
Orchestrates a dual-AI engineering loop where a Primary AI plans and implements, while a Review AI validates and reviews, with continuous feedback for optimal code quality. Supports custom AI pairing (Claude, Codex, Gemini, etc.)
Provides AI assistants with a comprehensive, one-time analysis for complete codebase context and understanding.
Automate Google Jules, the AI coding assistant, for tasks like code reviews, repository management, and AI-powered development workflows.
Analyze and visualize code graphs using CodeGPT.
An intelligent security agent that analyzes AI-generated code for vulnerabilities and assists with remediation.
ast-mcp-server gives coding agents compact, type-aware access to TypeScript and JavaScript projects. It uses the real compiler project model through ts-morph, so declarations, references, rename locations, and diagnostics come from the AST instead of text-search guesses.
An MCP server to help AI assistants to answer questions and generate AccelByte Extend SDK code more effectively .
Instead of direct calling MCP tools, mcpcode server transforms MCP tool calls into TypeScript programs, enabling smarter, lower-latency orchestration by LLMs.
Skene is a codebase analysis toolkit for product-led growth. It scan your codebase, detect growth opportunities, and generate actionable implementation plans.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.




