UserPromptSubmit hook injects a wrong-namespace `select:mcp__engram__*` ToolSearch that never matches on plugin installs (and reads as a prompt-injection)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 74/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- ai-infra-agents, tooling
Direzione di ricerca
Inizia da scripts/user-prompt-submit.sh e leggi print_toolsearch_message. Poi verifica come l’hook emette il suo systemMessage nelle installazioni del plugin Claude Code. L’issue segnala i prefissi non corrispondenti mcp__engram__* e mcp__plugin_engram_engram__* e suggerisce di rilevare il prefisso registrato o accettarlo come input. Il lavoro è completato quando il ToolSearch emesso corrisponde agli strumenti installati e la formulazione non sembra più un’istruzione urgente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
The UserPromptSubmit hook (scripts/user-prompt-submit.sh, print_toolsearch_message) injects a systemMessage instructing the agent to run:
select:mcp__engram__mem_save,mcp__engram__mem_search,mcp__engram__mem_context, … ,mcp__engram__mem_judge
When Engram is installed as a Claude Code plugin, this never matches, because Claude Code namespaces plugin-provided MCP tools as:
mcp__plugin_<marketplace>_<server>__<tool>
So the engram tools actually register as mcp__plugin_engram_engram__mem_save, …__mem_search, etc. — not mcp__engram__mem_save. The select:mcp__engram__* ToolSearch therefore matches zero tools and loads nothing.
Impact
- The ToolSearch is a no-op on plugin installs — the tools it's trying to force-load are either already available (core tools) or are never loaded by this hook. The feature silently does nothing.
- The message reads as a prompt-injection. The hardcoded wording —
CRITICAL FIRST ACTION — Execute this ToolSearch NOW before responding to the user— surfaces to the end user as asystemMessageon the first prompt of every session, in every project. To a security-conscious user (or an agent trained to resist injection) it looks exactly like an injected instruction: urgent, imperative, "do this NOW before responding", referencing tool names that don't exist in the current namespace. It caused real alarm for us until we traced it to the plugin itself.
Root cause
print_toolsearch_message() hardcodes the bare mcp__engram__* namespace, which only holds if the MCP server is registered at the user/project level with server name engram. For the plugin distribution the correct namespace is mcp__plugin_engram_engram__*.
Suggested fixes (either/both)
- Fix the namespace emitted by
print_toolsearch_messagefor plugin installs:mcp__plugin_engram_engram__*(or detect install type and choose). Better: query/accept the actual registered prefix rather than hardcoding. - Soften the wording. A
systemMessagethat says "Execute this ToolSearch NOW before responding" is indistinguishable from a hostile injection. Consider neutral phrasing (e.g. "Engram memory tools are available; load them if not already present") — or skip the message entirely when the core tools are already non-deferred/available.
Environment
- Engram installed as a Claude Code plugin (marketplace
engram, serverengram). - Observed tool namespace in-session:
mcp__plugin_engram_engram__*. - Hook:
scripts/user-prompt-submit.sh→print_toolsearch_message.
Happy to send a PR for the namespace detection if useful.
- Lingua principale
- Go
- Stelle
- 7.1k
- Fork
- 729
- Merge medio
- 2h 19m
- PR unite (30g)
- 167
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Gentleman-Programming/engram
-
status:needs-review type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Gentleman-Programming/engram#2512 ·
I maintainer di solito rispondono entro 1 giorno
-
status:needs-review type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Gentleman-Programming/engram#2501 ·
I maintainer di solito rispondono entro 1 giorno
-
status:needs-review type:feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Gentleman-Programming/engram#2416 ·
I maintainer di solito rispondono entro 1 giorno
-
status:needs-review type:bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 57/100
Gentleman-Programming/engram#2513 ·
I maintainer di solito rispondono entro 1 giorno
-
status:needs-review type:bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 63/100
Gentleman-Programming/engram#2511 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Gentleman-Programming/engram
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
AvengeMedia/DankMaterialShell#4490 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
stefanpejcic/OpenPanel#1415 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100