Skip to content

UserPromptSubmit hook injects wrong tool prefix when engram is installed as a plugin #534

Description

@JantonioFC

Summary

The UserPromptSubmit hook (scripts/user-prompt-submit.sh, function print_toolsearch_message) injects a ToolSearch select: instruction using the mcp__engram__* tool prefix. This is correct when engram is registered as a direct MCP server named engram, but wrong when engram is installed as a Claude Code plugin (e.g. via the engram@engram marketplace).

When installed as a plugin, the real tool names are prefixed mcp__plugin_engram_engram__*. As a result, the injected ToolSearch matches no tools, and the first-message memory bootstrap silently fails — the agent never loads mem_context, mem_save, etc. on the first turn.

Environment

  • Claude Code, engram installed as plugin (enabledPlugins: { "engram@engram": true })
  • engram plugin cache version 0.1.0
  • Linux

Steps to reproduce

  1. Install engram as a Claude Code plugin (not as a direct MCP server).
  2. Start a new session and send the first message.
  3. Observe the injected systemMessage: select:mcp__engram__mem_save,...
  4. The ToolSearch resolves to nothing because the actual tools are mcp__plugin_engram_engram__*.

Suggested fix

The hook should detect the installation mode (plugin vs direct MCP server) and emit the matching prefix — e.g. resolve the prefix dynamically, or fall back to a name-agnostic ToolSearch keyword query ("engram memory tools") instead of hardcoding select:mcp__engram__*.

Note

Hardcoding either prefix breaks the other install mode. A keyword-based ToolSearch or runtime detection would cover both.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions