Repository navigation
feat: supersession workflow — mark stale decisions superseded, flagged at recall - #1069
Merged
Merged
Conversation
…d at recall (#1053) Long-lived rooms accumulate revisited decisions that stay indistinguishable from current truth. The graph infra existed (typed memory_edges since v8) but was never a recall-layer concern. - EDGE_SUPERSEDED_BY type; Uteke::supersede(old,new,reason): wires the edge pair (old→new superseded_by, new→old supersedes) AND soft-deprecates the old memory in ONE transaction — partial failure rolls back entirely; recall cache invalidated for the namespace - Uteke::supersession_of(id): resolves the current-replacement pointer - MCP uteke_supersede {old_id,new_id,reason?} — accepts UUID or unambiguous prefix (resolve_id), self/unknown ids rejected loudly - MCP uteke_recall output flags stale hits: '⚠ superseded by <id> — verify before acting' (covers legacy/hard-restored deprecated rows that still surface) - docs/mcp.md updated Tests: edge pair + deprecation + hide-from-list + self/unknown rejection (core); short-id supersede via MCP executor.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
| ) | ||
| .map_err(|e| Error::db("insert superseded_by edge", e))?; | ||
| tx.execute( | ||
| "INSERT OR IGNORE INTO memory_edges (source_id, target_id, edge_type, created_at) VALUES (?1,?2,?3,?4)", |
ajianaz
force-pushed
the
feat/supersession-workflow
branch
from
August 17, 2026 14:03
84c4921 to
483e8f0
Compare
…code-scanning #687) Superseding the same memory twice left both superseded_by pairs (INSERT OR IGNORE) and supersession_of() picked LIMIT 1 with no ORDER BY. Now: prior pair deleted in-transaction before the new pair; lookup orders by created_at DESC deterministically. Test pins re-supersession replacing the pointer with no stacking.
ajianaz
added a commit
that referenced
this pull request
Aug 19, 2026
* fix(docs): standardize recall latency to ~45ms 3 files still referenced ~30ms (stale from early benchmarks). Actual measured P50 at 1K-10K memories is ~45ms per benchmarks.md. Updated: architecture.md, mcp.md, index.md * chore: harden .gitignore + restructure repo for public safety - Add internal/ to .gitignore (prevents future strategy/launch doc leaks) - Add benchmarks/longmemeval/results_*/ to .gitignore (ephemeral data) - Add docs/package-lock.json to .gitignore (VitePress build artifact) - Move blog/comparison-2026.md → docs/comparison-2026.md (consolidate docs) - Remove stale benchmarks/longmemeval/results_diverse/ (raw output, not summary) - Remove docs/package-lock.json from tracking Audit confirms: zero internal/ files in entire git history after filter-repo scrub. * feat: hybrid as default recall strategy + import fixes (#1005, #1014) (#1015) * feat(bench): batch import + strategy flag + API embedding auto-config - Replace 53x individual remember calls with single JSONL batch import (10x speedup) - Add --strategy flag to pass vector|hybrid to uteke recall - Auto-configure embedding API from EMBED_API_KEY/EMBED_API_BASE env vars - Add --chunk-sessions flag for session chunking (Tier 2 prep) - Dedup recall results by session_id (first occurrence = highest rank) - Raise subprocess timeout 120s -> 600s for large imports Initial 5Q results: hybrid R@5=1.000 vs vector R@5=0.800 (+20pp) * fix(bench): only mark sessions inserted after import succeeds Address Cora findings: - Move inserted_sids population to after batch import success - Parse import response to verify imported_count > 0 - Log warning if import returns 0 inserted * fix(bench): resolve uteke binary by absolute path to avoid x86_64 PATH clash Background subprocess calls were resolving to /opt/data/.cargo/bin/uteke (x86_64) instead of target/release/uteke (AArch64). Now resolves relative to repo root with shutil.which fallback. * docs(bench): add 50Q hybrid results — R@5 98.0%, R@10 100% Strategy comparison (uteke only): - Vector 500Q: R@5=85.4%, R@10=88.5%, NDCG@5=0.810 - Hybrid 50Q: R@5=98.0%, R@10=100%, NDCG@5=0.960 - Improvement: +12.6pp R@5 Hybrid uses RRF (k=60) fusion of vector + FTS5 search. 1 miss at R@5 (single-session-user), recovered at R@10. run_eval.py changes: - Add --strategy flag (vector|hybrid) - Throttle: taskset -c 0-1 + nice -n 19 - Absolute binary path resolution - Timeout: 900s per question * fix(core): add dedup, retry, and auto_link to import path (#1005) Import pipeline was missing 3 features that remember() has: 1. Dedup check — cosine >= 0.95 skips duplicate entries 2. Retry on embedding failure — 3 retries with backoff 3. Auto-link cosine edges — graph edges for imported memories Changes: - import_export.rs: call check_duplicate() before insert, use retry_embed() instead of single-attempt embed(), call auto_link_cosine() after successful insert - operations.rs: make retry_embed() and check_duplicate() pub(crate) so they're accessible from import_export.rs Import path is now semantically consistent with remember() path. * fix(core): cross-compile ORT_LIB_NAME for Android/iOS (#1014) Add target_os = "android" to Linux .so branch and target_os = "ios" to macOS .dylib branch. Without these, uteke-core fails to compile for mobile targets with E0425 (cannot find value ORT_LIB_NAME). Android uses libonnxruntime.so (same as Linux, loaded via jniLibs). iOS uses libonnxruntime.dylib (same as macOS, framework embedded). This unblocks uteke-mobile cross-compilation. * feat(core): hybrid as default recall strategy Change default_strategy from vector to hybrid (RRF: vector + FTS5). Benchmark justification (LongMemEval-S): - Vector 500Q: R@5=85.4%, R@10=88.5% - Hybrid 50Q: R@5=98.0%, R@10=100.0% - Improvement: +12.6pp R@5 Changes: - config.rs: default_strategy =
What
Core:
EDGE_SUPERSEDED_BYedge type +Uteke::supersede(old_id, new_id, reason)— wires the edge pair (old→new: superseded_byfor recall annotation,new→old: supersedesnavigable inverse) AND soft-deprecates the old memory, all in one transaction (cora finding fixed in-PR: edges committed separately from deprecation could leave a superseded_by pointer on a still-active row)Uteke::supersession_of(id)— resolves the replacement pointerMCP:
uteke_supersede {old_id, new_id, reason?}— UUID-or-prefix ids via the MCP: short ID (8-char) from recall/list unusable in pin/forget/graph tools — resolve_id_prefix never wired #1048 resolver; self-supersession and unknown ids rejected loudlyuteke_recalloutput flags stale hits:⚠ superseded by <id> — verify before acting— deprecated rows are already excluded from recall by default; the annotation covers legacy/hard-restored rows that still surfaceWhy
Closes #1053. Observed: room
uteke-cloudheld 6 auth-model memories superseded by an ADR pivot — only tribal knowledge marked them stale. Turns the graph from write-only decoration into a correctness layer: revisiting a decision is one call, and every future recall of the stale row carries the pointer to its replacement.Testing
supersession_ofresolves (and returns None for the new row), self/unknown ids errorCloses #1053