Skip to content

Research findings are paid for and thrown away — persist them as reusable context chunks #1963

Description

@macanderson

Problem

The pre-plan research stage (#1778, PR #1953) fans out read-only sub-agents whose answers are bounded and rendered into the planner prompt (crates/stella-pipeline/src/research.rs, pipeline/research_stage.rs) — then dropped with the turn. What survives is telemetry only: SubAgent brackets and ModelCallRole::Research calls in the session journal (store.db). Nothing reaches context.db.

A research child that just answered "where is X wired and what constrains it" produced exactly the kind of workspace fact the recall stage exists to serve. Today that knowledge is spent tokens with a one-turn lifetime; the next session re-derives it or plans without it.

What to build

Feed accepted research findings into the context plane as recallable chunks — most likely the episodic-memory ingest side of stella-context (the same substrate reflection mining writes to), tagged with provenance (research, the question asked, the goal that prompted it, workspace + commit identity) so recall fusion can rank and expire them honestly.

Design questions to settle before building:

  • Trust tier: research answers are a model's reading of the tree, not verified facts — they must not rank alongside verified memories without a provenance discount. Recall fusion already ranks by source; findings need their own source class.
  • Staleness: findings describe code at a commit; the staleness guard should ride the same observed discipline as other context records (see the staleness-guard conventions in stella-context).
  • Dedup: the same question asked across turns should refresh one chunk, not accumulate near-duplicates.
  • Where the write happens: the pipeline has no I/O of its own for this today; the write likely belongs behind a port the CLI wires (invariant 2 — no direct store calls from decision logic).

Verify

A pipeline run whose research stage produced findings leaves chunks queryable from context.db with research provenance; a later session's recall for a related goal surfaces them; a finding for a file since modified is marked stale rather than served fresh.

Constraints

  • crates/stella-pipeline/src/pipeline.rs and pipeline/tests.rs are god files closed to growth — wiring lands in siblings.
  • Byte-stable prompts (invariant 7): recalled research chunks ride the volatile recall path, never the stable prefix.
  • Zero telemetry egress (invariant 3) is unaffected — context.db is local.

Refs #1778, PR #1953.

Metadata

Metadata

Assignees

Labels

P2Polish — worth doing, not urgentarea:contextstella-context — graph, embeddings, memory, retrievalarea:pipelinestella-pipeline — triage→…→judge orchestrationfeatureNew capability or improvementgoal:enginePillar 4 — engine tuned and optimized: budget, wall-clock, resolve ratepain:token-efficiencyToken waste — redundant calls, bloated prompts, inefficient context/output useself-improvementGenuine self-improvement: stella making stella more capable

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions