Skip to content

feat: v0.1.0 remaining — tag junction, room document, pluggable embedding, time-travel - #314

Merged
ajianaz merged 9 commits into
developfrom
feat/v010-remaining-184-306-249-292
Jun 13, 2026
Merged

ajianaz merged 9 commits into
developfrom
feat/v010-remaining-184-306-249-292

Conversation

@ajianaz

@ajianaz ajianaz commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #184, Closes #306, Closes #249, Closes #292

#184 — Normalize tags with junction table (schema v5)

  • New memory_tags table with COLLATE NOCASE for O(log n) lookups
  • Migration v4→v5: creates table, populates from existing JSON tags
  • Dual-write: insert/update writes to both JSON column and junction table
  • All tag queries use junction table instead of json_each()
  • Backward compat: JSON tags column preserved

#306 — Room document view

  • RoomDocument with sections grouped by memory_type (📋 Decisions, 🔍 Facts, ⚙️ Procedures, 🎨 Preferences, 💬 Context)
  • Pinned memories get 📌 section first
  • CLI: uteke room document <room> — markdown-style human output + JSON
  • Server: POST /room/document endpoint

#249 — Pluggable embedding models

  • New Embedder trait: embed(), dims(), max_seq_len(), name()
  • EmbeddingEngine → OnnxEmbedder, implements Embedder
  • Uteke struct uses Box<dyn Embedder> with lazy backend selection
  • Config: [embedding] backend = "onnx" (default)
  • Future-ready: OpenAI/Ollama backends can impl Embedder without touching recall code

#292 — Time-travel queries

  • recall_at_time(): semantic recall with temporal validity filter
  • list_at_time(): list memories that existed at specific timestamp
  • Temporal logic: created_at <= pit, valid_from/valid_until, not deprecated
  • CLI: --at flag on recall and list commands (RFC3339 format)
  • Server: /recall and /list accept "at" field
  • Retry loop expands fetch limit when temporal filter removes too many

Tests

  • cargo test --workspace ✅ (134 passed, 4 ignored for ONNX model)
  • cargo clippy --workspace -- -D warnings ✅
  • cargo fmt --all -- --check ✅

ajianaz added 9 commits June 13, 2026 12:39
- New memory_tags table with COLLATE NOCASE for O(log n) lookups
- Migration v4→v5: creates table, populates from existing JSON tags
- Dual-write: insert/update writes to both JSON column and junction table
- All tag queries use junction table instead of json_each()
- Backward compat: JSON tags column preserved

5 files changed in uteke-core.
- RoomDocument with sections grouped by memory_type
- DocumentSection: heading + icon (📋 Decisions, 🔍 Facts, ⚙️ Procedures, etc)
- Pinned memories get 📌 section first
- CLI: `uteke room document <room>` — markdown-style human output + JSON
- Server: POST /room/document endpoint
- Types exported from uteke-core

Closes #306
- New Embedder trait (Send + Sync) in embed_trait.rs
- EmbeddingEngine renamed to OnnxEmbedder
- Tokenizer + Session wrapped in Mutex for &self embed()
- Uteke struct uses Box<dyn Embedder>
- Config: [embedding] backend field (default: "onnx")
- Uteke::open_with_backend() selects backend via lazy init
- Backward compat: EmbeddingEngine type alias = OnnxEmbedder
- Future: OpenAI/Ollama backends implement Embedder trait
- New Embedder trait (Send + Sync) in embed_trait.rs
- EmbeddingEngine renamed to OnnxEmbedder
- Tokenizer + Session wrapped in Mutex for &self embed()
- Uteke struct uses Box<dyn Embedder>
- Config: [embedding] backend field (default: "onnx"), validated at startup
- Uteke::open_with_backend() + open_with_tier_and_backend()
- Lazy init selects backend by name, error on unknown
- Backward compat: EmbeddingEngine type alias = OnnxEmbedder
- Future: OpenAI/Ollama implement Embedder trait

Closes #249
…time

- Store::list_at_time(): SQL temporal filter on created_at, valid_from,
  valid_until, deprecated
- Uteke::recall_at_time(): over-fetch + post-filter by temporal validity
- Uteke::list_at_time(): thin wrapper to store
- CLI: --at flag on recall and list commands (RFC3339 parsing)
- Server: /recall and /list endpoints accept 'at' field
- Server proxy: passes --at through to server
- 4 unit tests covering all temporal edge cases

Closes #292
Over-fetch with increasing multipliers (3x, 9x, 27x) when temporal
post-filtering yields fewer results than requested. Detects index
exhaustion to avoid pointless retries.

