feat(codex): Phase 1 mcp slice — codex plan-review prompt + runtime-aware selection #43

Merged
janpeter merged 10 commits from feat/codex-plan-review-phase1 into main 2026-06-09 07:20:25 +02:00
Owner

What

The mcp slice of Phase 1 — Codex as a fleet worker for IDEA_REVIEW_PLAN plan-review. Library capability only; the runner wiring (scrum4me-docker) and the UI (scrum4me-workers) land in follow-up PRs per the dual-GO design.

  • src/prompts/idea/review-plan.codex.md — codex-portable, autonomous IDEA_REVIEW_PLAN prompt: 3-round active rewrite (persists via update_idea_plan_md({ idea_id, markdown })), self-determined verdict (no ask_user_question), review_log.approval.status synced to approval_status, and a plan-write failure blocks approved.
  • src/lib/kind-prompts.ts — runtime-aware getKindPromptText(kind, runtime = 'CLAUDE') + getIdeaPromptText(kind, runtime = 'CLAUDE'); compound cache key ${runtime}:${kind}; (CODEX, IDEA_REVIEW_PLAN) -> review-plan.codex.md; every other (kind, runtime) is byte-identical to before (default CLAUDE).
  • scripts/seed-idea-review-codex-canary.ts — seeds an IDEA_REVIEW_PLAN / CODEX / QUEUED canary against a throwaway PLAN_READY idea with a rich, deliberately-improvable plan_md + grill_md.
  • docs: the dual-GO design spec + the codex-GO implementation plan.

Authoritative prompt source (note for reviewers)

payload.prompt_text (src/tools/wait-for-job.ts:957, via getIdeaPromptText) is intentionally not runtime-threaded in this PR. Per the design (codex plan-review P1-2), the docker runner is the authoritative prompt source: run-one-job.ts:364 calls getKindPromptText(ctx.kind, runtime) (runtime from getWorkerRuntimeFromEnv()) and passes it to buildCodexArgs. The payload field is redundant/informational, threading it is optional (and would also require adding runtime to the getFullJobContext select). The codex prompt reaches codex via the runner, which lands in the separate scrum4me-docker PR (plan Task 5).

Review & verification

  • Design: dual-GO — scrum4me-server:claude (operational) + mac:codex (source, round-2). Plan: mac:codex round-2 GO ("executable as written").
  • Internal: spec-compliance review clean (byte-for-byte, no scope creep); code-quality review — its single "Critical" was a cross-repo architecture misunderstanding (the runner, not the payload, is authoritative; see above).
  • npx vitest run -> 85 files / 682 tests green; npx tsc --noEmit -> clean.

🤖 Generated with Claude Code

