Skip to main content

nexcore_db/
lib.rs

1//! nexcore-db — Persistent SQLite storage for NexCore Brain working memory.
2//!
3//! Replaces the file-based JSON storage with a single SQLite database,
4//! providing ACID transactions, WAL mode for concurrent reads, and
5//! structured queries across sessions, artifacts, implicit knowledge,
6//! and code tracking data.
7//!
8//! # Architecture
9//!
10//! ```text
11//! nexcore-brain (business logic)
12//!     ↓
13//! nexcore-db (persistence)
14//!     ↓
15//! rusqlite + SQLite (bundled)
16//! ```
17//!
18//! # Usage
19//!
20//! ```rust,no_run
21//! use nexcore_db::pool::DbPool;
22//! use nexcore_db::sessions;
23//!
24//! let pool = DbPool::open_default().expect("open db");
25//! pool.with_conn(|conn| {
26//!     let all = sessions::list_all(conn)?;
27//!     println!("Found {} sessions", all.len());
28//!     Ok(())
29//! }).expect("query");
30//! ```
31
32#![forbid(unsafe_code)]
33#![warn(missing_docs)]
34#![cfg_attr(
35    not(test),
36    deny(clippy::unwrap_used, clippy::expect_used, clippy::panic)
37)]
38#![allow(
39    clippy::exhaustive_enums,
40    clippy::exhaustive_structs,
41    clippy::disallowed_types,
42    clippy::iter_over_hash_type,
43    clippy::arithmetic_side_effects,
44    clippy::as_conversions,
45    clippy::indexing_slicing,
46    clippy::wildcard_enum_match_arm,
47    clippy::shadow_unrelated,
48    clippy::too_many_arguments,
49    clippy::map_err_ignore,
50    reason = "Migration and persistence layers prioritize backward-compatible schema ingestion over style-only lint constraints"
51)]
52
53pub mod artifacts;
54pub mod autopsy;
55pub mod autopsy_engine;
56pub mod decisions;
57pub mod error;
58pub mod implicit;
59pub mod knowledge;
60pub mod migrate;
61pub mod pdp_telemetry;
62pub mod pool;
63pub mod schema;
64pub mod sessions;
65pub mod telemetry;
66pub mod tracker;