Skip to content

ccoalm/ccl-skills / skills/skill-extraction-workflow

skill-extraction-workflow

Flagged

复盘 / 沉淀 / 总结经验 / 补进技能 / 技能缺陷 / 流程优化 / would other teammates hit this / will we forget next time / teamwide recurrence / extract skill / post-mortem / 深度 review·审计技能仓库 / 对标外部技能包找 gap(benchmark superpowers·gstack 等) / 核查全局安装点(~/.config/opencode 等)旧快照是否遮蔽本仓技能 / 本仓(ccl-skills 等共享技能仓)OpenCode 项目配置·命令治理 → turn reusable lessons into durable CCL skills.

FileKindSize
SKILL.mdskill md111.0 KB
agents/openai.yamlconfig257 B
references/analysis-parse-fix-test-challenge-replay.mdmarkdown1.5 KB
references/attention-budget-ratchet.mdmarkdown13.7 KB
references/attribution-verification.mdmarkdown4.4 KB
references/bootstrap-slim-c3-obligation-table.mdmarkdown8.0 KB
references/correction-routing-map.mdmarkdown3.7 KB
references/coverage-exhaustion-traps.mdmarkdown19.6 KB
references/description-authoring.mdmarkdown21.1 KB
references/dual-track-review-gate.mdmarkdown110.6 KB
references/eval-routing.mdmarkdown22.2 KB
references/evidence-card-template.mdmarkdown3.2 KB
references/example-domain-preselect.mdmarkdown4.6 KB
references/external-practice-controls.mdmarkdown45.5 KB
references/extraction-lifecycle-handoff.mdmarkdown6.9 KB
references/extraction-quickstart.mdmarkdown20.2 KB
references/firing-point-placement.mdmarkdown21.3 KB
references/harness-patterns-and-eval.mdmarkdown42.6 KB
references/incident-postmortem-extraction.mdmarkdown28.8 KB
references/l0-l1-l2-routing.mdmarkdown10.3 KB
references/online-skill-review.mdmarkdown6.7 KB
references/parallel-stack-references-pattern.mdmarkdown35.9 KB
references/r0-leakage-audit.mdmarkdown19.9 KB
references/recurring-anti-patterns-checklist.mdmarkdown34.4 KB
references/resume-paused-delivery.mdmarkdown3.0 KB
references/review-feedback-mining.mdmarkdown5.7 KB
references/review-finding-standards.mdmarkdown7.3 KB
references/review-rubric.mdmarkdown3.1 KB
references/rule-consolidation.mdmarkdown38.2 KB
references/skill-listing-budget.mdmarkdown1.7 KB
references/source-register.mdmarkdown1.0 MB
references/source-to-skill-extraction.mdmarkdown109.3 KB
references/two-source-extraction-pattern.mdmarkdown19.4 KB
references/uiux-judgment-extraction.mdmarkdown19.1 KB
references/uiux-routing-map.mdmarkdown5.8 KB
references/validation-and-landing.mdmarkdown46.9 KB
scripts/AGENTS.mdmarkdown635 B
scripts/check-ccl-skills.shexecutablescript100.7 KB
scripts/check-contract-anchors.shexecutablescript5.6 KB
scripts/check-evidence-card-leak.shexecutablescript26.1 KB
scripts/check-mr-target-freshness.shexecutablescript9.4 KB
scripts/check-size-budget.shexecutablescript36.0 KB
scripts/check-sync-pointers.shexecutablescript22.6 KB
scripts/check_review_evidence_present.pyexecutablescript4.6 KB
scripts/contract-anchors.tsvother3.8 KB
scripts/entrypoint_form_census.pyexecutablescript7.1 KB
scripts/eval-golden-trace.rbexecutablescript10.0 KB
scripts/eval-health.rbexecutablescript14.6 KB
scripts/eval-routing-bank.rbexecutablescript30.4 KB
scripts/eval-routing.rbexecutablescript9.2 KB
scripts/extraction_review_gate.shexecutablescript1.8 KB
scripts/gate_receipt.pyexecutablescript24.7 KB
scripts/generic-r0-leak-scan.shexecutablescript12.4 KB
scripts/governing-chain-diff.pyexecutablescript12.8 KB
scripts/impact-chain-gate.rbexecutablescript124.4 KB
scripts/obligation-ledger.pyscript107.0 KB
scripts/reference-access-census.shexecutablescript8.3 KB
scripts/register-firing-path-resolution.rbexecutablescript48.4 KB
scripts/shared_git_surface_gate.pyexecutablescript38.0 KB
scripts/skill-behavior-eval.pyexecutablescript39.3 KB
scripts/skill-paired-eval.pyexecutablescript76.9 KB
scripts/source-register-lifecycle.rbscript1.5 KB
scripts/source-register-pending-status.rbscript2.0 KB
scripts/test_ai_coding_implementation_gates.shexecutablescript85.2 KB
scripts/test_antipattern_grep_panel.shexecutablescript3.2 KB
scripts/test_body_compliance_grading.shexecutablescript21.0 KB
scripts/test_check_ccl_impact_chain_refscripts.shexecutablescript145.1 KB
scripts/test_check_ccl_r0_status.shexecutablescript4.2 KB
scripts/test_check_ccl_register_pending_exclusion.shexecutablescript7.4 KB
scripts/test_check_ccl_regressions.shexecutablescript14.3 KB
scripts/test_check_ccl_route_drift.shexecutablescript22.6 KB
scripts/test_check_ccl_size_budget.shexecutablescript59.5 KB
scripts/test_check_ccl_skill_catalog.shexecutablescript23.3 KB
scripts/test_check_ccl_source_register_lifecycle.shexecutablescript6.1 KB
scripts/test_check_contract_anchors.shexecutablescript7.4 KB
scripts/test_check_mr_target_freshness.shexecutablescript12.8 KB
scripts/test_check_review_evidence_present.shexecutablescript4.3 KB
scripts/test_check_sync_pointers.shexecutablescript32.5 KB
scripts/test_ci_checkout_ref_binding.shexecutablescript8.2 KB
scripts/test_controlled_escalation_pins.shexecutablescript7.7 KB
scripts/test_entrypoint_domain_scan_terms.shexecutablescript8.8 KB
scripts/test_entrypoint_form_census.shexecutablescript6.3 KB
scripts/test_eval_routing_bank_grader_diagnostics.shexecutablescript20.6 KB
scripts/test_eval_routing_bank_resolution.shexecutablescript15.3 KB
scripts/test_eval_routing_bank_surface_binding.shexecutablescript6.9 KB
scripts/test_eval_routing_prose_target.shexecutablescript3.7 KB
scripts/test_eval_runtime.pyexecutablescript43.3 KB
scripts/test_extraction_review_gate.shexecutablescript15.2 KB
scripts/test_frozen_case_sanctity.shexecutablescript6.9 KB
scripts/test_frozen_case_sanctity_selfproof.shexecutablescript4.6 KB
scripts/test_gate_receipt.shexecutablescript17.7 KB
scripts/test_generic_r0_leak_scan.shexecutablescript6.4 KB
scripts/test_git_identity_predicate_gate.shscript13.8 KB
scripts/test_governing_chain_diff.shexecutablescript15.1 KB
scripts/test_impact_chain_gate_dateless_host.shexecutablescript6.8 KB
scripts/test_impact_chain_gate_verdict_differential.shexecutablescript20.8 KB
scripts/test_impact_chain_round_attribution.shexecutablescript32.5 KB
scripts/test_impact_chain_self_adjudication.shexecutablescript31.4 KB
scripts/test_impact_chain_source_refuted.shexecutablescript14.7 KB
scripts/test_liveness_predicate_gate.shexecutablescript14.5 KB
scripts/test_locale_independent_gates.shexecutablescript13.0 KB
scripts/test_obligation_ledger.shexecutablescript94.9 KB
scripts/test_obligation_ledger_repo_audit.shexecutablescript2.7 KB
scripts/test_pinned_phrase_mutation_walk.shexecutablescript6.5 KB
scripts/test_reference_access_census.shexecutablescript17.3 KB
scripts/test_register_firing_path_resolution.shexecutablescript41.0 KB
scripts/test_register_firing_path_wiring.shexecutablescript29.9 KB
scripts/test_regression_runner_lanes.shexecutablescript4.5 KB
scripts/test_regression_runner_registration.shexecutablescript1.5 KB
scripts/test_routing_bank_integrity.shexecutablescript15.5 KB
scripts/test_routing_pointer_integrity.shexecutablescript18.9 KB
scripts/test_shared_git_surface_gate.shexecutablescript76.8 KB
scripts/test_skill_paired_eval.pyscript60.0 KB
scripts/test_teardown_guard_pins.shexecutablescript17.0 KB
scripts/test_uiux_delivery_contract.shexecutablescript118.6 KB
scripts/test_uiux_loading_budget.shexecutablescript15.4 KB
scripts/test_validate_skill_credential_cwd.shexecutablescript2.6 KB
scripts/test_validate_skill_cross_refs.shexecutablescript4.8 KB
scripts/test_validate_skill_root_depth.shexecutablescript2.5 KB
scripts/validate-skill.shexecutablescript10.5 KB

