Skip to content

feat: improve context compaction handoff summaries#1273

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-3702edad
Mar 14, 2026
Merged

feat: improve context compaction handoff summaries#1273
teknium1 merged 1 commit into
mainfrom
hermes/hermes-3702edad

Conversation

@teknium1

@teknium1 teknium1 commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • adapt the core idea from feat: Codex-style handoff prefix for compressed context summaries #916 onto current main's call_llm-based context compressor
  • replace the old bare context-summary marker with a clearer handoff wrapper that explains earlier work may already be reflected in current session state
  • update the compaction summarization prompt to produce resume-oriented handoff summaries and add normalization/tests for legacy and current prefixes

Test plan

  • python -m pytest tests/agent/test_context_compressor.py tests/test_413_compression.py -n0 -q
  • python -m pytest tests/ -n0 -q
  • python -m hermes_cli.main chat -q 'Say hi in one word.'

Refs #916

Adapt PR #916 onto current main by replacing the old context summary marker
with a clearer handoff wrapper, updating the summarization prompt for
resume-oriented summaries, and preserving the current call_llm-based
compression path.
@teknium1 teknium1 merged commit 5c479ee into main Mar 14, 2026
1 check passed
Sarge-Reaper added a commit to Sarge-Reaper/hermes-agent that referenced this pull request Mar 24, 2026
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 NousResearch#705, NousResearch#1273, and context drift from lossy summarization.
Score improved 3.6% (0.6346 → 0.6572).
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
Adapt PR NousResearch#916 onto current main by replacing the old context summary marker
with a clearer handoff wrapper, updating the summarization prompt for
resume-oriented summaries, and preserving the current call_llm-based
compression path.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
Adapt PR NousResearch#916 onto current main by replacing the old context summary marker
with a clearer handoff wrapper, updating the summarization prompt for
resume-oriented summaries, and preserving the current call_llm-based
compression path.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
Adapt PR NousResearch#916 onto current main by replacing the old context summary marker
with a clearer handoff wrapper, updating the summarization prompt for
resume-oriented summaries, and preserving the current call_llm-based
compression path.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
Adapt PR NousResearch#916 onto current main by replacing the old context summary marker
with a clearer handoff wrapper, updating the summarization prompt for
resume-oriented summaries, and preserving the current call_llm-based
compression path.
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