
closure_drift
io.github.luizfnsilva由 GitHub 帳號 luizfnsilva 發布v1.5.0更新於 Nov 4, 2026
Before an agent tags a release: does that version label already name different code in the git tags?
概覽
唯讀的 MCP 伺服器,檢查某個 git 標籤的版本號是否已指向不同的程式碼,讓助理在打標籤或發布前先核對。
- 可以做什麼
- 對儲存庫執行 would-tag 檢查:現在為目前提交打標籤,是否會重複使用一個已指向不同程式碼的版本號。
- 讀取判定結果(clean、drift 或無法判定)以及說明同一版本號下哪些路徑不同的報告。
- 並排比較兩個標籤,查看共用同一版本號時哪些檔案不同。
- 查看某個處於 drift 的版本號是如何造成的,以及有多少標籤無法比較。
- 適用情境
- 適用於助理即將建立發布標籤、調整版本號或發布套件時,確認該版本字串尚未被不同的程式碼佔用。它是發布前的核對手段,不能取代 CI 關卡。
- 執行需求
- 以本機 stdio 程序執行(映像發布於 ghcr.io),需要 git 以及待檢查儲存庫的本機複本。README 提供的安裝方式是透過 uvx 從專案的 git 儲存庫安裝。未宣告任何帳號、API 金鑰或環境變數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 closure_drift,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
closure_drift
Does v1.4.2 mean one thing in your repository?
Check it without this tool: git show v2.16.1:requests/__version__.py says 2.16.0. closure_drift reads
the git history, not a package index: it shows what the tags contain, not which commit a published package
was built from.
A version is a string a human edits. When two releases share a version and differ in code, one address names two artefacts — and nothing notices, because the version is all that was recorded.
One command checks it. Read-only, one file, no dependencies, no network.
Three ways in
Try it now (recommended first). See the three answers on tiny repositories it builds and deletes, then measure yours:
Or without cloning: curl -sO https://raw.githubusercontent.com/luizfnsilva/closure_drift/v1.5.0/closure_drift.py
then python3 closure_drift.py inside any git repository. Needs Python 3.9+ and git. The last
lines say what to do next. (./reproduce.sh is something else: it validates closure_drift itself,
a long run, and does not look at your repository.)
With your agent. Install the skill (skills/closure-drift/),
which tells the agent when to check before a tag and how to read the answer:
gh skill install luizfnsilva/closure_drift closure-drift --agent claude-code (or codex,
cursor, gemini-cli, github-copilot, …). In Claude Code, skill and MCP server together:
/plugin marketplace add luizfnsilva/closure_drift. Other clients: integrations/.
In CI, the barrier that holds when nobody remembers to check: docs/CI.md.
Exit 0 pass, 1 drift, 2 nothing decided (a failure by default).
Check before you tag
--would-tag answers: if I tag this commit now, does its version already name different code?
After tagging, --tag NAME answers: does this tag name the version its commit declares? A tag
pushed before the version was bumped fails there; in the study it is how 79 of the 87 labels in
drift came about. On a tag push the Action runs --tag; on any other push, --would-tag.
Push the workflow before the first tag: a tag pushed together with the workflow that should run on
it may not start it (then run it by hand, with workflow_dispatch: in its on:). mode: measure
concludes only from two distinct labels; on the first release it is inconclusive, exit 2, so gate
with the default mode from the first tag.
Other pipelines: docs/CI.md.
For AI agents
An agent needs two things: to know when to check (before it creates a tag, bumps a version or publishes), and a way to run the check. The skill gives the first; the MCP server, the second.
- The skill, in any agent that reads skills:
gh skill install luizfnsilva/closure_drift closure-drift --agent claude-code(orcodex,cursor,gemini-cli,github-copilot, …). - In Claude Code, both at once, as a plugin:
/plugin marketplace add luizfnsilva/closure_drift, then/plugin install closure-drift@closure-drift. - The MCP server alone (standard library only, a
would_tagtool), for other clients:
Codex CLI, Gemini CLI, Cursor, VS Code, Windsurf, and a rule to paste into AGENTS.md, CLAUDE.md
or .cursorrules: integrations/. An agent can still skip the check; the barrier
is CI.
The answer
Exit 0 means clean and nothing else. No input we tried produces a traceback, and no failure exits 1.
- label — the version your project declares at each tag: in its build files, in the module they point to, or the tag itself when the version is derived from it
- closure — SHA-256 over
(path, git object id)of the files that determine your output
The report also says how many tags it could not compare.
Options
Settings can be committed in .closure-drift.json. Flags override it, except beside components,
where they need --component; a broken file is refused.
A monorepo declares its components, and gets one verdict each:
The answer is drift if any component is in drift, clean if all are clean, otherwise
incomplete. Components are declared, never guessed. A gate in such a repository passes
--component NAME to --would-tag.
What it found
The 100 most-downloaded PyPI projects with a public repository, at the defaults, measured with a build of 0.10.0 that prints the same reports as the release — rule and method fixed before the first run; no repository tuned (full table and every collision):
A version label names two different code states in 29 of the 88 decided, 29 of all 100. Each
of the 87 labels is in collisions.tsv, one line per tag involved, reproducible by hand:
A collision is not a verdict on a project. The usual causes are a tag created without bumping the
version, branch markers such as 7.x, and tag families in a monorepo. A first run, kept in the
repository, decided only 63 of 100 — it read the version from one file chosen at HEAD — and that
is why this release finds the label where each project keeps it.
Six reference repositories, measured with 1.0.0 at every tag (tools/reference/):
Two causes: a release tagged without bumping the version (impress.js), and tag families sharing
one version file (lodash). Neither project is badly run. --would-tag addresses the first,
--tags or components the second.
Limits
-
It never runs your code and attests nothing.
cleanis about addressing, not reproducibility. -
A change of file mode alone is not seen, unless
--modes. -
Never in the closure: folders
test/,tests/,spec/,docs/,vendor/,node_modules/,.git/; files named*_test.*,*.test.*,*.md. A--closureglob that names one of these folders brings it in (--closure 'vendor/**');.git/and the file patterns never. -
The default closure globs are a guess. Pass
--closure. -
Labels are compared as written:
1.0and1.0.0are two labels, unless--label-equality version. -
It reads git, not a package index: a tag never released counts, unless
--publishedlists what was. A tag left off the list is left out of the analysis, not shown unpublished. -
How the label is found is a set of rules, not a build:
docs/LABELS.md. -
In a gate, pass
--version-file, or--published: the rules can still read the wrong file when one tag happens to agree with it.
Every failure found so far: docs/FAILURES.md. More: SCOPE.md,
docs/WHY.md.
Safety
It starts git and, for a version pattern you supply, itself; nothing else. It never writes to the repository, and does not run commands named
in that repository's git config. What is defended and what is not:
THREAT_MODEL.md. Reporting: SECURITY.md.
Tests
Four suites, each pre-registered before the code. Scores are never added together.
CI runs the same four on Linux (Python 3.9 to 3.14), macOS and Windows; what each platform could not
run is in
tests/RECORD.md. These scores describe the cases executed, not inputs nobody
tried. ./reproduce.sh runs all of it. The 100 projects of the study are also a regression corpus,
pinned to recorded commits: 1.5.0 gives the recorded answer on all 99 still checkable (one tag of apache/arrow moved upstream), as predicted before it ran
(tools/regression/).
Ten large repositories (the Linux kernel, LLVM, CPython and seven more), protocol written
first. Every tag of the kernel: 6.5 GB for the whole process tree with 0.9.1, 900 MB with 1.0.0.
0.9.1 gave three wrong or near-empty answers there; 1.0.0 gives none of them. With a declared
version file (docs/LABELS.md) every tag of the kernel is compared: clean,
947 of 947, in four minutes.
tools/benchmark/READING.md.
Send a result
RESULTS.md is for measurements made by someone other than the author: two so far,
both on private repositories. closure-drift --json > result.json, then
open an issue
or write to [email protected]. A result showing the tool is wrong is the most useful kind.
Version
1.5.0 reads the version of the package a tag's prefix names (clap_complete-v4.6.1, @scope/[email protected]), reads pubspec.yaml, and lets --closure 'vendor/**' bring vendored code in.
1.4.0 checks the tag just pushed (--tag NAME, and the Action's default on a tag push) and says how each label in drift came about.
1.3.3 names the pattern to pass when a version file declares VERSION = "x" instead of version, and the section for agents starts with the skill.
1.3.2 puts two limits in the report itself: what is never in the closure, and when 1.0 and 1.0.0 on different code are counted as two labels.
1.3.0 opens the README with three ways in, ends every text report with a Next: line, and adds docs/EVIDENCE.md and a usability protocol; the verdicts are unchanged.
1.2.2 adds an agent skill (skills/closure-drift/): when to run the check, how to read the answer, and never to move a published tag; the detector is unchanged.
1.2.1 adds the first third-party results to RESULTS.md, and the refusal names a package.json it skipped because it is marked private.
1.2.0 names a version file one level down, says whether a dirty tree touches the closure, and writes UTF-8 when the output is not a terminal (from issue #12).
1.1.3 says when to use --explain or --compare, and --tags or --published; the detector is unchanged.
1.1.2 installs the MCP server in one line (closure-drift-mcp); the detector is unchanged.
1.1.1 fixes O11: a version file over the size limit (1 MB) is named and the answer is
incomplete, never clean. It adds integrations/ for AI agents. 1.1.0 (script sha256 e2a67a5a9148fe273d2c95ad4bcce9bc589a43711fc34443a4a9491fde575913)
adds --published, three version sources, an earlier refusal and two opt-in comparisons; with
no new option, results change only under --at commits (CHANGELOG.md). What it
had to meet was written first (tests/PREREGISTRATION.md §16), and a
reviewer who did not write it found 13 problems before the tag (docs/REVIEW-1.1.0.md).
SCOPE.md says what stays stable until 2.0.
Apache-2.0. Cite the version DOI, under concept DOI 10.5281/zenodo.21763931
(CITATION.cff). Planned next: ROADMAP.md.
來源:README.md,提交 ed2b4e5
工具
0版本歷史
10- v1.5.0最新Nov 4, 2026
- v1.4.0Nov 4, 2026
- v1.3.3Nov 4, 2026
- v1.3.2Nov 3, 2026
- v1.3.1Oct 30, 2026
- v1.3.0Oct 30, 2026
- v1.2.2Oct 29, 2026
- v1.2.0Oct 22, 2026
- v1.1.3Oct 18, 2026
- v1.1.2Oct 18, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分