scripts/test_teardown_guard_pins.sh

View on GitHub
#!/usr/bin/env bash
# Applied-mutation walk for the worktree teardown guard (family 9 in
# test_ai_coding_implementation_gates.sh). The pinned recipes guard an
# irreversible removal, so the walk runs in CI instead of living in a review
# note: in a throwaway copy, every pin row is deleted (an order row is
# reordered inside its section) and the fixture must red on that row's own
# label, with the unmutated copy green before and after. Relocation probes move
# a scoped phrase out of its section or line. The sweep gets decoy surfaces: a
# removal without the scan, without its exit-0 requirement on the scan line, or
# with a pointer that does not name the canonical reference must red it,
# including from a new top-level directory and under a file name that starts
# with a newline; a compliant decoy, a package-relative pointer inside the
# canonical package, a prune-only mention, ignored paths, round records,
# evaluation inputs and a register row must not. An unreadable file, an
# unreadable untracked directory, an unreadable index, a missing repository and
# a failed classification must each red it too. The copy is a git repository
# with an index and no commit, so the sweep lists it the way it does in CI
# while user commit hooks and signing never run.
# Rows are parsed from the fixture, so a new row enters this walk unasked; a
# teardown assertion written outside the row table is not walked, which is why
# the fixture keeps them all as rows.
set -euo pipefail
# The copy gets its own repository; inherited git variables (set inside git
# hooks, for one) would point git at the real one instead.
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY \
  GIT_ALTERNATE_OBJECT_DIRECTORIES GIT_COMMON_DIR GIT_CEILING_DIRECTORIES \
  GIT_NAMESPACE

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
repo_root="$(cd "$script_dir/../../.." && pwd -P)"
fixture_rel="skills/skill-extraction-workflow/scripts/test_ai_coding_implementation_gates.sh"

