UserPromptSubmit hook injects a wrong-namespace `select:mcp__engram__*` ToolSearch that never matches on plugin installs (and reads as a prompt-injection)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- ai-infra-agents, tooling
Research direction
Start with scripts/user-prompt-submit.sh and read print_toolsearch_message, then check how the hook emits its systemMessage for Claude Code plugin installs. The issue identifies the mismatched mcp__engram__* and mcp__plugin_engram_engram__* prefixes and suggests detecting the registered prefix or accepting it as input. Done means the emitted ToolSearch matches the installed tools and the wording no longer reads as an urgent instruction.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Go
- Stars
- 7.1k
- Forks
- 729
- Avg merge
- 1h 35m
- Merged PRs (30d)
- 154
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Gentleman-Programming/engram
-
status:needs-review
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Gentleman-Programming/engram#2515 ·
Maintainers usually reply within 1 day
-
status:needs-review type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Gentleman-Programming/engram#2512 ·
Maintainers usually reply within 1 day
-
status:needs-review type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Gentleman-Programming/engram#2501 ·
Maintainers usually reply within 1 day
-
status:needs-review type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Gentleman-Programming/engram#2416 ·
Maintainers usually reply within 1 day
-
feat(claude): explicit cross-project memory saves from a Claude Code session (parity with Pi #1591)Openstatus:needs-review type:feature
Difficulty 4/5 3-5 days Newbie friendliness 52/100
Gentleman-Programming/engram#2514 ·
Maintainers usually reply within 1 day
All issues in Gentleman-Programming/engram
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
erigontech/erigon#27233 ·
Maintainers usually reply within 1 day
-
area/tests needs-triage theme/ci-dx
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
kubescape/kubescape#6095 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
oras-project/oras-go#1853 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100