Skip to content

feat(ai): add pipeline driver skill (plan/implement/review) - #16

Open
ci wants to merge 1 commit into
feat/autoreview-grok-enginefrom
feat/ai-pipeline-skill
Open

feat(ai): add pipeline driver skill (plan/implement/review)#16
ci wants to merge 1 commit into
feat/autoreview-grok-enginefrom
feat/ai-pipeline-skill

Conversation

@ci

@ci ci commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Problem

Multi-stage work (investigate/plan, implement, review-fix loop) has only been orchestrated by prompts ($pr-closeout, lfg-style skills), which do not hold gates and are tied to one harness. The goal is a deterministic driver that works the same whether the main agent is Claude Code, Codex, or Amp, runs each stage on a chosen headless engine, and returns control to the main agent between stages.

Changes

New pipeline skill (modules/ai/skills/pipeline, profile coding):

  • scripts/pipeline: stdlib-only driver with new, plan, implement, review, run [--until], status, summary, reject. Each stage is one fresh engine process (codex, claude, or grok) with a JSON schema; results steer control flow. Exit codes: 0 done, 1 error, 3 needs the main agent.
  • new validates flags and the autoreview helper before creating an isolated jj workspace or git worktree (or checks that --workspace belongs to the repo). Runs live under ~/.local/state/pipeline/<run> with task.md, plan.md/json, implement.json, review-N.json, fix-N.json, summary.md, prompts, and full engine logs.
  • Plan stage is read-only per engine (codex read-only sandbox; claude plan mode with read tools, no user MCP servers; grok --tools allowlist plus MCP meta-tool deny). Every write stage refuses to start on a dirty workspace. Implement/fix run with bypass inside the isolated checkout, as in $codex-first. Codex runs --ephemeral; grok sessions are preassigned and deleted afterwards.
  • Review stage wraps autoreview --reviewers ... (default codex,grok) on the frozen branch, then a fix round (fix(review): commits), re-review. --max-rounds (5) caps fix rounds, not reviews, so a rerun after the main agent's own fixes can still confirm clean. Implementer rejections carry their reason into the next review prompt; a finding surviving two fix rounds halts; pipeline reject records the main agent's own rejection. Round and survival counters persist only after a fix completes.
  • Halts (exit 3): plan open_questions; implement/fix question|blocked|scope_change; failing tests; done without a new commit; dirty workspace after a stage; incorrect verdict without findings; round cap. run resumes from the last completed stage and retries the halted one.
  • Defaults: plan claude:fable:high (fable = latest Fable alias, 5.1 today) in plan mode, implement codex:gpt-5.6-sol:high, review codex:gpt-5.6-sol:xhigh,grok:grok-4.6:xhigh; inside an Amp orb the review default is the same panel through amp (amp:openai/gpt-5.6-sol:xhigh,amp:xai/grok-4.6:xhigh).
  • summary templates summary.md from the artifacts with no LLM call.
  • Prompts in prompts/*.md; SKILL.md documents the contract; skill-overrides.json publishes it to the coding profile.

Tests

  • End-to-end on a toy git repo: plan (grok and claude engines) -> implement (codex) -> review panel clean; produced commits pass uvx pytest -q and the CLI works.
  • Fix loop with a stub reviewer: finding -> fix(review) commit -> clean; already-addressed finding -> rejected without commit -> clean.
  • Resume after a disk-full engine crash: run skipped the completed plan and retried implement.
  • Unit checks via import: single-pass template rendering, failed-test/no-commit/status halts, --until on completed stages, review-before-implement rejection, invalid engine leaves no workspace, workspace ownership for jj workspaces and git worktrees, sibling helper resolution through an installed symlink.
  • make test (darwin build) passes with the new skill directory.
  • autoreview --reviewers codex,grok on this change ran the full 5-round cap. Rounds 1-4 findings were all fixed. Round 5 reported 6 findings; 5 were fixed after the cap without a further review round (claude planner moved to plan mode without Bash allow-globs and with --strict-mcp-config; pre-stage dirty check for write stages; reviewer spec validated at new; fix-round and survival counters persisted only after a completed fix), and 1 was rejected: "resume a halted fix before accepting a later clean review" is the main agent's job after a failing-test halt, now stated in SKILL.md. The last review round therefore has not been re-run; see the PR discussion if you want another pass.

@ci

ci commented Sep 2, 2026

Copy link
Copy Markdown
Owner Author

This PR is part of a stack:

  1. feat/autoreview-grok-engine
  2. feat/ai-pipeline-skill <-- this PR
  3. feat/pipeline-verify-stage

Created with jjpr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant