hermes-agent/agent
teknium1 32c89fed18 feat: configurable custom compaction prompt for context compression
Add a compression.prompt config option that lets users override the
default summarization prompt used during context compression.

What changes:

1. ContextCompressor.__init__() accepts compaction_prompt_override param.
   When set (non-empty string), it replaces the default summarization
   instructions in _generate_summary(). The framing (token target, turns
   to summarize, [CONTEXT SUMMARY]: prefix instruction) stays the same.

2. run_agent.py reads CONTEXT_COMPRESSION_PROMPT env var and passes it
   to ContextCompressor.

3. Config wiring — the new 'prompt' key under 'compression' section is
   mapped to CONTEXT_COMPRESSION_PROMPT env var in:
   - cli.py (load_cli_config defaults + env mapping)
   - hermes_cli/config.py (DEFAULT_CONFIG + show_config display)
   - gateway/run.py (gateway env mapping)

Usage in config.yaml:
  compression:
    prompt: 'Your custom summarization instructions here'

Or via environment variable:
  CONTEXT_COMPRESSION_PROMPT='Your custom instructions'

When empty (default), the built-in summarization prompt is used
unchanged. This gives power users control over how context is
compressed without modifying source code.

Inspired by PR #776 by @kshitijk4poor and the research in #499.
2026-03-11 05:45:24 -07:00
..
__init__.py Refactor Terminal and AIAgent cleanup 2026-02-21 22:31:43 -08:00
auxiliary_client.py fix: vision auto-detection now falls back to custom/local endpoints 2026-03-09 15:36:19 -07:00
context_compressor.py feat: configurable custom compaction prompt for context compression 2026-03-11 05:45:24 -07:00
display.py fix: replace silent exception swallowing with debug logging across tools 2026-03-10 06:59:20 -07:00
insights.py chore: add GLM/Kimi/MiniMax models to insights pricing (zero cost) 2026-03-06 19:12:14 -08:00
model_metadata.py chore: add context lengths for Kimi and MiniMax models 2026-03-06 19:01:38 -08:00
prompt_builder.py fix: replace silent exception swallowing with debug logging across tools 2026-03-10 06:59:20 -07:00
prompt_caching.py Refactor Terminal and AIAgent cleanup 2026-02-21 22:31:43 -08:00
redact.py Merge PR #713: docs: clarify Telegram token regex constraint 2026-03-10 16:59:54 -07:00
skill_commands.py feat: platform-conditional skill loading + Apple/macOS skills 2026-03-07 00:47:54 -08:00
trajectory.py Refactor Terminal and AIAgent cleanup 2026-02-21 22:31:43 -08:00