fail() { printf 'FAIL: %s\n' "$1" >&2; exit 1; }

tmp_root="$(mktemp -d "${TMPDIR:-/tmp}/teardown-guard-pins.XXXXXX")"
# The unreadable probes chmod parts of the copy to 000; restore access first so
# cleanup cannot leave them behind after a failure.
trap 'chmod -R u+rwX "$tmp_root" 2>/dev/null; rm -rf "$tmp_root"' EXIT
# The fixture reads the skills, the always-on layer, the docs and the root
# contract; the isolation probe below proves the fixture reads the copy.
cp -R "$repo_root/skills" "$tmp_root/skills"
cp -R "$repo_root/agent-context" "$tmp_root/agent-context"
cp -R "$repo_root/docs" "$tmp_root/docs"
cp "$repo_root/AGENTS.md" "$tmp_root/AGENTS.md"
cp "$repo_root/.gitignore" "$tmp_root/.gitignore"
git -C "$tmp_root" init -q
git -C "$tmp_root" add -A
copy_fixture="$tmp_root/$fixture_rel"
[[ -f "$copy_fixture" ]] || fail "copy is missing the fixture"

rows_file="$tmp_root/rows.txt"
python3 - "$repo_root/$fixture_rel" "$rows_file" <<'PY'
import re, sys
text = open(sys.argv[1], encoding="utf-8").read()
m = re.search(r"TEARDOWN_PINS=\"\$\(cat <<'PINS'\n(.*?)\nPINS\n", text, re.S)
if not m:
    sys.exit("TEARDOWN_PINS block not found in the fixture")
