Filter the LLM's declared citations (from the terminal done tool's args) down
to those that were actually retrieved during the reflect loop .
The agentic path previously cited EVERY retrieved id (process-dict accumulation)
— over-citation. With the terminal done tool (llm_core terminal_tool), the
model declares which ids it actually used; we keep only the intersection with
what was retrieved. This drops both over-citation (retrieved but not cited) and
hallucinated citations (cited but never retrieved), mirroring Hindsight's
done-tool id filter.
Summary
Types
Retrieved grounding ids, per tier (string ids).
Functions
Select the cited ids per tier, keeping only ids present in retrieved.
Types
Functions
Select the cited ids per tier, keeping only ids present in retrieved.
terminal_args is the raw done tool arguments (string keys
"memory_ids" / "observation_ids" / "mental_model_ids"). Results preserve
the retrieved order (deterministic, aligns with based_on).