Expand description
CELLSTATE Rust SDK
The cellstate crate provides a typed Rust interface to the CELLSTATE agent
memory platform. It includes:
- Core types: Entity IDs, enums, and domain structures from
cellstate-core - PCP types: Memory commit, recall service, and PCP runtime from
cellstate-pcp - HTTP client:
CellstateClientfor all REST API operations - Wire types: Request/response structs matching the API’s snake_case JSON
§Quick Start
use cellstate::CellstateClient;
use cellstate::types::CreateTrajectoryRequest;
// Create a client from env vars (CELLSTATE_API_URL, CELLSTATE_API_KEY)
let client = CellstateClient::from_env()?;
// Create a trajectory
let traj = client.create_trajectory(&CreateTrajectoryRequest {
name: "Research task".to_string(),
description: Some("Investigating memory models".to_string()),
parent_trajectory_id: None,
agent_id: None,
metadata: None,
}).await?;
println!("Created: {}", traj.trajectory_id);§Re-exported Types
All types from cellstate-core and cellstate-pcp are re-exported at the
crate root for convenience:
use cellstate::{TrajectoryId, ScopeId, AgentId, EntityIdType};
use cellstate::{Trajectory, Scope, Artifact, Note, Turn};
use cellstate::{TrajectoryStatus, AgentStatus, ArtifactType, NoteType, TurnRole};
use cellstate::{ContextPackage, ContextWindow, TokenBudget};
use cellstate::{EventKind, EventHeader, DagPosition};Re-exports§
pub use client::CellstateClient;pub use client::ResponseFormat;
Modules§
- client
- HTTP client for the CELLSTATE REST API.
- error
- Error types for the CELLSTATE Rust SDK.
- types
- Request and response wire types for the CELLSTATE REST API.
Structs§
- Agent
- An agent in the multi-agent system.
- AgentId
- Type-safe ID for agent entities.
- Artifact
- Artifact - typed output preserved across scopes. Artifacts survive scope closure and can be referenced later.
- Artifact
Id - Type-safe ID for artifact entities.
- Content
Hash - SHA-256 content hash for deduplication and integrity verification.
- Context
Assembler - Context assembler that builds context windows from packages. Adds sections by priority until budget is exhausted.
- Context
Package - Context package - all inputs for assembly. Similar to ContextPackage in the TypeScript CRM pattern.
- Context
Window - Assembled context window with token budget management.
- DagPosition
- Position of an event in the DAG.
- Event
Header - Event header with all metadata needed for processing.
- Event
Kind - Event kind encoded as a 16-bit value.
- Memory
Commit - Memory commit - versioned record of an interaction. Enables: “Last time we decided X because Y” Every interaction creates a versioned commit for recall, rollback, audit, and rehydration.
- Note
- Note - long-term cross-trajectory knowledge. Notes persist beyond individual trajectories.
- NoteId
- Type-safe ID for note entities.
- PCPConfig
- Master PCP configuration.
- PCPRuntime
- PCP Runtime - the main validation and checkpoint engine.
- Recall
Service - Service for recalling past interactions and decisions. Provides query methods for memory commits.
- Scope
- Scope - partitioned context window within a trajectory. Scopes provide isolation and checkpointing boundaries.
- ScopeId
- Type-safe ID for scope entities.
- Scoring
Component - Scoring
Debug - Debug output for scoring transparency
- Scoring
Weights - Weights for deterministic scoring formula.
- Source
Quality - Source quality tracking (P2)
- Tenant
Id - Type-safe ID for tenant entities.
- Token
Budget - Segment-based token budget allocation.
- Trajectory
- Trajectory - top-level task container. A trajectory represents a complete task or goal being pursued.
- Trajectory
Id - Type-safe ID for trajectory entities.
- Turn
- Turn - ephemeral conversation buffer entry. Turns die with their scope.
- TurnId
- Type-safe ID for turn entities.
Enums§
- Abstraction
Level - Semantic abstraction level for notes (L0 → L1 → L2 hierarchy).
- Agent
Status - Status of an agent in the system.
- Artifact
Type - Type of artifact produced during a trajectory.
- Effect
- An effect represents the outcome of an operation.
- Entity
Type - Entity type discriminator for polymorphic references.
- Error
Effect - An error effect that can be persisted and replayed.
- Extraction
Method - Method used to extract an artifact or evidence.
- Note
Type - Type of note (cross-trajectory knowledge).
- TTL
- Time-to-live and retention configuration for memory entries. Supports both time-based expiration and count-based limits.
- Trajectory
Status - Status of a trajectory (task container).
- Turn
Role - Role of a turn in conversation.
Traits§
- Entity
IdType - Trait for type-safe entity IDs.
Type Aliases§
- RawContent
- Raw binary content for BYTEA storage.
- Timestamp
- Timestamp type using UTC timezone.