rows = [r for r in m.group(1).split("\n") if r.strip()]
bad = [r for r in rows if r.count("|") != 4]
if bad:
    sys.exit(f"malformed teardown pin row: {bad[0]}")
open(sys.argv[2], "w", encoding="utf-8").write("\n".join(rows) + "\n")
PY
row_count="$(wc -l < "$rows_file" | tr -d ' ')"
(( row_count >= 20 )) || fail "parsed only $row_count teardown pin rows"

# Fixture temp files land in the copy, so the trap removes them even after an
# interrupted run.
run_copy() { TMPDIR="$tmp_root" bash "$copy_fixture" 2>&1; }

# Mutate one row in place. Exit 3 when the mutation cannot land exactly once,
# so a moved or duplicated phrase fails the walk instead of passing unmutated.
# Modes: mutate (delete, or reorder an order row) and relocate (move the phrase,
# or an order row's first line, out of its scope to a decoy heading at the end).
mutate() { # <mutate|relocate> <kind> <file> <scope> <phrase>
  python3 - "$@" <<'PY'
import sys
mode, kind, path, scope, phrase = sys.argv[1:6]
text = open(path, encoding="utf-8").read()
lines = text.split("\n")
def bail(msg):
    sys.stderr.write(msg + "\n")
    sys.exit(3)
def section_bounds(heading):
    if lines.count(heading) != 1:
        bail(f"section heading occurs {lines.count(heading)} times: {heading}")
    start = lines.index(heading)
    end = next((i for i in range(start + 1, len(lines)) if lines[i].startswith("#")), len(lines))
    return start, end
moved = phrase
if kind == "section":
    start, end = section_bounds(scope)
    body = "\n".join(lines[start + 1:end])
    if body.count(phrase) != 1:
        bail(f"phrase occurs {body.count(phrase)} times in its section: {phrase}")
    lines[start + 1:end] = body.replace(phrase, "", 1).split("\n")
elif kind == "line":
    hits = [i for i, line in enumerate(lines) if scope in line]
    if len(hits) != 1:
        bail(f"line anchor occurs on {len(hits)} lines: {scope}")
    if lines[hits[0]].count(phrase) != 1:
        bail(f"phrase occurs {lines[hits[0]].count(phrase)} times on its anchor line: {phrase}")
    lines[hits[0]] = lines[hits[0]].replace(phrase, "", 1)
elif kind == "order":
    if " ⟶ " not in phrase:
        bail("order row must read 'first ⟶ second'")
    first_lit, second_lit = phrase.split(" ⟶ ", 1)
    start, end = section_bounds(scope)
    first = [i for i in range(start + 1, end) if first_lit in lines[i]]
    second = [i for i in range(start + 1, end) if second_lit in lines[i]]
    if len(first) != 1 or len(second) != 1:
        bail(f"order literals must each sit on one line of the section (got {len(first)} and {len(second)})")
    if first[0] >= second[0]:
        bail("order literals are already reversed in the pristine copy")
    moved = lines.pop(first[0])
    if mode == "mutate":
        lines.insert(second[0], moved)  # lands right after the second literal's line
else:
    bail(f"unknown pin kind: {kind}")
if mode == "relocate":
    decoy = ["## Relocation decoy", "", moved, ""]
    if kind == "order":
        # Ahead of the section: a file-wide comparison still sees the scan
        # before the removal there, so only a section-scoped check reds.
        lines = decoy + lines
    else:
        lines += [""] + decoy
mutant = "\n".join(lines)
if mutant == text:
    bail("mutation left the file unchanged")
open(path, "w", encoding="utf-8").write(mutant)
PY
}

control_out="$(run_copy)" || fail "pre-control not green: $control_out"

