Skip to content

feat: MCP sync (13 tools) + dedup on insert + auto-aging - #449

Merged
ajianaz merged 1 commit into
developfrom
feat/mcp-sync-tools
Jun 22, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/mcp-sync-tools

Conversation

@ajianaz

@ajianaz ajianaz commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Changes

MCP Tools Sync (5 → 13)

All API server endpoints now have corresponding MCP tools:

  • uteke_search — FTS5 keyword search
  • uteke_doc_create / uteke_doc_get / uteke_doc_list / uteke_doc_search / uteke_doc_delete
  • uteke_graph — graph stats
  • uteke_room_recall — room-scoped semantic search

Dedup on Insert

  • check_duplicate() before insert: if cosine >= 0.95, return existing ID
  • Namespace-scoped, skips chunk: entries
  • 3 new tests: exact dup blocked, different content allowed, namespace isolation

Auto-Aging (Server)

  • Background thread runs aging_cleanup every 6 hours
  • Removes memories >180 days old with low access count
  • Best-effort: skips on lock contention

AGENT.md

  • New rule: MCP tools MUST sync with API endpoints before release

303 tests pass. Clippy clean. Fmt clean.

@github-actions

github-actions Bot commented Jun 22, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

❌ Blocked — critical issues found.

🔴 Error (3)

  • crates/uteke-server/src/main.rs:1588 — The new background worker sleeps for a full 6-hour interval before checking SHUTDOWN again: std::thread::sleep(interval); if SHUTDOWN.load(...) { break; }. If the process receives SIGINT shortly after the thread goes to sleep, shutdown will be delayed until that sleep finishes because the spawned thread is not coordinated with any wakeup mechanism.
  • crates/uteke-core/src/operations.rs:176 — In check_duplicate, self.index.try_read() returns Ok(None) on any lock acquisition failure: Err(_) => return Ok(None), // Don't block if locked. That means concurrent writes/readers can cause the dedup check to be skipped entirely, allowing duplicate memories to be inserted even when an identical embedding already exists.
  • crates/uteke-core/src/operations.rs:190 — When a namespace is provided, check_duplicate suppresses failures from self.store.memories_in_namespace(ns) by returning Ok(None). A storage/query error during filtering will therefore bypass deduplication and proceed to insert a new memory, which is incorrect behavior for an operation meant to prevent duplicates.

Review powered by cora-cli · BYOK · MIT


// Auto-aging background thread (#442 enhancement).
// Runs aging cleanup every 6 hours to remove cold, low-importance memories.
let aging_uteke = Arc::clone(&uteke);
@ajianaz
ajianaz force-pushed the feat/mcp-sync-tools branch from 697ac2f to 2014f2b Compare June 22, 2026 12:36
MCP Tools Sync (was 5, now 13):
- uteke_search, uteke_doc_create, uteke_doc_get, uteke_doc_list,
  uteke_doc_search, uteke_doc_delete, uteke_graph, uteke_room_recall
- All API server endpoints now have corresponding MCP tools

Dedup on Insert (#442 enhancement):
- check_duplicate() searches vector index for cosine >= 0.95
- Returns existing memory ID instead of creating a duplicate
- Namespace-scoped, skips chunk: prefixed entries
- 3 new tests: exact dup blocked, different content allowed,
  namespace isolation

Auto-Aging (server background thread):
- Runs aging_cleanup every 6 hours automatically
- Removes memories older than 180 days with <10K access count
- Best-effort: lock contention skips cycle silently

AGENT.md:
- Added rule: MCP tools MUST be in sync with API server endpoints
  before any release

303 tests pass. Clippy clean. Fmt clean.
@ajianaz
ajianaz force-pushed the feat/mcp-sync-tools branch from 2014f2b to e40eb1a Compare June 22, 2026 12:42
) -> Result<Option<String>, Error> {
const DEDUP_THRESHOLD: f32 = 0.95;

let index = match self.index.try_read() {

if results.is_empty() {
return Ok(None);
}
@ajianaz
ajianaz merged commit 91ca9ef into develop Jun 22, 2026
8 of 9 checks passed
@ajianaz
ajianaz deleted the feat/mcp-sync-tools branch June 22, 2026 12:45
ajianaz added a commit that referenced this pull request Aug 13, 2026
…ule (#449)

MCP Tools Sync (was 5, now 13):
- uteke_search, uteke_doc_create, uteke_doc_get, uteke_doc_list,
  uteke_doc_search, uteke_doc_delete, uteke_graph, uteke_room_recall
- All API server endpoints now have corresponding MCP tools

Dedup on Insert (#442 enhancement):
- check_duplicate() searches vector index for cosine >= 0.95
- Returns existing memory ID instead of creating a duplicate
- Namespace-scoped, skips chunk: prefixed entries
- 3 new tests: exact dup blocked, different content allowed,
  namespace isolation

Auto-Aging (server background thread):
- Runs aging_cleanup every 6 hours automatically
- Removes memories older than 180 days with <10K access count
- Best-effort: lock contention skips cycle silently

AGENT.md:
- Added rule: MCP tools MUST be in sync with API server endpoints
  before any release

303 tests pass. Clippy clean. Fmt clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants