|
compression: profile-aware worker + real-token baseline estimator
Item 2 — thread the active profile into CompressionWorker so compress_context applies per-profile overrides (compression_keep_recent, compression_max_tokens, compression_prompt_file). navi_code now compresses with keep_recent=12 instead of the global 8. Item 1 — estimate the next LLM call's context from the *real* prompt_tokens of the previous call (bulk) plus a heuristic delta for messages appended since, replacing the chars//3 estimate that undercounts code-heavy tool output and fired midturn compression too late (Navi kept working until the window was exhausted). Baseline is recorded after each stream and cleared after compression; check_context_size and the midturn gate use it, with a heuristic fallback when no baseline exists or the context shrank. Co-Authored-By: Claude <noreply@anthropic.com> |
|---|
|
|
| navi/core/agent.py |
|---|
| navi/core/compressor.py |
|---|
| navi/workers/base.py |
|---|
| navi/workers/compressor.py |
|---|
| tests/unit/core/test_compressor.py |
|---|