When the Consolidator compresses old session messages into history.jsonl,
those messages are immediately removed from the LLM's context. Dream
processes history.jsonl into long-term memory (memory.md) on a cron
schedule (default every 2h), creating a window where compressed content
is invisible to the LLM.
This change closes the gap by injecting unprocessed history entries
(history.jsonl entries not yet consumed by Dream) directly into the
system prompt as "# Recent History".
Key design notes:
- Uses read_unprocessed_history(since_cursor=last_dream_cursor) so only
entries not yet reflected in long-term memory are included, avoiding
duplication with memory.md
- No overlap with session messages: Consolidator advances
last_consolidated before returning, so archived messages are already
removed from get_history() output
- Token-safe: Consolidator's estimate_session_prompt_tokens calls
build_system_prompt via the same build_messages function, so the
injected entries are included in token budget calculations and will
trigger further consolidation if needed
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>