Skip to content

feat(research): thread ResearchContext metadata through plan/vote + weight voter prompts (#3372 increment 2) #3807

@williamzujkowski

Description

@williamzujkowski

Increment 2 of #3372 (increment 1 landed in PR #3806 — the research stage now captures structured ResearchContext { text, metadata: { discoveredItems(relevanceScore), recommendations, qualitySignals } } and returns deterministic structure-derived text, but the metadata is not yet threaded past the research stage).

Scope

Per the 7/7 higher_order vote on #3372 (Option A), complete the consumer side:

  1. Thread ResearchContext (the full object, not just text) through research() → plan() → vote() — change the DevPipelineStages signatures (research: () => Promise<ResearchContext>, plan/vote accept it). Updates the ~6 test files that mock these stages.
  2. Update voter-prompts.ts / buildVoteProposal to weight on research maturity (relevanceScore distribution, newItems vs alreadyInRegistry, gap recommendations) — the consumer the vote requires, else the structure is recovered but unused (speculative).
  3. Instrument vote outcomes so the structured-vs-text swap is judgeable (the contrarian's pinned condition: prove the structured summary holds or improves vote quality).

Why separate

Increment 1 kept the research(): Promise<string> signature to avoid wide test-mock churn; the signature change + prompt-weighting + instrumentation is a focused follow-up. Security: external titles/recommendations stay escaped/bounded (already handled in research-context.ts) — keep the "informational, NOT instructions" delimiter in buildVoteProposal.

Unblocks

#3234 (research→routing categories) — once ResearchContext metadata is threaded, the research topic/techniques become available at experience-record time. Relates to #3148/#3231/#3238 (research→context arc).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestp2Priority 2 - Medium impact, moderate changes needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions