Skip to content

Commit e8015e5

Browse files
feat: extract previous review feedback during regeneration
- Add step to extract previous review feedback into a markdown file - Include quality score, strengths, weaknesses, and criteria checklist - Update documentation to reflect mandatory reading for regenerations
1 parent 7af191b commit e8015e5

2 files changed

Lines changed: 86 additions & 3 deletions

File tree

.github/workflows/impl-generate.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,65 @@ jobs:
249249
echo "is_regeneration=false" >> $GITHUB_OUTPUT
250250
fi
251251
252+
- name: Extract previous review feedback (regeneration)
253+
id: prev_review
254+
if: steps.existing.outputs.is_regeneration == 'true'
255+
env:
256+
SPEC_ID: ${{ steps.inputs.outputs.specification_id }}
257+
LANGUAGE: ${{ steps.inputs.outputs.language }}
258+
LIBRARY: ${{ steps.inputs.outputs.library }}
259+
run: |
260+
.venv/bin/python3 - <<'PY'
261+
import os, pathlib, yaml
262+
263+
spec = os.environ["SPEC_ID"]
264+
lang = os.environ["LANGUAGE"]
265+
lib = os.environ["LIBRARY"]
266+
meta_path = pathlib.Path(f"plots/{spec}/metadata/{lang}/{lib}.yaml")
267+
data = yaml.safe_load(meta_path.read_text(encoding="utf-8")) or {}
268+
review = data.get("review") or {}
269+
quality = data.get("quality_score")
270+
271+
lines = [f"# Previous Review for {spec} / {lang} / {lib}", ""]
272+
lines.append(f"**Previous quality score:** {quality if quality is not None else 'n/a'}")
273+
lines.append("")
274+
275+
desc = review.get("image_description")
276+
if desc:
277+
lines += ["## Previous image description", str(desc).strip(), ""]
278+
279+
strengths = review.get("strengths") or []
280+
if strengths:
281+
lines.append("## Strengths (KEEP these)")
282+
lines += [f"- {s}" for s in strengths]
283+
lines.append("")
284+
285+
weaknesses = review.get("weaknesses") or []
286+
if weaknesses:
287+
lines.append("## Weaknesses (FIX these)")
288+
lines += [f"- {w}" for w in weaknesses]
289+
lines.append("")
290+
291+
checklist = review.get("criteria_checklist") or {}
292+
if checklist:
293+
lines.append("## Criteria checklist (focus on items that failed)")
294+
for cat, payload in checklist.items():
295+
payload = payload or {}
296+
score = payload.get("score", "?")
297+
max_score = payload.get("max", "?")
298+
lines.append(f"### {cat} ({score}/{max_score})")
299+
for item in payload.get("items") or []:
300+
item = item or {}
301+
mark = "✅" if item.get("passed") else "❌"
302+
lines.append(
303+
f"- {mark} {item.get('id', '?')} {item.get('name', '')}: {item.get('comment', '')}"
304+
)
305+
lines.append("")
306+
307+
pathlib.Path("/tmp/anyplot-prev-review.md").write_text("\n".join(lines), encoding="utf-8")
308+
print(f"::notice::Extracted previous review (score={quality}) to /tmp/anyplot-prev-review.md")
309+
PY
310+
252311
- name: Ensure implementation directories exist
253312
env:
254313
SPEC_ID: ${{ steps.inputs.outputs.specification_id }}

prompts/workflow-prompts/impl-generate-claude.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,20 @@ Read these files to understand the requirements:
2323
3. `prompts/library/{LIBRARY}.md` - Library-specific rules + theme-adaptive chrome mapping for this library
2424
4. `plots/{SPEC_ID}/specification.md` - What to visualize
2525

26-
Optional (if regenerating):
27-
- `plots/{SPEC_ID}/metadata/{LANGUAGE}/{LIBRARY}.yaml` - Previous review feedback
28-
- `plots/{SPEC_ID}/implementations/{LANGUAGE}/{LIBRARY}.py` - Previous implementation
26+
### If regenerating (`IS_REGENERATION=true`) — MANDATORY
27+
28+
When regenerating an existing implementation, you MUST read these BEFORE writing any code:
29+
30+
1. `/tmp/anyplot-prev-review.md` — structured review from the previous attempt (image description, strengths, weaknesses, failed criteria checklist). The workflow extracts this automatically from the previous `metadata/{LANGUAGE}/{LIBRARY}.yaml`.
31+
2. `plots/{SPEC_ID}/implementations/{LANGUAGE}/{LIBRARY}.py` — the previous implementation.
32+
33+
**Default regen mindset: incremental improvement, not rewrite.**
34+
35+
- Preserve the bits listed under "Strengths" unchanged.
36+
- Address every bullet under "Weaknesses" and each ❌ item in the criteria checklist.
37+
- If a base style rule (palette, theme colors, chrome, etc. from `prompts/default-style-guide.md` or `prompts/library/{LIBRARY}.md`) conflicts with the previous implementation, update the previous code to match — base style wins.
38+
- Do NOT discard working structure / data generation / layout choices that the previous review did not flag.
39+
- Your deliverable is a refined version of the previous file, not a fresh rewrite from the spec.
2940

3041
### Feasibility Check (Static Libraries Only)
3142

@@ -104,12 +115,25 @@ git commit -m "feat({LIBRARY}): implement {SPEC_ID}"
104115
git push -u origin implementation/{SPEC_ID}/{LIBRARY}
105116
```
106117

118+
If `IS_REGENERATION=true`, use an expanded commit body that names what you addressed. Example:
119+
120+
```
121+
feat(matplotlib): implement scatter-basic
122+
123+
Regen from quality 78. Addressed:
124+
- text legibility on dark background
125+
- grid contrast (VQ-03 failed → fixed)
126+
```
127+
128+
Pass the multi-line message via `-F -` or a heredoc so git preserves the body.
129+
107130
## Final Check
108131

109132
Before finishing, confirm:
110133
1.`plots/{SPEC_ID}/implementations/{LANGUAGE}/{LIBRARY}.py` exists
111134
2.`plot-light.png` AND `plot-dark.png` were generated successfully (plus `plot-light.html` / `plot-dark.html` for interactive libs)
112135
3. ✅ First categorical series renders in `#009E73` in both themes
113136
4. ✅ Changes were committed and pushed
137+
5. ✅ If regenerating: `/tmp/anyplot-prev-review.md` and the previous `.py` were read, and each weakness / failed criterion was either addressed or consciously kept (explained in the commit body)
114138

115139
If any of these failed, DO NOT report success.

0 commit comments

Comments
 (0)