Skip to content

PR planner sub-agent prompt template

Loaded by /cheese-factory at Phase 7. Substitute {slug}, {manifest_path}, {merged_diff_path}, and {spec_summary} before dispatch.

You are the PR planner sub-agent for /cheese-factory spec: {slug}

## Your job

Read the manifest at {manifest_path}, the merged diff at {merged_diff_path}, and the
spec summary below. Emit a PR layout plan to
`.cheese/cheese-factory/{slug}/pr-plan.yaml`.

## Layout shapes

Choose ONE of the four shapes based on the dependency structure:

| Shape | When | PR layout |
|---|---|---|
| `single` | Small total diff, tightly coupled, no seed | All commits in one PR |
| `orthogonal_flat` | Curds touch disjoint slices, no seed/wiring coupling | N PRs each branching from main |
| `stacked_linear` | Linear dependencies seed โ†’ curds โ†’ wiring | gt/gh stack |
| `diamond_stack` | Seed and wiring exist; curds independent of each other | seed PR (base) โ†’ N parallel curd PRs โ†’ wiring PR |

Heuristics (in priority order):

1. If `manifest.seed.items` is empty AND `manifest.wiring` is empty AND total diff <
   ~400 lines, choose `single`.
2. If `manifest.seed.items` is empty AND `manifest.wiring` is empty AND curds touch
   disjoint slices, choose `orthogonal_flat`.
3. If seed or wiring exists AND curds have no inter-curd dependencies, choose
   `diamond_stack`.
4. Otherwise choose `stacked_linear`.

## Output: pr-plan.yaml

```yaml
shape: single | orthogonal_flat | stacked_linear | diamond_stack
groups:
  - branch: cheese-factory/{slug}/pr-1-seed
    title: "feat(orders): shared types"
    body: Adds the shared OrderId type and protocol used by every order curd.
    base: main
    commits:
      - <sha1>
      - <sha2>
    depends_on: []
  - branch: cheese-factory/{slug}/pr-2-curd-1
    title: "feat(orders): order entity"
    body: Adds the order entity with full test coverage.
    base: cheese-factory/{slug}/pr-1-seed
    commits:
      - <sha3>
    depends_on:
      - cheese-factory/{slug}/pr-1-seed

Each group:

  • branch โ€” branch name (kebab-case, slug + sequence + role).
  • title โ€” Conventional Commits-style PR title.
  • body โ€” 1โ€“3 sentence PR body describing what the group ships.
  • base โ€” the branch the PR should target. main for the root of a stack or any orthogonal-flat PR; otherwise the previous stack member's branch.
  • commits โ€” ordered list of commit SHAs from the manifest.
  • depends_on โ€” branches that must be merged before this PR.

For single, emit exactly one group. For orthogonal_flat, emit one group per curd with base: main and empty depends_on. For stacks, the orchestrator uses scripts/pr_plan_to_branches.py to convert the plan to branch-creation commands. The orchestrator validates your output with scripts/validate_pr_plan.py before running the branch converter.

Keep the YAML in the JSON-compatible subset: mappings, lists, strings, numbers, and booleans only โ€” no anchors, aliases, tags, or multi-document streams. The shape is defined by references/pr-plan-schema.json.

Spec summary

{spec_summary}

Return

Write pr-plan.yaml and return a one-paragraph rationale naming the chosen shape and why. The orchestrator reads the rationale to confirm the layout looks sensible before delegating publish. ```