@adlc/model-ratchet

中文文档
1.12.0发布于 2026/10/10MITES Module构建来源已验证近 30 天下载 8165

Scheduled re-prosecution of hot paths — every frontier model release as a free re-audit (C12).

原始使用文档
文档目录15 节
  1. ADLC Phase
  2. Installation
  3. Usage
  4. Flags
  5. Hot Score Formula
  6. Default Mode (no --review-cmd , or with --dry-run )
  7. Review Mode ( --review-cmd )
  8. Exit Codes
  9. Examples
  10. Cron and CI Examples
  11. GitHub Actions — on every model release
  12. Cron (shell)
  13. CI gate (plan-only, no API key required)
  14. Core Gaps
  15. Relationship to Sibling Tools

@adlc/model-ratchet

Scheduled re-prosecution of hot paths — ADLC C12.

Every frontier model release is a free re-audit of the existing codebase: new models find what old ones missed. model-ratchet identifies the most valuable files to re-prosecute (high churn × high criticality), then either prints a prosecution plan or drives your review command over them, appending verified findings to the shared .adlc/findings ledger.

Run on every model release (or monthly) to ratchet codebase quality monotonically upward for the cost of a scheduled job.

When run from any subdirectory of a git repository, candidate files, churn metrics, and the findings ledger resolve relative to the repository root. Relative file paths are normalized to forward-slash separators across platforms, ensuring consistent matching between churn metrics, import graph analysis, and candidate files on Windows.

ADLC Phase

C12 / D1–D3 maintenance ratchet. Pairs with:

  • C8 review-calibration — calibrate the new model's recall first, then aim it at hot paths.
  • C9 lesson-foundry — verified findings become lessons that compound into skills.

Installation

npm install -g @adlc/model-ratchet   # or use npx

Usage

model-ratchet [--top <n>] [--review-cmd <cmd>] [--timeout-ms <n>] [--churn-limit <n>] [--dry-run] [--allow-empty] [--json]

Flags

FlagDefaultDescription
--top <n>10Number of hotspot files to select
--review-cmd <cmd>—Shell command to run per file. Use {file} as placeholder.
--timeout-ms <n>600000Kill a review-cmd run after <n> ms; it counts as an operational error for that file and the remaining files are still reviewed
--churn-limit <n>1000Commit history depth for churn computation
--dry-runfalsePrint prosecution plan only; do not run review-cmd
--allow-emptyfalseAllow review mode to exit 0 when zero candidate files are selected
--jsonfalseMachine-readable JSON output
--help—Show help

Hot Score Formula

SCORE = churn(limit)[file] × (1 + inDegree)
  • churn(limit)[file] — number of distinct commits touching the file in the last --churn-limit commits (via git log).
  • inDegree — number of repo source files (.mjs/.js/.ts/.tsx/.py/.cjs/.mts/.cts/.jsx, walk skips node_modules/, .git/, dist/) whose import/require/from specifiers resolve (relative resolution, try extensions) to this file.

Test/spec files (.test.*, .spec.*, test/, __tests__/) and non-source files (.md, .json, lock files) are excluded from both the candidate set and the import graph.

Default Mode (no --review-cmd, or with --dry-run)

Prints the prosecution plan table and suggested charter lines per file:

model-ratchet — Prosecution Plan
====================================================================
FILE                        CHURN  IN-DEGREE  SCORE
--------------------------  -----  ---------  -----
src/auth.mjs                   42          3    168
src/db/query.mjs               31          5    186
src/utils.mjs                  25          1     50

Suggested charter lines:
  Refute correctness of src/auth.mjs — hotspot: changed 42 times, imported by 3 files
  ...

Review Mode (--review-cmd)

Runs the command for each selected file with {file} substituted. Captures stdout and parses findings:

  • Lines matching /\S+:\d+/ (e.g. src/foo.js:42: missing null check)
  • Lines starting with - (bullet items)

Each finding is appended to .adlc/findings.jsonl:

{
  "ts": "2026-01-01T00:00:00.000Z",
  "tool": "model-ratchet",
  "file": "src/auth.mjs",
  "line": 42,
  "category": "ratchet",
  "severity": "unknown",
  "desc": "src/auth.mjs:42: missing null check"
}

