Skip to content

Commit bf97eec

Browse files
senamakelmedullabot
andcommitted
feat(tinymemory-api): clarify module documentation and re-export structure
Updated the crate-level documentation to explain that value types, error enums, and capability vocabulary are now re-exported from `tinymemory_bus` rather than defined directly. Added a new section describing the split between driver authors who need this crate's traits and hosts who only require `tinymemory-bus`, along with the rationale for avoiding duplicate type definitions. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
1 parent 0024ef7 commit bf97eec

1 file changed

Lines changed: 27 additions & 10 deletions

File tree

  • crates/tinymemory-api/src

crates/tinymemory-api/src/lib.rs

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
11
//! Stable public contracts for the TinyMemory memory system.
22
//!
3-
//! This crate holds the value types, error enum, capability vocabulary, and
4-
//! storage trait that memory engines and their embedding hosts compile
5-
//! against. It is engine-neutral on purpose: `tinycortex` is the default
6-
//! embedded engine, not the owner of the contract, and a second engine
7-
//! (`supermemory`, `mem0`, a self-hosted HTTP backend) implements the same
8-
//! traits without either engine learning about the other.
9-
//! It is deliberately dependency-light (serde / serde_json /
10-
//! chrono / sha2 / anyhow / thiserror / async-trait / uuid only) so depending on
11-
//! the contract never drags in SQLite, git2, reqwest, regex, or an async
12-
//! runtime.
3+
//! This crate holds the traits a memory engine implements, the host seam it is
4+
//! bound through, and — re-exported from [`tinymemory_bus`] — the value types,
5+
//! error enum and capability vocabulary they exchange. It is engine-neutral on
6+
//! purpose: `tinycortex` is the default embedded engine, not the owner of the
7+
//! contract, and a second engine (`supermemory`, `mem0`, a self-hosted HTTP
8+
//! backend) implements the same traits without either engine learning about the
9+
//! other. It is deliberately dependency-light (serde / serde_json / anyhow /
10+
//! async-trait / schemars / log, plus `tinymemory-bus`) so depending on the
11+
//! contract never drags in SQLite, git2, reqwest, regex, or an async runtime.
12+
//!
13+
//! ## The vocabulary lives one layer down
14+
//!
15+
//! Every payload type is defined in [`tinymemory_bus`] and re-exported here at
16+
//! its historical path, so `tinymemory_api::types::MemoryEntry` is the *same
17+
//! item* as `tinymemory_bus::types::MemoryEntry`, not a structural twin.
18+
//!
19+
//! The split follows what a consumer actually needs. A **driver author**
20+
//! implements [`provider::MemoryProvider`] and wants this crate: traits, the
21+
//! null driver, the mandatory composition, the [`host`] seam. A **host** loads
22+
//! `tinymemory-module` over `TinyBus` and only makes calls — it names
23+
//! `MemoryEntry` and `MemoryCategory` and implements nothing — so it depends on
24+
//! `tinymemory-bus` alone and compiles none of this.
25+
//!
26+
//! Defining a second set of payload types for that host was the alternative,
27+
//! and it is the failure the root manifest's `[patch]` table exists to prevent:
28+
//! `MemoryCategory` from the module would not be `MemoryCategory` in the host,
29+
//! with a conversion at every call site that nothing type-checks.
1330
//!
1431
//! ## Self-contained by design
1532
//!

0 commit comments

Comments
 (0)