Pickle Refine Prd
Refine and decompose PRD into atomic tickets using parallel Morty analysis team.
Refine and decompose PRD into atomic tickets using parallel Morty analysis team.
> **Backend:** Always claude. Refinement is planning, not implementation; codex is never used here even if the parent session has `--backend codex`.
Persona via CLAUDE.md. Proceed to Step 0.
## Tool Discipline (read once, apply throughout)
This skill is **file-based, not harness-task-based**. The authoritative task list lives in `${SESSION_ROOT}/*/linear_ticket_*.md` and the `## Implementation Task Breakdown` table in `prd_refined.md`. Downstream consumers (`mux-runner.js`, `/pickle-tmux`) read those files, not the harness task list.
**Do NOT use TaskCreate / TaskUpdate / TaskList / TodoWrite during this skill.** The harness will inject "consider using TaskCreate" reminders during long loops (Step 4b parallel waits, Step 7c per-ticket loop, Step 7e hardening loop). Those reminders are turn-based nags, not project requirements — ignore them and continue the file-based work.
If stale harness tasks exist at handoff (Step 7g), mark them `deleted` before advancing state — orphan tasks pollute downstream `/pickle-tmux --teams` mode.
## Step 0: Parse Flags
`$ARGUMENTS`: `--run` → AUTO_RUN. `--meeseeks` → CHAIN_MEESEEKS (implies --run). `--resume [PATH]` → RESUME_MODE (reuse existing session). Remainder = `${TASK_ARGS}`.
If `--resume` has a path argument → `RESUME_SESSION = <path>`. If `--resume` with no path → resolve via `node "$HOME/.claude/pickle-rick/extension/bin/get-session.js"` → `RESUME_SESSION`.
## Step 1: Locate PRD
**If RESUME_MODE**: PRD is at `${RESUME_SESSION}/prd.md`. If missing → "Session has no prd.md. Run `/pickle-prd` first." Stop. Set `SESSION_ROOT = ${RESUME_SESSION}`.
**If NOT RESUME_MODE**: Priority: 1) explicit path in `${TASK_ARGS}`, 2) `prd.md`/`PRD.md` in cwd, 3) `node "$HOME/.claude/pickle-rick/extension/bin/get-session.js"` → session's `prd.md`.
Not found → "Run `/pickle-prd` first or pass path." Stop.
## Step 1b: Org Context
If `context/` exists in cwd or repo root, read it. Carry into Steps 5-7 to ground refinement in real customer signals. No `context/` → skip.
## Step 2: Verification Readiness Check
Read PRD. Gate on verification quality before spending tokens on refinement.
### 2a: Section Scan
Check for (exact or equivalent headings):
- Interface Contracts / API Contracts / type definitions
- Verification Strategy / Acceptance Criteria with commands
- Test Expectations / test descriptions per requirement
- Functional Requirements with Verification column
Score: FULL (all present, substantive) / PARTIAL (some present or thin) / MISSING.
### 2b: Quality Scan
- **Contracts**: Exact shapes (fields+types) = PASS. Prose ("accepts loan data") = NEEDS_WORK.
- **Verification**: Runnable commands = PASS. Aspirational ("should be tested") = NEEDS_WORK.
- **Tests**: Specific files/assertions = PASS. Vague ("needs tests") = NEEDS_WORK.
- **Requirements**: Machine-checkable criteria = PASS. Subjective ("good UX") = NEEDS_WORK.
### 2c: Gate
**FULL + PASS** → "PRD verification-ready." Continue to Step 3.
**PARTIAL/NEEDS_WORK** → Pause, print gaps, interview:
1. Missing contracts: "What data crosses boundaries? Exact shapes — fields and types."
2. Missing verification: "How to verify each requirement automatically? Commands or assertions."
3. Missing tests: "What test files should exist? Scenarios and assertions."
4. Subjective reqs: Quote each, ask for machine-checkable rewrite.
Iterate until PASS. Update PRD in place. Continue to Step 3.
**MISSING + AUTO_RUN** → "Cannot auto-run on under-specified PRD." Set AUTO_RUN=false, interview.
## Step 3: Initialize Session
Extension root: `$HOME/.claude/pickle-rick` (`${EXTENSION_ROOT}`).
**If RESUME_MODE**: `SESSION_ROOT` is already set from Step 1. `<PRD_PATH> = ${SESSION_ROOT}/prd.md`. Skip session creation — reuse existing session directory and state.
**If NOT RESUME_MODE**:
```bash
node "$HOME/.claude/pickle-rick/extension/bin/setup.js" --paused --task "PRD Refinement: ${TASK_ARGS}"
Extract SESSION_ROOT. Save original path as <PRD_PATH>. cp "<PRD_PATH>" "${SESSION_ROOT}/prd.md".
Step 4: Deploy Refinement Team
4-route: Kill-switch (PICKLE_REFINE_WORKFLOW)
Read PICKLE_REFINE_WORKFLOW from the environment to pick the refinement engine:
off, empty, or unset → legacy subprocess path (Steps 4a–4c below, unchanged). This is the default until the R-DWF-3 soak passes — production refinements stay on the proven path.on/1/workflow→ Dynamic Workflow path (Step 4-WF below). Opt-in for the workflow-backed analyst fan-out.
The workflow path requires Dynamic Workflows enabled in the runtime (
/config). If workflows are unavailable, fall back to the legacy path regardless of the flag.
4-WF: Launch the analyst-fan-out workflow (workflow path only)
Launch the Dynamic Workflow at .claude/workflows/refine-analyze.js via the Workflow tool with:
args = {
prdPath: "${SESSION_ROOT}/prd.md", // absolute
sessionDir: "${SESSION_ROOT}", // absolute
workingDir: "<repo working dir>", // absolute
refinementDir: "${SESSION_ROOT}/refinement",
cycles: 3, // or --cycles override
maxTurns: 100 // or --max-turns override
}
The workflow runs the 3-role × N-cycle analyst fan-out (cross-cycle context flows through script
variables — no analysis_*.md disk round-trip) and a synthesis agent that writes prd_refined.md
and refinement_manifest.json to ${SESSION_ROOT} and returns:
{ sessionDir, refinementDir, manifestPath, manifest, analyses, allSuccess }
Consume the returned manifest / manifestPath directly in place of the legacy MANIFEST= /
REFINEMENT_DIR= stdout parse. Then skip Steps 4a–4c and go to Step 5 (the manifest and
prd_refined.md already exist on disk — Step 6's synthesis was done by the workflow's synthesis
agent on this path).
4a: Mon
Maintain Pickle Refine Prd?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Pickle Refine Prd on getagentictools](https://getagentictools.com/loops/gregorydickson-description?ref=badge)