applied=0
pristine="$tmp_root/pristine.tmp"
while IFS='|' read -r kind rel scope phrase label; do
  target="$tmp_root/$rel"
  [[ -f "$target" ]] || fail "row target missing from the copy: $rel"
  cp "$target" "$pristine"
  mutate mutate "$kind" "$target" "$scope" "$phrase" || fail "mutation did not land for row: $label"
  if out="$(run_copy)"; then
    fail "mutant stayed green (row: $label)"
  fi
  last="$(printf '%s\n' "$out" | tail -1)"
  case "$last" in
    "FAIL: teardown guard: $label:"*) : ;;
    *) fail "mutant red on the wrong assertion — expected [teardown guard: $label], got: $last" ;;
  esac
  cp "$pristine" "$target"
  applied=$((applied + 1))
done < "$rows_file"
[[ "$applied" == "$row_count" ]] || fail "walked $applied of $row_count rows"

# Relocation: a deletion mutant cannot tell a scoped check from a whole-file
# grep. For the first row of each kind, move its phrase under a decoy heading at
# the end of the file, or an order row's first line to a decoy heading ahead of
# the section; a scoped check reds on its row, a whole-file one stays green.
relocations=0
relocate() { # <kind>
  local want="$1" kind rel scope phrase label out
  while IFS='|' read -r kind rel scope phrase label; do
    [[ "$kind" == "$want" ]] && break
  done < "$rows_file"
  [[ "$kind" == "$want" ]] || fail "no $want row to relocate"
  cp "$tmp_root/$rel" "$pristine"
  mutate relocate "$kind" "$tmp_root/$rel" "$scope" "$phrase" || fail "relocation did not land for row: $label"
  if out="$(run_copy)"; then
    fail "relocation probe: row stayed green with its phrase outside its $kind scope: $label"
  fi
  case "$(printf '%s\n' "$out" | tail -1)" in
    "FAIL: teardown guard: $label:"*) : ;;
    *) fail "relocation probe red on the wrong assertion for row: $label: $(printf '%s\n' "$out" | tail -1)" ;;
  esac
  cp "$pristine" "$tmp_root/$rel"
  relocations=$((relocations + 1))
}
relocate section
relocate line
relocate order

# Sweep decoys: each is planted alone, judged, then removed.
canonical='`worktree-isolation/references/merge-and-teardown.md`'
recipe_no_scan=$'```bash\ngit worktree remove <path>\n```\n'
recipe_no_exit="See $canonical."$'\n\n```bash\ngit -C <path> status --ignored -s\ngit worktree remove <path>\n```\n'
recipe_exit_elsewhere="See $canonical."$'\n\n```bash\ngit -C <path> status --ignored -s\ngit worktree remove <path>\n```\n\nThe health check must exit 0 before release.\n'
recipe_no_pointer=$'```bash\ngit -C <path> status --ignored -s   # must exit 0\ngit worktree remove <path>\n```\n'
recipe_basename_pointer=$'See `references/merge-and-teardown.md`.\n\n```bash\ngit -C <path> status --ignored -s   # must exit 0\ngit worktree remove <path>\n```\n'
recipe_compliant="See $canonical."$'\n\n```bash\ngit -C <path> status --ignored -s   # must exit 0\ngit worktree remove <path>\n```\n'
reds=0
greens=0
decoy() { # <copy-relative path> <content> <red|green> [expected offender text]
  local rel="$1" content="$2" expect="$3" want="${4:-}" out last
  mkdir -p "$(dirname "$tmp_root/$rel")"
  printf '%s' "$content" > "$tmp_root/$rel"
  if out="$(run_copy)"; then
    [[ "$expect" == green ]] || fail "sweep decoy stayed green: $rel"
    greens=$((greens + 1))
  else
    [[ "$expect" == red ]] || fail "precision decoy redded the fixture: $rel: $(printf '%s\n' "$out" | tail -1)"
    last="$(printf '%s\n' "$out" | tail -1)"
    case "$last" in
      "FAIL: teardown guard sweep: "*"$rel: $want"*) : ;;
      *) fail "sweep decoy $rel red for the wrong reason, expected [$rel: $want], got: $last" ;;
    esac
    reds=$((reds + 1))
  fi
  rm -f "$tmp_root/$rel"
}
decoy "skills/zz-teardown-decoy/references/recipe.md" "$recipe_no_scan" red "no ignored-output scan"
decoy "docs/zz-teardown-decoy.md" "$recipe_no_pointer" red "no pointer to the canonical teardown"
decoy "docs/zz-no-exit.md" "$recipe_no_exit" red "no exit-0 requirement on the scan line"
decoy "docs/zz-exit-elsewhere.md" "$recipe_exit_elsewhere" red "no exit-0 requirement on the scan line"
decoy "zz-new-root/guide.md" "$recipe_no_scan" red "no ignored-output scan"
rm -rf "$tmp_root/zz-new-root"
# A file name that starts with a newline must still be reported: the verdict
# comes from the classifier's exit status, not from parsing its text.
newline_name="$tmp_root/docs/"$'\n'"unsafe.md"
printf '%s' "$recipe_no_scan" > "$newline_name"
if out="$(run_copy)"; then
  fail "a decoy whose name starts with a newline left the sweep green"
