Skip to content

Conversation

@jmacAJ
Copy link
Contributor

@jmacAJ jmacAJ commented Dec 29, 2025

This pull request introduces a new chat history compression system and improves memory and tool call management across the entity agent system. The most significant change is the addition of a robust chat history compression pathway that preserves citations, URLs, and critical context, ensuring downstream tasks can continue seamlessly. Additionally, it introduces safety checks for memory usage and enforces tool call limits to prevent resource overuse.

Chat history compression:

  • Added sys_compress_chat_history.js, a new pathway that compresses chat history while preserving essential information, including user requests, tool calls/results, exact data (numbers, URLs, citations), and conversation context. The implementation extracts and validates citations/URLs, formats chat history for LLM prompts, and logs preservation rates.

Tool call management:

  • Updated sys_entity_agent.js to enforce a limit on the number of tool calls executed per run, preventing the system from exceeding the maximum allowed tool calls and logging a warning if the limit is reached.

Memory management:

  • Updated sys_memory_manager.js to immediately skip memory operations if useMemory is explicitly set to false, improving efficiency and configurability.

- Introduced a new pathway for compressing chat history while preserving critical information, citations, and context.
- Added functionality to intelligently summarize tool calls and results, ensuring that essential data such as URLs, file names, and exact figures are retained.
- Implemented error handling to provide fallback summaries in case of compression failures.
- Created integration tests to validate compression quality and retention of key information.
- Developed a comprehensive guide for testing compression quality and metrics tracking.
…summaries

- Introduced a new pathway to synthesize tool calls and results into structured research summaries, preserving citations and key findings.
- Enhanced chat history management by validating and reconstructing messages to ensure no orphaned tool results remain.
- Implemented pre-request token checks to optimize chat history compression before model requests.
- Added comprehensive integration tests to validate the functionality and accuracy of the summarization process, ensuring proper extraction and preservation of URLs and citations.
- Improved error handling to provide fallback summaries in case of summarization failures.
@jmacAJ jmacAJ marked this pull request as draft December 29, 2025 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants