task-pipeline
Orchestrate one project task end-to-end — resolve, implement, review, ship — delegating each phase to a context-isolated subagent over a shared worktree.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Orchestrate one project task end-to-end — resolve, implement, review, ship — delegating each phase to a context-isolated subagent over a shared worktree.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Prepare a guarded, ready-to-paste kickoff prompt for the next eligible phase of a phased project, verifying strict prerequisite closeout first and refusing blocked or ambiguous phase starts.
Safely determine whether a phased Hazma project can begin its next or a requested phase, then produce a guarded Codex kickoff prompt. Use when a user asks which phase is ready, asks to begin a phase, or needs a phase handoff; this skill does not implement the task.
Run Hazma's preflight gate, create or validate a Codex branch, commit intentionally with a valid Conventional Commit header, push, and open or update a pull request. Use when a user asks to commit, ship, or open a PR for current work.
Implement exactly one numbered task from a Hazma project plan, including task-note updates, numerical-impact measurement, documentation consistency, and the preflight gate. Use when a user asks to take a project task or the next project task; stop before committing unless the caller expressly owns the commit.
Orchestrate a bounded, multi-agent Codex review loop for a pushed Hazma pull request: select independent reviewer lenses, collect reviews in parallel, apply and push justified fixes, verify them, post durable round summaries, and stop at convergence, escalation, or the iteration cap.
Perform a read-only, findings-first review of a Hazma project PLAN before implementation, covering feasibility, numerical correctness, architecture, Python conventions, and testability. Use when a user asks whether a project plan is ready or asks to review projects/<slug>/PLAN.md.
| name | task-pipeline |
| description | Orchestrate one project task end-to-end — resolve, implement, review, ship — delegating each phase to a context-isolated subagent over a shared worktree. |
Role: Act as the lightweight orchestrator that drives one task from
implementation through review to a shipped PR, delegating each phase to a
fresh subagent with full context isolation. The orchestrator stays slim:
it reads structured ## Pipeline Report blocks, makes go/no-go
decisions, and points at the shared agent layer
(docs/agents/) rather than restating
its rules.
When to use this skill
/clear steps.When NOT to use this skill
projects/<slug>/PLAN.md (Phase A stalls without one). Route these to
a plain commit + PR via /commit-and-pr./review-cycle; reviewing a working-tree diff is
/code-review./review-plan.Required:
Task 5.2 phased, Task 3 flat), or the
literal string next. Phase A resolves it with
resolve_task.py.--project <slug> or parsed from the current
branch (both claude/ and codex/ prefixes; the slug is the first
segment after the prefix). If neither resolves, stop and ask.Optional:
false.false./review-cycle as advisory context
only. The full contract lives there.3).Every subagent prompt that operates inside the worktree (Phase B
implementer, Phase E finalizer, and the review subagents spawned by
/review-cycle) opens with the preamble below. Substitute <WT_PATH>
and <BRANCH> from Phase A.
Your working directory is
<WT_PATH>. Change to it immediately withcd <WT_PATH>before doing anything else. All file operations, git commands, and Python commands must run inside this directory.CRITICAL: Do NOT create your own worktree or call any worktree-creation tool. You are already in an isolated git worktree on branch
<BRANCH>, branched from the trunk. This worktree is managed by the pipeline orchestrator.Hazma ships Cython extensions. If your work touches
.pyx,.pxd, or_build.py, runpip install -e .inside this worktree before running tests, and confirmpython -c "import hazma; print(hazma.__file__)"resolves inside<WT_PATH>— otherwise every result you report comes from a different tree.
Resolve the project slug (precedence: explicit --project → branch
parse → error). Confirm projects/<slug>/PLAN.md exists and read its
frontmatter for phased: true|false. PLAN.md is not the source of
live task status — the Tasks tables under task-notes/ are.
Resolve the task before creating the worktree:
scripts/agents/resolve_task.py --project <slug> [--task <id>]
It reads the live Tasks status table (flat → task-notes/README.md;
phased → the current phase's task-notes/phase-XX/README.md), skips
_template.md, and prints JSON: {status, task_id, task_title, task_slug, phase, reason}. Omit --task for the lowest-numbered
non-Complete row. On status: done the project has no open task — stop
and report. On status: error fall back to reading the table by hand.
Record TASK_ID, TASK_TITLE, and TASK_SLUG.
scripts/agents/setup_task_worktree.sh \
--project <slug> --task-slug <TASK_SLUG> --agent claude
It fetches origin, resolves the trunk from origin/HEAD (falling back to
master), always branches from it (never ambient HEAD), picks a
collision-free name, and verifies HEAD before reporting success.
Branch policy (canonical). Project branches are
<agent>/<project-slug>/<task-slug>. This skill runs under Claude Code,
so it creates with --agent claude and a matching
.claude/worktrees/<slug>/<task-slug>/ base. Always parse both
prefixes (A.1); create with the running agent's.
The script prints one line of JSON:
{"branch":…,"wt_path":<absolute>,"head_sha":…}. Record BRANCH and the
absolute WT_PATH.
git -C "${WT_PATH}" rev-parse HEAD
git -C "${WT_PATH}" status --short
Confirm HEAD matches the trunk SHA the script reported and the worktree is clean.
Agent(
subagent_type: "general-purpose",
model: "opus",
description: "Pipeline — implement",
prompt: <implementation prompt below>
)
Implementation agent prompt: open with the Subagent preamble, then continue with:
You are the implementation engineer. Use the
/execute-single-taskskill exactly as written, with these pipeline-specific overrides:
- Skip Step 3 (entering a worktree) — already done.
- Project slug:
<project-slug>.- Task:
<TASK_ID>—<TASK_TITLE>.- Execute every other step.
/execute-single-taskcarries the full gate itself — the numerical-impact measurement, the durable-doc sweep, test-validity preflight, canonical-contract diff, Step 9 self-review, thescripts/agents/preflight.shgate, and the project-closure version bump are all defined there. Do not re-implement or second-guess them here.- Commit and push. Stage only files you intentionally changed (never
git add -Ablindly; never commit build output). Immediately before committing, run the preflight gate and the branch/worktree assertion fromdocs/agents/preflight.md(git rev-parse --abbrev-ref HEADis<BRANCH>, nevermaster; cwd is<WT_PATH>). Write a Conventional Commits message — validate the header withscripts/agents/check_pr_title.py "<header>"before committing. Thengit push -u origin HEAD.- Record the exact commit SHA via
git rev-parse HEADafter push; report it asCOMMIT_SHA.Output format — you MUST end your response with this exact section:
## Pipeline Report STATUS: <COMPLETE | BLOCKED> PROJECT: <project slug> TASK_ID: <e.g. Task 5.2 or Task 3> TASK_TITLE: <short title> TASK_NOTE_PATH: <projects/<slug>/task-notes/... path> BRANCH: <branch name> COMMIT_SHA: <output of git rev-parse HEAD after push> FILES_CHANGED: <comma-separated list of changed files> SUMMARY: <one-paragraph summary of what was implemented> NUMERICAL_IMPACT: <none (verified: <command>) | <function>: <magnitude>> BLOCKER: <description if BLOCKED, "none" if COMPLETE> PLAN_IMPACT: <None | Task note only | Phase file patched | ADR-XXXX | Project closure>
Parse only the ## Pipeline Report. Do not read the full narrative —
the orchestrator stays slim.
STATUS == BLOCKED: stop the pipeline. Report the blocker. The
worktree remains for inspection.Pipeline Report missing: treat as failed. Report the raw output
(first and last ~60 lines).Do not trust the self-reported SHA:
git -C "${WT_PATH}" fetch origin "${BRANCH}"
git -C "${WT_PATH}" rev-parse "origin/${BRANCH}"
The origin/<BRANCH> HEAD must equal COMMIT_SHA. If the branch is
absent from origin, or the SHAs disagree, report failure and stop.
If both skip-review and skip-pr are true, skip to Phase F.
The orchestrator opens the draft PR inline. The draft lets Phase D
reviewers use native PR tooling (gh pr view, gh pr diff).
Safe placeholder title (scope pipe):
DRAFT_TITLE="chore(pipe): pipeline draft <TASK_SLUG>"
Shorten the slug if the header would exceed 69 characters (validate with
scripts/agents/check_pr_title.py "${DRAFT_TITLE}"). Phase E rewrites
the title with a real scope before marking the PR ready.
Write a temporary body file inside the worktree:
## Task
<TASK_ID>: <TASK_TITLE>
Task note: `<TASK_NOTE_PATH>`
## Summary
- Draft — pipeline in progress. Title and body finalized after review.
Open the draft and capture its number:
cd "${WT_PATH}" && \
gh pr create --draft --base master --head "${BRANCH}" \
--title "${DRAFT_TITLE}" --body-file pr_draft_body.md && \
rm pr_draft_body.md
PR_NUMBER="$(gh pr view --json number --jq .number)"
Record PR_NUMBER. If skip-review is true, skip to Phase E.
/review-cycle)/review-cycle is the single review-loop implementation. The
orchestrator runs its workflow itself — it does not spawn a level-2
orchestration subagent — passing the shared worktree so fixes land in
WT_PATH. Reviewer, review-respond, and verification subagents are
spawned by /review-cycle's own phases; that keeps subagent nesting at
one level.
Run the /review-cycle workflow with
PR_NUMBER, WT_PATH, BRANCH, external-reviews, and
max-review-iterations.
/review-cycle owns reviewer selection (per
review-lenses.md), the
per-round PR comment, the commit-and-push of review fixes, the
verification rounds, and the convergence shortcut. Do not restate the
roster here.
From /review-cycle's final summary, capture: STATUS
(CONVERGED | NOT_CONVERGED | ESCALATE), ITERATIONS_USED,
UNRESOLVED, NUMERICAL_IMPACT, FINAL_COMMIT_SHA (already verified
against origin; falls back to Phase B COMMIT_SHA when the all-APPROVE
shortcut fired), and REVIEW_SUMMARY.
Route on STATUS:
CONVERGED → Phase E.NOT_CONVERGED → Phase E, but Phase E leaves the PR a draft and lists
the unresolved items in the body.ESCALATE → stop the pipeline. Report the stuck items. The worktree
and draft PR remain for manual resolution.If skip-pr is true, skip to Phase F.
Agent(
subagent_type: "general-purpose",
model: "sonnet",
description: "Pipeline — finalize PR",
prompt: <finalization prompt below>
)
PR finalization agent prompt: open with the Subagent preamble, then continue with:
You are finalizing draft PR #
<PR_NUMBER>. Do NOT use/commit-and-pr— the PR already exists and the code is already committed.Context:
- Project:
<project-slug>— Task<TASK_ID>:<TASK_TITLE>.- Branch:
<BRANCH>; task note:<TASK_NOTE_PATH>.- Implementation summary:
<SUMMARY from Phase B>.- Numerical impact:
<NUMERICAL_IMPACT>.- Review:
<CONVERGED | NOT_CONVERGED | skipped>; unresolved:<UNRESOLVED or "none">; summary:<REVIEW_SUMMARY or "skipped">.- Plan impact:
<PLAN_IMPACT from Phase B>.Steps:
- Read
docs/PR_GUIDELINES.mdand the task note.- Run
git diff --stat origin/master...<BRANCH>and reconcile the Summary bullets you write against it.- Compose a Conventional Commits title (
type(scope): subject) using the guidelines' scope table. Do NOT include task IDs. Validate before setting it:scripts/agents/check_pr_title.py "<title>". Rewrite until it passes; do not hand-count.- Compose the body to
pr_body.md:If## Summary - <bullets from implementation and review outcomes> ## Project `projects/<project-slug>/` — <TASK_ID>: <TASK_TITLE>. See `<TASK_NOTE_PATH>` for detail, decisions, and verification. ## Numerical impact <NUMERICAL_IMPACT — name the functions and the magnitude, or state "no public code path touched". Never omit this section.> ## Review - Internal review: <converged in N rounds | not converged — N unresolved items | skipped> - <list unresolved items if any> ## Test plan - <verification commands + real output, or cite the task note's ## Verification section — do not invent green results><PLAN_IMPACT>isProject closure, insert a## Versioningsection between## Projectand## Numerical impact. Read the new version fromhazma/__init__.py; the prior is ingit show origin/master:hazma/__init__.py:## Versioning Closing project — version bumps `<OLD>` → `<NEW>` (`<patch | minor | major>` per `PLAN.md` `version_bump:`). New `CHANGELOG.md` entry under `## [<NEW>]`. See `docs/versioning.md`.- Update the PR:
gh pr edit <PR_NUMBER> --title "<title>" --body-file pr_body.md, thenrm pr_body.md.- If review is
CONVERGED(or skipped):gh pr ready <PR_NUMBER>, then watch CI to a bounded conclusion:gh pr checks <PR_NUMBER> --watch --fail-fast. Report the outcome; fixing a CI failure is out of scope — surface it, do not loop on it. If review isNOT_CONVERGED, leave the PR a draft and ensure the body's## Reviewsection lists the unresolved items.Output format — you MUST end your response with this exact section:
## Pipeline Report STATUS: <PR_READY | PR_DRAFT | PR_FAILED> PR_URL: <URL or "none"> PR_TITLE: <the title used> CI_STATUS: <passing | failing | pending | not-watched> ERROR: <description if PR_FAILED, "none" otherwise>
Parse the report: PR_READY → record URL and CI_STATUS (report a
failing CI to the user; the pipeline does not fix CI). PR_DRAFT →
record the URL and the unresolved items. PR_FAILED → report the error;
the worktree and draft PR remain for manual recovery.
Before Phase F, verify gh pr view <PR_NUMBER> --json headRefOid equals
FINAL_COMMIT_SHA.
Report the final pipeline state. Do not clean up the worktree or branch — the user decides when to delete them.
## Pipeline Summary
**Project:** <project-slug>
**Task:** <TASK_ID> — <TASK_TITLE>
**Branch:** <BRANCH>
**Worktree:** <WT_PATH>
### Implementation
- Status: <COMPLETE | BLOCKED>
- Commit: <COMMIT_SHA>
- Files changed: <FILES_CHANGED>
- Summary: <SUMMARY>
### Numerical impact
<NUMERICAL_IMPACT>
### Review
- Status: <CONVERGED | NOT_CONVERGED | ESCALATE | skipped>
- Iterations: <ITERATIONS_USED>
- Unresolved: <UNRESOLVED or "none">
- Final commit: <FINAL_COMMIT_SHA>
### PR
- Status: <PR_READY | PR_DRAFT | PR_FAILED | skipped>
- URL: <PR_URL>
- Title: <PR_TITLE>
- CI: <CI_STATUS>
### Plan Impact
<PLAN_IMPACT from Phase B; note if a phase file or PLAN frontmatter was
flipped to Complete, or a project moved from Active to Completed in
projects/README.md.>
### Versioning (only when PLAN_IMPACT is `Project closure`)
- Package version: <OLD> → <NEW> (<patch | minor | major>)
- CHANGELOG entry: `## [<NEW>]` added to `CHANGELOG.md`
## Pipeline Report sections and make go/no-go decisions. Phase D runs
the /review-cycle workflow, which does its own reading. The
orchestrator never reads source code or implements fixes.master. The pipeline always branches in Phase A
and every write uses git -C <worktree>. The branch/worktree assertion
runs immediately before every commit. Note the trunk is master, not
main — an assertion written against main protects nothing here.COMMIT_SHA against
origin/<BRANCH>; Phase E verifies the final HEAD against
FINAL_COMMIT_SHA.cd into WT_PATH
and not call any worktree-creation tool./review-cycle workflow. No subagent
may spawn another orchestration skill.NUMERICAL_IMPACT missing or hand-waved is a failed
phase — the whole point of the pipeline in a physics library is that no
number moves silently.gh pr view /
gh pr diff./review-cycle, every round
— including rounds that loop, hit the cap, or escalate. The PR timeline
is the durable record./commit-and-pr for finalization. That skill assumes
uncommitted changes and a non-existent PR; Phase E uses gh pr edit.WT_PATH and the branch in place. When a run ends BLOCKED / ESCALATE /
PR_FAILED and the user is done inspecting, reclaim the stale worktree
with git worktree remove <WT_PATH> (and delete the unused branch)
before re-running, so collision suffixes do not pile up./execute-single-task handles the frontmatter flips, learnings
synthesis, the projects/README.md move, and the version bump +
CHANGELOG entry. Phase E only surfaces it in the PR body.resolve_task.py skips
_template.md; never pass one to a subagent as a task target.