Commit 6bd4b57
fix: use cached raw user message as auto-recall query to avoid channel metadata noise (#579)
On Slack, `event.prompt` in the `before_prompt_build` hook includes
Conversation info JSON metadata (message_id, sender_id, conversation_label,
etc.) prepended by the platform adapter. This metadata pollutes the embedding
vector, causing irrelevant memories to score higher during auto-recall.
The `gatingText` variable (used for skip/greeting detection) was already
correctly using `lastRawUserMessage.get(cacheKey)` — the clean user text
cached during `message_received`. However, the actual `recallQuery` passed
to `retrieveWithRetry()` still used `event.prompt` directly, so the
retrieval itself was still affected by the noise.
This fix applies the same pattern to `recallQuery`: prefer the cached raw
user message, falling back to `event.prompt` for non-channel triggers or
when no cached message is available.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent c035e98 commit 6bd4b57
1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2263 | 2263 | | |
2264 | 2264 | | |
2265 | 2265 | | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
2266 | 2271 | | |
2267 | 2272 | | |
2268 | 2273 | | |
2269 | | - | |
| 2274 | + | |
2270 | 2275 | | |
2271 | 2276 | | |
2272 | 2277 | | |
| |||
0 commit comments