hypothesis-generation-pipeline
Goal:
- Dispatch one enabled generation strategy for a given
ResearchPlan.
Inputs:
ResearchPlan- active
state/STRATEGY_PLAN.json - one enabled generation
strategy - optional resume context from
state/PIPELINE_STATE.json
Outputs:
hypotheses/<id>/HYPOTHESIS.jsonhypotheses/<id>/HYPOTHESIS.mdhypotheses/<id>/ORIGIN.jsonliterature/queries/<query_id>/*whenhypothesis-generate-literatureis selectedhypotheses/<id>/REVIEW/*.json- updated
meta/INSIGHTS_FROM_REVIEWS.jsonwhen the hypothesis is viable - updated proximity receipt/status artifacts, plus
state/PROXIMITY_GRAPH.jsonwhen the embedding bridge succeeds - updated
tournaments/*.json - updated
islands/ISLANDS.json - updated
state/PIPELINE_STATE.json
Sub-skills:
hypothesis-generate-literatureliterature-searchhypothesis-generate-debatehypothesis-generate-assumptionshypothesis-review-pipelineinsights-from-reviewshypothesis-proximity-updatehypothesis-ranking-pipeline
Context Loading:
- Open
skills/shared-references/schema-index.md. - Read
packages/agent_contracts/research_plan.pybefore consumingresearch_plan/RESEARCH_PLAN.jsonas the canonical generation brief. - Read
packages/agent_contracts/strategy_plan.pybefore consumingstate/STRATEGY_PLAN.jsonas the active generation-stage routing input. - Read
packages/agent_contracts/hypothesis.pybefore dispatching any atomic generation skill that will writehypotheses/<id>/HYPOTHESIS.json. - Read
packages/agent_contracts/literature.pyandskills/shared-references/literature-search-contract.mdbefore dispatchinghypothesis-generate-literature. - Read
packages/agent_contracts/state.pybefore assigning or updatingislands/ISLANDS.json. - Read
packages/agent_contracts/pipeline_runtime.pybefore updatingstate/PIPELINE_STATE.json. - Read
state/STRATEGY_PLAN.jsonand confirm the current round permits the selected generation strategy. - Read
RUN_POLICY.yamlwhen review rigor or downstream optional review behavior depends on the effective run policy.
Execution Contract:
- This pipeline skill does not own hidden prompt templates.
state/STRATEGY_PLAN.jsonis a routing input to this skill, not a generation-stage artifact that this skill may rewrite ad hoc.research_plan/RESEARCH_PLAN.jsonis a required canonical input. If it is missing or invalid, stop immediately and return control to the top-level workflow or configuration stage instead of attempting generation.- Append-only routing audit artifacts such as
state/STRATEGY_DECISIONS.jsonlremain owned by the top-level orchestration layer and the canonical router surface inpython -m tools.policy.plan_strategy <run_dir>. - It coordinates downstream generation, review, insights, proximity, and ranking skills; those downstream skills remain responsible for the field-level canonical shapes of the artifacts they write.
- The selected generation strategy must be consistent with
state/STRATEGY_PLAN.json. - When the selected generation strategy is
literature_exploration_generation, the dispatchedhypothesis-generate-literatureskill must calltools.search_literature(run_dir, request)and consume a non-blockedEvidenceBundleContractbefore writing a literature-grounded hypothesis. - The generation pipeline must not accept prompt-invented literature evidence in place of
literature/queries/<query_id>/EVIDENCE_BUNDLE.json. - On a fresh run, execute one generated hypothesis per selected generation strategy so the initial frontier mirrors the full seed set instead of collapsing to a single synthetic output.
- On a regeneration pass triggered from evolution, execute one generated hypothesis per selected generation strategy and then refresh the evolution plan before continuing.
- After each generated hypothesis is written, immediately run:
hypothesis-review-pipelineinsights-from-reviewswhen the hypothesis is viablehypothesis-proximity-updatefor each viable hypothesishypothesis-ranking-pipeline
- The generation pipeline must not skip proximity because no embedding vector is already present. The bridge owns provider invocation and records a receipt/status when the provider is disabled, unavailable, invalid, or failed.
- Do not generate, infer, or fabricate embeddings in prompt output. Proceed to ranking through the documented receipt-gated fallback path only after
hypothesis-proximity-updatehas recorded a skipped or failed receipt/status. - For initial frontier seeding, assign one non-empty
island_idto each viable generated hypothesis, then calltools.ensure_run_islands_for_hypotheses(run_dir)before the round is considered complete. - Newly created seed islands are initialization records only: they must keep
decayed_reward = 0.0,decayed_visits = 0.0, andvisit_count = 0. - Initial frontier island assignment is distinct from the later single-island reward / decay mechanics in
hypothesis-evolution-loop; do not applytools.update_single_island_reward(...),tools.update_run_single_island_reward(...), or any manual reward/visit increment during seeding. - Persist only canonical island fields. Do not add dashboard-derived or router-derived fields such as
hypothesis_ids,ucb_score, orstrategy_labeltoislands/ISLANDS.json.
Execution Steps:
- Open
skills/shared-references/schema-index.md, then readpackages/agent_contracts/research_plan.py,packages/agent_contracts/strategy_plan.py,packages/agent_contracts/hypothesis.py,packages/agent_contracts/literature.py,packages/agent_contracts/state.py, andpackages/agent_contracts/pipeline_runtime.pybefore consuming generation-stage routing state or performing any directly managed generation-stage write. - Read
research_plan/RESEARCH_PLAN.json, activestate/STRATEGY_PLAN.json, and relevant policy context. - If the research plan artifact is missing or invalid, stop immediately. Do not dispatch any generation strategy.
- Confirm that the selected generation strategy is allowed for the active round.
- Dispatch exactly one matching atomic generation skill for the current strategy and let that sub-skill write the canonical hypothesis and origin artifacts. For
literature_exploration_generation, require the sub-skill to calltools.search_literature(run_dir, request)and preserve the resulting literature artifacts. - Run
hypothesis-review-pipelinefor the newly created hypothesis. - If the hypothesis remains viable, run
insights-from-reviews. - Run
hypothesis-proximity-updatefor each viable hypothesis by callingtools.update_hypothesis_proximity(run_dir, hypothesis_id)through that skill. If the bridge records a skipped, disabled, failed, or provider-unavailable receipt/status, preserve it and continue to ranking without fabricating placeholder embeddings. - Run
hypothesis-ranking-pipeline. - For initial frontier seeding, assign exactly one non-empty
island_idto each viable generated hypothesis, calltools.ensure_run_islands_for_hypotheses(run_dir), and verify the resulting canonicalislands/ISLANDS.jsoncontains one unvisited island record per viable seed hypothesis. - Update
state/PIPELINE_STATE.jsonas required by the top-level workflow and refreshed downstream status. - Do not append or rewrite
state/STRATEGY_DECISIONS.jsonlfrom this skill. If the caller needs a routing refresh or new decision record, return control to the top-level orchestration layer orstrategy-router. - Run
python -m tools.validation.contract_validation <run_dir> --skill hypothesis-generation-pipelinebefore declaring completion.
Completion Rule:
- This skill is complete only when the selected generation strategy has produced exactly one canonical hypothesis candidate, required downstream review and frontier-upkeep work has been dispatched, and any directly managed state or island updates validate.