Hermes plugin: @url/@file attachments and tool-call arguments are still retained as the user's own words (follow-up to #6818)

Open
#7,249 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
53/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start with the Hermes plugin’s _build_turn_messages, _stub_attached_context, and _format_arguments, then check how on_pre_compress builds checkpoint messages. The issue reports 270 plugin tests passing with a local fix, but does not name the test files. Reproduce the extraction behavior with the stated payloads; done means attached content is not attributed to the user and tool-call arguments do not retain paths or commands.

Written by the indexing model from the issue text.

Description

integration:hermes

What happens

Follow-up to #6818, on Hermes plugin 2.0.0 with server 1.3.0. Two kinds of content still end up stored as the user's own words and actions.

1. @url: / @file: attachments are retained as the user's message. Hermes expands context references into the user message itself: agent/context_references.py appends --- Attached Context --- followed by one block per reference (🌐 @url:… (N tokens), 📄 @file:…, 📁, 📌, 🧾). sync_turn receives that expanded text as user_content, and _build_turn_messages sends it as User: …. Extraction then treats the attached page's first person as the user speaking. The #6818 note doesn't help here, because it only covers the tool message: this content arrives inside the user's own message.

Repro: attach the transcript of the video from #6818 (@url:https://www.youtube.com/watch?v=r0Mm_79yKso) with the message "audit this problem on our setup". Then call dry-run-extract on the payload the plugin builds, with its default context plus the relayed note. In my bank this returned 22 facts. About 20 of them gave the video creator's life to the user: "User's VPS runs 2 cores / 4 GB", "User tested space bunny", "User modified the Hindsight plugin", "User plans to keep using Hindsight".

2. The tool-call lines added in 2.0.0 produce facts about the agent's working files. _format_arguments sends key=value for every argument, cut to 120 characters. Extraction turns these into facts like "User's scratch directory is ~/.hermes/cache/scratch/fl" and "User's Hermes agent uses ~/.hermes/hermes-agent/venv/bin/python". In one bank, facts naming such paths went from 1.3% of new facts (144/11,228, 30 days before upgrading) to 6.3% (86/1,369, after).

What I measured (dry-run-extract, nothing stored)

Payload Facts Attached content credited to the user
Current plugin payload 22 ~20
+ an attribution rule in retain_custom_instructions 23 ~20
Attachment moved to its own attachment role + context note 23 ~8
Attachment replaced by a one-line reference 2 0 (and −85% input tokens)

This matches your finding in #6818 that hints in context or instructions don't override the narrator rule. Removing the content is the only fix I found that works on the plugin side.

Side finding: the extraction model matters more than the prompt. On 14 real chunks from agent sessions (2 runs each, same bank config), facts crediting the agent's own work to the user ("User researched/ran/found…") went from 13/25 of user-attributed facts on claude-haiku-4-5 to 4/11 on claude-haiku-5-5. Rewording the mission or custom instructions changed nothing measurable (5–8 vs 6–8).

Suggested fix (what I run locally, 270 plugin tests pass)

  • _stub_attached_context(user_content) in _build_turn_messages (and on user messages in the on_pre_compress checkpoint). Keep the user's typed text, drop --- Context Warnings ---, and replace everything after --- Attached Context --- with [The User attached @url:…, @file:…; its content was written by its own author and is not retained here.]. The reference names come from the block header lines. A retain_attached_context setting (default false) turns this off.
  • _format_arguments keeps only https?:// addresses found in the arguments (de-duplicated, at most 3), so a line reads Tool call: web_fetch(https://…) or Tool call: terminal(). Fetch provenance is kept, and paths, commands and file bodies are dropped.

Hermes core already strips the same block for session titles (agent/title_generator.py, _CONTEXT_FOOTER_RE), so a core-side option would also work: pass the unexpanded message (ContextReferenceResult.original_message) to memory providers.

Environment: Hermes Agent (current main), hindsight-hermes 2.0.0, Hindsight server 1.3.0 (Docker), retain on claude-haiku-4-5 through an OpenAI-compatible proxy.

Dominant language
Python
Stars
45.2k
Forks
5.9k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vectorize-io/hindsight

All issues in vectorize-io/hindsight

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.