proposal-refiner
Skill1 starsChanged 7 months agoMITView on GitHub
Use when the architect-team / bug-fix / ux-test pipeline receives free-text prose (not a directory of OpenSpec / Superpowers artifacts), OR when /architect-team:refine-prompt is invoked standalone. Conversationally refines the prompt with codebase-map grounding and multi-axis clarity grading (clarity / scope / acceptance / grounding / conflict / scope-fidelity), iterating with the user until satisfied, then outputs a structured refined-prompt markdown the downstream pipeline consumes. A domain gate, not a process gate — the user-confirmation step IS the deliverable; --no-refine bypasses it. The body documents the R1-R6 phases, the six grading axes, standalone-vs-pipeline mode, and the scope-fidelity domain gate per `common-pipeline-conventions` `## Scope discipline`.
In this repository60 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-exploreSkill
- openspec-proposeSkill
- api-design-from-frontendSkill
- architect-team-pipelineSkill
- bug-fix-pipelineSkill
- cartographer-teamSkill
- claude-design-importSkill
- claude-md-efficiencySkill
- closeoutSkill
- common-pipeline-conventionsSkill
- contract-first-parallelismSkill
- coverage-mappingSkill
- data-annotationsSkill
- data-dictionarySkill
- data-engineering-explorationSkill
- data-eng-pipelineSkill
- data-lineage-mappingSkill
- delivery-manifestSkill
- design-fidelity-mappingSkill
- dev-api-integration-testingSkill
- diagnostic-research-teamSkill
- documentation-currencySkill
- domain-research-teamSkill
- dynamic-value-discoverySkill
- editability-completenessSkill
- email-testingSkill
- endpoint-trace-mappingSkill
- expensive-verification-debuggingSkill
- frontend-route-mappingSkill
- helpdeskSkill
- intake-and-mappingSkill
- interaction-completenessSkill
- interaction-intuitionSkill
- interactive-mockup-discoverySkill
- intuition-map-lifecycleSkill
- mcp-output-contract-designSkill
- mempalace-integrationSkill
- mini-architect-team-pipelineSkill
- phenotype-absorptionSkill
- phenotypesSkill
- playwright-suite-builderSkill
- playwright-user-flowsSkill
- readme-stylingSkill
- reuse-first-designSkill
- root-cause-test-failuresSkill
- structure-optimizationSkill
- team-spawning-and-review-gatesSkill
- test-prod-safety-classifierSkill
- test-run-monitorSkill
- token-compressionSkill
- ux-test-builderSkill
- verification-planningSkill
- verified-agent-outputSkill
- visual-fidelity-reconciliationSkill
- visual-to-api-designSkill
- visual-verification-teamSkill
- warehouse-sql-miningSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 32
Read <cwd>/codebases.json or <cwd>/.architect-team/intake-state.json's prior codebase list if present.
- Very specific: line 122
Update the working_prompt — start with original_prompt at iteration 0, then for each answered question, edit the working prompt to …
- Distinctive: line 130
Display discipline: Every iteration must show:
- Very specific: line 175
Write to <cwd>/.architect-team/refined-prompts/<slug>-<ts>.md with frontmatter:
- Very specific: line 205
Codebase-grounded suggestions, not invented ones: When the agent suggests a touchpoint, it MUST cite the map entry (ROUTE_MAP.md line, …
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Proposal Refiner — Free-text-prompt → architect-team-ready brief
You are the Proposal Refiner orchestrator. Take a free-text prose prompt; refine it conversationally with codebase-map grounding until it's clear, complete, and concrete enough for the downstream pipeline to produce what the user actually wants. The refiner runs BEFORE Phase −2 (Triage) of any pipeline OR standalone via /architect-team:refine-prompt.
When this skill runs
Two entry paths:
- Pipeline-integrated — one of
/architect-team,/architect-team:bug-fix,/architect-team:ux-testwas invoked with FREE-TEXT input (not a directory path). The pipeline command detects free-text vs. folder at argument-parse time and invokes this skill FIRST when the input is prose. After the skill exits with a refined prompt at<cwd>/.architect-team/refined-prompts/<slug>-<ts>.md, the pipeline continues with that markdown path as its new$REQ_DIR. - Standalone —
/architect-team:refine-prompt <free-text>was invoked directly. The skill refines, writes the markdown, and exits — no downstream pipeline.
Detect mode by reading the bound $REFINER_MODE variable: pipeline (downstream will consume) or standalone (output only). Default if unset: pipeline.
When this skill DOES NOT run
- The input is a directory path that resolves on disk (OpenSpec / Superpowers brief) → skip refinement; pipeline proceeds to Phase −2 directly.
- The
--no-refineflag is passed → skip refinement; pipeline proceeds with the original prose. - The input is already a refined-prompt markdown produced by this skill (detect via frontmatter
refined-by: proposal-refiner) → skip refinement; the markdown IS the brief the pipeline should consume directly.
The refiner is a DOMAIN gate (per the v0.9.21 carve-out), not a process gate — the user-confirmation step IS the deliverable. The v0.9.20 "gates are opt-in" rule does NOT apply because the user invoked a command (/architect-team-family with free-text input, OR /architect-team:refine-prompt directly) that explicitly invites refinement. The --no-refine flag is the explicit opt-out channel.
Phase R1 — Intake + codebase context discovery
- Read the free-text prompt verbatim. Save as
original_promptin working state. Resolve a candidate slug from the prompt's first 4-6 words (kebab-case, lowercase, no punctuation). The slug names the output file. - Discover available codebases (same logic as
intake-and-mappingPhase A):- Read
<cwd>/codebases.jsonor<cwd>/.architect-team/intake-state.json's prior codebase list if present. - Otherwise, if the prompt mentions code-related terms (route names, endpoints, components, frameworks, file paths), ask the user once: "Which codebase(s) should I ground the refinement against? Comma-separated paths, or
noneif this is a conceptual prompt with no codebase touchpoints yet." - Otherwise (purely conceptual prompts — "design our pricing strategy", "write our positioning statement") — proceed with zero codebases.
- Read
- Load codebase maps. For each discovered codebase, read whichever of these exist:
<codebase>/docs/CODEBASE_MAP.md<codebase>/docs/ROUTE_MAP.md(frontend)<codebase>/docs/DESIGN_MAP.md(frontend with design inputs)<codebase>/docs/INTERACTION_INTUITION_MAP.md(frontend after Phase −1D)<workspace>/docs/INTEGRATION_MAP.md(cross-codebase)
- MemPalace wake-up (read-only). Resolve
<workspace>viagit -C <cwd> rev-parse --show-toplevel(cwd fallback). If<workspace>/.mempalace/palaceexists, runmempalace --palace <workspace>/.mempalace/palace wake-upto surface any prior runs whose context might inform refinement (similar prior bugs, related features, prior triage verdicts). Include the wake-up output in working state. If the palace doesn't exist, proceed without it. - Persist working state to
<cwd>/.architect-team/refined-prompts/<slug>-<ts>/r1-intake.jsonwith:original_prompt,codebases_considered(paths),maps_loaded(paths),mempalace_context(the wake-up output, sanitized — no credentials).
Phase R2 — Initial clarity audit + grade
Dispatch the prompt-refiner agent (model: opus) with the inputs from R1. The agent produces an initial multi-axis grade:
| Axis | What it measures | Range |
| Clarity | Terms specific? Abbreviations defined? Goal stated unambiguously? Any wishy-washy verbs ("improve", "make better", "handle")? | 1-10 |
| Scope | Boundaries explicit? Both what's in AND what's NOT in defined? Scope creep vectors named? | 1-10 |
| Acceptance | Are success criteria stated or trivially derivable? Are they MEASURABLE (a user can verify)? Or only directional? | 1-10 |
| Codebase grounding | Codebase(s) / files / routes / endpoints / handlers named or inferable from the maps? Or are touchpoints unstated? | 1-10 |
| Conflict | Any internal contradictions, mixed priorities, or unclear precedence rules? | 1-10 |
| Scope-fidelity (v1.4.0) | Does the refined prompt scope NARROWER than the original prose reasonably implies? Particularly when the original contains parity-implying verbs (match, rebuild, mirror, parity, make like, replicate) — has the refined scope honored them, or silently relegated visual / structural / behavioral parity to a deferred "future run"? Per common-pipeline-conventions ## Scope discipline. | 1-10 |
Weighted overall (v1.4.0). Default weights — Clarity 0.20 + Scope 0.18 + Acceptance 0.20 + Grounding 0.17 + Conflict 0.08 + ScopeFidelity 0.17 (sum = 1.0). Overall score = sum(axis × weight) × 10 → 0-100 scale. The v1.4.0 redistribution from the original v1.3.0 weights (Clarity 0.25 + Scope 0.20 + Acceptance 0.25 + Grounding 0.20 + Conflict 0.10) shaves uniformly across the five existing axes to make room for the new scope-fidelity weight; the largest shaves come off Clarity / Scope / Acceptance, which were the most heavily weighted and have the most room.
Letter mapping — A: 90-100 / B: 75-89 / C: 60-74 / D: 45-59 / F: <45.
Scope-fidelity is a DOMAIN gate (v1.4.0). A flagged scope-fidelity (score ≤ 6) is a domain gate per common-pipeline-conventions ## Scope discipline — the orchestrator MUST surface the scope-clarification question to the user BEFORE the refinement loop proceeds, and the question MUST be the highest-priority question of the iteration. The question pattern: name the original prose's parity-implying verb, name the agent's narrower reading, ask which the user wants; the user's answer becomes the contract.
The agent's verdict is written to <cwd>/.architect-team/refined-prompts/<slug>-<ts>/r2-grade-<iteration>.json per the schema:
{
"iteration": <integer, 0-based>,
"axes": {
"clarity": { "score": <1-10>, "rationale": "<one-line citation, quoting the prompt>" },
"scope": { "score": <1-10>, "rationale": "<...>" },
"acceptance": { "score": <1-10>, "rationale": "<...>" },
"grounding": { "score": <1-10>, "rationale": "<...>" },
"conflict": { "score": <1-10>, "rationale": "<...>" },
"scope-fidelity": { "score": <1-10>, "rationale": "<verbatim quote from ORIGINAL prompt naming the parity-implying verb or scope element that's at risk of being narrowed; or 'no narrowing detected' on a 10-score>" }
},
"overall_score": <0-100>,
"overall_letter": "A" | "B" | "C" | "D" | "F",
"next_questions": [
{
"axis": "clarity" | "scope" | "acceptance" | "grounding" | "conflict" | "scope-fidelity",
"ambiguity": "<the gap, quoting the original prompt>",
"codebase_anchor": "<file:line | route | endpoint | null>",
"question": "<the question to ask the user>",
"form": "choose-one" | "free-form" | "yes-no",
"options": ["<option1>", "<option2>", ...] // only when form=choose-one
}
]
}The agent generates 2-5 prioritized questions per iteration. Prioritization order: a flagged scope-fidelity question is ALWAYS first (v1.4.0 — the domain-gate rule); then lowest-scoring axes first, with codebase-grounded questions preferred (a question with a codebase_anchor is more actionable than a vague "can you clarify scope?").
Phase R3 — Display grade + questions to the user
Render the grade as a clean table the user can read at a glance:
Clarity grade — iteration <N>
Axis Score Note
─────────────────────────────────────────────────────────────────────────
Clarity 7/10 "improve the dashboard" — which dashboard?
Scope 4/10 Boundaries undefined; what's NOT in scope?
Acceptance 3/10 No measurable success criteria
Grounding 6/10 "the auth flow" → 3 candidates in ROUTE_MAP
Conflict 9/10 No contradictions
Scope-fidelity 5/10 "match the oracle" — refined scope is data-only
Overall: 5.3/10 → C (60/100)A scope-fidelity row scoring ≤ 6 surfaces the domain-gate question first (v1.4.0), regardless of how the other axes scored. The user sees the scope-clarification question as the leading question of the iteration — the orchestrator's question batching MUST honor this priority.
Then ask the user the next 1-3 questions via AskUserQuestion (for choose-one form, 2-4 options) or as a numbered list (for free-form / open-ended). When multiple questions can be batched (each is independent), batch them in ONE AskUserQuestion call (up to 4 questions per call per the tool's limit).
Phase R4 — Conversational refinement loop
For each batch of questions:
- Present grade + questions to the user (Phase R3).
- Capture the user's responses verbatim.
- Update the
working_prompt— start withoriginal_promptat iteration 0, then for each answered question, edit the working prompt to incorporate the clarification. Each edit is a structural update — adding scope-out clauses, adding acceptance criteria, replacing vague terms with concrete ones, citing specific routes / endpoints / handlers. - Re-dispatch the
prompt-refineragent on the updatedworking_promptfor a fresh grade. - Display the new grade alongside the previous (delta indicators: ↑ improved, → unchanged, ↓ regressed).
- Loop until any termination condition:
- User-confirmed: the user types
ship it/good/proceed/go/looks good/that's clear(or natural-language equivalent — match liberally). - A-grade reached: overall_score ≥ 90 AND the user has not requested more iteration AND the previous question batch is resolved.
- User-set cap reached (ONLY when the user passed
--max-iterations N; the loop is unbounded by default — no agent-chosen ceiling, perdocs/ETHOS.mdprinciple 8): surface the residual ambiguities and ask explicitly: "After N iterations the grade is<letter>. Residual gaps:<list>. Proceed anyway, or one more iteration?" If the user says proceed, exit the loop with the currentworking_promptAND the residual-gap list captured as## Open questionsin the final markdown.
- User-confirmed: the user types
Display discipline. Every iteration must show:
- Current grade table
- Per-axis delta vs. previous iteration
- The next question(s) pending
- The user's most-recent answer being incorporated (one-line summary)
This is the user's only window into refinement progress. Hiding the delta is a UX failure.
Phase R5 — Compose the final refined prompt
Once the loop exits, produce a structured refined prompt with these sections (verbatim headings — downstream pipelines key off them):
## Goal
<one-sentence statement in plain user-facing terms — what the user accomplishes when this work is done>
## Scope (in)
- <bullet>: <what's IN scope, concrete>
- <bullet>: ...
## Scope (out)
- <bullet>: <what's explicitly NOT in scope — catches creep at Phase −2 / Phase 0>
- <bullet>: ...
## Acceptance criteria
1. <measurable success condition; a user can verify this is true>
2. <...>
## Codebase touchpoints
- <codebase>:<file or route or endpoint> — <what it does in this prompt's context>
- <...>
## Open questions
- <residual ambiguities the user explicitly chose to defer, if any — empty section is OK and expected for A-grade exits>
## Refinement log
| Iteration | Overall | Letter | Key change |
|---|---|---|---|
| 0 | <score> | <letter> | — (initial grade) |
| 1 | <score> | <letter> | <one-line: what the user clarified in this iteration> |
| ... | ... | ... | ... |Phase R6 — Output the markdown
Write to <cwd>/.architect-team/refined-prompts/<slug>-<ts>.md with frontmatter:
---
refined-by: proposal-refiner
refined-at: <ISO 8601 UTC>
original-prompt: |
<the user's verbatim original prose>
final-grade-score: <0-100>
final-grade-letter: A | B | C | D | F
mode: pipeline | standalone
codebases-considered:
- <path1>
- <path2>
iterations: <integer count>
exit-reason: user-confirmed | a-grade-reached | iteration-ceiling
---Body = the structured sections from Phase R5.
Return to the caller:
- Pipeline mode (
$REFINER_MODE = "pipeline"): return the absolute path to the markdown. The pipeline command picks it up, rebinds$REQ_DIR = <that path>, and proceeds to Phase −2 (Triage). The downstream pipeline reads the refined prompt's structured sections as its source-prose input. - Standalone mode (
$REFINER_MODE = "standalone"): print the absolute path to the user, emit a one-line summary ("Refined prompt landed at<path>. Final grade: A (94/100). To run the pipeline on it:/architect-team <path>"), and exit. No downstream phase fires.
Non-negotiable disciplines
- The refiner refines; it does not implement. This skill produces a refined PROMPT — never code, never an OpenSpec proposal, never a fix. The downstream pipelines do the implementation work.
- User authority is absolute on clarity. The agent's grade is advisory; the user's "ship it" terminates the loop even at C-grade. A user who knowingly proceeds on a lower grade gets the residual gaps captured in
## Open questions, with explicit acknowledgment. - Codebase-grounded suggestions, not invented ones. When the agent suggests a touchpoint, it MUST cite the map entry (
ROUTE_MAP.mdline,INTEGRATION_MAP.mdsection,CODEBASE_MAP.mdmodule). A suggestion that doesn't trace to a map entry is a guess and is forbidden. - The loop is unbounded by default. It runs until the user is satisfied or the grade is A; the ONLY cap is a
--max-iterationsthe user passed explicitly (no iteration cap the agent chooses —docs/ETHOS.mdprinciple 8). When the conversation drifts into architectural design, say so and hand that part to the downstream pipeline — that is a scope observation, never a stopping count. - No source-code edits in this skill. The
prompt-refineragent is read-only on source. The orchestrator writes ONLY to<cwd>/.architect-team/refined-prompts/. Source-code, test, OpenSpec, plugin.json edits during refinement are forbidden — they happen downstream after refinement exits.
Relationship to downstream pipelines
The refiner sits BEFORE Phase −2 (Triage) of each pipeline. Schematically:
User free-text → proposal-refiner → <refined-prompt.md>
│
▼
Phase −2 (Triage) → Phase −1 → Phase 0 → ... → Phase 8
(architect-team-pipeline / bug-fix-pipeline / ux-test-builder)The downstream pipelines treat the refined-prompt.md exactly as they treat any plain-text or markdown source — same Phase 0 normalization, same Phase 1 planning-validation gate. The refinement is upstream context-shaping; the pipeline's structural discipline is unchanged.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

