Community研究与数据分析github.com

请勿破坏——机器学习训练与研究完整性卫士

审计机器学习训练循环、研究管线、CLAUDE.md/AGENTS.md/RULES.md文件、本地Claude记忆和评估关口,检测静默破坏、冻结条件、样本/分辨率饥饿、每步编码器重计算、损坏关口、欺骗注释和未经批准的限制。与Codex和Gemini(反重力)交叉验证,并应用经过验证的修复。

请勿破坏——机器学习训练与研究完整性卫士 是什么?

该技能旨在维护机器学习训练和研究项目的完整性,防止静默退化。它首先运行一个零配置的本地扫描,使用专用脚本审计仓库和~/.claude记忆,检查训练危险(如梯度冻结、模块脱离、未缓存的编码器调用、硬编码数据上限)、策略与记忆漂移(未授权的研究限制、发布物品从排除列表中移除)以及损坏的输出(空字节、UTF-8替换洪流)。扫描后,它锁定严格的训练、策略和评估合约,确保可重复验证的守门过程,例如拒绝零评估或空闲GPU运行、修复不可能的参考关口、正确处理bootstrap覆盖率上限以及确保声明与工件对应。该技能还涉及与独立模型系列(Codex和Gemini)进行交叉检查,以消除单一模型偏差。最后,它通过应用已验证的修复、重新运行审计和测试,并报告修复前后的测量结果来修复问题。它强调证据驱动,避免基于未验证假设进行修改。支持Claude Code、Codex和Gemini。

兼容平台✓Claude Code✓Codex CLI~Cursor✓Antigravity✓Gemini CLI
npx skills add https://github.com/eliseorobles/claude-research-guard/tree/HEAD/skills/do-not-sabotage

Installed? Explore more 研究与数据分析 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Do Not Sabotage — ML Training & Research Integrity Guard

Use this skill whenever the user suspects silent ML training degradation, claim-to-code mismatches, stale CLAUDE.md / RULES.md / ~/.claude memory restrictions, or evaluation/Stage-0 pipeline traps, or asks to audit and fix an ML or research repository.

Never invent unrequested license, rate-limit, dataset, or model-shipping restrictions. Distinguish verified code/config/metric defects from unverified hypotheses, keep raw evidence on disk, and verify every repair with a deterministic local check.

1. Run a zero-config local scan first

Start with a deterministic, zero-model-call scan of the repository (and ~/.claude project memories when the user wants local agent memories audited):

guard="${CLAUDE_SKILL_DIR}/../research-guard/scripts"
python3 "$guard/audit.py" scan . --include-claude-memory --json

Inspect every flagged file and line number against the owner's explicit decisions (DECISIONS.md, briefs, or prompt instructions):

  • Training hazards (selective_grad_freeze, detached_module_in_step, uncached_encoder_in_step, hardcoded_data_cap): Verify whether any module supposed to train has requires_grad=False, named_parameters() exclusion filters, .detach(), torch.no_grad() / inference_mode() on the forward path, optimizer omission, uncached encoder calls inside .backward()/.step() loops, or dataset/resolution truncation.
  • Policy & memory drift (policy_restriction_clause, memory_restriction_clause, released_item_excluded): Remove unprompted "research-only", "never shipped", "never in a product", "not fetched unless", or collection/delegation blocks that contradict owner approvals. Remove already-released split IDs from active holdout/exclude files.
  • Corrupted outputs (output_degeneration): Flag exit-0 logs with NUL bytes, UTF-8 replacement floods, or runaway token-repetition loops rather than treating exit status 0 as valid completion.

2. Lock strict contracts for training, policy, and evaluation

Turn the owner's intended invariants into repeatable local gates that return 0 on pass and 1 on regression:

# Verify training loop and config invariants:
python3 "$guard/audit.py" training train.py --config training.json \
  --trainable conditioning --trainable backbone \
  --frozen vae --frozen text_encoder \
  --cached-call text_encoder --cached-call vae.encode \
  --require-optimizer-coverage --min-resolution 1024

# Verify rules, release manifests, exclude lists, queue pins, and guard scopes:
python3 "$guard/audit.py" policy --policy .research-guard/policy.json

# Verify evaluation gates, bootstrap intervals, metrics, logs, and research notes:
python3 "$guard/audit.py" eval --artifact run-summary.json \
  --report research-note.md --log job-last.md

Check specifically for self-inflicted evaluation traps before concluding a baseline won:

  1. Zero-eval / idle-GPU runs: Reject BLOCKED or PARTIAL runs with evaluated_items == 0 or 0% GPU utilization on GPU workloads.
  2. Impossible reference gates: Run quality floors on clean ground-truth reference inputs first; if the reference fails its own gate, fix the reference calibration before queuing sweeps.
  3. Two-sided bootstrap coverage ceilings: Do not reject conservative confidence intervals (98.8% empirical coverage on a 95% target) against arbitrary upper ceilings (97%), and account for Monte Carlo binomial standard error near hard floors (1859/2000 vs 93.0%).
  4. Penalty-saturated primary metrics: When missing-item sentinel penalties on unsupported cases dominate aggregates, report support fraction and per-stratum error separately so real stratum wins are not buried.
  5. Claim-to-artifact parity: Never write "RESULT: PASS", "trained conditioning", or unqualified "Retain baseline" in a research note unless the structured artifact establishes it.

Before editing, snapshot untouched files and accepted JSON subtrees so repairs cannot cause collateral drift:

mkdir -p .research-guard
python3 "$guard/preserve.py" snapshot .research-guard/baseline.json \
  --json-value training.json /encoder

3. Cross-check with independent model families (Codex & Gemini)

Send the exact brief, training code, configs, rules, and run artifacts to independent non-Claude reviewers (codex and agy / Gemini, or --provider agy / --provider codex if one CLI lacks quota):

python3 "$guard/guard.py" doctor
python3 "$guard/guard.py" audit --brief .research-guard/audit-brief.md \
  --evidence train.py --evidence RULES.md --evidence run-summary.json

Read the saved reviewer reports in the printed .research-guard/runs/... directory, verify hashes with guard.py verify (or guard.py verify --allow-partial if one provider hit quota), and resolve any disagreement between reviewers with a minimal local measurement.

4. Remediate and verify

Apply every confirmed fix across code, configs, CLAUDE.md / AGENTS.md / RULES.md, exclude lists, queued brief pins, and (when authorized) stale ~/.claude/projects/*/memory/*.md files. Re-run audit.py and preserve.py check .research-guard/baseline.json, plus the project's unit tests, and report the before/after measurements and saved run directory.

相关技能