- π€ LLM usage: $0.1500 (1 commits)
- π€ Human dev: ~$100 (1.0h @ $100/h, 30min dedup)
Generated on 2026-07-12 using openrouter/qwen/qwen3-coder-next
Deconnected builds one evidence graph across frontend code, API routes, backend modules, workers, Docker services, SQL/ORM references and database tables. It helps identify safe extraction seams, probable legacy elements and refactoring risks before code is moved or removed.
Deconnected is intentionally conservative. A missing reference is evidence for investigation, not automatic permission to delete a table, endpoint or module.
- static scanning of Python, JavaScript, TypeScript, SQL, PHP, Go, Java and Kotlin files;
- Python route, import, table and embedded-SQL analysis with LibCST;
- SQL table extraction with sqlglot and a lower-confidence fallback parser;
- Docker Compose and Dockerfile dependency scanning;
- optional database-schema reflection through SQLAlchemy;
- import and correlation of TestQL runtime topology;
- table usage classification from static, runtime and test evidence;
- extraction-candidate discovery from graph cohesion and boundary edges;
- optional integrations with code2llm, code2logic, redup, regix, vallm and toonic;
- constrained refactoring plans, optional LiteLLM/OpenRouter refinement and isolated Claude Code execution;
- patch-scope policy, forbidden-operation checks, repository snapshots and validation reports.
TestQL runtime topology LibCST / sqlglot / source scan
β β
ββββββββββββββββ¬ββββββββββββββββ
βΌ
Unified evidence graph
βΌ
usage classification and seam analysis
βΌ
constrained refactoring plan
βΌ
LiteLLM/OpenRouter planning or Claude Code execution
βΌ
worktree β patch policy β tests β acceptance or rollback
- Python 3.10 or newer;
- Git for isolated refactoring simulations;
- optional Docker/TestQL/runtime services when those integrations are used;
- optional
claudeexecutable for Claude Code execution.
Core package and development tools:
python -m pip install -e ".[dev]"Browser and TestQL support:
python -m pip install -e ".[dev,gui,testql]"
playwright install chromiumLiteLLM/OpenRouter planning:
python -m pip install -e ".[dev,llm]"Full optional ecosystem:
python -m pip install -e ".[dev,gui,testql,ecosystem,llm]"External ecosystem packages are optional adapters. A missing adapter does not block the core scan.
deconnected scan . --out .deconnected/graph.jsonWith a TestQL topology and reflected database schema:
deconnected scan . \
--testql-topology .testql/topology.json \
--database-url "$DATABASE_URL" \
--out .deconnected/graph.jsondeconnected report .deconnected/graph.json
deconnected table-usage .deconnected/graph.json
deconnected classify-tables .deconnected/graph.json
deconnected seams .deconnected/graph.jsonMachine-readable table classifications:
deconnected classify-tables .deconnected/graph.json --json-outputdeconnected generate-frontend-tests \
.testql/topology.json \
--out .deconnected/generated-web.testql.toon.yamldeconnected plan-refactor \
.deconnected/graph.json \
"extract protocol audit feature" \
--out .deconnected/refactor-plan.jsondeconnected verify-refactor . .deconnected/refactor-plan.jsonClaude Code simulation inside an isolated worktree:
deconnected simulate-refactor \
. \
.deconnected/refactor-plan.json \
--keep-worktreeactively_usedβ runtime SQL evidence exists;statically_reachableβ reachable from a GUI/API/job/service entrypoint and referenced outside tests;statically_referencedβ referenced, but no complete entrypoint path was proven;test_onlyβ discovered references are limited to tests;probable_legacyβ no static, runtime or test evidence was found.
probable_legacy is a review candidate. Before deletion, verify migrations, production traffic, external consumers, scheduled jobs, manual scripts, backups and rollback procedures.
Set the provider key supported by the selected LiteLLM model. For OpenRouter:
export OPENROUTER_API_KEY="..."Generate and refine a plan:
deconnected plan-refactor \
.deconnected/graph.json \
"split protocol audit into a bounded package" \
--provider litellm \
--model openrouter/deepseek/deepseek-chat \
--out .deconnected/refactor-plan.jsonThe deterministic plan is created first. The model may refine it, but the returned object must validate against the RefactorPlan Pydantic schema.
Current limitation: CLI budget parameters are not exposed yet. BudgetPolicy exists in the Python API and uses conservative defaults.
The Claude Code adapter runs claude -p with a restricted tool list:
Read, Glob, Grep, Edit,
Bash(pytest:*), Bash(npm test:*), Bash(git diff:*), Bash(ruff:*)
The simulation:
- refuses plans with blockers;
- creates an isolated Git worktree and branch;
- asks Claude Code to apply only the approved plan;
- records snapshots before and after;
- evaluates changed paths and forbidden operations;
- runs the validation matrix only when policy passes;
- saves the binary Git patch and reports.
The current branch is not edited directly.
Each simulation writes to:
.deconnected/runs/<plan-id>/
Artifacts:
agent-result.json
policy.json
snapshot-before.json
snapshot-after.json
snapshot-diff.json
verification.json
patch.diff
See docs/ARTIFACTS.md for field-level interpretation.
Check availability:
deconnected integrationsRun installed analyzers:
deconnected ecosystem-scan . \
--target http://localhost:8100 \
--tools testql,code2llm,redup,regix,vallm,toonic \
--out .deconnected/ecosystemThe command writes .deconnected/ecosystem/manifest.json with availability, status and produced artifacts.
Default assumptions:
- no automatic database table drops;
- no remote pushes;
- no Git history rewriting;
- no direct work on the current branch;
- every plan contains
allowed_pathsandforbidden_operations; - a scope or policy violation blocks acceptance;
- tests passing cannot override a blocked patch policy;
- a patch is retained for review even when blocked.
Run the complete test suite:
PYTHONPATH=src pytest -qCompile Python sources:
python -m compileall srcLint:
ruff check src tests- Architecture
- CLI reference
- LLM and Claude Code setup
- Refactoring workflow
- Artifacts
- Troubleshooting
- Changelog
Version 0.6.1 is an experimental refactoring-analysis tool. Review generated plans and patches before merging. Database-destructive changes and public API changes require explicit human approval outside the current automated flow.
Licensed under Apache-2.0.