Skip to main content

remem/
context_bundle.rs

1//! Context Bundle v1 (GH-932): versioned request/plan/bundle/audit contract.
2//!
3//! remem's callers should face a policy-aware context compiler instead of
4//! "several search tools plus one pre-rendered text blob". This module holds
5//! the v1 internal Rust contract:
6//!
7//! - `plan(request)` builds a deterministic [`ContextPlan`] with a stable
8//!   plan hash (no timestamps or randomness enter the hash);
9//! - `execute(plan, inputs)` selects caller-provided candidates by reusing
10//!   the existing SessionStart relevance policy, enforces per-section and
11//!   total token budgets, and returns a [`ContextBundle`] whose
12//!   [`ContextAudit`] records every considered/selected/dropped candidate
13//!   with a machine-readable reason and a degraded mode
14//!   (full / canonical_only / blocked).
15//!
16//! v1 is an experimental internal API. MCP/REST endpoints, DB-backed
17//! executor wiring, rerank/graph channels, doctor plan summaries, and
18//! benchmark artifact hashes are follow-up work on GH-932.
19
20mod audit;
21mod domain;
22mod executor;
23mod planner;
24mod policy;
25#[cfg(test)]
26mod tests;
27
28pub use domain::{
29    AgentRole, AuditEntry, ChannelKind, ContextAudit, ContextBundle, ContextFilters, ContextIntent,
30    ContextItem, ContextPlan, ContextRequest, DegradedMode, ItemValidity, PlannedChannel,
31    ProjectRef, RiskClass, SectionBudgets, SourceKind, TrustClass, CONTEXT_BUNDLE_SCHEMA_VERSION,
32};
33pub use executor::{execute, ExecutorInputs};
34pub use planner::plan;
35pub(crate) use policy::validate_request;
36pub use policy::CONTEXT_BUNDLE_POLICY_VERSION;