agentic_contracts/lib.rs
1//! # Agentic Contracts v0.2.0
2//!
3//! Shared contracts for the AgenticOS ecosystem.
4//!
5//! This crate defines the traits, types, and standards that ALL sisters must implement.
6//! It serves as the single source of truth for:
7//!
8//! - **Sister trait**: Core lifecycle management
9//! - **SessionManagement / WorkspaceManagement**: Context handling (split in v0.2.0)
10//! - **Grounding trait**: Query-based evidence verification (rewritten in v0.2.0)
11//! - **EventEmitter trait**: Observability events
12//! - **Queryable trait**: Standard query interface
13//! - **FileFormat traits**: 20-year compatible file I/O (trait-based in v0.2.0)
14//! - **Errors**: Two-layer error model — ProtocolError + SisterError (new in v0.2.0)
15//! - **Hydra**: Placeholder traits for orchestrator integration (new in v0.2.0)
16//!
17//! ## What changed in v0.2.0
18//!
19//! v0.1.0 was written based on THEORY. v0.2.0 was validated against REALITY
20//! (the actual implementations in 5 shipped sisters).
21//!
22//! Key changes:
23//! - `SisterFileHeader` (96-byte "AGNT") → `FileFormatReader`/`FileFormatWriter` traits
24//! - `ContextManagement` → split into `SessionManagement` + `WorkspaceManagement`
25//! - `Grounding` → query-based (no evidence_id), three methods: ground/evidence/suggest
26//! - `SisterConfig` → flexible data paths (single, multiple, or none)
27//! - Added `ProtocolError` for MCP/JSON-RPC errors (separate from `SisterError`)
28//! - Added `hydra` module with `HydraBridge` and `ExecutionGate` placeholders
29//!
30//! ## Usage
31//!
32//! ```toml
33//! [dependencies]
34//! agentic-contracts = "0.2"
35//! ```
36//!
37//! ```rust,ignore
38//! use agentic_contracts::prelude::*;
39//!
40//! pub struct MyNewSister {
41//! // ...
42//! }
43//!
44//! impl Sister for MyNewSister {
45//! const SISTER_TYPE: SisterType = SisterType::Memory;
46//! const FILE_EXTENSION: &'static str = "amem";
47//! // ...
48//! }
49//! ```
50//!
51//! ## The Promise
52//!
53//! - ANY sister can be consumed by Hydra uniformly
54//! - ANY sister can work with ANY other sister
55//! - ANY file format will be readable in 20 years
56
57pub mod context;
58pub mod errors;
59pub mod events;
60pub mod file_format;
61pub mod grounding;
62pub mod hydra;
63pub mod query;
64pub mod receipts;
65pub mod sister;
66pub mod types;
67
68// Re-export everything in prelude for convenience
69pub mod prelude {
70 pub use crate::context::*;
71 pub use crate::errors::*;
72 pub use crate::events::*;
73 pub use crate::file_format::*;
74 pub use crate::grounding::*;
75 pub use crate::hydra::*;
76 pub use crate::query::*;
77 pub use crate::receipts::*;
78 pub use crate::sister::*;
79 pub use crate::types::*;
80}
81
82// Also re-export at crate root
83pub use prelude::*;