Blind-Rebuild Verification
You are given a spec dir (natural-language spec generated by a reverse-engineering tool like REgent regent-reverse) and an out dir. Your job is to rebuild the target package from spec only and prove the spec was sufficient.
This is a meta-test of the spec, not just an implementation task. The original repo is OFF-LIMITS — never ls, cat, grep, git log, or otherwise read it.
When this skill fires
- User says "blind-rebuild verification", "rebuild from spec only", or names the regent-build skill test.
- You're handed a
<spec_dir>/AGENTS.md plus <spec_dir>/{README,architecture}.md, layout/, specs/, conventions/, inventory/.
Required reading order (literal)
<spec_dir>/AGENTS.md — its rebuild order is authoritative.
<spec_dir>/README.md + architecture.md — goals, constraints, building blocks.
<spec_dir>/layout/tree.txt + layout/src.map.md — file map + public APIs.
<spec_dir>/specs/*.spec.md — R-/S- requirements (MUST > SHOULD).
<spec_dir>/conventions/*.md — style, tooling, error conventions.
<spec_dir>/inventory/functional-checklist.md — grading key.
Rebuild loop
For each file in src.map.md:
- Read its purpose, public API, side effects, imports from
src.map.md.
- Read the matching
specs/*.spec.md R-num requirements that govern it.
- Honor any constraints from
conventions/ (import style, version, error format).
- Write the minimum code that satisfies R-requirements and passes the checklist.
Do not copy verbatim. Reconstruct from natural-language spec.
Verification protocol
- Per
conventions/dev-env.md: build install command + test command.
- Run the full test suite. Expect exit 0.
- Run every
- [ ] line of inventory/functional-checklist.md as an actual command/call. Capture output, exit codes.
- For non-obvious cases, write a 5-line ad-hoc Python probe rather than guessing.
Final report (under 4 KB)
Structure:
- Clear spec sections —
path:line cites where requirements were unambiguous.
- Vague/missing/invented sections —
path:line for spec gaps. Be honest; this is the point.
- Checklist table — every
- [ ] with PASS/FAIL + one-line reason + evidence.
- Inventions bullet-list — every decision not specified by the spec (e.g. "chose dict over if/elif in formats.py", "invented LICENSE body text because spec said only 'MIT stub'").
- Final verdict — PASS (spec sufficient) or FAIL (spec has gap), with the exact missing
R- or S- number.
Pitfalls
- Do not read the original repo. Even verifying a "small detail" by reading original defeats the test. If spec is ambiguous, mark it vague in the report — don't peek.
- Empty/clean out-dir. Spec says "starts cleaned" — assume
mkdir -p is yours.
- Use
uv venv + uv pip install when venv needed. Never sudo. PEP 668 + python3 without pip → uv path.
pip install -e .[test] will warn "no extra named test" if pyproject lacks a test extra. Not a real error; add pytest separately via uv pip install pytest or just pip install -e . for greeter-style packages without extras.
- Literal punctuation matters. For non-English locales (zh, ja), full-width
, 。 ! etc. are usually required by spec — copy them byte-for-byte, do not auto-translate.
error: prefix on stderr is literal in many CLI specs. argparse + print(f"error: {exc}", file=sys.stderr) is the canonical pattern.
- SHOULD vs MUST.
SHOULD requirements are graded as PASS when honored; MUST failures → FAIL.
__all__ matters. If spec says __init__.py declares __all__, declare it. from __future__ import annotations is required in Python ≥3.10 modules when the spec mentions it.
- Console script verification. After
pip install -e ., run the binary directly (e.g. greeter Ada); don't trust that install succeeded without an actual invocation.
- Exit code discipline. Spec-defined codes (0 success, 2 domain error) must be tested explicitly with
$?.
- Whitelist reuses, don't reinvent. If
conventions/architecture-rules.md says formats.py is "function defs and a dict literal" — use a dict, even if an if/elif chain feels Pythonic. Match evidence.
Subagent Fallback (parent-agent rebuild)
When delegate_task fails — MiniMax 429 quota exhaustion, pool timeout at
max_concurrent_children=1, or model unavailability — the parent agent
MUST do the rebuild directly rather than retrying the subagent.
Triggers for fallback:
- Subagent returns 429 (Token Plan 用量上限) from MiniMax
- dispatch timeout after 600s with no output
- model resolves to a provider with exhausted quota
Parent-agent rebuild pattern:
- Python: write minimal stub modules + implementation via
write_file using clean string literals (never read_file → write_file)
- Rust:
cargo init --lib workspace (trait crate + impl crate), then write src/lib.rs
- Debug: fix one bug at a time, verify with
python3 -c or #[test] probes
- Grade: comprehensive test walking every checklist item
Cross-Language Pitfalls
Rust + regex-automata
NonMaxUsize has .get() not usize::from()
HalfMatch has .offset() returning usize (no Dead/Quit variants in 0.4)
search_captures returns () not Option in 0.4
group_info().group_len() requires PatternID argument
RegexBuilder is a temporary — bind to let binding before chaining
Common Implementation Bugs
_exit_buffer calls _write_buffer directly, bypassing _check_buffer → quiet flag ignored
- Buffer saved AFTER flush in
end_capture → returns empty string
- Sentinel
NO_CHANGE values crash int() in update(width=...)
Style.parse() doesn't raise on malformed input → get_style never falls back to default
read_file output fed to write_file → line number prefixes injected into source files
What NOT to capture
- Specific license text you invented for one project — it's a per-spec invention, belongs in the report not as a durable rule.
- Per-implementation choices (dict vs if-elif) — report those in the inventions list, don't generalize.
Reference
See references/greeter-report.md for a worked example (small Python CLI package, 20/20 PASS, 4 minor inventions).
1---2name: blind-rebuild-verification3description: Verify a reverse-engineered spec is self-sufficient by rebuilding the target from spec ONLY (never read the original). Use when the user hands you a spec directory + out directory and says "rebuild from spec only, do not read the original repo."4---56# Blind-Rebuild Verification78You are given a spec dir (natural-language spec generated by a reverse-engineering tool like REgent regent-reverse) and an out dir. Your job is to rebuild the target package **from spec only** and prove the spec was sufficient.910This is a meta-test of the spec, not just an implementation task. The original repo is OFF-LIMITS — never `ls`, `cat`, `grep`, `git log`, or otherwise read it.1112## When this skill fires1314- User says "blind-rebuild verification", "rebuild from spec only", or names the regent-build skill test.15- You're handed a `<spec_dir>/AGENTS.md` plus `<spec_dir>/{README,architecture}.md`, `layout/`, `specs/`, `conventions/`, `inventory/`.1617## Required reading order (literal)18191. `<spec_dir>/AGENTS.md` — its rebuild order is authoritative.202. `<spec_dir>/README.md` + `architecture.md` — goals, constraints, building blocks.213. `<spec_dir>/layout/tree.txt` + `layout/src.map.md` — file map + public APIs.224. `<spec_dir>/specs/*.spec.md` — R-/S- requirements (MUST > SHOULD).235. `<spec_dir>/conventions/*.md` — style, tooling, error conventions.246. `<spec_dir>/inventory/functional-checklist.md` — grading key.2526## Rebuild loop2728For each file in `src.map.md`:291. Read its purpose, public API, side effects, imports from `src.map.md`.302. Read the matching `specs/*.spec.md` R-num requirements that govern it.313. Honor any constraints from `conventions/` (import style, version, error format).324. Write the minimum code that satisfies R-requirements and passes the checklist.3334**Do not copy verbatim.** Reconstruct from natural-language spec.3536## Verification protocol37381. Per `conventions/dev-env.md`: build install command + test command.392. Run the full test suite. Expect exit 0.403. Run **every** `- [ ]` line of `inventory/functional-checklist.md` as an actual command/call. Capture output, exit codes.414. For non-obvious cases, write a 5-line ad-hoc Python probe rather than guessing.4243## Final report (under 4 KB)4445Structure:46- **Clear spec sections** — `path:line` cites where requirements were unambiguous.47- **Vague/missing/invented sections** — `path:line` for spec gaps. Be honest; this is the point.48- **Checklist table** — every `- [ ]` with PASS/FAIL + one-line reason + evidence.49- **Inventions bullet-list** — every decision not specified by the spec (e.g. "chose dict over if/elif in formats.py", "invented LICENSE body text because spec said only 'MIT stub'").50- **Final verdict** — PASS (spec sufficient) or FAIL (spec has gap), with the exact missing `R-` or `S-` number.5152## Pitfalls5354- **Do not read the original repo.** Even verifying a "small detail" by reading original defeats the test. If spec is ambiguous, mark it vague in the report — don't peek.55- **Empty/clean out-dir.** Spec says "starts cleaned" — assume `mkdir -p` is yours.56- **Use `uv venv` + `uv pip install`** when venv needed. Never `sudo`. PEP 668 + `python3` without `pip` → uv path.57- **`pip install -e .[test]` will warn "no extra named test"** if pyproject lacks a `test` extra. Not a real error; add `pytest` separately via `uv pip install pytest` or just `pip install -e .` for greeter-style packages without extras.58- **Literal punctuation matters.** For non-English locales (zh, ja), full-width `,` `。` `!` etc. are usually required by spec — copy them byte-for-byte, do not auto-translate.59- **`error: ` prefix on stderr is literal in many CLI specs.** argparse + `print(f"error: {exc}", file=sys.stderr)` is the canonical pattern.60- **SHOULD vs MUST.** `SHOULD` requirements are graded as PASS when honored; `MUST` failures → FAIL.61- **`__all__` matters.** If spec says `__init__.py declares __all__`, declare it. `from __future__ import annotations` is required in Python ≥3.10 modules when the spec mentions it.62- **Console script verification.** After `pip install -e .`, run the binary directly (e.g. `greeter Ada`); don't trust that install succeeded without an actual invocation.63- **Exit code discipline.** Spec-defined codes (0 success, 2 domain error) must be tested explicitly with `$?`.64- **Whitelist reuses, don't reinvent.** If `conventions/architecture-rules.md` says `formats.py` is "function defs and a `dict` literal" — use a dict, even if an `if/elif` chain feels Pythonic. Match evidence.6566## Subagent Fallback (parent-agent rebuild)6768When `delegate_task` fails — MiniMax 429 quota exhaustion, pool timeout at69max_concurrent_children=1, or model unavailability — the parent agent70MUST do the rebuild directly rather than retrying the subagent.7172**Triggers for fallback:**73- Subagent returns 429 (Token Plan 用量上限) from MiniMax74- dispatch timeout after 600s with no output75- model resolves to a provider with exhausted quota7677**Parent-agent rebuild pattern:**78- Python: write minimal stub modules + implementation via `write_file` using clean string literals (never read_file → write_file)79- Rust: `cargo init --lib` workspace (trait crate + impl crate), then write src/lib.rs80- Debug: fix one bug at a time, verify with `python3 -c` or `#[test]` probes81- Grade: comprehensive test walking every checklist item8283## Cross-Language Pitfalls8485### Rust + regex-automata86- `NonMaxUsize` has `.get()` not `usize::from()`87- `HalfMatch` has `.offset()` returning usize (no Dead/Quit variants in 0.4)88- `search_captures` returns `()` not `Option` in 0.489- `group_info().group_len()` requires `PatternID` argument90- `RegexBuilder` is a temporary — bind to `let binding` before chaining9192## Common Implementation Bugs9394- `_exit_buffer` calls `_write_buffer` directly, bypassing `_check_buffer` → quiet flag ignored95- Buffer saved AFTER flush in `end_capture` → returns empty string96- Sentinel `NO_CHANGE` values crash `int()` in `update(width=...)`97- `Style.parse()` doesn't raise on malformed input → `get_style` never falls back to default98- `read_file` output fed to `write_file` → line number prefixes injected into source files99100## What NOT to capture101102- Specific license text you invented for one project — it's a per-spec invention, belongs in the **report** not as a durable rule.103- Per-implementation choices (dict vs if-elif) — report those in the inventions list, don't generalize.104105## Reference106107See `references/greeter-report.md` for a worked example (small Python CLI package, 20/20 PASS, 4 minor inventions).