feat: add disable_1m_context toggle to settings UI

Adds a new config option to expose the CLAUDE_CODE_DISABLE_1M_CONTEXT
environment variable through the settings sidebar, allowing users to
opt out of the extended 1M context window without manually setting
environment variables.

Closes #154
This commit is contained in:
2026-02-24 20:05:50 -08:00
committed by Naomi Carrigan
parent ca08b990d8
commit 9e2f2912bc
10 changed files with 51 additions and 0 deletions
+10
View File
@@ -28,6 +28,9 @@ pub struct ClaudeStartOptions {
#[serde(default)]
pub use_worktree: bool,
#[serde(default)]
pub disable_1m_context: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -119,6 +122,9 @@ pub struct HikariConfig {
#[serde(default)]
pub use_worktree: bool,
#[serde(default)]
pub disable_1m_context: bool,
}
impl Default for HikariConfig {
@@ -152,6 +158,7 @@ impl Default for HikariConfig {
budget_warning_threshold: 0.8,
discord_rpc_enabled: true,
use_worktree: false,
disable_1m_context: false,
}
}
}
@@ -259,6 +266,8 @@ mod tests {
assert_eq!(config.budget_action, BudgetAction::Warn);
assert!((config.budget_warning_threshold - 0.8).abs() < f32::EPSILON);
assert!(config.discord_rpc_enabled);
assert!(!config.use_worktree);
assert!(!config.disable_1m_context);
}
#[test]
@@ -292,6 +301,7 @@ mod tests {
budget_warning_threshold: 0.75,
discord_rpc_enabled: true,
use_worktree: true,
disable_1m_context: false,
};
let json = serde_json::to_string(&config).unwrap();
+10
View File
@@ -279,6 +279,11 @@ impl WslBridge {
}
}
// Disable 1M context window if requested
if options.disable_1m_context {
cmd.env("CLAUDE_CODE_DISABLE_1M_CONTEXT", "1");
}
cmd
} else {
// Running on Windows - use wsl with bash login shell to ensure PATH is loaded
@@ -319,6 +324,11 @@ impl WslBridge {
}
}
// Disable 1M context window if requested
if options.disable_1m_context {
claude_cmd.push_str("CLAUDE_CODE_DISABLE_1M_CONTEXT=1 ");
}
claude_cmd.push_str(
"claude --output-format stream-json --input-format stream-json --verbose",
);