Skip to main content

ijima_core/
lib.rs

1// Copyright (C) 2026 Industrial Algebra
2// SPDX-License-Identifier: Apache-2.0
3
4//! # ijima-core
5//!
6//! Core schema, stores, error types, and API contract for the
7//! [Ijima](https://github.com/Industrial-Algebra/Ijima) centralized
8//! agentic memory backend.
9//!
10//! Ijima is the single source of truth for agentic memory across the IA
11//! ecosystem. This crate holds the type-level contract every other Ijima
12//! crate and every harness adapter speaks: the memory palace model, the
13//! knowledge graph, the session context repository, and the unified error
14//! type.
15//!
16//! The store implementations (SQLite + vector index), the HTTP server,
17//! the mining engine, and the harness client live in their own crates
18//! (`ijima-server`, `ijima-miner`, `ijima-client`). This crate deliberately
19//! stays transport- and backend-free so the contract can be shared without
20//! pulling in heavy I/O dependencies.
21//!
22//! ## Features
23//!
24//! - `std` (default): Standard library support. Without it, only the
25//!   pure type definitions compile.
26//!
27//! - `embeddings`: pure `Embedder` trait + `Embedding` vector type. The
28//!   default dimension is 384 to match pi-mempalace's `all-MiniLM-L6-v2`
29//!   for migration parity.
30//! - `serde`: Serialize/Deserialize impls for all domain types. Required
31//!   by the store backends and the HTTP API.
32//! - `store`: the pure async `Store` trait every backend implements.
33//!
34//! ## Status
35//!
36//! Scaffolded — the API surface is being filled in test-first. See
37//! `docs/HANDOFF.md` and `docs/DESIGN.md` at the repository root.
38
39#![forbid(unsafe_code)]
40#![warn(missing_docs)]
41
42pub mod capabilities;
43pub mod diary;
44pub mod embeddings;
45pub mod error;
46pub mod harness;
47pub mod knowledge;
48pub mod memory;
49pub mod mining;
50pub mod namespace;
51pub mod palace;
52pub mod provenance;
53pub mod repo;
54pub mod revocation;
55pub mod session;
56pub mod store;
57
58/// Federation control-API wire contract (scaffold). Gated behind the
59/// `federation` feature; see `docs/adr/federation-control-api.md`.
60#[cfg(feature = "federation")]
61pub mod federation;
62
63pub use capabilities::intersection_number;
64pub use diary::DiaryEntry;
65pub use embeddings::{DEFAULT_EMBEDDING_DIM, Embedder, Embedding};
66pub use error::IjimaError;
67pub use knowledge::{
68    Entity, EntityId, EntityRecord, ImportTriple, KgImportCounts, KgStats, KnowledgeGraph, Triple,
69};
70pub use memory::{Memory, MemoryId, MemorySource};
71pub use mining::{AcceptedExtraction, QueuedExtraction};
72pub use namespace::{Namespace, NamespaceId, NamespaceKind, NamespaceMembership};
73pub use palace::{PalaceGraph, ProjectTaxon, Room, Tunnel, TunnelTraversal};
74pub use provenance::{AuthorityScope, InstanceId};
75pub use repo::RepoDirectory;
76pub use revocation::TokenRevocation;
77pub use session::{Session, SessionId, SessionTurn, TurnRole};
78pub use store::{NamespaceCount, SearchHit, Store, StoreStats};
79
80/// Convenience `Result` alias used throughout the Ijima crates.
81pub type Result<T, E = IjimaError> = core::result::Result<T, E>;