Use when evaluation data exists and optimization proposals are needed. Analyzes scores, user journey drop-off points, and prior attempts to produce ranked hypotheses batched 2-3 per cycle.
Use when evaluation data exists and optimization proposals are needed. Analyzes scores, user journey drop-off points, and prior attempts to produce ranked hypotheses batched 2-3 per cycle.
argument-hint
[count] - Optional: number of hypotheses to generate (default: 5, max: 10)
Generate Hypotheses
Analyze evaluation data and produce ranked optimization proposals. Batches the top 2-3 hypotheses per evolution cycle for implementation.
Instructions
CRITICAL — NON-INTERACTIVE: Execute all steps without pausing. Never ask questions, request confirmation, or wait for input. Read state, analyze, generate, write output, update state, stop.
Step 0: Initialize
Read factory/evolution-state.json:
Verify status is "hypothesizing" or "rejected" (if rejected, we're retrying with next batch)
Set CYCLE to current_cycle
If status is neither, display error and stop
Parse $ARGS for optional count (default: 5, max: 10)
Read the latest evaluation:
Find the most recent file in factory/evaluations/eval-*.json
Load its scores, top_issues, and user_journeys
Read hypothesis history:
Read all files in factory/hypotheses/hyp-*.json
Read rejected_hypotheses from evolution state
Build a set of previously attempted and rejected approaches
Step 1: Analyze Evaluation Data
For each issue in top_issues, map it to a concrete improvement:
Identify the root cause — what in the codebase is causing this score deficit?
Define the fix — what specific change would address it?
Estimate impact — how many composite score points could this recover?
Assess confidence — how certain are we this fix will work? (0.0-1.0)
Journey drop-off: expected_impact += 2 (already applied in Step 1)
Multi-journey issue (appears in 2+ journeys): confidence *= 1.2 (cap at 1.0)
Similar to rejected hypothesis: confidence *= 0.5
Previously attempted (same approach, different cycle): skip entirely
Sort by priority_score descending.
Step 3: Batch Top Hypotheses
Select the top 2-3 hypotheses for this cycle:
Take the highest-priority hypothesis
Add the next highest that does NOT conflict (same files, overlapping changes)
If a third doesn't conflict with the first two, include it
If all remaining conflict, batch only 2
A hypothesis conflicts if it modifies the same primary files as an already-batched hypothesis in a way that could cause merge issues.
Step 4: Generate Implementation Sketches
For each batched hypothesis, produce an implementation sketch:
{"pages_affected":["src/app/page.tsx"],"new_components":["src/components/SocialProof.tsx"],"modifications":["src/app/layout.tsx"],"estimated_tasks":3,"key_changes":["Add testimonial data to homepage","Create SocialProof component with carousel","Add trust badges below hero section"]}
Read the actual source files referenced to ensure the sketch is grounded in the real codebase.
Step 5: Write Output Files
Generate a timestamp: TIMESTAMP = current ISO-8601 datetime formatted as YYYY-MM-DD-HHmmss
{"version":1,"timestamp":"[ISO-8601]","cycle":1,"evaluation_ref":"factory/evaluations/eval-[latest].json","total_generated":5,"batched_count":3,"hypotheses":[{"id":"hyp-1-001","title":"Add social proof section below hero","category":"conversion","description":"Homepage lacks trust signals. Adding testimonials, logos, and stats below the hero would increase trust and reduce bounce rate.","rationale":"Conversion audit scored trust_credibility at 2/5. User journey 'New visitor' drops off before CTA due to lack of social validation.","expected_impact":8,"confidence":0.8,"effort":"small","effort_multiplier":1,"priority_score":6.4,"batched":true,"addresses_issues":["issue-1","issue-3"],"addresses_journeys":["New visitor"],"predicted_score_change":{"conversion.trust_credibility":"+2","composite_score":"+5"},"implementation_sketch":{"pages_affected":["src/app/page.tsx"],"new_components":["src/components/SocialProof.tsx"],"modifications":[],"estimated_tasks":3,"key_changes":["Add testimonial data structure","Create SocialProof component","Integrate below hero on homepage"]}}],"skipped":[{"id":"hyp-1-004","title":"...","reason":"Similar to rejected hypothesis hyp-0-002","priority_score":3.2}]}