repo-intake-and-plan
Rigor Intake helper for README-first deep learning repo reproduction. Use when the task is specifically to scan a repository, read the README and common project files, extract documented commands, classify inference, evaluation, and training candidates, and return the smallest trustworthy reproduction plan to the main orchestrator. Do not use for environment setup, asset download, command execution, final reporting, paper lookup, or end-to-end orchestration.
1How It Works & Mechanism
The foundation of this skill rests on two deterministic Python scripts: scan_repo.py performs structure/signal scanning, while extract_commands.py extracts and classifies commands from the README; SKILL.md merely defines when to use them and what to output. Command extraction is not a process of 'letting the model read the README and guess', but a reproducible pipeline driven by regular expressions, header attribution, and heuristic classification.
"""Extract shell-like commands from README content and classify them."""
The scanning scope is fixed by a whitelist: it inspects only 9 key files and 7 high-signal directories without traversing the entire repository; results and warnings are directly produced by the script (e.g., explicitly warning if a README is missing) rather than free-form model descriptions.
KEY_FILES = [ "README.md", "README", "requirements.txt", "environment.yml", "environment.yaml", "pyproject.toml", "setup.py", "setup.cfg", "Dockerfile", ]
The classifier implements explicit priorities and reasoning: setup/asset syntax is evaluated first (preventing installation steps from being classified as inference), followed by header semantics, entrypoint script name heuristics (train*.py / eval*.py / sample|generate|infer*.py), and finally keyword scanning as a fallback.
# Unambiguous setup/asset syntax outranks generic headings such as # "Basic Example", which otherwise makes installation look like inference. if lowered.startswith(SETUP_PREFIXES + ASSET_PREFIXES): return "other"
It performs structural inspection on .py entrypoints referenced in the README: reading the script (≤512 KiB) and scoring it based on occurrences of optimizer.step(/backward(/train()/def train*/epoch loops; a score of ≥4 promotes the command's classification to training, recording classification_source='entrypoint-structure' and evidence tags.
TRAINING_STRUCTURE_SIGNALS = [ ("optimizer-step", re.compile(r"\boptimizer\s*\.\s*step\s*\(", re.IGNORECASE), 3), ("backward-pass", re.compile(r"\.\s*backward\s*\(", re.IGNORECASE), 3), ("model-train-mode", re.compile(r"\.\s*train\s*\(", re.IGNORECASE), 2), ("train-function", re.compile(r"\bdef\s+train\w*\s*\(", re.IGNORECASE), 1), ("epoch-loop", re.compile(r"\bfor\s+\w*epoch\w*\s+in\b", re.IGNORECASE), 1), ]
'Classification can be conservative enough to admit ignorance' is codified into the reference: when evidence is insufficient, candidates are labeled as inferred, preferring documented ambiguity over over-promising; explicit README evidence takes precedence over filename heuristics.
## Conservative behavior - prefer explicit README evidence over filename guesses - mark guessed classifications as inferred - record ambiguity instead of overcommitting
Role boundaries are strictly enforced: it only scans and plans, without installing environments, downloading large assets, executing substantive commands, or making high-risk patching decisions; it delivers the minimal trustworthy reproduction recommendation to the main orchestrator.
## Clear boundaries - This skill scans and plans. - This skill is helper-tier and should usually be orchestrator-invoked. - It does not install environments. - It does not prepare large assets. - It does not execute substantive reproduction commands. - It does not decide high-risk patching.
The orchestrator genuinely invokes these two scripts (they are not mere documentation decorations): orchestrate_repro.py resolves the skill directory and executes scan_repo.py --repo … --json as a subprocess, then passes the resulting readme_path to extract_commands.py --readme … --json, integrating the output into the reproduction workflow.
scan_data = run_json(scan_script, ["--repo", str(repo_path), "--json"]) readme_path = scan_data.get("readme_path") command_data: Dict[str, Any] = {"commands": [], "counts": {}, "warnings": []} if readme_path: command_data = run_json(extract_script, ["--readme", readme_path, "--json"])
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| cli | Python 3(脚本解释器;由宿主/编排器调用,脚本自身无子进程外呼) |
4Recommended Governance & Evidence
- scripts/: Execute local script or command: python3 scripts/scan_repo.py --repo <path> --json (provided with this skill; read-only directory enumeration)
5Second-Pass Verification
- [ok] skill 路径(任务书标『待定位』) — 实际相对路径 skills/repo-intake-and-plan;SKILL.md 位于该目录根。
- [ok] 『helper 脚本』确实存在且被调用(非文档装饰) — orchestrate_repro.py:1162-1167 设定 scan_script/extract_script 并在 1173-1178 以 run_json(...) 执行;_bundled/MANIFEST.json 记录两文件打包目标与 sha256;references/skill-registry.json 的 required_files 列出两者。
- [discrepancy] SKILL.md 未给出脚本调用示例 — SKILL.md 仅在 Notes 写 'Use `references/repo-scan-rules.md` and helper scripts under `scripts/`.',没有给命令行/参数示例;实际 CLI 契约(--repo/--json、--readme/--json)只能从脚本 argparse 与编排器调用点得到。对模型自助调用不够友好,属可改进项;不影响机制结论,已在 capabilities/how_it_works 中改用编排器调用点为证据。
- [ok] 无网络/无凭证/无写入 — 两脚本 import 仅 argparse/json/re/pathlib/datetime/typing(scan_repo 另有 timezone);全目录 URL/urllib/requests/socket/subprocess/os.environ 扫描零命中;无写文件调用(仅 print 到 stdout)。
- [ok] 路径越界防护 — referenced_python_script() 先 (root / path).resolve() 再 candidate.relative_to(root),越界抛 ValueError 返回 None;并有 is_file() 与 524_288 字节上限。
- [ok] 分类优先级与注释一致 — classify() 实际顺序为 setup/asset 前缀 → 章节语义 → SCRIPT_CATEGORY_HINTS → 关键词,与文件内注释 'Unambiguous setup/asset syntax outranks generic headings' 一致;command_kind() 独立返回 setup/asset/run/smoke(--help/-h → smoke)。
- [ok] README 定位与姊妹 helper 分工 — README.md:160 'Two helpers support orchestration: `repo-intake-and-plan` and `paper-context-resolver`.';tests/trigger_cases.json 中 'expected_top': 'repo-intake-and-plan' 的用例存在(repo_scan_only_en:'Do not run anything yet.'),与 SKILL.md 的『不执行实质命令』一致。
- [ok] 元数据 — 本地 git HEAD bd91195ad73199b95e24532b581ff12c07dcce09(= 任务书 pin);LICENSE MIT / Copyright (c) 2026 Chengkun Rao;gh api → stars 487、last_push 2026-09-13T13:16:25Z。
6Verdict & Scenarios
1953a875072a9f35…