Exit code 2 from review-cmd is treated as "findings present" (not an error). Exit codes other than 0 or 2, a run killed by --timeout-ms, or a run killed by a signal cause an operational error (tool exits 1); the remaining files are still reviewed.

Exit Codes

CodeMeaning
0Success — plan printed or review run complete
1Operational error — not a git repo, bad --review-cmd exit code, a review-cmd timeout, bad args
2Gate failure — review mode with zero candidate files selected and --allow-empty not set

Examples

# Print prosecution plan for top 10 hot files
model-ratchet

# Top 5 files, last 500 commits
model-ratchet --top 5 --churn-limit 500

# Dry-run plan even if review-cmd is provided
model-ratchet --top 10 --review-cmd "adversarial-review {file}" --dry-run

# Run adversarial review and append findings
model-ratchet --review-cmd "adversarial-review --file {file}"

# Machine-readable output for orchestrators
model-ratchet --top 5 --json

# Run a custom linter as the reviewer
model-ratchet --review-cmd "eslint {file} --format compact"

Cron and CI Examples

GitHub Actions — on every model release

# .github/workflows/model-ratchet.yml
name: model-ratchet

on:
  # Manually trigger when a new model is released
  workflow_dispatch:
  # Or run monthly
  schedule:
    - cron: '0 9 1 * *'

jobs:
  ratchet:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0  # needed for full churn history
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - name: Run model-ratchet
        run: |
          npx @adlc/model-ratchet \
            --top 10 \
            --review-cmd "npx @adlc/adversarial-review --file {file}" \
            --json > ratchet-results.json
      - uses: actions/upload-artifact@v4
        with:
          name: ratchet-findings
          path: .adlc/findings.jsonl

Cron (shell)

# Run on every model release — add to crontab or a release script
# crontab entry: run on the 1st of every month at 09:00
# 0 9 1 * * cd /path/to/repo && model-ratchet --top 10 --review-cmd "adversarial-review {file}" --json >> .adlc/ratchet-runs.log 2>&1

# Or run manually after a model upgrade:
model-ratchet --top 20 --review-cmd "adversarial-review --file {file}" --json

CI gate (plan-only, no API key required)

- name: Print hot paths prosecution plan
  run: npx @adlc/model-ratchet --top 10 --json

Core Gaps

None. Uses churn(), isGitRepo(), appendEntry(), parseArgs(), opError(), pass(), printJson() from @adlc/core. All hot-score logic, import-graph walking, and finding parsing live in lib/.

Relationship to Sibling Tools

  • adversarial-review — natural choice for --review-cmd; model-ratchet aims it at the highest-value files.
  • review-calibration (C8) — calibrate first, then ratchet.
  • lesson-foundry (C9) — consume the .adlc/findings ledger entries that model-ratchet appends.
  • gate-manifest (C11) — findings from ratchet runs appear in the shared findings ledger that manifests track.

版本与发布记录

@adlc/model-ratchet 共发布 18 个版本,首次发布于 2026/06/14;过去 12 个月发布了 18 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.12.0latest2026/10/1027 天前
1.11.12026/09/091 个月前
1.11.02026/08/252 个月前
1.10.02026/08/112 个月前
1.9.02026/08/092 个月前
1.8.02026/08/082 个月前

关于 @adlc/model-ratchet 的常见问题

@adlc/model-ratchet 是什么?

Scheduled re-prosecution of hot paths — every frontier model release as a free re-audit (C12).

如何安装 @adlc/model-ratchet?

在项目目录运行 npm install @adlc/model-ratchet,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 model-ratchet,可以用 npx model-ratchet 直接运行。

@adlc/model-ratchet 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/adlc__model-ratchet 是否存在。

@adlc/model-ratchet 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@adlc/model-ratchet 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@adlc/model-ratchet 可以商用吗?

@adlc/model-ratchet 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@adlc/model-ratchet 的下载量有多少?

根据 npm 官方下载统计,@adlc/model-ratchet 在 2026/10/05 – 2026/11/03 这 30 天内被下载 8,165 次,日均约 272 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adlc/model-ratchet 还在维护吗?

最新版本 1.12.0 发布于 2026/10/10(27 天前);至今共发布 18 个版本,其中过去 12 个月发布了 18 个;首次发布于 2026/06/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。