--- name: refine-local-plans description: 현재 plan들 세분화해, 현재 plan 세분화, 기존 plan 더 나눠, local plan 분리해 같은 요청에서 이미 생성된 미착수 local plan을 유지하거나 최대 3개의 local sibling plan으로 한 단계 분리할 때 사용한다. 현재 Worker용 PLAN/CODE_REVIEW 형식, 유효한 runtime dependency 이름, readiness를 함께 갱신한다. --- # refine-local-plans ## 목표 기존 미착수 local pair를 더 작은 실행 단위로 한 번만 나눈다. 문서와 runtime dependency를 갱신하되 구현 조사, 실행 검증, Worker/Review 시작은 하지 않는다. ## 대상 - 사용자가 지정한 `agent-task/{task_group}` 또는 `PLAN-local-G??.md`를 대상으로 삼는다. - 대상을 생략하면 미착수 local pair가 있는 active task group이 정확히 하나일 때만 사용한다. 여러 개면 후보만 보고한다. - 대상은 active PLAN/CODE_REVIEW pair가 있고 Implementation/Review identity와 구현 소유 필드가 아직 채워지지 않았으며 verdict가 없는 작업이다. - `complete.log` 또는 `USER_REVIEW.md`가 있는 작업과 이미 구현이 시작된 pair는 제외한다. 이전 loop의 `*.log`만 있다는 이유로 미착수 follow-up pair를 제외하지 않는다. - 대상 또는 dependency가 바뀌는 direct dependent가 이미 구현 중이면 분리하지 않는다. - 대상 pair와 실제 dependency가 바뀌는 미착수 sibling pair만 읽는다. - index 할당에는 같은 task group의 active directory name과 archived sibling directory basename만 사용한다. Readiness 판정에 필요한 direct predecessor `complete.log`만 active/archive에서 좁게 읽고 Worker 문서에는 그 경로나 상태를 쓰지 않는다. - Roadmap, source, test 또는 다른 `SKILL.md`를 추가로 읽거나 호출하지 않는다. PLAN만으로 독립 경계가 명확하지 않으면 유지한다. ## 절차 1. **범위를 고정한다** - 각 PLAN의 목적, write set, checklist, verification, encoded dependency만 정리한다. - CODE_REVIEW는 미착수 여부, Plan identity, checklist, 명령만 확인한다. - Active directory name으로 direct dependent를 찾고 실제 dependency가 바뀌는 미착수 pair만 대상에 추가한다. 2. **유지 또는 분리를 결정한다** - 의미 있는 독립 경계가 두 개면 2개, 세 개면 최대 3개로 한 단계만 분리한다. - 각 child는 단독 구현 가능한 결과와 겹치지 않는 write set을 가져야 한다. 공유 상태나 dependency가 더 복잡해지면 유지한다. - 원본 checklist와 verification을 담당 child에 빠짐없이 배분하되 실행하지 않는다. 3. **경로와 dependency를 확정한다** - 이름은 `NN_{subtask_name}` 또는 `NN+PP[,QQ...]_{subtask_name}`만 사용한다. 모든 predecessor는 `NN`보다 작고 같은 task group의 sibling이어야 한다. - 첫 child는 가능한 경우 원본 index와 기존 predecessor를 유지한다. 추가 child는 active/archive basename에 없는 다음 index를 사용한다. - 직렬 child에만 실제 predecessor를 comma-separated로 표시하고 병렬 child에는 dependency를 만들지 않는다. - 기존 direct dependent가 새 child를 의존해야 하는데 predecessor index가 그 dependent의 index 이상이면, 해당 미착수 dependent를 다음 collision-free index로 옮긴다. `02+01+03`처럼 더 큰 index를 참조하는 이름은 만들지 않는다. - 변경 대상 directory, PLAN header, review header와 `개요 > task`는 같은 최종 task path를 사용한다. Historical `*.log`의 header는 수정하지 않는다. - 원본에 `Roadmap Targets`가 있으면 모든 필수 child를 거친 closure child 하나에만 둔다. 그런 closure를 만들 수 없으면 분리하지 않는다. 4. **현재 Worker 형식으로 pair를 만든다** - Build/review lane과 G는 원본을 유지하고 재라우팅하지 않는다. - 현재 runtime-provided Plan model identity를 PLAN metadata와 review ledger에 동일하게 기록한다. Implementation/Review는 `pending`으로 둔다. - PLAN은 `구현 에이전트 규칙` 네 bullet, 짧은 `배경`, 실행에 필요한 `구현 범위`, checklist, 항목, 수정 파일, 검증만 둔다. 원본에 `Archive Evidence Snapshot`이 있으면 구현에 필요한 finding과 affected path만 담당 child에 보존한다. - 분석 파일 목록, routing 점수, 분할 과정, dependency 상태/경로와 전체 archive history를 Worker PLAN에 쓰지 않는다. - CODE_REVIEW는 `agent-ops/skills/common/plan/templates/review-stub-template.md`의 compact Worker 구조를 사용한다. Product behavior/scope/contract/verification checkpoint만 넣고 dependency, `complete.log`, archive, finalization, review 전용 checklist는 넣지 않는다. - PLAN과 CODE_REVIEW의 checklist 문구·순서와 검증 명령을 정확히 맞춘다. 5. **한 transaction으로 교체한다** - 모든 최종 pair를 먼저 메모리에서 완성한다. Task-group parent에 `STAGED_BATCH.md`를 쓰고, 각 영향받는 directory에는 `STAGED_PLAN.md`와 `STAGED_CODE_REVIEW.md`를 모두 쓴 뒤 교체를 시작한다. - Marker에는 task group, Plan identity, old-to-new directory mapping, 최종 pair basenames를 기록한다. 중단 시 이 mapping만 재개하고 scope/index를 다시 결정하지 않는다. - 교체되는 미착수 active pair는 기존 lane/G와 monotonic suffix로 archive한 뒤 directory를 필요한 최종 이름으로 옮긴다. 교체 pair의 `plan_number`는 그 archive 다음 suffix를 사용하고, 새 child는 기존 log가 없으면 `0`을 사용한다. 기존 log를 덮어쓰거나 수정하지 않는다. - 모든 staged pair의 header, identity, checklist, 명령을 검증한 뒤 최종 basename으로 promote한다. 모든 pair가 확인된 뒤에만 `STAGED_BATCH.md`를 제거한다. 6. **Readiness를 보고한다** - 각 최종 directory의 encoded predecessor만 확인한다. - 모두 충족되면 `implementation-ready`, 하나라도 미충족이면 `dependency-waiting`을 보고한다. - Worker 또는 Review를 시작하지 않는다. ## 출력 ```text Local plan refinement - targets: <원본 PLAN 경로> - decisions: <유지 | 원본 -> child 목록> - dependency updates: <변경 내용 또는 없음> - readiness: - document check: passed ``` ## 금지 - Inventory/validator script, compile, build, test, lint, formatter, smoke/E2E, live/remote 검증을 실행하지 않는다. - Source/test 재분석, verification 실행, package 설치, dependency 다운로드, cache warming을 하지 않는다. - `plan` 또는 `finalize-task-routing`으로 child를 재라우팅하지 않는다. - 관련 없는 active sibling 재인덱싱, repository 밖 staging, 전체 task group 복원을 하지 않는다. - Plan 밖 구현 범위를 추가하거나 child를 재귀 분리하지 않는다.