AI 에이전트가 Python 코드 수정을 관리하고 회귀를 방지할 수 있도록 결정론적 구조 분석 및 변경 제어 기능을 제공합니다.
다른 이름 orenlab/codeclone
- 스타
- 12
- Tools
- —
- 다운로드, 30일
- 1,112
- 최신 버전
- 2.0.3
- 마지막 커밋
- 2026년 10월 28일
- 라이선스
- MPL-2.0
CodeClone MCP란?
CodeClone은(는) MCP server입니다. AI 에이전트가 Python 코드 수정을 관리하고 회귀를 방지할 수 있도록 결정론적 구조 분석 및 변경 제어 기능을 제공합니다.
프로젝트 README에서 생성된 요약
CodeClone MCP server 정보
CodeClone은 AI 코딩 에이전트를 사용하여 Python 코드베이스를 관리하는 개발자에게 결정론적 구조 분석 및 변경 제어 기능을 제공합니다. 이 도구는 로컬 우선 방식으로 작동하며, 코드가 수정되기 전에 의도된 변경 사항을 기록하고, 구조적 영향 범위를 매핑하며, 명시적인 편집 경계를 설정합니다. 이러한 접근 방식을 통해 개발자는 실제 패치를 선언된 범위 및 확립된 구조적 베이스라인과 비교하여 회귀를 방지할 수 있습니다.
이 시스템은 호스팅 서비스나 클라우드 계정 없이 작동하며, 모든 분석 상태, 엔지니어링 메모리 및 궤적을 로컬에 저장합니다. MCP 제어 인터페이스를 통해 Claude Code, Cursor, VS Code, Codex, Claude Desktop과 같은 AI 클라이언트와 통합되도록 설계되었습니다. 이 서버는 분석, 진단 및 변경 제어를 아우르는 38개의 MCP 도구를 노출하여, 에이전트에게 실시간 구현 컨텍스트와 검증 가능한 리뷰 영수증을 제공함으로써 수정 사항이 의도된 제한 내에서 유지되도록 보장합니다.
활용 사례
- 1범위 확장 방지AI 에이전트가 좁은 범위의 작업을 관련 없는 모듈이나 공개 API로 몰래 확장하는 것을 제한할 수 있습니다.
- 2새로운 회귀 격리개발자는 기존의 기술 부채와 특정 코드 변경으로 인해 발생한 새로운 문제를 구분할 수 있습니다.
- 3구조적 품질 게이트 자동화CI를 사용하여 새로운 코드 복제, API 중단 또는 메트릭 회귀를 유발하는 pull request를 거부할 수 있습니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
CodeClone MCP 설치 방법
형식 확인: 2026년 11월 10일Claude Code에 CodeClone MCP 설치
$ claude mcp add codeclone -- uvx codecloneCursor에 CodeClone MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"codeclone": {
"command": "uvx",
"args": [
"codeclone"
]
}
}
}VS Code에 CodeClone MCP 설치
.vscode/mcp.json
{
"servers": {
"codeclone": {
"type": "stdio",
"command": "uvx",
"args": [
"codeclone"
]
}
}
}Claude Desktop에 CodeClone MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"codeclone": {
"command": "uvx",
"args": [
"codeclone"
]
}
}
}Codex에 CodeClone MCP 설치
~/.codex/config.toml
[mcp_servers.codeclone] command = "uvx" args = ["codeclone"]
Gemini CLI에 CodeClone MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"codeclone": {
"command": "uvx",
"args": [
"codeclone"
]
}
}
}자동 검사
2026년 11월 12일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 이는 보안 감사가 아닙니다. 코드를 직접 읽고 서버에 필요한 최소한의 권한만 부여하십시오. 검사 방식
- 소스 저장소 연결 및 접근 가능통과
- 오픈 소스 라이선스 (OSI)통과
- 최근 1년 내 커밋 또는 릴리스통과
- 패키지 이름이 인기 패키지와 유사하지 않음통과
- 원격 엔드포인트가 HTTPS 사용검사되지 않음
- 파괴적인 도구에 라벨 표시됨검사되지 않음
- 모델에 대한 숨겨진 지침 없음통과
- 패키지와 의존성에 심각한 보안 권고 없음통과
README
GitHub에서 보기[!IMPORTANT] Sections marked
2.1 alpharequire the CodeClone 2.1 prerelease. Everything else works with the current stable release, CodeClone 2.0.2.
What is CodeClone?
CodeClone helps developers use AI coding agents without losing control of structural change.
Before an agent edits code, CodeClone records the intended change, maps the structural blast radius, and establishes explicit edit boundaries. After the edit, it compares the real patch with the declared scope, verifies structural regressions, and leaves an auditable review receipt.
CodeClone does not generate or rewrite source files, and it does not ask an LLM to decide whether a structural change is safe. Every finding and every gate comes from deterministic repository facts shared across agents, human reviewers, IDEs, reports, and CI.
| Capability | What it provides |
|---|---|
| Canonical structural analysis | One deterministic report: clones, complexity, coupling, cohesion, dead code, module map, API inventory, coverage joins |
| Baseline-aware governance | Records accepted legacy debt and separates it from regressions introduced by the current change |
| One report, many surfaces | CLI, HTML, JSON, Markdown, SARIF, MCP, IDE integrations, and GitHub Actions from one canonical payload |
Structural Change Controller — 2.1 alpha |
Intent-first change control, blast radius, explicit edit boundaries, patch verification, and review receipts |
Live Implementation Context — 2.1 alpha |
Real-time structural and call-graph context served from the current analysis run — no stale index to maintain |
Engineering Memory — 2.1 alpha |
Local, typed, evidence-linked project knowledge and reusable histories of prior controlled changes |
Agent coordination — 2.1 alpha |
Conflict-safe multi-agent intents, queues, recovery, and workspace hygiene |
CodeClone requires no hosted service or cloud account. Analysis state, controller state, Engineering Memory, and trajectories are stored locally.
Why intent comes before the diff
Most review tools begin after the patch already exists. CodeClone begins earlier:
task request
→ declared intent
→ structural blast radius
→ explicit boundary
→ actual patch
→ deterministic verification
Agent scope expansion can look reasonable in the final diff. A narrow task may quietly spread into shared helpers, tests, configuration, public APIs, or unrelated modules.
By the time that expansion reaches the final diff, it already looks intentional. CodeClone catches it at the declared boundary instead — by comparing what the agent said it would change with what it actually changed.
Quick start
Requires Python 3.10 or newer.
1. Analyze a repository
Run the stable release without installing anything:
uvx codeclone@latest .
Prefer a browsable report? Generate the HTML view and open it:
uvx codeclone@latest . --html --open-html-report
Once you use it regularly, install it as a local tool:
uv tool install codeclone
codeclone .
2. Record the current structural baseline
Before asking an agent to change the repository, capture the accepted state once:
codeclone . --update-baseline
git add codeclone.baseline.json
git commit -m "chore: add CodeClone structural baseline"
The baseline records the structural debt that already exists. Future analysis can then separate new regressions from findings that were already present, so agents and reviewers can focus on what the current change introduced.
Updating the baseline is an explicit governance action. Do not regenerate it merely to make a failing check pass.
3. Connect your AI agent — 2.1 alpha
Continue to Agent change control below to install the MCP control surface and wire CodeClone into Claude Code, Cursor, VS Code, Codex, or Claude Desktop.
One canonical structural report
CodeClone runs one deterministic analysis and renders the same canonical report through every supported surface.
The report covers:
- function, block, and segment clones;
- clone drift and duplicated branch families;
- complexity, coupling, cohesion, dependency cycles, and dead code;
- Module Map — a package/module dependency graph with cycle, hub, overloaded-module, and unwind-candidate views;
- Guided Finding Review — a prioritized review queue with shared finding cards, filters, and progress tracking;
- public API inventory and baseline-aware API break detection;
- external coverage joined with structural hotspots;
- deterministic structural health and review priorities.
codeclone . --json --html --md --sarif --text
How CodeClone works · Canonical report contract
Baseline-aware governance and CI
The baseline is a versioned, integrity-checked contract that records the accepted structural state of the repository.
It lets CodeClone and connected agents distinguish:
- findings that already existed;
- regressions introduced by the current change;
- deliberate baseline updates approved by the user.
Check future changes against the committed baseline:
codeclone . --ci
Use CodeClone in GitHub Actions:
- uses: orenlab/codeclone/.github/actions/codeclone@v2
with:
fail-on-new: "true"
sarif: "true"
pr-comment: "true"
CI can reject newly introduced clones, metric regressions, API breaks, and coverage regressions without requiring the existing repository to be clean first.
Baseline contract · CI integration and quality gates
How CodeClone differs
Linters check style and correctness file by file. Clone detectors report duplication and stop there. Hosted review bots ask a model for an opinion about a finished diff.
CodeClone combines CFG-based clone detection, multi-metric baseline governance, and a read-only MCP control surface in one local-first, open-source package — and applies them before the edit happens, not only after. Structural facts are computed deterministically, so the same input always produces the same verdict, in the terminal, in CI, and inside your agent's loop.
Agent change control — 2.1 alpha
Install the MCP control surface
uv tool install --prerelease allow "codeclone[mcp]"
codeclone-mcp --transport stdio
The server exposes 38 MCP tools covering analysis, change control, blast radius, memory, and diagnostics. Responses
are built for agent loops: deterministic next_tool guidance, token-budget-aware payloads, and replies that keep
mandatory control facts inline while linking full evidence for drill-down.
Before gating agents or CI, confirm [tool.codeclone] and local gitignore hygiene:
codeclone setup status
codeclone setup plan
codeclone setup apply # or: codeclone setup wizard
See Repository setup and readiness.
Wire it into your client
| Client | Setup |
|---|---|
| VS Code | Extension setup |
| Cursor | Plugin and skills |
| Claude Code | Plugin setup |
| Codex | Plugin setup |
| Claude Desktop | Bundle setup |
Every client uses the same MCP interface and the same canonical structural facts.
The controlled-change workflow
For an agent, the normal workflow is:
analyze → start → edit → finish
Analyze. CodeClone builds one canonical structural report for the repository and compares it with the accepted baseline.
Start. start_controlled_change:
- records the agent's intent;
- maps structural blast radius;
- separates editable paths from review context and do-not-touch boundaries;
- exposes the regression budget relative to the accepted baseline;
- returns the authoritative
edit_allowedresult.
Edit. The agent writes the code. CodeClone does not generate or rewrite source files. Where the host supports
hooks, integrations can stop edits unless edit_allowed=true. While editing, the agent stays oriented through
Live Implementation Context instead of rediscovering the repository with broad
searches.
Finish. finish_controlled_change:
- resolves the actual changed files;
- checks declared scope against the real patch;
- verifies structural changes;
- validates optional review claims;
- records Patch Trail evidence;
- produces an auditable review receipt.
If the patch crosses the declared boundary or introduces regressions beyond the budget, verification fails — and the receipt records exactly where and why. The result is not an AI opinion about the patch. It is a deterministic comparison between declared intent, repository structure, the accepted baseline, and the actual change.
Read the Structural Change Controller guide
Live Implementation Context
get_implementation_context serves the agent bounded, task-scoped context directly from the current analysis run:
- structural context and call relationships for the declared edit scope;
- contract-oriented truth maps and test anchors;
- freshness signals and active intent boundaries.
There is no separate vector database drifting behind the code, and no watcher daemon re-indexing the tree. Context comes from the same analysis that produces findings and gates — so what the agent reads is what the verifier will check. Context is read-only: it informs edits but never authorizes them.
Also in the 2.1 line
- Platform Observability — development-time tracing of CLI, MCP, analysis phases, database activity, and payload pressure, so you can see what CodeClone itself is doing and what it costs.
- Corpus Analytics — offline intent clustering and interpretability over recorded controlled changes, with versioned profiles and inspectable JSON/HTML outputs.
Engineering Memory — 2.1 alpha
Engineering Memory gives agents durable, repository-specific context without treating model output as project truth.
The local SQLite store can contain:
- architecture and contract notes;
- risks, test anchors, and public surfaces;
- git and change-control provenance;
- prior trajectories and Patch Trail evidence;
- recurring advisory patterns called Experiences.
Agent-created records remain drafts until a human approves them.
codeclone memory init --root .
codeclone memory search "baseline schema" --match all
Retrieval is hybrid — FTS5/BM25 lexical search, optional LanceDB vector search, and Reciprocal Rank Fusion combining the two — with fully reproducible ranking.
Memory can guide an agent. It cannot authorize edits, override blast radius, change a gate, or replace canonical report facts.
Engineering Memory documentation · Trajectories and Experiences
Trust boundaries
- Structural findings and gates come from deterministic analysis, not LLM judgment.
edit_allowedis an explicit controller result; status or advisory ownership does not grant permission.- Read-only analysis commands do not modify source code or project governance state.
- Baseline updates are explicit user-approved governance actions.
- Controller and memory operations write only to their explicit local state stores.
- Memory, trajectory, and implementation-context evidence remain advisory.
stdiois the recommended transport for local clients.- Remote HTTP exposure requires explicit
--allow-remote.
Contributing
Bug reports, feature discussions, and pull requests are welcome — start with Issues or Discussions, or join the Discord.
Run the repository version from source:
git clone https://github.com/orenlab/codeclone.git
cd codeclone
uv sync --all-extras
uv run codeclone .
Documentation
License
- Code: MPL-2.0
- Documentation: MIT
See LICENSES.md for the license scope map.
Links
CodeClone MCP 질문
CodeClone MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add codeclone -- uvx codeclone를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
CodeClone MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
CodeClone이 소스 코드를 다시 작성하나요?
아니요, CodeClone은 소스 파일을 생성하거나 다시 작성하지 않습니다. 컨트롤러 및 분석 레이어 역할을 수행합니다.
CodeClone은 기존의 기술 부채를 어떻게 처리하나요?
기존의 레거시 부채를 기록하여 현재 변경 사항으로 인해 발생하는 새로운 회귀와 분리하는 베이스라인 인식 거버넌스 시스템을 사용합니다.
CI/CD 파이프라인에서 CodeClone을 사용할 수 있나요?
네, GitHub Actions에서 사용할 수 있으며, 새로 발생한 코드 복제, 메트릭 회귀, API 중단 및 커버리지 회귀를 차단할 수 있습니다.
CodeClone을 사용하려면 클라우드 계정이 필요한가요?
아니요, 호스팅 서비스나 클라우드 계정이 필요 없는 로컬 우선 도구입니다.