Skip to content

Enhance agent memory persistence and Ollama resilience#119

Merged
pikpikcu merged 3 commits into
mainfrom
pikpikcu/airecon
Apr 23, 2026
Merged

Enhance agent memory persistence and Ollama resilience#119
pikpikcu merged 3 commits into
mainfrom
pikpikcu/airecon

Conversation

@pikpikcu

Copy link
Copy Markdown
Owner

No description provided.

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 pikpikcu merged commit 0d9ab87 into main Apr 23, 2026
4 checks passed
pikpikcu added a commit that referenced this pull request Jun 20, 2026
Enhance agent memory persistence and Ollama resilience
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.

1 participant