1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//! Knowledge graph with SQLite persistence, FTS5 search, and smart recall.
//!
//! Provides a complete knowledge graph layer on top of SQLite:
//!
//! - **Types**: [`GraphNode`], [`GraphEdge`], [`ScoredNode`], [`GraphStats`]
//! - **Schema**: [`init_graph_schema`] — creates tables, FTS5, indexes
//! - **CRUD**: node/edge insert, read, update, delete
//! - **Search**: FTS5 full-text search and dynamic filtering
//! - **Recall**: [`smart_recall`] — composite scoring with recency, importance, access, FTS, graph boost
//! - **Traversal**: [`graph_neighbors`] (1-hop), [`related_nodes`] (BFS via recursive CTE)
//! - **Lifecycle**: [`decay_importance`], [`tag_stale_nodes`], [`compute_stats`]
//!
//! All functions take `&rusqlite::Connection` — no hardcoded paths.
//!
//! ```no_run
//! use rusqlite::Connection;
//! use llm_kernel::graph::{init_graph_schema, upsert_node, smart_recall, GraphNode};
//!
//! let conn = Connection::open_in_memory().unwrap();
//! init_graph_schema(&conn).unwrap();
//!
//! upsert_node(&conn, &GraphNode {
//! id: "rust-ownership".into(),
//! node_type: "concept".into(),
//! title: "Rust Ownership Model".into(),
//! body: "Ownership, borrowing, and lifetimes...".into(),
//! tags: vec!["rust".into(), "memory-safety".into()],
//! projects: vec!["my-project".into()],
//! agents: vec![],
//! created: "2026-01-01T00:00:00Z".into(),
//! updated: "2026-01-01T00:00:00Z".into(),
//! importance: 0.8,
//! access_count: 0,
//! accessed_at: String::new(),
//! }).unwrap();
//!
//! let results = smart_recall(&conn, Some("my-project"), Some("ownership"), 5).unwrap();
//! for scored in &results {
//! println!("{:.2} — {}", scored.score, scored.node.title);
//! }
//! ```
/// CJK-aware graph search (Rust-side segmentation; no schema change).
pub use AsyncPoolGraph;
// Re-export primary types and functions
pub use ;
pub use ;
pub use ;
pub use smart_recall;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;