fi
case "$(printf '%s\n' "$out" | tail -1)" in
  "FAIL: teardown guard sweep: "*'docs/\nunsafe.md: no ignored-output scan'*) : ;;
  *) fail "newline-named decoy red for the wrong reason: $(printf '%s\n' "$out" | tail -1)" ;;
esac
rm -f "$newline_name"
reds=$((reds + 1))
decoy "docs/zz-basename-pointer.md" "$recipe_basename_pointer" red "no pointer to the canonical teardown"
decoy "docs/zz-teardown-compliant.md" "$recipe_compliant" green
decoy "skills/worktree-isolation/references/zz-package-relative.md" "$recipe_basename_pointer" green
decoy "skills/zz-teardown-decoy/references/prune.md" $'```bash\ngit worktree prune\n```\n' green
decoy "skills/zz-teardown-decoy/node_modules/pkg/README.md" "$recipe_no_scan" green
decoy ".work/zz-local.md" "$recipe_no_scan" green
decoy "specs/zz-round/plan.md" "$recipe_no_scan" green
decoy "eval/zz-input.md" "$recipe_no_scan" green
rm -rf "$tmp_root/skills/zz-teardown-decoy" "$tmp_root/specs" "$tmp_root/eval"
# The append-only register describes defects, removal commands included, and
# the sweep skips it; a register row naming the command must stay green.
register="$tmp_root/skills/skill-extraction-workflow/references/source-register.md"
cp "$register" "$pristine"
printf '%s\n' '| decoy row | `decoy` | listed only `git worktree remove <path>` | n/a | n/a |' >> "$register"
if ! out="$(run_copy)"; then
  fail "precision decoy in the source register redded the fixture: $(printf '%s\n' "$out" | tail -1)"
fi
cp "$pristine" "$register"
greens=$((greens + 1))

# A read error must fail the sweep rather than skip a file it could not see.
# Permissions do not bind root, so the unreadable probes are skipped there.
as_root=0
[[ "$(id -u)" != 0 ]] || as_root=1
unreadable="permission probes skipped as root"
if (( ! as_root )); then
  locked_file="$tmp_root/docs/zz-unreadable.md"
  printf '%s' "$recipe_no_scan" > "$locked_file"
  chmod 000 "$locked_file"
  if out="$(run_copy)"; then
    fail "an unreadable file left the sweep green"
  fi
  chmod 644 "$locked_file"
  case "$(printf '%s\n' "$out" | tail -1)" in
    "FAIL: teardown guard sweep: could not read docs/zz-unreadable.md"*) : ;;
    *) fail "unreadable file red for the wrong reason: $(printf '%s\n' "$out" | tail -1)" ;;
  esac
  rm -f "$locked_file"
  # A listing failure must fail the sweep too: an unreadable index stops git.
  chmod 000 "$tmp_root/.git/index"
  if out="$(run_copy)"; then
    fail "a failed repository listing left the sweep green"
  fi
  chmod 644 "$tmp_root/.git/index"
  case "$(printf '%s\n' "$out" | tail -1)" in
    "FAIL: teardown guard sweep: could not list the repository's Markdown"*) : ;;
    *) fail "failed listing red for the wrong reason: $(printf '%s\n' "$out" | tail -1)" ;;
  esac
