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.
Problem
The ReAct loop in
repi/investigation/react_loop.pylets 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
1..N-3into a single "findings so far" assistant message.chunk_idreferenced in the collapsed steps, so the final-answer grounding validator still passes.Acceptance
investigation/schema.py.