Skip to content

R3: Message compaction after iteration 5 #12

Description

@VarunGitGood

Problem

The ReAct loop in repi/investigation/react_loop.py lets the message history grow monotonically. By iteration 8+, the LLM is reasoning over many old observations it no longer needs — cost rises and signal-to-noise drops.

Scope

  • After iteration 5, summarize observations from steps 1..N-3 into a single "findings so far" assistant message.
  • Keep the most recent 3 raw observations un-summarized so the model still has fresh context.
  • The summary must preserve every chunk_id referenced in the collapsed steps, so the final-answer grounding validator still passes.

Acceptance

  • Token usage per investigation drops measurably on the longer eval scenarios.
  • Final-answer chunk_id grounding still passes validation in investigation/schema.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    react-qualityReAct loop reasoning improvements

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions