Pre-Prompt Semantic Injection Pattern

Description

Architectural pattern where memory retrieval fires automatically on every user prompt via a UserPromptSubmit hook, injecting the top-N relevant memories as plain text before Claude processes the message. Contrasts with the native Claude Code model where Claude must decide to call an MCP search tool (consuming tool-definition tokens and risking non-retrieval). Eliminates the failure class of Claude 'not thinking to search' and removes tool-definition overhead from the context window.

Key claims

Relations

Sources

src-20260409-e32facfa1c9f