Skip to content

feat(core,cli): opt-in history mode for time travel, recall/list --at --history (#1598) - #1652

Merged
ajianaz merged 1 commit into
developfrom
feat/time-travel-history-1598
Nov 3, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/time-travel-history-1598

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

What

The second part of #1598 that is safe now (design: #1648, docs/plans/2026-11-03-time-travel-1598.md §4, §5.2).

  • uteke recall --at T --history and uteke list --at T --history also return the memories deprecated after T (forgotten, superseded, replaced by a contradiction). --history requires --at.
  • Core Uteke::recall_at_time_history: today's recall_at_time results plus Store::deprecated_after (the rows written at or before T and deprecated after it, with an embedding). Those rows pass through the same memory_existed_at predicate and the same tag, namespace, entity and category filters. Each is scored by cosine similarity against the embedding kept in the row, with the same hot boost. The results are merged by score and truncated to limit. The query is embedded a second time only when such rows exist.
  • Core Uteke::list_at_time_with(.., history) / Store::list_at_time_with: the four SQL branches replace deprecated = 0 with (deprecated = 0 OR (?history AND (deprecated_at IS NULL OR deprecated_at > pit))). list_at_time is the history = false wrapper, so its SQL behaviour is unchanged.
  • Small refactor: the hot-tier boost in recall_inner moved into hot_boosted, so both paths score the same way.

Why

#1598 / Atlas finding 2. Since #1086 the documented meaning of at includes memories deprecated after it, but every real deprecation path removes the vector, so the index-based candidate set never held them. The #1086 test only checked the predicate on a hand-built Memory. The new tests go through soft_forget and supersede.

The new mode is opt-in and only on the CLI, so CORE results do not change: the default at on HTTP, MCP and the CLI is the same as before. Making history the default changes results for existing callers, so it waits on the contract issue uteke-cloud#458 (Gitea). uteke-cloud does not implement at at all, so it had nothing to match. With a running server --history uses the local store, as other flags the HTTP body cannot carry do.

Cost: one indexed query (deprecated = 1 plus time bounds) and one dot product for each memory deprecated after T. prune bounds that set (deprecated_ttl_days).

Testing

  • operations::time_travel::history_tests (keyword embedder, no ONNX): with one row forgotten and one superseded after T, plain recall_at_time returns only the live row (the gap). History mode returns all three, sorted by score. After the deprecation it returns neither. The tests also cover the tag and namespace filters, limit, and an instant before the write. The list test runs all four SQL branches with history off and on.
  • crates/uteke-cli/tests/time_travel_history.rs (real binary): list --at between the write and the forget is empty without --history and holds the memory with it. --history without --at is refused.
  • cargo test -p uteke-core -p uteke-cli -p uteke-server -p uteke-mcp, cargo clippy --workspace --all-targets -D warnings, cargo fmt, and cargo run -p docgen (no diff) all pass locally.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit d57696e into develop Nov 3, 2026
15 checks passed
@ajianaz
ajianaz deleted the feat/time-travel-history-1598 branch November 3, 2026 00:56
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.

1 participant