## What The **mcp slice** of Phase 1 — Codex as a fleet worker for `IDEA_REVIEW_PLAN` plan-review. Library capability only; the runner wiring (scrum4me-docker) and the UI (scrum4me-workers) land in follow-up PRs per the dual-GO design. - `src/prompts/idea/review-plan.codex.md` — codex-portable, **autonomous** IDEA_REVIEW_PLAN prompt: 3-round active rewrite (persists via `update_idea_plan_md({ idea_id, markdown })`), self-determined verdict (no `ask_user_question`), `review_log.approval.status` synced to `approval_status`, and a plan-write failure blocks `approved`. - `src/lib/kind-prompts.ts` — runtime-aware `getKindPromptText(kind, runtime = 'CLAUDE')` + `getIdeaPromptText(kind, runtime = 'CLAUDE')`; compound cache key `${runtime}:${kind}`; `(CODEX, IDEA_REVIEW_PLAN) -> review-plan.codex.md`; every other `(kind, runtime)` is byte-identical to before (default `CLAUDE`). - `scripts/seed-idea-review-codex-canary.ts` — seeds an `IDEA_REVIEW_PLAN` / `CODEX` / `QUEUED` canary against a throwaway `PLAN_READY` idea with a rich, deliberately-improvable `plan_md` + `grill_md`. - docs: the dual-GO design spec + the codex-GO implementation plan. ## Authoritative prompt source (note for reviewers) `payload.prompt_text` (`src/tools/wait-for-job.ts:957`, via `getIdeaPromptText`) is intentionally **not** runtime-threaded in this PR. Per the design (codex plan-review P1-2), the **docker runner is the authoritative prompt source**: `run-one-job.ts:364` calls `getKindPromptText(ctx.kind, runtime)` (runtime from `getWorkerRuntimeFromEnv()`) and passes it to `buildCodexArgs`. The payload field is redundant/informational, threading it is optional (and would also require adding `runtime` to the `getFullJobContext` select). The codex prompt reaches codex via the runner, which lands in the separate scrum4me-docker PR (plan Task 5). ## Review & verification - Design: dual-GO — scrum4me-server:claude (operational) + mac:codex (source, round-2). Plan: mac:codex round-2 GO ("executable as written"). - Internal: spec-compliance review clean (byte-for-byte, no scope creep); code-quality review — its single "Critical" was a cross-repo architecture misunderstanding (the runner, not the payload, is authoritative; see above). - `npx vitest run` -> **85 files / 682 tests green**; `npx tsc --noEmit` -> clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Approved brainstorm design for routing IDEA_REVIEW_PLAN to a codex fleet
worker as an autonomous active-improver (3-round rewrite, no ask_user_question
gate), reusing update_idea_plan_reviewed. Full+UI scope; no schema / migration /
shared change; Claude's plan-review untouched. Depends on Phase 0 substrate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Phase 0 confirmed merged/live on scrum4me-docker master (ee8c647): multi-stage
  Dockerfile + agent-codex service + runtime branch. §1 prerequisite SATISFIED.
- rich seed plan_md (P2-2), claimer-tier note (P2-1), no-op rescale (P3-1),
  UI-gate env (P3-2), build-without-target (P3-3), parameterized claim-filter (P3-4),
  product_id canary recommendation; added review-log section.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
P1-1 workers snapshot overrides requested_model (not a fake model_id);
P1-2 close runner-vs-payload P1: docker runner getKindPromptText is authoritative
     (run-one-job.ts:364) -> getKindPromptText(ctx.kind, runtime);
P2-3 require review_log.approval.status to mirror top-level approval_status;
P2-4 update_idea_plan_md failure must block 'approved' (no false-positive);
P3-5 refresh source anchors (wait-for-job.ts:895-968, run-one-job.ts:364).
All five verified against source before applying.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- §10 risk row: prompt-source RESOLVED (run-one-job.ts:364 authoritative)
- §4 workers: correct model_id usage-write anchor (update-job-status.ts:853-855)
- review-log: codex round-2 GO recorded

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
8 tasks, bite-sized TDD: mcp codex-portable prompt + runtime-aware getKindPromptText
(TDD) + rich seed; docker runtime passthrough (runner authoritative); workers
requested_model override (TDD) + template allowedRuntimes; gated host canary.
Derived from the dual-GO spec (2026-06-08-codex-plan-review-phase1-design.md).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
P1-1 codex prompt calls update_idea_plan_md({ markdown }) not plan_md (schema);
P1-2 Task 6 RED test mock gets launch_preview_json.context.ideaId (idea-binding);
P1-3 run-one-job passes capabilities to registerWorker+startHeartbeat so the workers
     UI gate (capabilities has 'review') counts the codex worker, else review enqueue
     is blocked despite claimable agents;
P2-4 force a canary host via pausing max2 / a semantic tag, not required_capability=LOW_P;
P3-5 tsx-load smoke marked explicitly non-binding.
All verified against source. Spec §4/§8/§14 updated to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(IDEA_REVIEW_PLAN, CODEX) -> review-plan.codex.md; all other (kind, runtime)
combinations unchanged; runtime defaults to CLAUDE so existing call-sites are
byte-identical.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
janpeter/scrum4me-mcp!43
No description provided.