Enhance agent memory persistence and Ollama resilience#119
Merged
Conversation
Key improvements to loop_context.py and config.py so the agent retains more useful context across 100+ iteration sessions: - _MAX_TOOL_RESULT_CHARS: 3K → 12K — tool outputs (nmap, nuclei, etc.) now pass enough data for the LLM to reason without being truncated - Char budget ratio: 0.35 → 0.55 — compression triggers later, letting more genuine conversation history accumulate before eviction - Fast-truncation keep window: 6 → 14 non-system messages — fewer older tool results get thrown away on each compression cycle - _compress_old_tool_outputs keep_window: aggressive 4→8, normal 8→14 - _drop_stale_tool_results window: 5 → 12 recent messages protected - _build_compressed_findings_summary: compression_summary cap 700→1800, high-value evidence 5→15 entries, new medium-value evidence section (severity≥3 + confidence≥0.55) so mid-severity findings survive - _call_compression_llm: _PER_MSG_CAP 350→700 chars/msg, now uses agent_llm_compression_num_ctx and agent_llm_compression_num_predict from config instead of hardcoded values; adds Injection Points section - Config defaults: llm_compression_num_ctx 4096→8192, num_predict 512→1536, uncompressed_keep_count 10→20 - Import _get_context_limits in loop_context.py so compression LLM call actually reads the configured num_ctx/num_predict values Test update: test_budget_uses_runtime_num_predict_when_provided now asserts on total chars (correct) rather than message count (fragile — truncate_conversation inserts a separator message on drop, keeping count equal while chars decrease).
pikpikcu
added a commit
that referenced
this pull request
Jun 20, 2026
Enhance agent memory persistence and Ollama resilience
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.