context-core
Deterministic core library for context caching and selection.
context-core provides the foundational types and algorithms for the Context platform: document ingestion, cache building, content-hash versioning, term-frequency scoring, and token-budgeted selection. All operations are deterministic — identical inputs always produce identical outputs.
Crate overview
| Module | Purpose |
|---|---|
document |
Document model with content-hash versioning (DocumentId, Document, Metadata) |
cache |
Cache build pipeline (CacheBuilder, CacheManifest, ContextCache) |
selection |
Deterministic context selection with scoring and token budgeting (ContextSelector) |
types |
Shared types (Query, ScoreDetails, ContextBundle) |
Usage
Add to your Cargo.toml:
[]
= { = "../context-core" }
Build a cache
use ;
use ;
let root = new;
let id = from_path.unwrap;
let doc = ingest.unwrap;
let builder = new;
let cache = builder.build.unwrap;
Select context
use ContextSelector;
use Query;
let selector = default;
let query = new;
let result = selector.select.unwrap;
Build
Spec references
See spec_refs.md for links to the governing specifications.
"Context Engine" is a trademark of Context Engine Contributors. The software is open source under the Apache License 2.0. The trademark is not licensed for use by third parties to market competing products or services without prior written permission.