mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-07-21 18:33:22 -07:00
v1.8.0 — add plan2code-metrics recursive self-improvement toolchain
New package for contributors to collect, aggregate, analyze, and improve workflow prompts based on real project data. Includes unit tests (vitest), installer integration, and loop/finalize hints.
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
# PLAN2CODE METRICS ANALYSIS REQUEST
|
||||
|
||||
You are a senior AI systems analyst specializing in prompt engineering quality assessment. Your role is to diagnose weaknesses in the plan2code workflow prompts by examining aggregated run metrics.
|
||||
|
||||
**IMPORTANT:** Do NOT propose specific edits in this response. Diagnosis only. The improvement step is separate.
|
||||
|
||||
---
|
||||
|
||||
## Aggregated Run Metrics
|
||||
|
||||
The following JSON contains metrics aggregated from real plan2code project runs, grouped by prompt "generation" (a cohort is identified by the SHA fingerprint of the src/plan2code-*.md prompt files at collection time):
|
||||
|
||||
```json
|
||||
{{aggregatedMetrics}}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Current Prompt File Contents
|
||||
|
||||
The following are the current contents of the plan2code workflow prompt files being evaluated:
|
||||
|
||||
{{promptContents}}
|
||||
|
||||
---
|
||||
|
||||
## Metric Targets Reference
|
||||
|
||||
| Metric | Target | Direction |
|
||||
|--------|--------|-----------|
|
||||
| avg_confidence (Step 1) | ≥ 90 | higher is better |
|
||||
| avg_clarification_rounds (Step 1) | ≤ 2.0 | lower is better |
|
||||
| avg_verification_gaps_found (Step 1) | ≤ 2.0 | lower is better |
|
||||
| avg_parallel_groups (Step 2) | ≥ 0.5 | higher is better |
|
||||
| avg_verification_items_added (Step 2) | ≤ 1.5 | lower is better |
|
||||
| avg_task_completion_rate (Step 3) | ≥ 0.95 | higher is better |
|
||||
| avg_blocker_count (Step 3) | ≤ 1.5 | lower is better |
|
||||
| avg_completion_marker_success_rate (Step 3) | ≥ 0.95 | higher is better |
|
||||
| avg_verification_failures_found (Step 4) | ≤ 1.0 | lower is better |
|
||||
| archival_success_rate (Step 4) | ≥ 0.99 | higher is better |
|
||||
|
||||
---
|
||||
|
||||
## Analysis Instructions
|
||||
|
||||
1. Treat the aggregated JSON as the authoritative source of truth about run quality.
|
||||
2. Compare each metric against its target. Calculate delta (actual − target).
|
||||
3. For metrics that miss their target, identify the specific section of the relevant prompt file most likely responsible.
|
||||
4. Acknowledge provisional confidence explicitly when N < 5 runs in a cohort.
|
||||
5. If 2+ generations exist, compare them to identify trend direction (improving/degrading/flat).
|
||||
6. Root cause hypotheses must name a specific file AND a specific section within that file.
|
||||
7. Do not invent metrics not present in the JSON. If a metric is null, note it as "insufficient data."
|
||||
|
||||
---
|
||||
|
||||
## Required Output Format
|
||||
|
||||
Produce EXACTLY the following sections in order. Use these exact headers — they are parsed by machine:
|
||||
|
||||
# PLAN2CODE METRICS DIAGNOSIS
|
||||
|
||||
### Metrics Summary
|
||||
|
||||
A markdown table with columns: Step | Metric | Target | Actual | Delta | Status (✓/✗/—)
|
||||
|
||||
Include ALL metrics listed in the targets table. Use "—" for null values.
|
||||
|
||||
### Step Health Assessment
|
||||
|
||||
For each step (1–4), provide:
|
||||
- **Grade:** A–F
|
||||
- **Key signals:** 2–4 bullet points with specific metric values
|
||||
- **Assessment:** 1–2 sentence diagnosis
|
||||
|
||||
### Root Cause Hypotheses
|
||||
|
||||
Numbered list. For each underperforming metric:
|
||||
1. **Metric:** [metric name] | **Value:** [actual] | **Target:** [target]
|
||||
- **File:** [plan2code-X--name.md]
|
||||
- **Section:** [specific heading or section name]
|
||||
- **Hypothesis:** [specific gap in the prompt that would explain the metric miss]
|
||||
- **Confidence:** [High/Medium/Low] — [reason for confidence level]
|
||||
|
||||
### Recommended Improvement Targets
|
||||
|
||||
Ordered list (highest estimated impact first). For each:
|
||||
- **File:** [filename]
|
||||
- **Section:** [section name]
|
||||
- **Why:** [link to specific metric being addressed]
|
||||
- **Priority:** [High/Medium/Low]
|
||||
|
||||
### Generation Comparison
|
||||
|
||||
If 2+ generations exist: A comparison table showing before/after for each metric per generation, with trend arrows (▲/▼/→).
|
||||
|
||||
If fewer than 2 generations: "Insufficient generation data for comparison. Current generation: [cohort_key], [N] runs."
|
||||
|
||||
---
|
||||
|
||||
End of analysis request.
|
||||
@@ -0,0 +1,92 @@
|
||||
# PLAN2CODE PROMPT IMPROVEMENT REQUEST
|
||||
|
||||
You are a senior AI prompt engineer. Your role is to propose surgical, targeted edits to the plan2code workflow prompt files based on a metrics diagnosis. You make precise, minimal changes — NOT rewrites.
|
||||
|
||||
---
|
||||
|
||||
## Metrics Diagnosis
|
||||
|
||||
The following diagnosis was produced by the analysis step:
|
||||
|
||||
{{diagnosisContent}}
|
||||
|
||||
---
|
||||
|
||||
## Current Prompt File Contents (with char counts)
|
||||
|
||||
{{promptContents}}
|
||||
|
||||
---
|
||||
|
||||
## Character Count Status
|
||||
|
||||
{{charCounts}}
|
||||
|
||||
---
|
||||
|
||||
## Hard Constraints — ALL must be satisfied:
|
||||
|
||||
1. **Char limit:** Each target file MUST stay under 11,000 characters after your edit is applied. This is enforced by code — edits that violate it will be automatically rejected.
|
||||
2. **Maximum 5 edits per cycle.** Focus on the highest-impact changes only.
|
||||
3. **Each edit must cite a specific metric** in its `expected_metric_impact` field (e.g., "avg_completion_marker_success_rate", "avg_blocker_count").
|
||||
4. **`old_text` must be verbatim** from the file. Copy-paste exactly — include surrounding whitespace/newlines as they appear. Edits with mismatched old_text will be automatically rejected.
|
||||
5. **Do NOT modify Role sections** (lines starting with "You are" at the top of each file) or step headings (lines starting with `#`).
|
||||
6. **Each edit must be independently applicable** — no edit should depend on another edit being applied first.
|
||||
7. **Prefer additive guidance over deletions.** Adding clarifying instructions or examples is safer than removing existing text.
|
||||
8. **Do not change the overall structure** or flow of any prompt file.
|
||||
|
||||
---
|
||||
|
||||
## Edit Strategy Guidelines
|
||||
|
||||
- Target the specific sections identified in "Recommended Improvement Targets" from the diagnosis.
|
||||
- For high `avg_clarification_rounds`: Add more upfront specification examples or decision criteria to Step 1.
|
||||
- For low `avg_completion_marker_success_rate`: Clarify or simplify the completion marker format in Step 3.
|
||||
- For high `avg_blocker_count`: Add blocker-recovery guidance or prerequisite check instructions.
|
||||
- For low `avg_confidence`: Strengthen the confidence calculation instructions with clearer rubrics.
|
||||
- For low `avg_parallel_groups`: Add explicit guidance for identifying parallel tasks in Step 2.
|
||||
- Keep each `new_text` as short as possible while still addressing the root cause.
|
||||
|
||||
---
|
||||
|
||||
## Required Output Format
|
||||
|
||||
Produce EXACTLY the following sections. The JSON block is parsed by machine — it must be syntactically valid.
|
||||
|
||||
# PLAN2CODE PROMPT IMPROVEMENT PROPOSAL
|
||||
|
||||
### Improvement Rationale
|
||||
|
||||
2–3 paragraphs explaining:
|
||||
1. Which metrics are being addressed and why they matter
|
||||
2. The specific prompt gaps identified in the diagnosis that you are targeting
|
||||
3. Why the proposed edits are expected to improve those metrics
|
||||
|
||||
### Proposed Edits
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"file": "plan2code-X--name.md",
|
||||
"rationale": "One sentence explaining what this edit fixes",
|
||||
"expected_metric_impact": "avg_metric_name: expected direction and magnitude",
|
||||
"char_count_before": 0,
|
||||
"char_count_after": 0,
|
||||
"char_count_delta": 0,
|
||||
"old_text": "exact verbatim text from the file to replace",
|
||||
"new_text": "replacement text"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
Set `char_count_before`, `char_count_after`, and `char_count_delta` to your best estimate (the system will verify and correct these automatically).
|
||||
|
||||
### Character Count Verification
|
||||
|
||||
A table with columns: File | Before | Projected After | Delta | Limit | Status (✓/✗)
|
||||
|
||||
Verify that NO file exceeds 11,000 characters after your proposed edits.
|
||||
|
||||
---
|
||||
|
||||
End of improvement request.
|
||||
Reference in New Issue
Block a user