Canonical orchestrator for /lp:spec, /lp:plan, /lp:implement, /lp:review-implement, /lp:cook, and /lp:debug-investigator using worker skills plus the SQLite state manager.
Orchestrator canonical duy nhất cho namespace /lp:*.
Skill này là source of truth cho:
/lp:spec <requirement>/lp:plan <requirement>/lp:implement <plan | plan_name | workflow_id>/lp:review-implement <plan | plan_name | workflow_id>/lp:cook <requirement>/lp:debug-investigator <symptom>Wrapper skills và wrapper commands khác chỉ được phép trỏ về file này.
Skill này chỉ áp đặt orchestration model cho namespace /lp:* và các wrapper/worker liên quan của LP. Nó không tự động áp đặt execution model đó cho các task ngoài LP hoặc các yêu cầu thông thường trong main conversation.
.codex/create-plancreate-specreview-specreview-planimplement-planreview-implementqa-automationdebug-investigator.codex/
plans/
PLAN_<NAME>/
plan.md
phase-01-*.md
phase-02-*.md
manifests/
ownership.json
dependency-graph.json
benchmark.json
pipeline/
PLAN_<NAME>/
00-create-spec.output.md
00-create-spec.output.contract.json
00-review-spec.output.md
00-review-spec.output.contract.json
01-create-plan.output.md
01-create-plan.output.contract.json
02-review-plan.output.md
02-review-plan.output.contract.json
03-implement-plan.output.md
03-implement-plan.output.contract.json
04-review-implement.output.md
04-review-implement.output.contract.json
05-qa-automation.output.md
05-qa-automation.output.contract.json
.codex/active-plan được phép tồn tại như pointer, nhưng phải trỏ về .codex/plans/PLAN_<NAME>/.
Dùng cho task thường:
Chỉ bật khi task đủ lớn hoặc user yêu cầu parallel. Ngoài standard plan, bắt buộc có:
plan = logical work package + canonical plan artifact package dưới .codex/plans/PLAN_<NAME>/primary run = phiên điều phối chính duy nhất của một plan tại một thời điểmchild job = đơn vị worker/subagent được primary run spawn để xử lý phase/task conreviewer conversation = conversation chỉ đọc/review/phối hợp, không có quyền writer mặc địnhevent log = lớp audit/rebuild để reconcile khi DB state lệch với artifact realityplan.md + phase files.codex/active-planNếu DB state và published artifact mâu thuẫn nhau, published artifact + reconcile result thắng DB snapshot cũ.
WAITING_USER không giữ exclusive execution lease.PASS nếu chưa có published artifact/contract hợp lệ.lp-plan, lp-implement, lp-cook là thin wrappersHiện runtime enforce chủ yếu các transition/gate checks (plan_approved, follow-up prerequisites, workflow status).
Ownership/dependency/scope policies vẫn là canonical expectations ở layer docs/contracts, nhưng chưa được enforce đầy đủ trong script runtime hiện tại. Nếu worker report blocker hoặc cần user input, workflow phải dừng đúng gate.
/lp:implement chỉ hoàn tất khi:
implement-plan = PASSreview-implement = PASSqa-automation = PASSscope_violationimplement-plan khi implement-plan/review-implement/qa-automation trả fail cần sửa.3 vòng sửa.WAITING_USER khi gặp một trong các điều kiện:
/lp:specplan_namestart-speccreate-specsync-output từ 00-create-spec.output.contract.jsonreview-specsync-output từ 00-review-spec.output.contract.jsonspec_approved = true/lp:plan/lp:planplan_namestart-plancreate-spec -> review-spec trướcspec và create-spec = PASS + review-spec = PASS, orchestrator promote cùng workflow sang lane plan (không tạo workflow mới)create-plansync-output từ 01-create-plan.output.contract.jsonreview-plansync-output từ 02-review-plan.output.contract.jsonplan_approved = true/lp:implement/lp:implementworkflow_id, plan_name, hoặc plan_fileplan_approved = truestart-implementimplement-plan03-implement-plan.output.contract.jsonreview-implement04-review-implement.output.contract.jsonqa-automation05-qa-automation.output.contract.jsonimplement-plan/review-implement/qa-automation fail và chưa chạm điều kiện dừng, quay lại implement-planWAITING_USER/lp:cookstart-cookcreate-spec -> review-spec trước để chốt requirement + UX flow + happy/edge casesplan_approved = true mới vào delivery loop/lp:debug-investigatorstart-debugdebug-investigator/lp:plan <fix-scope>Chỉ auto proceed khi đồng thời đúng tất cả điều kiện:
resolve-next trả can_proceed = trueWAITING_USER / BLOCKED / FAILED
AskUserQuestionpolicy: Pipeline tự chạy tiếp theo default. Chỉ dùngAskUserQuestiontại decision gate (ambiguity / blocker / scope change / confirm rủi ro cao). Không pop question sau mọi bước. → Chi tiết:AGENTS.md (section 6: Decision Gate Policy)
--repo-root -> git root từ cwd hiện tại -> fail rõ ràng nếu không suy ra được<repo-root>/.codex/state/pipeline_state.db.codex/state/ và .codex/pipeline/ là shared resources nên cần tránh reuse cùng plan_name.codex/ riêngGlobal-scope deployment note (khi skill ở
~/.agents/skills/): Tất cả.codex/paths trong skill này luôn resolve về project root của project hiện tại, KHÔNG phải~/.codex/toàn cục. Scripts dùnggit rev-parse --show-topleveltừ CWD của agent để xác định đúng project root. Nếu git root không resolve được,lp_pipeline.pysẽ fail fast với lỗi rõ ràng thay vì fallback sang path depth mơ hồ. Luôn chạy LP pipeline từ trong project directory để đảm bảo path resolution đúng.
create-spec, review-spec, create-plan, review-plan, implement-plan, review-implement, qa-automation, debug-investigator) bắt buộc dùng agents; parent agent là orchestrator, không tự thay worker step khi flow canonical yêu cầu agent worker.run_in_background=true cho top-level LP agents vì orchestrator cần result ngay để sync contract, set gate, và quyết định step kế tiếp.review-plan và review-implement, canonical execution model là spawn 4 agents độc lập theo 4 persona bắt buộc, chạy song song trong current workspace, sau đó orchestrator mới validate evidence, normalize conflicts, và tổng hợp verdict cuối; không được bỏ qua persona nào trong flow chuẩn.use agents, but no worktree by default, không phải avoid agents.Flow ngắn:
Orchestrator (parent agent)
→ spawn top-level worker agent
→ run foreground in current workspace
→ publish output + contract
→ sync state
→ decide next step
Anti-misread:
review-plan là worker-only skill; nó chỉ trả structured findings/contract cho orchestrator gate, không tự orchestration sang step tiếp theo.review-implement là worker-only skill; nó chỉ trả structured findings/contract cho orchestrator gate, không tự orchestration sang step tiếp theo.Mỗi worker step phải ghi 2 files:
NN-step.output.mdNN-step.output.contract.jsonState sync ưu tiên JSON contract.
~/.agents/skills/lp-state-manager/SKILL.md (global skill) hoặc local mirror khi đang dev skill~/.agents/skills/lp-pipeline-orchestrator/scripts/lp_pipeline.py (global skill) hoặc local mirror khi đang dev skillskill lp-pipeline-orchestrator (command index)AGENTS.md (section 6: Decision Gate Policy) — khi nào dùng AskUserQuestion và khi nào không