pub struct Context {Show 19 fields
pub brain_wave: BrainWave,
pub session_id: Option<Uuid>,
pub user_id: Option<String>,
pub meta: HashMap<String, Value>,
pub scratchpad: HashMap<String, Value>,
pub dharma_profile: Option<String>,
pub compartment: Option<String>,
pub karma_debt: f32,
pub intent_score: f32,
pub citta_coherence: f32,
pub citta_valence: f32,
pub self_model_confidence: f32,
pub drive_curiosity: f32,
pub drive_caution: f32,
pub drive_energy: f32,
pub drive_exploration_weight: f32,
pub drive_conservative_weight: f32,
pub last_gana: Option<Gana>,
pub readonly: bool,
}Expand description
Per-request execution context.
Fields§
§brain_wave: BrainWaveCurrent brain-wave state
session_id: Option<Uuid>Session ID (if in a session)
user_id: Option<String>User ID (for multi-user isolation)
meta: HashMap<String, Value>Request metadata (from MCP client)
scratchpad: HashMap<String, Value>Scratchpad for intermediate results within a single dispatch
dharma_profile: Option<String>Whether this request is running under a Dharma governance profile
compartment: Option<String>Mandala compartment (research/sandbox/production/secure)
karma_debt: f32Cached karma debt (updated post-dispatch, synced periodically)
intent_score: f32Intent score for this request (0.0 = low intent, 1.0 = high intent)
citta_coherence: f32Citta coherence at dispatch time (0.0–1.0). Low coherence blocks writes.
citta_valence: f32Citta valence at dispatch time (−1.0 to 1.0). Negative = displeasure.
self_model_confidence: f32Self-model confidence at dispatch time (0.0–1.0). Below 0.5 triggers conservative dispatch (prefer cached results).
drive_curiosity: f32Drive curiosity level (0.0–1.0). High curiosity → exploration bias.
drive_caution: f32Drive caution level (0.0–1.0). High caution → conservative bias.
drive_energy: f32Drive energy level (0.0–1.0). Low energy → lightweight tool bias.
drive_exploration_weight: f32Drive exploration weight (0.0–1.0). Derived from curiosity.
drive_conservative_weight: f32Drive conservative weight (0.0–1.0). Derived from caution.
last_gana: Option<Gana>Last Gana dispatched in this context (for co-usage tracking, Phase 6)
readonly: boolRead-only server mode — the dispatch pipeline refuses any tool that declares writes while this is set.
Implementations§
Source§impl Context
impl Context
Sourcepub fn new(brain_wave: BrainWave) -> Self
pub fn new(brain_wave: BrainWave) -> Self
Create a new context with the given brain-wave state.
Sourcepub const fn brain_wave(&self) -> BrainWave
pub const fn brain_wave(&self) -> BrainWave
Get the current brain-wave state.
Sourcepub fn can_access_galaxy(&self, galaxy: Galaxy) -> bool
pub fn can_access_galaxy(&self, galaxy: Galaxy) -> bool
Check if this context has access to the given galaxy.
Compartment-based access control:
None(default): full access to all galaxies (backward compatible)sandbox: only Tutorial and Research (no production data)production: all memory galaxies except system (Karma, Dharma, Substrate)secure: all memory galaxies
Sourcepub fn can_write_galaxy(&self, galaxy: Galaxy) -> bool
pub fn can_write_galaxy(&self, galaxy: Galaxy) -> bool
Check if this context allows write operations to the given galaxy.
Sandbox is read-only for Research (can write to Tutorial only).