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.
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| auxiliary_client.py | ||
| context_compressor.py | ||
| display.py | ||
| insights.py | ||
| model_metadata.py | ||
| prompt_builder.py | ||
| prompt_caching.py | ||
| redact.py | ||
| skill_commands.py | ||
| trajectory.py | ||