feat(compression): optimize context compressor via autoresearch - #2866
feat(compression): optimize context compressor via autoresearch#2866SSGREAPER wants to merge 14 commits into
Conversation
…le; gitignore local plans and ported skills
… prevent Pydantic validation errors
…wen-3-235b, llama3.1-8b)
Applied Karpathy's autoresearch pattern to autonomously optimize the context compressor. 50 experiments run, 8 improvements kept. - _SUMMARY_RATIO 0.20 → 0.30 (more budget for summaries) - _MIN_SUMMARY_TOKENS 2000 → 500 (no inflation on short conversations) - _MAX_SUMMARY_TOKENS 8000 → 4000 (tighter cap) - _DEFAULT_TAIL_TOKEN_BUDGET 20000 → 8000 (more aggressive compression) - Truncation 3000 → 4500 chars (retains more tool output) - Regex file path pre-extraction with "MUST appear in summary" - Template restructured: Relevant Files + Critical Context moved up - MANDATORY PRESERVATION RULES added to both prompts Addresses #705, #1273, and context drift from lossy summarization. Score improved 3.6% (0.6346 → 0.6572).
|
Closing this PR: 1. PR is unmergeable. 1,733 files changed, 280K+ additions — the branch includes 13 unrelated commits (MCP errors, Cerebras/Groq providers, gateway fixes, lock files) on top of the compressor change. GitHub can't even render the diff. The actual compressor change is 1 commit in 1 file, buried under everything else. 2. Compression tuning changes are risky without real-world validation. The autoresearch loop optimized against its own synthetic evaluation metric — that's circular. A 3.6% composite score improvement on a synthetic benchmark doesn't justify changing defaults that affect every user's compression behavior. Specifically:
3. Some ideas have merit. The file path pre-extraction regex and mandatory preservation rules for error messages/commands are worth exploring — but as a separate, clean PR with real-world testing on long gateway sessions, not as autoresearch-tuned constants. If you want to resubmit the compressor changes, please open a PR with only the |
Summary
Applied Karpathy's autoresearch pattern to autonomously optimize the context compressor. An agent loop ran 50 experiments, evaluating each change against a composite metric (info retention, compression ratio, structural integrity, test regression). 8 improvements were kept.
Changes discovered by the autoresearch loop:
_SUMMARY_RATIO0.20 → 0.30 (50% more budget for summaries)Issues addressed
Metrics (composite score 0–1, higher is better)
Test plan
test_compression_boundary.py,test_context_compressor.py)🤖 Generated with Claude Code + autoresearch