Skip to main content

CommandContext

Struct CommandContext 

Source
pub struct CommandContext {
Show 32 fields pub session_cost_usd: f64, pub session_input_tokens: u64, pub session_output_tokens: u64, pub session_turns: u32, pub workspace: PathBuf, pub help_text: String, pub session_approved_tools: HashSet<String>, pub permission_mode: PermissionMode, pub memory_dir: PathBuf, pub provider_name: String, pub model_name: String, pub model_override: Option<String>, pub data_dir: PathBuf, pub message_count: usize, pub tool_call_count: usize, pub tools_count: usize, pub hooks_count: usize, pub skill_names: Vec<String>, pub nous_scores: Vec<(String, f64)>, pub budget_usd: Option<f64>, pub economic_mode: Option<String>, pub workspace_journal_status: Option<String>, pub project_instructions_tokens: usize, pub git_context_tokens: usize, pub memory_index_tokens: usize, pub workspace_context_tokens: usize, pub skills_catalog_tokens: usize, pub show_reasoning: bool, pub context_ruling: Option<String>, pub context_window: Option<usize>, pub identity_tier: Option<String>, pub identity_subject: Option<String>,
}
Expand description

Mutable context passed to every command invocation.

Fields§

§session_cost_usd: f64

Accumulated cost in USD for this session.

§session_input_tokens: u64

Input tokens consumed this session.

§session_output_tokens: u64

Output tokens consumed this session.

§session_turns: u32

Number of user turns in this session.

§workspace: PathBuf

Workspace root directory.

§help_text: String

Pre-rendered help text (set by the registry).

§session_approved_tools: HashSet<String>

Tools the user has permanently approved for this session (via “always” response).

§permission_mode: PermissionMode

Permission mode: “default” (prompt), “yes” (auto-approve all), “plan” (deny all writes).

§memory_dir: PathBuf

Directory for persistent agent memory files (.arcan/memory/).

§provider_name: String

Provider name (e.g. “anthropic”, “openai”, “mock”).

§model_name: String

Current model name (e.g. “claude-sonnet-4-20250514”).

§model_override: Option<String>

Model override requested via /model command (applied on next turn).

§data_dir: PathBuf

Data directory for persistent storage (.arcan/).

§message_count: usize

Number of messages in the conversation history.

§tool_call_count: usize

Number of tool calls executed this session.

§tools_count: usize

Number of registered tools.

§hooks_count: usize

Number of registered hooks.

§skill_names: Vec<String>

Names of discovered skills.

§nous_scores: Vec<(String, f64)>

Latest Nous evaluation scores: (evaluator_name, score_value).

§budget_usd: Option<f64>

Session budget in USD (set via --budget). None means unlimited.

§economic_mode: Option<String>

Autonomic economic mode label (e.g. “Sovereign”, “Conserving”). Populated when ARCAN_AUTONOMIC_URL is configured.

§workspace_journal_status: Option<String>

Workspace journal status string (e.g. path or “unavailable”). Set when a shared Lance workspace journal is opened.

§project_instructions_tokens: usize

Estimated tokens for project instructions (CLAUDE.md, AGENTS.md, docs/).

§git_context_tokens: usize

Estimated tokens for git context section.

§memory_index_tokens: usize

Estimated tokens for MEMORY.md index.

§workspace_context_tokens: usize

Estimated tokens for shared workspace journal context.

§skills_catalog_tokens: usize

Estimated tokens for skills catalog.

§show_reasoning: bool

Whether to display reasoning/thinking tokens in the output.

§context_ruling: Option<String>

Current Autonomic context ruling (e.g. “Breathe — pressure 42%, quality 0.85, …”).

§context_window: Option<usize>

Context window size in tokens (from provider).

§identity_tier: Option<String>

Identity tier label (e.g. “pro”, “free”, “anonymous”).

§identity_subject: Option<String>

Identity subject (e.g. “user@example.com”).

Trait Implementations§

Source§

impl Debug for CommandContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CommandContext

Source§

fn default() -> CommandContext

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.