Architecture
Audience and Use
This page is for engineers deciding how to adopt Locus in production systems.
Use it to:
- Choose where Locus should sit in your stack.
- Understand component responsibilities before integration starts.
- Avoid coupling host transports to internal implementation details.
Purpose
Locus is the Rust implementation layer for STTP memory systems. STTP remains the protocol layer. Locus provides reusable components for parsing, validation, storage, retrieval, and composition with stable contract boundaries.
Layering
- Protocol layer: STTP grammar and four-layer node contract.
- Implementation core: locus-core-rs.
- SDK/application layer: locus-sdk.
- Host transport layer: MCP, HTTP, gRPC hosts that consume Locus crates.
Crate Responsibilities
locus-core-rs
- Domain models and contracts.
- STTP parsing and validation.
- Storage adapters (in-memory and SurrealDB).
- Core services for calibration, store/query, rollups, and sync-ready primitives.
locus-sdk
- Primitive memory workflows: find, recall, aggregate, transform, explain, schema.
- Composition workflows for multi-step operations.
- Deterministic manual compression and recursive content construction.
- Transport DTOs and typed request/response boundaries.
Design Principles
- Deterministic-first behavior where possible.
- Explicit policy controls over hidden defaults.
- Transport-neutral workflows.
- Additive evolution with compatibility preservation.
- Observable retrieval paths with explainable outcomes.
Data Contract Boundaries
- STTP node text is validated against the protocol structure.
- Core models carry parsed and computed fields.
- SDK contracts define application-level behavior and policy.
- Transport DTOs convert cleanly into SDK contracts.
Dependency Direction
- locus-sdk depends on locus-core-rs.
- locus-core-rs has no dependency on locus-sdk.
- Hosts should depend on locus-sdk for workflow orchestration and on locus-core-rs only when low-level access is required.
This dependency model keeps host contracts stable while internal implementations evolve.