Repository navigation
Conversation
* fix: remove --branch=main * fix: remove VitePress base (routing handled by Worker) * fix: restore VitePress base for proper asset routing * fix: add VitePress base '/docs/uteke/' for asset routing * fix: restore docs/.vitepress/config.ts from develop * fix: remove VitePress base — routing via Worker with <base href> injection * fix: add VitePress base + _redirects * fix: add CF Pages _redirects
…374) * docs: fix v0.2.0 consistency issues across README and VitePress docs Audit found 9 issues where docs diverged from code. All now match cli.rs/config.rs/schema.rs as of v0.2.0. Fixes: - README.md: test count 108 -> 180 (actual count in crates/) (#365) - docs/cli-reference.md: - Version 0.1.0 -> 0.2.0 (#366) - Add section (#317) - Add recall and flags (#293) - Add , , to Other Commands - Remove nonexistent remember flags: , , (never wired in cli.rs) (#367) - Add remember and flags (#367) - Remove global flag (not implemented) (#369) - search default limit 20 -> 10 (#373) - aging: -> , -> (#366) - strict threshold label 0.7 -> min_score_strict (default 0.5) - -> - docs/configuration.md (#370, #369): - All -> (matches LoggingConfig) - Remove nonexistent field (only , exist) - Recall min_score default 0.0 -> 0.3 (matches RecallConfig::default) - Remove flag mentions - Migrate example: flat / -> - docs/architecture.md (#371): schema version v5 -> v7 (v6 content_type, v7 graph tables from #317) - docs/docker.md (#372): model size 208MB -> 188MB (matches README/ INSTALL/getting-started) - docs/getting-started.md (#366): aging flags -> , -> GitHub issues: closes #365, closes #366, closes #367, closes #369, closes #370, closes #371, closes #372, closes #373 * docs(configuration): fix strict threshold inconsistency flagged by CodeCora Review bot found that the sentence below the recall table still referenced '--min 0.7' while the table documents min_score_strict = 0.5. Remove the hardcoded 0.7 example so the sentence stays generic and consistent with the documented default. Follow-up to #370 on PR #374.
* feat: auto-wired memory edges (#346) Self-wiring knowledge graph: every remember() extracts entity references via pure string parsing (no LLM) and writes typed edges to a new memory_edges SQLite table. get_related() now uses indexed SQL instead of O(n) JSON scan. Schema v7 -> v8: - New memory_edges table (source_id, target_id, edge_type, created_at) with indices on source, target, type; UNIQUE(source, target, type). - New optional memories.slug column (partial index) for [[slug]] linking. - Migration v7->v8 backfills existing metadata.relationships JSON entries into memory_edges rows. Extraction patterns (zero LLM): - [[slug]] -> references edge (via memories.slug lookup) - @tag -> tagged_as edge (most recent memory with that tag) - ^<uuid> -> supersedes edge (direct UUID) - ><uuid> -> replies_to edge (direct UUID) - rel:<t>:<id> -> <t> edge (legacy --meta form, backward compat) New CLI: uteke edges <id> # list direct edges (both directions) uteke edges <id> --deep N # BFS across edge table, N hops uteke edges <id> --json Core API (uteke-core): - Uteke::wire_edges() (pub(crate)) called from remember_precomputed - Uteke::edges_for(id) -> EdgeList { outgoing, incoming } - Uteke::related_via_edges(id, depth) -> Vec<Memory> (replaces O(n) scan) - Uteke::count_edges() -> usize - Store::add_memory_edge/add_memory_edges_batch/resolve_slug/ resolve_tag_to_memory/list_memory_edges/edge_bfs/count_memory_edges Rewrites: - get_related() prefers edge table; falls back to legacy JSON scan only if no edges exist for the memory (backward compat for pre-v8 stores that never auto-wired). Cleanup: - Fixed pre-existing clippy warnings in commands/graph.rs (3x else-if collapse) so cargo clippy --workspace -- -D warnings passes cleanly. Tests: +20 unit tests covering extraction patterns (slug/tag/uuid/reply/ legacy meta), edge roundtrip, deduplication, BFS traversal, cycle safety, and slug/tag resolution. All 193 tests pass. Docs: CHANGELOG entry, new 'uteke edges' section in cli-reference.md. Closes #346. * fix(edges): address CodeCora review findings Three valid findings from security/semantic review: 1. Migration FK abort (finding #131): backfill INSERT now uses 'INSERT ... SELECT ... WHERE EXISTS (SELECT 1 FROM memories WHERE id = ?2)' so a legacy metadata.relationships entry pointing to a deleted or nonexistent memory is skipped instead of aborting the v7->v8 schema migration (which would prevent the database from opening). 2. get_related() semantic change (finding #132): union edge-table results with legacy metadata.relationships scan instead of early-returning when any edge exists. The previous code could silently drop incoming relations encoded only in metadata. Now both sources are merged via a shared visited set. 3. Slug uniqueness documentation (finding #130): the SCHEMA comment and Store::resolve_slug doc now accurately describe slug resolution as 'most recently updated wins' rather than claiming uniqueness is enforced (the partial index is non-unique). Users who need deterministic links are told to keep slugs unique per namespace. Plus: - Removed stray double-semicolon in schema.rs (clippy warning). - Added 2 regression tests for findings #131 and #132. The 'Hardcoded password in variable' finding on edges.rs:146 was a false positive (variable named 'token' in UUID extraction code) — no actual secret, will dismiss the alert. All 195 tests pass. Clippy clean. * style: cargo fmt edges.rs (Format CI) * perf(edges): hoist BFS prepare statement out of loop (CodeCora #134) edge_bfs() previously called self.conn.prepare(...) inside the while loop, recompiling the same SQL once per visited node. Move the prepare above the loop and reuse the statement across hops. Also adds migration_dispatcher_reaches_v8 regression test that proves the v7->v8 migration is invoked on upgrade (refutes CodeCora finding #136, which misread the dispatcher logic). A fresh Store now must report schema_version=8 and a queryable memory_edges table. All 172 tests pass. * fix(edges): enforce namespace isolation on UUID/rel edges (#138) CodeCora found that ExtractedRef::Uuid (^<uuid>, ><uuid>) and ExtractedRef::Rel (rel:<type>:<id>) resolved targets via store.get_by_id without namespace filtering. This leaked relationships across isolated namespaces — inconsistent with slug (@[[slug]]) and tag (@tag) resolution which are already namespace-scoped. Fix: add Store::get_by_id_in_namespace(id, ns) and use it in wire_edges for Uuid + Rel branches. A UUID that exists in another namespace is now treated as unresolved (same as a missing UUID). +1 regression test (uuid_edges_respect_namespace_isolation) covering both cross-namespace rejection and same-namespace success. 173 tests pass. Clippy clean. Finding #139 (wire_edges non-atomic vs store.insert) dismissed as an accepted design trade-off: edge rows CASCADE-delete on forget, so no permanent corruption. Atomic buffering would require restructuring remember() and is deferred until we have usage signal. Closes #138. * style: cargo fmt
* feat: OpenAI + Ollama embedding backends (#337) Three backends now supported via [embedding] backend config: - onnx (default, fully offline, EmbeddingGemma Q4 768d) - openai (text-embedding-3-small 1536d default, Azure-compatible) - ollama (nomic-embed-text 768d default, local server) New files: - crates/uteke-core/src/embed/openai.rs (OpenAiEmbedder + 5 tests) - crates/uteke-core/src/embed/ollama.rs (OllamaEmbedder + 5 tests) Core changes (uteke-core): - EmbedderEnv resolver reads backend config from env vars without pulling the CLI config crate into core. - ensure_embedder() dispatch now constructs OpenAI/Ollama backends with defaults when model/base_url/dims are empty. - Dim mismatch detection: if backend dims != index dims on first embed call, return a clear Validation error pointing at 'uteke repair' instead of silently producing garbage vectors. - VectorIndex::dims() exposed (wraps usearch Index::dimensions()). - reqwest 0.12 gains 'json' feature (always included, no feature flag). CLI config changes (uteke-cli): - EmbeddingConfig extended: api_key, base_url, dims. - SUPPORTED_BACKENDS now [onnx, openai, ollama]. - merge_from_file handles the 3 new fields. - apply_env_overrides handles UTEKE_EMBEDDING_BACKEND/MODEL/API_KEY/ BASE_URL/DIMS. API key falls back to OPENAI_API_KEY. - +6 new config tests (full openai merge, env precedence, fallback, invalid dims). Docs: - configuration.md: expanded Embedding Backend section with backend-specific defaults table, Azure OpenAI recipe, and a dim mismatch error example. Env var table extended with the 5 new UTEKE_EMBEDDING_* vars. - CHANGELOG entry. Acceptance criteria (from issue #337): [x] OpenAiEmbedder implements Embedder trait with HTTP call [x] OllamaEmbedder implements Embedder trait with HTTP call [x] Config [embedding] backend/api_key/base_url/model/dims supported [x] Env vars override config (UTEKE_EMBEDDING_*) [x] ONNX remains default (backward compatible) [x] Dim mismatch detection with clear error message [x] reqwest always included (no feature flags) [x] Documentation updated (configuration.md) [x] Tests for backend selection logic 212 tests pass. Clippy clean. cargo fmt clean. Closes #337. * fix(embedding): plumb uteke.toml settings into backend dispatch CodeCora found that lazy backend dispatch read only env vars via EmbedderEnv::resolve, silently ignoring [embedding] api_key/base_url/ model/dims from uteke.toml. Users who set those in config (without env vars) would see backend defaults used instead. Fix: - Replace EmbedderEnv with a public EmbeddingSettings struct + a resolve_with_defaults() helper that layers env vars on top of caller-supplied config values. - Add Uteke::open_with_embedding() constructor that takes the merged CLI config as EmbeddingSettings. Stored on the Uteke struct so ensure_embedder() can read it at lazy-init time. - finish_open() gains the embedding_settings param. All other constructors forward EmbeddingSettings::default() (no behavior change for library users who don't supply settings). - VectorIndex::dims() exposed for dim-mismatch detection. - CLI main.rs now calls open_with_embedding() and forwards config.embedding.{api_key,base_url,model,dims} from uteke.toml. +3 core regression tests covering: defaults-empty, env-overrides-config, config-only-when-env-absent. Ensures the plumbing precedence (env > uteke.toml > backend default) is locked in. 215 tests pass. Clippy clean. cargo fmt clean. * fix(embedding): validate base_url + send dimensions param (CodeCora #146, #147, #155) Two real issues from review: 1. base_url validation (#155): OpenAiEmbedder/OllamaEmbedder stored base_url verbatim and only failed later during the HTTP call. Add crate::embed::validate_base_url() — rejects empty, schemeless, or unparseable URLs at construction time so callers see a clear Validation error instead of a confusing 404 later. Called from both OpenAiEmbedder::new and OllamaEmbedder::new. 2. Dimensions param (#146): OpenAiEmbedder accepted a dims field but never sent it in the request body. A user who set dims=3072 with a model defaulting to 1536 would silently get 1536d vectors from the API while the index believed it was 3072d. Now we include 'dimensions: N' in the request JSON when dims > 0. text-embedding-3-* honor this field; older models ignore unknown fields so this is safe to send unconditionally. Docs: - configuration.md Azure OpenAI example had an unclosed quote (#156). Fixed. Tests: +1 (rejects_invalid_base_url) covering schemeless, empty, and unparseable URLs. 187 core tests pass. Clippy clean. fmt clean. * fix(embedding): add UTEKE_ALLOW_DIM_MISMATCH escape hatch for repair CodeCora finding #154: the dim-mismatch guard blocked any embed-based operation once a user switched backends on an existing store, including 'uteke repair' which is the recovery path. Chicken-and-egg. Fix: skip the check when UTEKE_ALLOW_DIM_MISMATCH=1 is set. The error message now points at this flag directly: 'Rebuild the index (UTEKE_ALLOW_DIM_MISMATCH=1 uteke repair) or switch backend.' Docs: configuration.md dim-mismatch section shows the exact recovery incantation. 187 core tests pass. Clippy clean. fmt clean. * fix(embedding): treat empty env vars as unset + Azure api-version doc CodeCora finding: std::env::var returns Ok("") for explicitly empty variables, so setting UTEKE_EMBEDDING_API_KEY="" would silently overwrite a non-empty api_key from [embedding] in uteke.toml. Fix: in both lib.rs::EmbeddingSettings::resolve_with_defaults and cli/config.rs::apply_env_overrides, empty env-var values are now filtered out via .filter(|v| !v.is_empty()) before falling through to the config-provided value. Docs: the Azure OpenAI example now includes the required api-version query param (?api-version=2024-10-21) since Azure rejects requests without it. +1 core regression test (empty env does not overwrite config). 188 core tests pass. Clippy clean. fmt clean.
Dependabot PR #364 bumped sha2 in uteke-core from 0.10 to 0.11 but CI failed across Build/Check/Clippy/Test because sha2 0.11 dropped the LowerHex impl on the digest output Array. The line let actual = format!("{:x}", hasher.finalize()); no longer compiles. Dependabot doesn't fix code, so the PR sat BLOCKED. This commit applies the bump and fixes the breakage: - crates/uteke-core/Cargo.toml: sha2 = "0.11" - crates/uteke-core/src/embed/engine.rs: iterate the digest bytes and format each as {:02x} manually instead of relying on LowerHex. Also unifies the workspace on a single sha2 version (uteke-server was already on 0.11 from an earlier bump — now both match). 188 tests pass. Clippy clean. fmt clean. Closes #364 (Dependabot PR, superseded).
New `graph` recall strategy fuses graph signals from the `memory_edges` table (#346) into RRF recall scores. Well-connected memories drift upward; isolated memories are untouched. - crates/uteke-core/src/graph_rerank.rs (new): - compute_graph_signals(): single batched SQL query over memory_edges computes edge_count, neighbor_count, edge_type_diversity, incoming_count, outgoing_count per candidate. O(edges touching candidates), not O(total edges). - rerank_with_graph(): additive, log-scaled density + authority boosts (ln(1+x) * weight), capped at 1.0. Cold-start (no edges) and disabled-flag are no-ops. - GraphRerankConfig { density_weight, authority_weight, enabled } + sanitized() clamping. - RecallStrategy::Graph variant wired into recall_hybrid; boost runs before caching (strategy-keyed cache, no collision with hybrid/vector/fts5). - Uteke gains graph_rerank_config field + open_with_embedding_and_graph constructor so the CLI passes merged [recall] weights. - CLI: --strategy <vector|fts5|hybrid|graph> flag on recall (default vector, preserves original behavior; graph is opt-in). - Config [recall]: default_strategy, graph_density_weight, graph_authority_weight, graph_rerank_enabled + env overrides UTEKE_RECALL_STRATEGY / UTEKE_GRAPH_DENSITY_WEIGHT / UTEKE_GRAPH_AUTHORITY_WEIGHT / UTEKE_GRAPH_RERANK_ENABLED. - 10 unit tests (signal counting, hub boost, log-saturation, score cap, cold-start + disabled no-ops, <10ms latency guard over 5000 edges). - Docs: cli-reference, configuration, architecture (also fixes stale schema v7 -> v8 from #346). Backward compatible: existing strategies unchanged. Closes #378.
* feat(#350): backlink auto-generation — bidirectional memory edges (#350) Every forward edge (references, tagged_as, supersedes, replies_to) now automatically receives an inverse edge from target → source, making the memory graph navigable in both directions without an O(n) scan. Core (uteke-core): - EDGE_REFERENCED_BY const + backlink_type_for() helper - Store::ensure_backlink() — idempotent inverse-edge insertion - Store::add_memory_edge_with_backlink() — forward + backlink in one call - Store::add_memory_edges_batch() now also ensures backlinks (covers the auto-wire path on every ) - Store::rebuild_backlinks() — scan forward edges, repair missing inverses - Uteke::link_memories() — public explicit-edge API with auto backlink - Uteke::rebuild_backlinks() — delegates to Store, logs count - lib.rs now exports edge types + EdgeList/MemoryEdge/backlink_type_for CLI (uteke-cli): - New subcommand - gains Tests (+11 new, 198 → 209 core tests, all pass): - backlink_type_for forward/inverse/unknown mapping - ensure_backlink: creates inverse, idempotent, skips inverse+unknown types, skips self-loops - add_memory_edge_with_backlink: creates both, idempotent - batch insert generates backlinks for all forward edges - rebuild_backlinks: from existing forward edges, idempotent, ignores non-forward types - wire_edges end-to-end: remember() produces forward + referenced_by backlink - Updated store_edge_dedup for new backlink semantics Docs: CHANGELOG + cli-reference.md (rebuild-backlinks command, --direction) Closes #350 * fix(#350): mark wire_edges e2e test #[ignore] + propagate rebuild errors CI failure: wire_edges_generates_backlinks calls Uteke::open which downloads the ONNX embedder from HuggingFace — unavailable in the CI sandbox. Marked #[ignore] consistent with the other Uteke::open-based tests in lib.rs (test_recall_threshold_*). Backlink behavior is fully covered at the Store level by batch_insert_generates_backlinks, add_memory_edge_with_backlink_*, and rebuild_backlinks_*. Also addressed Cora review comment: rebuild_backlinks() previously used .filter_map(|r| r.ok()) which silently dropped per-row rusqlite errors. Replaced with .collect::<Result<Vec<_>, _>>()? so iteration failures propagate instead of being swallowed. * fix(#350): propagate backlink errors instead of silent warn Addresses Cora + CodeCora review: backlink failures were silently swallowed (tracing::warn only), which could leave the store with a forward edge but missing inverse 'referenced_by' edge — contradicting the documented 'automatic' backlink guarantee. - Store::add_memory_edge_with_backlink() now propagates ensure_backlink errors via '?'. Callers who explicitly request 'with backlink' get transactional semantics. - Store::add_memory_edges_batch() also propagates. The auto-wire path (Uteke::wire_edges) already wraps batch failures in a best-effort catch (tracing::warn), so remember() still never fails due to edges. * fix(#350): atomic forward + backlink insertion via SQLite transaction CodeCora flagged: 'add_memory_edge_with_backlink() inserts the forward row first and only then calls ensure_backlink(). If backlink creation fails, the method returns an error but leaves the DB in a partially updated state with only the forward edge present.' Wrap both insert paths in unchecked_transaction(): - add_memory_edge_with_backlink: forward + inverse in single tx - add_memory_edges_batch: full batch + all inverses in single tx On backlink failure the transaction is dropped (rollback) so no partial edge state survives. Commits only when both forward and inverse are applied. The 'no-backlink' edge types still commit (they have no inverse to guarantee). * fix(#350): wrap rebuild_backlinks in transaction for atomic repair CodeCora flagged: rebuild_backlinks scans rows then inserts missing backlinks one-by-one without a transaction. If one insert fails partway, the repair is left in a partial state with some backlinks created and others missing. Wrap the repair pass in unchecked_transaction() so either all missing backlinks are written or the whole rebuild rolls back atomically.
…386) * feat(#349): memory type formalization + pattern-based auto-inference Expand MemoryType enum from 5 to 9 variants (add Note, Insight, Reference, Event) and add zero-LLM pattern-based inference on every remember(). Core (uteke-core): - MemoryType enum: +Note, +Insight, +Reference, +Event variants - MemoryType::infer_from_content(): URL prefix → Reference; decided/chose/will use → Decision; realized/learned/discovered → Insight; how-to/numbered list → Procedure; always/never/prefer/hate → Preference; ISO date + time word → Event; fallback → Note - MemoryType::recall_boost(): per-type additive score boost (Decision/Preference +0.05, Insight +0.03, Event +0.02, Note -0.02) - remember_typed() now runs inference when caller passes the default 'fact'. If inference yields Note (ambiguous), keeps Fact for backward compatibility. Explicit types are honored as-is. - Helper functions: contains_any, is_numbered_list, has_iso_date CLI (uteke-cli): - --type help text documents the full taxonomy + auto-inference Tests (+13 new, 208 → 221 core tests): - enum roundtrip + case-insensitive parsing - per-pattern inference tests (reference, decision, insight, procedure, preference, event, fallback note) - recall_boost sign checks - has_temporal_validity for new variants - has_iso_date + is_numbered_list helpers Closes #349 * fix(#349): reference detection with whitespace + drop http:// URL CodeCora #386 flagged two issues: 1. infer_from_content() used lower.starts_with() on the original content for 'ref:' / 'see:' / 'docs:' detection, while the comment said these are line-start signals. Leading whitespace (e.g. ' ref: ...') would miss the Reference classification. Fixed: use first_line.to_lowercase() for line-start signals. 2. Test hardcoded http://example.com — replaced with https:// and added a regression test for the whitespace case. * fix(#349): split remember_typed (explicit) and remember_auto_infer CodeCora #386: remember_typed reclassified explicit 'fact' values via auto-inference, breaking the API contract — callers passing 'fact' explicitly could get 'Preference' back. Fix: - remember_typed() now honors the caller-chosen type as-is, no override - remember_auto_infer() is the new inference path; explicit_type=None triggers pattern-based inference, Some(t) bypasses it - remember() default path uses remember_auto_infer(None) so content signals drive the type - Shared embed-then-store logic extracted into private remember_embed() Backward compat preserved: ambiguous content still falls back to 'fact'. * fix(#349): uppercase URL schemes + multi-digit numbered lists CodeCora #386 round 2 found two bugs in infer_from_content: 1. URL detection used first_line.starts_with("http://") on the original (case-sensitive) string. 'HTTPS://example.com' was NOT detected as Reference. Fix: use first_lower for all prefix checks. 2. is_numbered_list used strip_prefix(single_digit) which only stripped ONE leading digit. '10. item' → strip '1' → rest='0. item' → no separator match. Fix: take_while(all_digits) then check separator. Added regression tests for both cases. * fix(#349): validate explicit_type in remember_auto_infer CodeCora #386 r2: remember_auto_infer(Some(t)) forwarded the type string directly to remember_embed without validation, bypassing the unknown-type check that remember_typed performs. An invalid type like 'bogus' would silently be stored. Fix: run the same MemoryType::from_str_opt validation before using the explicit type string. * fix(#349): reset counter on parse failure in is_numbered_list CodeCora #386 r3: when num_str.parse::<u32>() failed (e.g. overflow from '9999999999999999999999999. x'), the code fell through via 'continue' without resetting consecutive/expected. A large-number line between valid numbered lines would not break the sequence. Fix: on parse failure or out-of-order number, reset consecutive=0 and expected=1. * fix(#349): validate month/day ranges in ISO date detection CodeCora #386 r4: is_iso_date_bytes only checked the digit/dash pattern, accepting impossible dates like 2026-99-99 or 2026-13-40 as valid Event triggers. Fix: parse month and day from the digit bytes and validate month is 1-12 and day is 1-31. Added regression tests for invalid dates. * fix(#349): clippy manual_range_contains in is_iso_date_bytes Clippy CI failed: month/day range checks used manual >= && <= instead of RangeInclusive::contains. * fix(#349): per-month day validation in ISO date detection CodeCora #386 r5: is_iso_date_bytes validated month 1-12 and day 1-31 globally, accepting impossible dates like 2026-02-31 or 2026-04-31. Fix: lookup max_day per month (31 for Jan/Mar/May/Jul/Aug/Oct/Dec, 30 for Apr/Jun/Sep/Nov, 29 for Feb to accept leap day). Not a full calendar implementation but eliminates the most obvious false positives. Added tests for per-month invalid dates.
* feat(#352): salience + recency dual-axis recall ranking Add two orthogonal, opt-in boost axes for recall: salience (mattering) and recency (freshness). Both are computed from existing memory fields — zero LLM. Core (uteke-core): - New salience_recency.rs module: - salience_score(): 0..=1 blend of access_count, importance, pinned - recency_score(): per-type exponential decay (exp(-age/half_life)) - type_half_life_days(): Decision/Preference 365d, Fact/Reference 180d, Insight 240d, Event 30d, default 90d - apply_boosts(): additive fusion of base score + salience + recency - SalienceRecencyConfig with sanitized() clamp + is_noop() check - Uteke::set_salience_recency_config() for per-query overrides - Boosts applied AFTER recall cache lookup so cache stays time-independent CLI (uteke-cli): - --salience / --recency flags on 'recall' - [recall] config: salience_weight (0.15), recency_weight (0.15) Tests (+12 new): - salience: zero access, pinned bonus, high access climbs, clamped to 1 - recency: brand new ~1, decays with age, per-type half-life ordering - type_half_life: known types + unknown fallback - apply_boosts: noop when weights zero, raises score when active - config: sanitized() clamps, is_noop() Closes #352 * fix(#352): reset salience/recency config after each recall CodeCora #387: set_salience_recency_config() mutates shared state on Uteke instance. In server / MCP mode where one Uteke instance serves multiple requests, a --salience / --recency override would leak into later recalls that didn't request those flags. Fix: add Uteke::reset_salience_recency_config() and call it after each recall_hybrid / recall_related / recall_at_time returns. The CLI recall command now resets the boost config as soon as the results are fetched, before any post-processing. * docs(#352): clarify 'half-life' terminology (it's actually τ) CodeCora #387 noted: the recency formula uses exp(-age_days / half_life), which yields ~0.37 (1/e) at age_days == half_life. A true half-life yields 0.5 at that point. The math was intentional (exponential time constant), but the terminology was wrong. Fix: rename doc comments to 'time constant (τ)' and clarify that a true half-life would require multiplying by ln(2) ≈ 0.693. Function names unchanged for backward compat. * fix(#352): prevent boost config leak on recall error paths CodeCora #387: set_salience_recency_config() was called before the recall closure, but reset only ran on the success path. Early returns from parse_from_rfc3339 or '--at and --related' conflict left the boost config active on the shared Uteke instance. Fix: wrap recall logic in an IIFE closure that returns Result. The closure captures all ? early-return paths, then reset runs unconditionally before unwrapping the result. Also: CHANGELOG updated to use 'time constant (τ)' instead of 'half-life' for the recency decay formula.
* feat(#347): timeline event tracking — per-memory audit log Add an append-only event log per memory (created, updated, recalled, consolidated, tagged, forgot) in a new timeline_events table (schema v9). Core (uteke-core): - New timeline.rs module: - TimelineEventType enum (6 variants) - TimelineEvent struct (id, memory_id, event_type, event_data, created_at) - Store::add_timeline_event / list_timeline_events / count_timeline_events - Uteke::timeline / count_timeline_events / try_timeline_event - Schema migration v8 → v9: timeline_events table + 3 indices (idempotent, no data backfill — timeline starts from this version forward) - remember_precomputed() now emits a 'created' event (best-effort) CLI (uteke-cli): - New 'uteke timeline <id> [--limit N]' command (default 20, JSON support) Tests (+5 new): - TimelineEventType roundtrip - timeline_add_and_list (with JSON event_data) - timeline_limit + count - empty for missing memory - migration_dispatcher_reaches_v9 Existing schema-version assertions updated (v8 → v9). Closes #347 * fix(#347): clarify timeline hook placement + emit Consolidated event CodeCora #388 questioned whether the 'created' timeline event covers all remember paths. The hook is correctly placed in remember_precomputed (the single shared creation path called by remember(), remember_typed(), remember_with_contradiction(), and the consolidate path). Comment now makes that explicit. Also emits a 'consolidated' event when remember_with_contradiction supersedes an older memory, with the deprecated id in event_data. * fix(#347): Consolidated event on superseded memory + tiebreaker sort CodeCora #388 found two issues: 1. Consolidated timeline event was attached to the NEW replacement memory, but semantically it should be on the OLD (superseded) memory — that's the one being retired. Fix: attach to deprecated_id, with metadata 'replaced_by' pointing to the new memory. 2. Timeline events ordered by created_at DESC only, but RFC3339 strings from to_rfc3339() omit fractional seconds when zero. Events created in the same second had undefined relative order. Fix: add 'id DESC' as a secondary sort key (AUTOINCREMENT ensures insertion order). Also: handle deprecated_id being Option<String> properly. * fix(#347): log JSON serialization failures instead of silent empty string CodeCora #388: add_timeline_event used serde_json::to_string(v) .unwrap_or_default() which stored empty string "" on serialization failure, silently corrupting event data. Fix: on serialization failure, log a warning and store 'null' as a detectable sentinel value instead of masking it as empty.
* feat(#351): orphan detection — find disconnected memories Detect memories that have no graph edges (incoming or outgoing), have never been recalled, are not pinned, and fall below an importance threshold. Such memories dilute recall quality and are prime candidates for cleanup via the dream cycle (#353). Core (uteke-core): - New orphans.rs module: - OrphanMemory struct with orphan_score (0.0..=1.0) - compute_orphan_score(): (1-edge_density)*0.4 + (1-access_freq)*0.3 + (1-importance)*0.3 - Store::find_orphans(): single SQL pass via LEFT JOIN on memory_edges twice — no O(n^2) scan - Uteke::find_orphans() with namespace scoping - DEFAULT_ORPHAN_THRESHOLD = 0.3 - Leverages #350 backlinks: any referenced memory is automatically excluded CLI (uteke-cli): - New 'uteke orphans [--threshold 0.3] [--limit 50]' command Tests (+7 new): - orphan_score: disconnected/low vs connected/high - find_orphans: returns isolated low-importance, excludes connected - respects threshold (low vs high) - excludes pinned and accessed memories - namespace-scoped detection - limit cap Closes #351 * fix(#351): fetch all orphan candidates before sort + truncate CodeCora #389: the previous loop broke out as soon as orphans.len() >= limit, but the subsequent sort_by(orphan_score desc) could reorder the truncated subset — a higher-score orphan that appeared later in the SQL result set would be dropped. Fix: collect all candidates first, compute orphan_score, sort, THEN truncate to limit. Orphan result sets are typically small (each match has zero edges + zero accesses), so the full fetch is cheap. * fix(#351): differentiate access_count=0 vs 1 + clamp importance CodeCora #389 found two issues in compute_orphan_score: 1. access_count.max(1) made access_count=0 and access_count=1 produce the same log10(1)/3 = 0.0 score. Never-accessed memories were treated identically to accessed-once. Fix: use log10(n+1) so access_count=1 produces a non-zero normalized frequency. 2. importance was cast to f32 and used as (1-importance)*0.3 without clamping. Out-of-range values (>1.0 or <0.0) would skew the score or produce negative results. Fix: clamp to [0, 1]. Added 2 regression tests: never-accessed vs once-accessed, and importance bounds clamping. * fix(#351): exclude deprecated memories + clippy manual_range_contains CodeCora #389 round 2: find_orphans SQL didn't filter m.deprecated = 0, so superseded memories could appear as orphan candidates even though they were intentionally retired. Fix: add 'AND m.deprecated = 0' to the WHERE clause. Also: fix clippy manual_range_contains warning in test assertion.
* feat(#353): dream cycle — coordinated maintenance pipeline Add 'uteke dream', a single command that runs all 6 maintenance phases in dependency order: lint → backlinks → dedup → orphans → compact → verify. All local, zero LLM. Inspired by GBrain's overnight dream cycle. Core (uteke-core): - New dream.rs module: - DreamPhase enum (6 phases) with all_in_order() + from_str_opt() - DreamReport with per-phase results, totals, dry_run flag, duration - PhaseResult / PhaseStatus types - Uteke::dream(namespace, dry_run, phases) orchestrator - Lint: count memories with unknown memory_type values - Backlinks: rebuild_backlinks() (#350) - Dedup: consolidate(threshold=0.92) - Orphans: inline SQL count (degrades gracefully if #351 not merged) - Compact: prune(TTL=30d) - Verify: existing verify() (db/index consistency) CLI (uteke-cli): - New 'uteke dream [--phases P1,P2] [--skip P3] [--dry-run] [--quiet]' - Exits non-zero on errors (cron-friendly) - --quiet shows only warnings/errors Tests (+4 new): phase roundtrip, phase order, dry-run, phase filter Closes #353 * fix(#353): don't abort dream on phase error + lint via SQL CodeCora #390 flagged two issues: 1. dream() propagated the first phase error via '?', aborting the whole pipeline. Fix: wrap each phase in a match — failures are recorded as a PhaseStatus::Error result but subsequent phases still run. 2. phase_lint loaded every memory into RAM via load_all() just to count bad types. Fix: use SQL COUNT with NOT IN (...) — O(1) memory, no deserialization overhead. * fix(#353): error on invalid phase + namespace-aware orphans + propagate SQL errors CodeCora #390 found three issues: 1. Invalid --phases names were silently dropped via filter_map, causing 'uteke dream --phases bogus' to run ALL phases. Fix: return error listing valid phase names. 2. phase_orphans ignored the namespace parameter (_namespace). Running 'uteke dream --namespace X' counted orphans globally. Fix: add 'AND m.namespace = ?2' when namespace is provided. 3. Multiple SQL queries used unwrap_or(0) which masked database errors as 'clean' results. Fix: propagate via map_err → Error::db. Pipeline catch loop converts to PhaseStatus::Error without aborting. * fix(#353): namespace-aware lint + exclude deprecated in orphan count CodeCora #390 r2: 1. phase_lint ignored namespace, running global COUNT regardless of the --namespace flag. Fix: add WHERE namespace = ?1 when namespace is provided. 2. phase_orphans SQL didn't exclude deprecated memories, matching the same bug fixed in #351. Fix: add AND m.deprecated = 0 to both namespace and global queries. * fix(#353): dedup phase returns Warning status when duplicates found CodeCora #390 r3: phase_dedup set warnings=1 when duplicates were found but couldn't be merged (dry-run or threshold too high), yet status remained Ok. Inconsistent with phase_lint and phase_orphans which return Warning status for the same pattern. Fix: set PhaseStatus::Warning when has_warnings is true. * docs(#353): document namespace scope and dry-run semantics CodeCora #390 r3 raised two architectural concerns: 1. Backlinks phase is global, not namespace-scoped. This is by design — rebuild_backlinks() operates on the edge graph which is not namespace- partitioned. Documented in the dream() doc comment. 2. Orphan detection in dry-run doesn't reflect projected post-maintenance state. This is by design — dry-run reports against current state. Documented in the dream() doc comment. No code changes — documentation only. * fix(#353): canonical phase order + dedup CodeCora #390 r4: if user passed --phases verify,lint,backlinks, phases executed in that order instead of dependency order. verify before lint makes no sense and could produce misleading results. Fix: sort selected phases by canonical position in all_in_order(), and dedup duplicates. Added 2 tests: reversed order, and duplicate phases. * fix(#353): compact phase shows 'would be pruned' in dry-run CodeCora #390 r4: phase_compact always printed 'memories pruned' even in dry-run mode, implying destructive changes already happened. Fix: print 'would be pruned' when dry_run is true.
#382: GET /stats?namespace=<name> returned 404 because the handler hardcoded uteke.stats(None). Fix: parse ?namespace= query parameter and pass to stats() for scoped results. #384: 'uteke init --agent hermes' was not recognized. Added init_hermes() which generates a complete uteke-tool plugin directory (plugin.yaml, tool.py, README.md) matching the Hermes plugin format documented in docs/integrations/hermes.md. Also fixed CLI help text: removed nonexistent 'copilot, codex' agents, added 'hermes'. #383 (port 8888 vs 8767): already fixed in codebase — config template uses 8767. No code change needed.
* feat(#348): citation & source attribution system Add provenance tracking to every memory via source + source_type columns. Core: - Schema v9→v10 migration: ALTER TABLE memories ADD COLUMN source TEXT, source_type TEXT NOT NULL DEFAULT 'unknown' - Memory struct: source: Option<String>, source_type: String fields - SourceType variants: user, url, file, import, derived, system, unknown - Uteke::set_source(id, source, source_type) for post-insert updates - ExportEntry gains optional source field for round-trip preservation - Import auto-sets source_type='import', source='import:<filename>' - Default for new memories: source=None, source_type='user' CLI: - 'uteke remember --source <URL> --source-type url' flags - Server mode forwards source/source_type in POST /remember body Tests: +1 new (set_source round-trip). Schema version assertions updated from v9 to v10. Closes #348 * fix(#348): use stored ID for set_source, not latest-memory lookup CodeCora #396: set_source used uteke.list(None, 1, 0, ns) to find the latest memory by namespace. In concurrent contexts, another memory could be inserted between remember() and the lookup, causing source attribution to be applied to the wrong memory. Fix: capture the ID returned by remember() / remember_with_contradiction() in a hoisted stored_id variable, and pass it directly to set_source(). * fix(#348): propagate set_source errors instead of ignoring CodeCora #396 r2: 'let _ = uteke.set_source(...)' silently ignored database errors, so the CLI could report success even when --source was never persisted. Fix: use '?;' to propagate the error as a user-facing failure.
* feat(#381): MCP Streamable HTTP transport + protocol version bump Protocol: - Bump protocolVersion from 2024-11-05 to 2025-06-18 (current spec) Architecture: - Extract MCP handler into uteke_mcp library crate (lib.rs) - main.rs simplified to just stdio transport loop delegating to lib - uteke-server gains POST /mcp endpoint that calls the shared handler HTTP endpoint: - POST /mcp accepts JSON-RPC body (initialize, tools/list, tools/call) - Returns application/json with MCP-Protocol-Version header - Uses existing Mutex<Uteke> from uteke-server (thread-safe) - Enables remote MCP clients without subprocess spawning Closes #381 * fix(#381): restore dropped params + body size limit CodeCora #397: 1. exec_remember now passes --type to remember_typed (was dropped in refactor). 2. exec_recall now accepts tags filter and min_score (were hardcoded to None and 0.0). 3. exec_list now accepts offset for pagination (was hardcoded to 0). 4. POST /mcp enforces 1 MiB body size limit via .take() to prevent memory exhaustion from unbounded reads. Also: updated tool schemas to document the restored parameters. * fix(#381): restore room/author params in exec_remember CodeCora #397 r2: the refactor dropped room and author parameters from the MCP remember tool. Clients using collaborative memory (room mode) would silently lose room linkage. Fix: restore room/author handling with remember_in_room() when room is provided, plus add them to the tool schema. * fix(#381): safe ID slicing + reject oversized MCP bodies CodeCora #397 r3: 1. exec_list used &m.id[..8] which panics if ID < 8 bytes. Fix: use m.id.get(..8).unwrap_or(&m.id) for safe slicing. 2. POST /mcp used .take(MAX_MCP_BODY) which silently truncated oversized bodies, processing a partial JSON-RPC message as if valid. Fix: check Content-Length header first and return 413 if > 1 MiB. * chore: retrigger CI (flaky env test on previous run)
* fix(#394): include binary name and version in schema mismatch error Error now reads: 'please upgrade uteke (current binary: uteke-core v0.2.0, schema v10)' instead of just 'please upgrade uteke'. Makes it clear which binary needs upgrading and what version the user has. * chore: retrigger CI
#399) * fix(#392): room list is cross-namespace + add room create (#393) #392: 'uteke room list' was filtered by the global --namespace flag, making rooms invisible to agents in other namespaces. Rooms are cross-namespace collaboration spaces — list should show ALL rooms unless explicitly filtered with 'room list --namespace X'. Fix: only apply namespace filter when explicitly passed on the room subcommand, not inherited from the global flag. #393: No 'uteke room create' command existed — rooms could only be created implicitly via 'remember --room'. Added explicit: uteke room create <room_id> [--title "My Room"] * fix: clippy unneeded return in room create handler
* feat(#385,#395): auto-install Hermes plugin + room operations #385: init --agent hermes now installs to ~/.hermes/plugins/uteke-tool/ instead of generating to CWD. Falls back to CWD if HOME not set. Plugin uses Python stdlib only (urllib, no requests dependency). README documents MCP server path: hermes mcp add uteke --command uteke-mcp. #395: Plugin now exposes room operations: room_create, room_recall, room_list, room_summary, room_stats, room_delete. Added server endpoints for the missing operations: POST /room/create, GET /room/list, POST /room/stats, DELETE /room/delete. Also fixes #392 (room list cross-namespace visibility) and #393 (room create command) which were already merged but needed server-side endpoints for the plugin. * fix(#385,#395): CodeCora fixes 1. Windows support: check USERPROFILE as fallback for HOME when determining plugin install directory. 2. URL decoding: parse_query_param now percent-decodes values (%20 → space, + → space) for proper namespace/room_id handling. 3. DELETE /room/delete returns 404 for non-existent rooms instead of 500 (not-found is a client error, not server failure). * fix(#385,#395): native path separators + proper UTF-8 url_decode CodeCora r2: 1. Plugin install path uses PathBuf::push() for platform-native separators instead of hardcoded forward slashes. 2. url_decode collects bytes into Vec<u8> then converts via String::from_utf8() to correctly handle multi-byte UTF-8 sequences.
The init_hermes() function was generating plugin.yaml, tool.py, and README.md but missing __init__.py — which Hermes requires to load the plugin as a Python package. Without __init__.py, Hermes logs: WARNING: Failed to load plugin 'uteke-tool': No __init__.py Fix: write __init__.py as the first file in plugin_dir. Update JSON output files list to include it. Note: Bug 2 in #402 (MCP tools not injected into agent tool list) is a Hermes-side issue, not uteke. The MCP server correctly responds to tools/list — the problem is in Hermes' TUI/desktop gateway.
Three fixes for v0.2.0 validation issues: 1. **Contradictory server detection log**: When server was detected but command unsupported (aging, doctor, etc.), code fell through to "No server detected" — contradicting the earlier "Server detected" info log. Now logs "Opening local store for server-unsupported command" when server IS available but command falls back to local. 2. **Misleading db_size_bytes**: Stats reported global DB size alongside namespace-scoped memory count, making a 10-memory namespace appear to use 1.7 MB. Added "(global, shared)" label in human output and updated doc comment to clarify the field is global across all namespaces. 3. **Aging defaults**: Documented in issue but deferred to #404 (configurable limits) — moving hardcoded constants to config is a larger refactor that belongs in v0.3.0 scope.
* release: v0.2.1 — DX & Ecosystem Version bump 0.2.0 → 0.2.1. Highlights: - Memory types, backlinks, timeline, salience/recency ranking - Dream cycle maintenance pipeline - Orphan detection - Citation & source attribution (schema v10) - MCP Streamable HTTP transport (protocol 2025-06-18) - OpenAI + Ollama embedding backends - Hermes plugin auto-install with room operations - Fixes: #402 (__init__.py), #403 (server log + DB size label) Includes: version bump, CHANGELOG, README/README.id update, docs (cli-reference, architecture, configuration, hermes integration), roadmap update. Closes #402, #403. * fix: flaky embedding settings test — add #[serial] to prevent env var race The embedding_settings_env_* tests share UTEKE_EMBEDDING_API_KEY and UTEKE_EMBEDDING_MODEL env vars. When cargo test runs them in parallel, one test can clobber the env var mid-assertion of another. Fix: mark all three embedding_settings_* tests with #[serial] from serial_test crate (already a dev-dep in uteke-cli, now added to uteke-core).
🔍 Cora AI Code ReviewReview powered by cora-cli · BYOK · MIT |
ajianaz
added a commit
that referenced
this pull request
Aug 13, 2026
release: v0.2.1 — sync develop to main
5 of 9 tasks
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.
🚀 Release v0.2.1 — DX & Ecosystem
Merges develop → main for the v0.2.1 release.
What's New
Features (12):
uteke room createcommand (enhancement: add uteke room create command for explicit room creation #393)Fixes (4):
uteke init --agent hermesgenerates plugin missing __init__.py, causing load failure #402 — Hermes plugin missing__init__.pyTest Fix:
embedding_settings_env_*tests — added#[serial]to prevent env var race conditionQuality
After merge: Tag
v0.2.1will trigger the release workflow (binaries + Docker + crates.io).Milestone: v0.2.1 — DX & Ecosystem