Addresses Cora review: temporal recall can return too few results.
Index exhaustion = candidates_len < fetch_limit. When this happens,
expanding the search scope cannot yield more results. Previously
only stopped when results.is_empty(), which missed the case where
partial results exist but the index has no more candidates.
…n time

- recall_at_time(): semantic recall with temporal validity filter
- list_at_time(): list memories that existed at timestamp
- Temporal logic: created_at <= pit, valid_from/valid_until, not deprecated
- CLI: --at flag on recall and list commands (RFC3339 format)
- Server: /recall and /list accept "at" field
- 4 new store tests for temporal filtering
- Retry loop expands fetch limit when temporal filter removes too many

Closes #292
"SELECT mt.memory_id FROM memory_tags mt \
INNER JOIN memories m ON mt.memory_id = m.id \
WHERE mt.tag = ?1 AND m.namespace = ?2",
namespace,
) {
// Time-travel mode: parse --at and use recall_at_time
let point_in_time = match req_data.at.as_deref() {
Some(at_str) => match chrono::DateTime::parse_from_rfc3339(at_str) {
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

❌ Blocked — critical issues found.

🔴 Error (3)

  • crates/uteke-core/src/memory/tags.rs:122 — Both rename_tag and delete_tag begin a transaction with let tx = self.conn.unchecked_transaction()?;, but every subsequent query and update in these functions is executed through self.conn rather than tx. As written, the read/modify/write sequence is not actually protected by the transaction, so partial updates can be committed if an error occurs midway and the intended TOCTOU protection in the comment is not achieved. The problem is visible throughout the new code paths, e.g. self.conn.prepare(...), self.conn.query_row(...), and self.conn.execute(...) after tx is created.
  • crates/uteke-core/src/memory/crud.rs:40 — The new insert implementation first inserts into memories and then separately loops over memory.tags inserting into memory_tags. If any tag insert fails after the main row is written, the function returns an error but the memory row remains committed without matching junction-table entries. The same pattern appears in update, which updates the main row, deletes old tags from memory_tags, and reinserts new ones without wrapping the whole sequence in a transaction. This creates an inconsistent store state for all tag-based queries that now read from memory_tags.
  • crates/uteke-server/src/main.rs:528 — In /recall, the non-time-travel path still calls uteke.recall(...) and then applies the existing entity/category filtering and output trimming, but the new at path directly switches to uteke.recall_at_time(...) without preserving the earlier CLI restriction that --at and --related are incompatible. RecallRequest still accepts related and depth, yet those fields are ignored whenever at is present. That means server clients can send { "at": ..., "related": true } and get a normal temporal recall instead of an error or related recall behavior, diverging from the CLI contract introduced in crates/uteke-cli/src/commands/recall.rs.

Review powered by cora-cli · BYOK · MIT

@ajianaz
ajianaz merged commit 7451641 into develop Jun 13, 2026
8 of 9 checks passed
@ajianaz
ajianaz deleted the feat/v010-remaining-184-306-249-292 branch June 13, 2026 06:45
ajianaz added a commit that referenced this pull request Jun 13, 2026
* feat(#304,#305): semantic room recall + LLM-free room summary (#309)

#304 — Semantic room recall:
- recall_room_semantic() uses hybrid RRF search scoped to room memories
- `uteke room recall <room> --query "..." --min 0.5` ranks by relevance
- POST /room/recall server endpoint
- Backward compatible: without --query, chronological dump unchanged

#305 — Room summary (LLM-free topic clustering):
- room_summary() clusters memories by tag co-occurrence
- Extracts: topic clusters, top tags, recent decisions, pinned highlights
- `uteke room summary <room>` — human + JSON output
- POST /room/summary server endpoint

9 files changed, +627 lines

* feat: v0.1.0 remaining — tag junction, room document, pluggable embedding, time-travel (#314)

* feat(#184): normalize tags with junction table (schema v5)

- New memory_tags table with COLLATE NOCASE for O(log n) lookups
- Migration v4→v5: creates table, populates from existing JSON tags
- Dual-write: insert/update writes to both JSON column and junction table
- All tag queries use junction table instead of json_each()
- Backward compat: JSON tags column preserved

5 files changed in uteke-core.

* feat(#306): room document view — structured output from room memories

- RoomDocument with sections grouped by memory_type
- DocumentSection: heading + icon (📋 Decisions, 🔍 Facts, ⚙️ Procedures, etc)
- Pinned memories get 📌 section first
- CLI: `uteke room document <room>` — markdown-style human output + JSON
- Server: POST /room/document endpoint
- Types exported from uteke-core

Closes #306

* fix(#306): bound room document query to 10K, fix non-ASCII truncation panic

* feat(#249): pluggable embedding models via Embedder trait

- New Embedder trait (Send + Sync) in embed_trait.rs
- EmbeddingEngine renamed to OnnxEmbedder
- Tokenizer + Session wrapped in Mutex for &self embed()
- Uteke struct uses Box<dyn Embedder>
- Config: [embedding] backend field (default: "onnx")
- Uteke::open_with_backend() selects backend via lazy init
- Backward compat: EmbeddingEngine type alias = OnnxEmbedder
- Future: OpenAI/Ollama backends implement Embedder trait

* feat(#249): pluggable embedding models via Embedder trait

- New Embedder trait (Send + Sync) in embed_trait.rs
- EmbeddingEngine renamed to OnnxEmbedder
- Tokenizer + Session wrapped in Mutex for &self embed()
- Uteke struct uses Box<dyn Embedder>
- Config: [embedding] backend field (default: "onnx"), validated at startup
- Uteke::open_with_backend() + open_with_tier_and_backend()
- Lazy init selects backend by name, error on unknown
- Backward compat: EmbeddingEngine type alias = OnnxEmbedder
- Future: OpenAI/Ollama implement Embedder trait

Closes #249

* feat(#292): time-travel queries — recall/list memories at a point in time

- Store::list_at_time(): SQL temporal filter on created_at, valid_from,
  valid_until, deprecated
- Uteke::recall_at_time(): over-fetch + post-filter by temporal validity
- Uteke::list_at_time(): thin wrapper to store
- CLI: --at flag on recall and list commands (RFC3339 parsing)
- Server: /recall and /list endpoints accept 'at' field
- Server proxy: passes --at through to server
- 4 unit tests covering all temporal edge cases

Closes #292

* fix(#292): retry loop for temporal recall to fill requested limit

Over-fetch with increasing multipliers (3x, 9x, 27x) when temporal
post-filtering yields fewer results than requested. Detects index
exhaustion to avoid pointless retries.

Addresses Cora review: temporal recall can return too few results.

* fix(#292): stop retry on index exhaustion regardless of result count

Index exhaustion = candidates_len < fetch_limit. When this happens,
expanding the search scope cannot yield more results. Previously
only stopped when results.is_empty(), which missed the case where
partial results exist but the index has no more candidates.

* feat(#292): time-travel queries — recall and list at specific point in time

- recall_at_time(): semantic recall with temporal validity filter
- list_at_time(): list memories that existed at timestamp
- Temporal logic: created_at <= pit, valid_from/valid_until, not deprecated
- CLI: --at flag on recall and list commands (RFC3339 format)
- Server: /recall and /list accept "at" field
- 4 new store tests for temporal filtering
- Retry loop expands fetch limit when temporal filter removes too many

Closes #292

* docs: update for v0.1.0 — rooms, time-travel, pluggable embeddings, tag junction (#315)

* docs: update branch protection rules for main and develop branches (#308)

Co-authored-by: ajianaz <[email protected]>

* feat: benchmark suite — uteke bench + LongMemEval harness (#49, #316) (#320)

* feat(#49): uteke bench command — synthetic performance benchmarking

- CLI: `uteke bench` with --counts and --json flags
- Benchmarks: insert throughput, recall latency (avg+p95), storage footprint
- Deterministic xorshift64* PRNG (no rand dep)
- Synthetic content generator with word banks
- Human-readable table + JSON output
- Temp stores auto-cleaned up

Closes #49

* feat(#316): LongMemEval benchmark harness for retrieval accuracy

- benchmarks/longmemeval/ harness: run_eval.py + print_metrics.py
- Downloads dataset from HuggingFace (download_data.sh)
- Measures session-level Recall@5/10/50, NDCG@5/10/50
- Per-question-type breakdown (single-session, multi-session, knowledge-update, etc.)
- benchmarks/RESULTS.md: comparison table vs Mem0/Hindsight
- README.md with quick-start guide

Closes #316

* docs: add bench command + LongMemEval harness to changelog, CLI ref, README

* docs: complete v0.1.0 documentation — index, getting-started, README.id, sidebar (#321)

- docs/index.md: 6 new feature cards (Rooms, Time-Travel, Relationship Graph,
  Smart Decay, MCP Server, Benchmarks) + 7 new comparison table rows
- docs/getting-started.md: 6 new sections (Rooms, Time-Travel Queries,
  Memory Importance & Pinning, Relationship Graph, Recall Cache,
  Benchmarking) + fixed model path to embeddinggemma-q4/onnx/
- README.id.md: synced with English README — v0.1.0 badge, 15 features,
  expanded comparison table with Rooms/Time-travel/MCP/Graph/Decay/Cache/Bench
- docs/.vitepress/config.ts: restructured sidebar into 3 groups
  (Getting Started, Features, Reference) with anchors to new sections

* release: v0.1.0 — version bump, JSON output fix, changelog (#322)

- Version: 0.0.15 → 0.1.0 (workspace + inter-crate deps)
- Fix: recall --json now always outputs [] on empty results (was {"results":[]})
  This ensures cora-cli and other JSON consumers can parse output reliably.
- CHANGELOG: [Unreleased] → [0.1.0] — 2026-06-13

* ci: add CodeCorraDev Roadmap project board auto-sync (#319)

* ci: add project board auto-sync workflow

* fix(ci): harden project-sync workflow for CodeCora findings

- Guard against empty issue fields on workflow_dispatch (use || '')
- Early exit when no issue context (manual dispatch)
- Separate stdout/stderr for GraphQL calls
- Check for 'errors' field in response instead of naive grep 'item'
- Add fallback case for unhandled events

Fixes CodeCora alerts on PR #319.

---------

Co-authored-by: ajianaz <[email protected]>
ajianaz added a commit that referenced this pull request Aug 13, 2026
…ding, time-travel (#314)

* feat(#184): normalize tags with junction table (schema v5)

- New memory_tags table with COLLATE NOCASE for O(log n) lookups
- Migration v4→v5: creates table, populates from existing JSON tags
- Dual-write: insert/update writes to both JSON column and junction table
- All tag queries use junction table instead of json_each()
- Backward compat: JSON tags column preserved

5 files changed in uteke-core.

* feat(#306): room document view — structured output from room memories

- RoomDocument with sections grouped by memory_type
- DocumentSection: heading + icon (📋 Decisions, 🔍 Facts, ⚙️ Procedures, etc)
- Pinned memories get 📌 section first
- CLI: `uteke room document <room>` — markdown-style human output + JSON
- Server: POST /room/document endpoint
- Types exported from uteke-core

Closes #306

* fix(#306): bound room document query to 10K, fix non-ASCII truncation panic

* feat(#249): pluggable embedding models via Embedder trait

- New Embedder trait (Send + Sync) in embed_trait.rs
- EmbeddingEngine renamed to OnnxEmbedder
- Tokenizer + Session wrapped in Mutex for &self embed()
- Uteke struct uses Box<dyn Embedder>
- Config: [embedding] backend field (default: "onnx")
- Uteke::open_with_backend() selects backend via lazy init
- Backward compat: EmbeddingEngine type alias = OnnxEmbedder
- Future: OpenAI/Ollama backends implement Embedder trait

* feat(#249): pluggable embedding models via Embedder trait

- New Embedder trait (Send + Sync) in embed_trait.rs
- EmbeddingEngine renamed to OnnxEmbedder
- Tokenizer + Session wrapped in Mutex for &self embed()
- Uteke struct uses Box<dyn Embedder>
- Config: [embedding] backend field (default: "onnx"), validated at startup
- Uteke::open_with_backend() + open_with_tier_and_backend()
- Lazy init selects backend by name, error on unknown
- Backward compat: EmbeddingEngine type alias = OnnxEmbedder
- Future: OpenAI/Ollama implement Embedder trait

Closes #249

* feat(#292): time-travel queries — recall/list memories at a point in time

- Store::list_at_time(): SQL temporal filter on created_at, valid_from,
  valid_until, deprecated
- Uteke::recall_at_time(): over-fetch + post-filter by temporal validity
- Uteke::list_at_time(): thin wrapper to store
- CLI: --at flag on recall and list commands (RFC3339 parsing)
- Server: /recall and /list endpoints accept 'at' field
- Server proxy: passes --at through to server
- 4 unit tests covering all temporal edge cases

Closes #292

* fix(#292): retry loop for temporal recall to fill requested limit

Over-fetch with increasing multipliers (3x, 9x, 27x) when temporal
post-filtering yields fewer results than requested. Detects index
exhaustion to avoid pointless retries.

Addresses Cora review: temporal recall can return too few results.

* fix(#292): stop retry on index exhaustion regardless of result count

Index exhaustion = candidates_len < fetch_limit. When this happens,
expanding the search scope cannot yield more results. Previously
only stopped when results.is_empty(), which missed the case where
partial results exist but the index has no more candidates.

* feat(#292): time-travel queries — recall and list at specific point in time

- recall_at_time(): semantic recall with temporal validity filter
- list_at_time(): list memories that existed at timestamp
- Temporal logic: created_at <= pit, valid_from/valid_until, not deprecated
- CLI: --at flag on recall and list commands (RFC3339 format)
- Server: /recall and /list accept "at" field
- 4 new store tests for temporal filtering
- Retry loop expands fetch limit when temporal filter removes too many

Closes #292
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