Skip to content

Vary SIM prose, domain-aware Python hypotheses, per-idea citations + simulated thinking - #38

Merged
duckyquang merged 3 commits into
mainfrom
feat/sim-content-variation
Jul 16, 2026
Merged

Vary SIM prose, domain-aware Python hypotheses, per-idea citations + simulated thinking#38
duckyquang merged 3 commits into
mainfrom
feat/sim-content-variation

Conversation

@duckyquang

Copy link
Copy Markdown
Owner

Problem

The keyless SIM generators (frontend/src/lib/sim/content.ts, webapp/content.py) were fixed-skeleton slot-fill: the self-critique / stress / review stitching sentences were identical every round and session, the entire research-proposal overview prose was byte-identical every session, and the Python make_hypothesis was always biomedical regardless of goal. Users saw the same text template over and over.

What changed

De-template (both runtimes, seeded r.choice([...]) banks; headings + structure unchanged):

  • makeReview / make_review — the four dimension paragraphs + assumption note vary (scores drawn first, so they stay deterministic).
  • makeSelfCritique / make_self_critique — fixed reread/doubt/stakes stitching now varies per round + target.
  • makeStressReport / make_stress_report — break/claim/attack/feasibility/citation sentences vary per hyp + round (verdict token still seeded separately so report ↔ ranking agree).
  • makeOverview / make_overview — every top-level section and per-proposal block drawn from banks, seeded per session (via proposal ids) so two runs of the same goal read differently; per-proposal streams keep blocks distinct. Prose genericised to fit any domain.
  • Match rationales varied in engine.ts, simulator.py, seed.py.

Domain-aware Python hypotheses: ported the TS DOMAINS table + keyword extraction + title scaffolds into webapp/content.py, so a non-biomedical goal yields on-topic hypotheses. make_plan reports the inferred domain. Both DOMAINS tables enriched (reasoning/LLM terms → computing; inflammation/senescence → biomedicine).

Per-idea citations: fixed a browser bug where overviewRefs re-sampled random curated papers instead of each proposal's real citations (so the overview cited different papers than the drawer/donut). It now consumes p.citations, deduped like the Python _overview_refs, with [n] markers spread across the claim / why / experiment sentences. Overview ↔ drawer ↔ per-proposal donut now cite the same papers. Framing / summary / landscape / comparative / recommended / open-questions stay uncited (Co-Scientist synthesis). The Groq-prose path stays honestly uncited.

Simulated thinking: every sim hypothesis gets varied seeded reasoning (distinct per hyp), threaded through engine.ts (PlanHyp/hypContent/addHyp/toHypothesis) and the Python store (hyp_thinking side table, read in get_hypothesis). Groq GenHyp gains a real reasoning field (prompt + parse) that becomes thinking for BYOK hyps. types.ts Hypothesis + PlanHyp gain optional thinking.

Verification

  • npm run build — green.
  • pytest co_scientist/tests/unit -q276 passed.
  • ruff — no new errors (net −3 vs baseline; the one unavoidable en-dash gets a scoped # noqa).
  • Server E2E (two same-goal runs): prose differs between runs while ## headings match; per-proposal [n] resolve to the References list; framing/summary uncited; hypotheses on-topic (not biomedical); each hypothesis carries distinct thinking; self-critique rounds read distinctly.

🤖 Generated with Claude Code

duckyquang and others added 3 commits July 16, 2026 05:38
…s + thinking

The mirrored keyless generators (frontend sim/content.ts, webapp/content.py)
emitted fixed-skeleton text: the same self-critique/stress/review stitching every
round, identical overview prose every session, and always-biomedical Python
hypotheses. This de-templates them and threads simulated reasoning through.

De-template (both runtimes, seeded phrase banks, headings/structure unchanged):
- makeReview / make_review: 4 dimension paragraphs + assumption note now draw from
  seeded banks (scores drawn first so they stay deterministic).
- makeSelfCritique / make_self_critique: the fixed reread/doubt/stakes stitching
  sentences now vary per round + target.
- makeStressReport / make_stress_report: the break/claim/attack/feasibility/citation
  sentences vary per hyp + round (verdict token still seeded separately for
  report<->ranking consistency).
- makeOverview / make_overview: every top-level section and per-proposal block
  drawn from banks, seeded per session (proposal ids) so two runs of the same goal
  read differently; per-proposal streams keep blocks distinct. Prose genericised so
  it fits any domain, not just wet-lab.
- Match rationales varied (engine.ts, simulator.py, seed.py).

Domain-aware Python hypotheses: ported the TS DOMAINS table / keyword extraction /
title scaffolds into webapp/content.py so a non-biomedical goal (e.g. a reasoning
method) yields on-topic hypotheses instead of drug/pathway mad-libs. make_plan now
reports the inferred domain. Enriched both DOMAINS tables (reasoning/LLM terms →
computing; inflammation/senescence → biomedicine).

Per-idea citations: browser overviewRefs now consumes each proposal's real
citations (was re-sampling random curated papers — a bug), deduped like the Python
_overview_refs, and markers are spread across the claim / why / experiment
sentences. Overview, drawer and per-proposal donut now cite the SAME papers.
Framing/summary/landscape/comparative/recommended/open-questions stay UNCITED
(Co-Scientist synthesis). Groq-prose path stays honestly uncited.

Simulated thinking: each sim hypothesis gets varied seeded reasoning (distinct per
hyp), threaded through engine.ts (PlanHyp/hypContent/addHyp/toHypothesis) and the
Python store (hyp_thinking side table, read in get_hypothesis). Groq GenHyp gains a
real `reasoning` field (prompt + parse) that flows into thinking for BYOK hyps.
types.ts Hypothesis + PlanHyp gain optional thinking.

Verified: npm run build green; pytest co_scientist/tests/unit -q (276 passed);
ruff adds no new errors; server E2E — two same-goal runs differ in prose while
headings match, per-proposal [n] resolve to References, framing uncited,
hypotheses on-topic, hypotheses carry distinct thinking.

Co-Authored-By: Claude Fable 5 <[email protected]>
…e table

When this lands alongside the engine-thinking-capture work (which stores
thinking as a column on the hypotheses table), get_hypothesis must prefer
that column and fall back to the sim's hyp_thinking side table, so both
real-engine and simulated reasoning reach the drawer.

Co-Authored-By: Claude Fable 5 <[email protected]>
@duckyquang
duckyquang merged commit 4767331 into main Jul 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant