Bug Description
When context.engine: lcm is configured and hermes-lcm is the active context engine, the CLI status bar displays ctx -- with an empty progress bar ([░░░░░░░░░░]) instead of the actual context fill percentage. The bar never shows meaningful data, even after the first API response.
⚕ minimax-m2.7 │ ctx -- │ [░░░░░░░░░░] -- │ 9m
References
run_agent.py:~1306 — plugin engine initialization (fix location)
run_agent.py:~1550 — switch_model path (reference for correct pattern)
run_agent.py:~1340 — on_session_start call site with broken kwargs fallback
plugins/context_engine/lcm/engine.py — LCMEngine (affected plugin)
Steps to Reproduce
- Install hermes-lcm into
~/.hermes/hermes-agent/plugins/context_engine/lcm/
- Configure
context.engine: lcm in ~/.hermes/config.yaml
- Start a new Hermes CLI session:
hermes
- Observe the status bar — it shows
ctx -- with [░░░░░░░░░░] even after sending message
Expected Behavior
Context size and usage updates after api calls
minimax-m2.7 │ 101K/204.8K │ [█████░░░░░] 50% │ 53m
Actual Behavior
Status bar (broken):
⚕ minimax-m2.7 │ ctx -- │ [░░░░░░░░░░] -- │ 9m
Affected Component
CLI (interactive chat)
Messaging Platform (if gateway-related)
No response
Operating System
Debian 13
Python Version
3.13.5
Hermes Version
latest
Relevant Logs / Traceback
Root Cause Analysis (optional)
In run_agent.py, the built-in ContextCompressor resolves context_length in its __init__ by calling get_model_context_length():
# run_agent.py — built-in path (works correctly)
self.context_compressor = ContextCompressor(
model=self.model,
context_length=get_model_context_length(...), # ← resolves here
...
)
However, external (plugin) context engines are instantiated via a different path that skips this:
# run_agent.py — plugin engine path (broken)
_selected_engine = load_context_engine(engine_name)
self.context_compressor = _selected_engine # ← no context_length set!
on_session_start() is called later with context_length=getattr(self.context_compressor, "context_length", 0) — but since update_model was never called on the plugin engine, context_length is 0. The status bar's calculation context_tokens / context_length * 100 produces 0 / 0 = None → ctx --.
Proposed Fix (optional)
In run_agent.py (~line 1306), immediately after loading an external context engine, call update_model() with the resolved context_length:
_selected_engine = load_context_engine(engine_name)
self.context_compressor = _selected_engine
if not self.quiet_mode:
logger.info("Using context engine: %s", _selected_engine.name)
# FIX: Resolve context_length for external engines
from agent.model_metadata import get_model_context_length
_init_ctx_len = get_model_context_length(
self.model,
base_url=self.base_url,
api_key=getattr(self, "api_key", ""),
config_context_length=_config_context_length,
provider=self.provider,
)
self.context_compressor.update_model(
model=self.model,
context_length=_init_ctx_len,
base_url=self.base_url,
api_key=getattr(self, "api_key", ""),
provider=self.provider,
)
This mirrors what switch_model already does correctly. After the fix, the status bar shows the correct context_length from session start.
Are you willing to submit a PR for this?
Bug Description
When
context.engine: lcmis configured and hermes-lcm is the active context engine, the CLI status bar displaysctx --with an empty progress bar ([░░░░░░░░░░]) instead of the actual context fill percentage. The bar never shows meaningful data, even after the first API response.References
run_agent.py:~1306— plugin engine initialization (fix location)run_agent.py:~1550—switch_modelpath (reference for correct pattern)run_agent.py:~1340—on_session_startcall site with broken kwargs fallbackplugins/context_engine/lcm/engine.py— LCMEngine (affected plugin)Steps to Reproduce
~/.hermes/hermes-agent/plugins/context_engine/lcm/context.engine: lcmin~/.hermes/config.yamlhermesctx --with[░░░░░░░░░░]even after sending messageExpected Behavior
Context size and usage updates after api calls
minimax-m2.7 │ 101K/204.8K │ [█████░░░░░] 50% │ 53m
Actual Behavior
Status bar (broken):
Affected Component
CLI (interactive chat)
Messaging Platform (if gateway-related)
No response
Operating System
Debian 13
Python Version
3.13.5
Hermes Version
latest
Relevant Logs / Traceback
Root Cause Analysis (optional)
In
run_agent.py, the built-inContextCompressorresolvescontext_lengthin its__init__by callingget_model_context_length():However, external (plugin) context engines are instantiated via a different path that skips this:
on_session_start()is called later withcontext_length=getattr(self.context_compressor, "context_length", 0)— but sinceupdate_modelwas never called on the plugin engine,context_lengthis 0. The status bar's calculationcontext_tokens / context_length * 100produces0 / 0 = None→ctx --.Proposed Fix (optional)
In
run_agent.py(~line 1306), immediately after loading an external context engine, callupdate_model()with the resolvedcontext_length:This mirrors what
switch_modelalready does correctly. After the fix, the status bar shows the correctcontext_lengthfrom session start.Are you willing to submit a PR for this?