Bug Description
When a user sends a photo via Telegram, the gateway auto-analyzes it with _enrich_message_with_vision() (gateway/run.py). The description returned by the auxiliary vision LLM sometimes includes a trailing ## Honcho Context block — which then becomes visible to the user as part of the bot's response or is injected into the enriched message text that the agent receives.
The ## Honcho Context\n{result} string is generated in plugins/memory/honcho/__init__.py:483 as a system-prompt injection for the main agent. However, the auxiliary LLM used for vision analysis appears to be called with a system prompt that includes this Honcho memory block, causing the model to echo it back in its output.
Steps to Reproduce
- Have Honcho memory plugin configured and active (hybrid mode)
- Send a photo via Telegram
- The
## Honcho Context text (Honcho's dialectic memory synthesis response) appears at the bottom of the image description in the enriched message — visible to the user
Actual Behavior
The [The user sent an image~ Here's what I can see: ... ## Honcho Context\n...] block leaks Honcho memory text into user-visible messages. The user sees something like:
## Honcho Context
I'd be happy to help investigate and fix a bug, but I need more information. Could you please provide details about:
1. What bug are you referring to?...
Expected Behavior
The vision analysis description should contain ONLY the image description. The ## Honcho Context block is intended solely for system prompt injection into the main agent — it should never appear in vision analysis output or be visible to the user.
Root Cause Analysis
The auxiliary vision LLM call chain:
gateway/run.py:_enrich_message_with_vision() → tools/vision_tools.py:vision_analyze_tool()
...appears to be using a system prompt that includes the Honcho memory injection. The Honcho prefetch_all() result (formatted as ## Honcho Context\n{result}) is included in the auxiliary model's context, causing it to leak into the image description output.
In run_agent.py lines 6737-6740, _ext_prefetch_cache is appended to the user message for the API call. If the vision tool is invoked in a context where this injection is present, it carries into the auxiliary LLM response.
Proposed Fix
Option 1 (correct fix): In agent/auxiliary_client.py, ensure vision analysis calls use a clean, minimal system prompt with NO memory plugin injection. Auxiliary LLM calls (vision, summarization, compression) should be completely isolated from the Honcho/memory system prompt block.
Option 2 (defensive fallback): In gateway/run.py:_enrich_message_with_vision(), strip any text at or after a ## Honcho Context marker from the vision description before using it.
Files Involved
gateway/run.py — _enrich_message_with_vision() at line ~5048
tools/vision_tools.py — vision_analyze_tool() at line 264
agent/auxiliary_client.py — auxiliary LLM client used for vision calls
plugins/memory/honcho/__init__.py — line 483 generates the ## Honcho Context\n string
run_agent.py — lines 6737-6740 inject _ext_prefetch_cache into user message for API call
Environment
- Platform: Telegram gateway
- Memory plugin: Honcho (hybrid mode — auto-inject + tools)
Bug Description
When a user sends a photo via Telegram, the gateway auto-analyzes it with
_enrich_message_with_vision()(gateway/run.py). The description returned by the auxiliary vision LLM sometimes includes a trailing## Honcho Contextblock — which then becomes visible to the user as part of the bot's response or is injected into the enriched message text that the agent receives.The
## Honcho Context\n{result}string is generated inplugins/memory/honcho/__init__.py:483as a system-prompt injection for the main agent. However, the auxiliary LLM used for vision analysis appears to be called with a system prompt that includes this Honcho memory block, causing the model to echo it back in its output.Steps to Reproduce
## Honcho Contexttext (Honcho's dialectic memory synthesis response) appears at the bottom of the image description in the enriched message — visible to the userActual Behavior
The
[The user sent an image~ Here's what I can see: ... ## Honcho Context\n...]block leaks Honcho memory text into user-visible messages. The user sees something like:Expected Behavior
The vision analysis description should contain ONLY the image description. The
## Honcho Contextblock is intended solely for system prompt injection into the main agent — it should never appear in vision analysis output or be visible to the user.Root Cause Analysis
The auxiliary vision LLM call chain:
gateway/run.py:_enrich_message_with_vision()→tools/vision_tools.py:vision_analyze_tool()...appears to be using a system prompt that includes the Honcho memory injection. The Honcho
prefetch_all()result (formatted as## Honcho Context\n{result}) is included in the auxiliary model's context, causing it to leak into the image description output.In
run_agent.pylines 6737-6740,_ext_prefetch_cacheis appended to the user message for the API call. If the vision tool is invoked in a context where this injection is present, it carries into the auxiliary LLM response.Proposed Fix
Option 1 (correct fix): In
agent/auxiliary_client.py, ensure vision analysis calls use a clean, minimal system prompt with NO memory plugin injection. Auxiliary LLM calls (vision, summarization, compression) should be completely isolated from the Honcho/memory system prompt block.Option 2 (defensive fallback): In
gateway/run.py:_enrich_message_with_vision(), strip any text at or after a## Honcho Contextmarker from the vision description before using it.Files Involved
gateway/run.py—_enrich_message_with_vision()at line ~5048tools/vision_tools.py—vision_analyze_tool()at line 264agent/auxiliary_client.py— auxiliary LLM client used for vision callsplugins/memory/honcho/__init__.py— line 483 generates the## Honcho Context\nstringrun_agent.py— lines 6737-6740 inject_ext_prefetch_cacheinto user message for API callEnvironment