Execute an implementation plan with progress tracking
Resolve $ARG to a plan file path:
.md → use as-is/plan/plan.mdls -d .claude_reports/plans/*$ARG* 2>/dev/null
{match}/plan/plan.md_audit/_fix_ suffix; if still multiple, ask userchore: Safety checkpoint before {plan-name} execution{type}: {description}\n\n{bullet list of key changes} — type: feat/fix/refactor/choreBefore any code changes, ensure the working tree is clean and up-to-date:
git fetch && git pull to sync with the remote.
git merge --abort), warn the user, and stop. Do NOT proceed with execution.git status to check for uncommitted changes.git add -A && git commit with a commit message that accurately describes the current uncommitted changes (analyze the diff to write a meaningful message).git rev-parse HEAD → save as $SAFETY_COMMIT.
$SAFETY_COMMIT is persisted into the checklist header during Initialization.plan/plan.md).
.claude_reports/plans/2026-03-18_refactor_engine/plan/plan.md → log dir is .claude_reports/plans/2026-03-18_refactor_engine/{log_dir}:
{log_dir}/plan/checklist.md already exists with [x]/[FAIL]/[SKIP-DEP] marks: this is a resume. Read the checklist, update the Safety commit: line with the current $SAFETY_COMMIT, and skip all completed steps. Continue from the first [ ] step.mkdir -p {log_dir}/dev_logs {log_dir}/dev_reviews{log_dir}/plan/checklist.md — checklist derived directly from the English plan with the following header and body:Safety commit: {$SAFETY_COMMIT}
Phase A: [description]
[ ] Step 1: [file] — [what to change]
[ ] Step 2: [file] — [what to change]
Phase B: [description]
[ ] Step 3: [file] — [what to change]
[x] or [FAIL] as steps complete or fail.dev_logs/step_01_model_py.md).[x] in the English checklist file[x] or [FAIL]).qa_level in plan frontmatter overrides auto-detect for ALL phases. Otherwise, detect per phase:
autonomy_level in plan frontmatter determines decision point gating. Default: proactive.
| Level | Auto-detect condition | Action |
|---|---|---|
| Light | ≤3 units, mechanical, single-variant | 1× 품질관리팀 (model: "sonnet") |
| Standard | 4–10 units, logic changes, single module | 1× 품질관리팀 (default opus) |
| Thorough | >10 units, cross-module/variant, architectural | 2–3× 품질관리팀 in parallel (opus): A=correctness, B=consistency, C=safety (>20 files) |
| Adversarial | Cross-variant (SE+SS+CSS), shared modules (utils/, network.py), or >20 files with architectural impact — AND Codex available | Thorough-level 품질관리팀 + 1× codex-review-team (adversarial-review) in parallel |
Thorough mode — A: bugs/logic/signature mismatches; B: naming/conventions/dead code; C: tensor shapes/None edge cases. Each writes to dev_reviews/phase_{NN}_{focus}.md. All 🔴 from ANY agent must be addressed.
Adversarial mode — runs all Thorough agents PLUS an additional codex-review-team agent in the same parallel batch. The Codex agent runs adversarial-review --wait --scope auto and writes to dev_reviews/phase_{NN}_codex.md. All 🔴 from ANY agent (including Codex) must be addressed.
Codex availability check: Before selecting Adversarial, run codex --version (suppress stderr). If the command fails or Codex is not authenticated, fall back to Thorough silently. This check is skipped if --qa adversarial is explicitly specified (fail loudly instead).
{log_dir}/dev_logs/.
Decision: field explaining the rationale — the subagent creates this file itself.model: 'sonnet' when invoking 품질관리팀.codex-review-team agent in the same parallel batch. Codex prompt: "Run adversarial-review on the current changes. Write results to: {log_dir}/dev_reviews/phase_{NN}_codex.md. Return the file path and a one-line verdict."mkdir -p {log_dir}/dev_reviews before first invocation.phase_{NN}_fix.md). If still 🔴, treat as major.proactive: auto-rollback phase and continue (proceed immediately to step 1 below).standard: ask the user: "Phase N에서 🔴 major 이슈가 발견되었습니다. 롤백할까요, 수정을 시도할까요? (a) 롤백, (b) 수정 1회 시도, (c) 건너뛰기 (기본값: 롤백)" — wait for response before acting.passive: ask the user with full issue detail (list all 🔴 issues found, which files are affected, and what the reviewer recommends), then ask: "어떻게 진행할까요? (a) 롤백, (b) 수정 1회 시도, (c) 건너뛰기 (기본값: 롤백)" — wait for response before acting.old_string from the phase's step logs.$SAFETY_COMMIT from checklist header → git checkout . (reverts ALL uncommitted changes including prior phases). Mark ALL steps [FAIL] ("Reverted by git checkout due to rollback failure in Phase N"). Stop and go to Final Report.[FAIL] with reason.[SKIP-DEP].After each gated decision, record the decision per the Decision Point Logging Rule. Decisions propagate up to the pipeline skill's pipeline_summary.md.
[FAIL]/[SKIP-DEP] after Plan Status Update): Autonomy gate (Critical):
proactive: auto-rollback to safety commit (proceed immediately to the steps below).standard or passive: ask the user: "모든 단계가 실패했습니다. Safety commit으로 롤백할까요? (기본값: 롤백)" — wait for response before acting.
Read $SAFETY_COMMIT → git diff --name-only $SAFETY_COMMIT HEAD -- ':!.claude_reports' → git checkout $SAFETY_COMMIT -- <changed files> (preserves .claude_reports/). Verify with git status. Note in Final Report.After each gated decision, record the decision per the Decision Point Logging Rule. Decisions propagate up to the pipeline skill's pipeline_summary.md.
.shape assumptions, dict key access).[FAIL], rollback via step log, continue to next step.After all phases are processed, read the English checklist and report a summary to the user:
[FAIL] and [SKIP-DEP] steps with their reasons.[x]: report success, no need to list individual steps./run-test <plan file path> to verify functional correctness.[x]: change the English plan's frontmatter status to done.[x] and some are [FAIL]/[SKIP-DEP]: change status to partial and add a failed_steps field listing the failed step numbers.[FAIL]/[SKIP-DEP] (no [x] steps): change status to failed and add a failed_steps field listing all step numbers.Execute the plan at: $ARG