fi
# A classification pass that dies must fail the sweep, not pass it.
mkdir -p "$tmp_root/shim"
printf '#!/bin/sh\nexit 1\n' > "$tmp_root/shim/python3"
chmod +x "$tmp_root/shim/python3"
if out="$(PATH="$tmp_root/shim:$PATH" TMPDIR="$tmp_root" bash "$copy_fixture" 2>&1)"; then
  fail "a failed classification pass left the sweep green"
fi
case "$(printf '%s\n' "$out" | tail -1)" in
  "FAIL: teardown guard sweep: the classification pass failed"*) : ;;
  *) fail "failed classification red for the wrong reason: $(printf '%s\n' "$out" | tail -1)" ;;
esac
rm -rf "$tmp_root/shim"

# Git reports an untracked directory it cannot read on stderr and still exits
# 0; the sweep must treat that report as an incomplete listing.
if (( ! as_root )); then
  locked="$tmp_root/hooks/zz-unreadable"
  mkdir -p "$locked"
  printf '%s' "$recipe_no_scan" > "$locked/README.md"
  chmod 000 "$locked"
  if out="$(run_copy)"; then
    fail "an unreadable untracked directory left the sweep green"
  fi
  chmod 755 "$locked"
  case "$(printf '%s\n' "$out" | tail -1)" in
    "FAIL: teardown guard sweep: git could not list every file"*) : ;;
    *) fail "unreadable directory red for the wrong reason: $(printf '%s\n' "$out" | tail -1)" ;;
  esac
  rm -rf "$tmp_root/hooks"
  unreadable="3 unreadable probes red"
fi

# A listing that never reaches the canonical file is a broken listing, not a
# clean one: hide it from git (the row pins still read it directly).
canonical_rel="skills/worktree-isolation/references/merge-and-teardown.md"
mkdir -p "$tmp_root/.git/info"
touch "$tmp_root/.git/info/exclude"
cp "$tmp_root/.git/info/exclude" "$pristine"
git -C "$tmp_root" rm -q --cached "$canonical_rel"
printf '%s\n' "/$canonical_rel" >> "$tmp_root/.git/info/exclude"
if out="$(run_copy)"; then
  fail "a listing without the canonical file left the sweep green"
fi
cp "$pristine" "$tmp_root/.git/info/exclude"
git -C "$tmp_root" add "$canonical_rel"
case "$(printf '%s\n' "$out" | tail -1)" in
  "FAIL: teardown guard sweep: the canonical teardown was never scanned"*) : ;;
  *) fail "hidden canonical file red for the wrong reason: $(printf '%s\n' "$out" | tail -1)" ;;
esac

# Without a repository there is no list of the repository's Markdown, so the
# sweep must fail rather than fall back to a guess.
mkdir -p "$tmp_root/.work"
mv "$tmp_root/.git" "$tmp_root/.work/git-off"
if out="$(run_copy)"; then
  fail "a copy without a repository left the sweep green"
fi
mv "$tmp_root/.work/git-off" "$tmp_root/.git"
case "$(printf '%s\n' "$out" | tail -1)" in
  "FAIL: teardown guard sweep: not a git work tree"*) : ;;
  *) fail "missing repository red for the wrong reason: $(printf '%s\n' "$out" | tail -1)" ;;
esac

# Post-control green, then tree isolation: a mutated copy reds while the live
# tree's own fixture stays green, so the walk above read the copy.
run_copy >/dev/null || fail "post-control not green"
first_row="$(head -1 "$rows_file")"
IFS='|' read -r kind rel scope phrase label <<< "$first_row"
cp "$tmp_root/$rel" "$pristine"
mutate mutate "$kind" "$tmp_root/$rel" "$scope" "$phrase" || fail "isolation mutation did not land"
if run_copy >/dev/null; then fail "tree-isolation probe: mutated copy stayed green"; fi
TMPDIR="$tmp_root" bash "$repo_root/$fixture_rel" >/dev/null 2>&1 || fail "tree-isolation probe: live tree fixture not green"
cp "$pristine" "$tmp_root/$rel"

echo "test_teardown_guard_pins: ok ($applied applied mutations, each red on its own row; $relocations relocations red; $reds sweep decoys red, $greens precision decoys green; $unreadable; hidden canonical file, missing repository and failed classification red; controls green)"
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall