- M5p1: BM25 text indexing via Tantivy with background syncer (0.26ms @ 10K docs) - M5p2: RRF fusion layer combining BM25 + ANN scores (46µs @ 1K candidates) - M5p3: unified Search query API (8-stage pipeline, BM25 + vector + ranking) - M5p4: creator text + vector indexing and creator search executor (< 20ms @ 200 creators) - Refactor db/mod.rs into focused sub-modules (creators, items, sessions, signals, etc.) - Decompose monolithic files into directory modules (query/executor, ranking/diversity, etc.) - Split brute.rs → brute/mod.rs + brute/tests.rs; extract search executor helpers - Add benches: fusion, search, session, text_index - Add M5 UAT test suites (m5_uat, m5_search, m5p4_creator_search, text_index) - Update blog posts, roadmap, content strategy, and M5 planning docs - Add tmp/ and .claude/worktrees/ to .gitignore Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
54 lines
2.5 KiB
Rust
54 lines
2.5 KiB
Rust
//! Agent session layer for tidalDB.
|
|
//!
|
|
//! Provides session-scoped signals with aggressive decay, schema-declared
|
|
//! policies, and FOR SESSION ranking context. An agent creates a session,
|
|
//! writes preference hints and reward signals, then queries results shaped
|
|
//! by that session — all without Redis, a feature store, or middleware.
|
|
//!
|
|
//! # Architecture
|
|
//!
|
|
//! - Active sessions live in a `DashMap<SessionId, Arc<SessionState>>` in `TidalDb`.
|
|
//! - Session signals are tracked in per-session `DashMap<String, SessionHotState>`,
|
|
//! keyed by signal type name.
|
|
//! - On `close_session`, the snapshot is archived to `closed_sessions` (and
|
|
//! optionally to persistent storage in durable mode).
|
|
//! - The `FOR SESSION` ranking boost is applied by `ProfileExecutor::score_with_session`
|
|
//! using a `SessionContext` derived from the session snapshot.
|
|
//!
|
|
//! # Module structure
|
|
//!
|
|
//! | File | Concern |
|
|
//! |------|---------|
|
|
//! | `types` | Identity newtypes (`SessionId`, `AgentId`) and lightweight DTOs |
|
|
//! | `signal_state` | Per-session decay math (`SessionHotState`, `SessionSignalState`) |
|
|
//! | `audit` | Bounded audit log and `MAX_*` constants |
|
|
//! | `policy` | Policy rule evaluation (`PolicyEvaluator`, violations) |
|
|
//! | `state` | Live runtime state (`SessionState`, `SessionHandle`) |
|
|
//! | `snapshot` | Full state dumps and `SessionContext` for ranking |
|
|
//! | `serde` | Binary encode/decode for all session record types |
|
|
|
|
pub mod audit;
|
|
pub mod policy;
|
|
pub mod serde;
|
|
pub mod signal_state;
|
|
pub mod snapshot;
|
|
pub mod state;
|
|
pub mod types;
|
|
|
|
// ── Re-exports ────────────────────────────────────────────────────────────────
|
|
// Everything below preserves the flat `crate::session::Foo` import surface
|
|
// that db/mod.rs, query/*, and ranking/* depend on.
|
|
|
|
pub use audit::{AuditEntry, AuditLog, MAX_ANNOTATIONS, MAX_AUDIT_ENTRIES, MAX_CLOSED_SESSIONS};
|
|
pub use policy::{PolicyEvaluator, PolicyViolation, PolicyViolationKind};
|
|
pub use serde::{
|
|
deserialize_audit_log, deserialize_snapshot, deserialize_start_record, serialize_audit_log,
|
|
serialize_snapshot, serialize_start_record,
|
|
};
|
|
pub use signal_state::{
|
|
DEFAULT_SESSION_LAMBDA, SessionHotState, SessionSignalState, SignalSnapEntry,
|
|
};
|
|
pub use snapshot::{SessionContext, SessionSnapshot, build_frozen_snapshot, build_snapshot};
|
|
pub use state::{SessionHandle, SessionState};
|
|
pub use types::{AgentId, SessionId, SessionInfo, SessionSummary};
|