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

Aperta
#7,249 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
53/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
45.2k
Fork
5.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vectorize-io/hindsight

Tutte le issue di vectorize-io/hindsight

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.