Repository navigation
Fix MCP response format, FTS5 sanitization, and embedding caching - #12
Merged
Merged
Conversation
- Wrap tools/call responses in MCP CallToolResult content blocks
(server.py and stdio.py) so clients receive spec-compliant
{content: [{type: "text", text: ...}]} payloads
- Sanitize FTS5 queries by quoting tokens to prevent crashes on
metacharacters like ", *, AND, OR in bm25.py and memory store
- Cache EmbeddingModel and SentenceTransformer instances at module
level to avoid re-loading on every search query
- Update all test assertions to parse the new content wrapper
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The tools/call content wrapper introduced in the previous commit broke CLI admin commands (tokens create/list/remove, setup provisioning, and the openclaw_client helper) which read tool result fields directly. Unwrap the content block transparently in both _call_mcp helpers so all downstream callers continue to work. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add _process_duplicates: compares memory embeddings via cosine similarity within the same scope, with idempotency guards and model/dimension compatibility checks - Add _process_conflicts: detects slot+scope overlaps among active memories, appends to existing unresolved conflicts rather than creating duplicates, handles NULL scope_id with IS NULL semantics - Extract SentenceTransformer cache to shared public module (hoard.core.memory.model_cache) used by store.py and worker.py - Raise embed_memory job priority to 10 so embeddings are ready before detection jobs run (detection gracefully no-ops if missing) - Add write.duplicates.similarity_threshold config default (0.85) - Add 10 new tests covering detection, idempotency, missing embeddings, mismatched models, NULL scope_id, and conflict append behavior Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ired) Both _process_duplicates and _process_conflicts now filter the source memory through active_memory_conditions before proceeding, preventing creation of duplicate/conflict records for already-inactive memories. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cover all three inactive-memory paths (retracted, superseded, expired) for both duplicate and conflict detection, confirming each is a no-op. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tools/callresponse format: Wrap tool payloads in MCP-specCallToolResultwithcontentblocks ({content: [{type: "text", text: ...}]}), fixing both HTTP server and stdio transport",*,AND,OR, etc.) by quoting each token before passing toMATCH, preventing crashes on user input in both entity search and memory queryEmbeddingModelandSentenceTransformerinstances at module level to avoid expensive re-instantiation on every search queryTest plan
hoard search '"test" AND foo')result.content[0].textvia curl🤖 Generated with Claude Code