diff --git a/src-tauri/src/config.rs b/src-tauri/src/config.rs
index 157aec3..1691d5d 100644
--- a/src-tauri/src/config.rs
+++ b/src-tauri/src/config.rs
@@ -75,6 +75,11 @@ pub struct ClaudeStartOptions {
/// Valid values: "low", "medium", "high", "xhigh" (Opus 4.7 only), "max". None uses CLI default.
#[serde(default)]
pub effort_level: Option,
+
+ /// Sets `ENABLE_PROMPT_CACHING_1H=1` or `FORCE_PROMPT_CACHING_5M=1` env var (v2.1.108+).
+ /// Values: "1h" → 1-hour TTL, "5m" → force 5-minute TTL. None uses CLI default.
+ #[serde(default)]
+ pub prompt_caching_ttl: Option,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -246,6 +251,11 @@ pub struct HikariConfig {
/// Valid values: "low", "medium", "high", "xhigh" (Opus 4.7 only), "max". None uses CLI default.
#[serde(default)]
pub effort_level: Option,
+
+ /// Sets `ENABLE_PROMPT_CACHING_1H=1` or `FORCE_PROMPT_CACHING_5M=1` env var (v2.1.108+).
+ /// Values: "1h" → 1-hour TTL, "5m" → force 5-minute TTL. None uses CLI default.
+ #[serde(default)]
+ pub prompt_caching_ttl: Option,
}
impl Default for HikariConfig {
@@ -302,6 +312,7 @@ impl Default for HikariConfig {
show_clear_context_on_plan_accept: true,
custom_model_option: None,
effort_level: None,
+ prompt_caching_ttl: None,
}
}
}
@@ -520,6 +531,7 @@ mod tests {
show_clear_context_on_plan_accept: true,
custom_model_option: None,
effort_level: None,
+ prompt_caching_ttl: None,
};
let json = serde_json::to_string(&config).unwrap();
diff --git a/src-tauri/src/wsl_bridge.rs b/src-tauri/src/wsl_bridge.rs
index 2267af2..2bba6de 100644
--- a/src-tauri/src/wsl_bridge.rs
+++ b/src-tauri/src/wsl_bridge.rs
@@ -410,6 +410,15 @@ impl WslBridge {
}
}
+ // Set prompt caching TTL env var if specified (v2.1.108+)
+ if let Some(ref ttl) = options.prompt_caching_ttl {
+ match ttl.as_str() {
+ "1h" => { cmd.env("ENABLE_PROMPT_CACHING_1H", "1"); }
+ "5m" => { cmd.env("FORCE_PROMPT_CACHING_5M", "1"); }
+ _ => {}
+ }
+ }
+
cmd
} else {
// Running on Windows - use wsl with bash login shell to ensure PATH is loaded
@@ -485,6 +494,15 @@ impl WslBridge {
}
}
+ // Set prompt caching TTL env var if specified (v2.1.108+)
+ if let Some(ref ttl) = options.prompt_caching_ttl {
+ match ttl.as_str() {
+ "1h" => { claude_cmd.push_str("ENABLE_PROMPT_CACHING_1H=1 "); }
+ "5m" => { claude_cmd.push_str("FORCE_PROMPT_CACHING_5M=1 "); }
+ _ => {}
+ }
+ }
+
claude_cmd.push_str(
"claude --output-format stream-json --input-format stream-json --verbose",
);
diff --git a/src/lib/commands/slashCommands.ts b/src/lib/commands/slashCommands.ts
index a41d921..5d549ee 100644
--- a/src/lib/commands/slashCommands.ts
+++ b/src/lib/commands/slashCommands.ts
@@ -78,6 +78,7 @@ async function changeDirectory(path: string): Promise {
show_clear_context_on_plan_accept: config.show_clear_context_on_plan_accept ?? true,
custom_model_option: config.custom_model_option || null,
effort_level: config.effort_level || null,
+ prompt_caching_ttl: config.prompt_caching_ttl || null,
},
});
@@ -166,6 +167,7 @@ async function startNewConversation(): Promise {
show_clear_context_on_plan_accept: config.show_clear_context_on_plan_accept ?? true,
custom_model_option: config.custom_model_option || null,
effort_level: config.effort_level || null,
+ prompt_caching_ttl: config.prompt_caching_ttl || null,
},
});
diff --git a/src/lib/components/ConfigSidebar.svelte b/src/lib/components/ConfigSidebar.svelte
index eb34cf5..8ed0d37 100644
--- a/src/lib/components/ConfigSidebar.svelte
+++ b/src/lib/components/ConfigSidebar.svelte
@@ -79,6 +79,7 @@
task_loop_commit_prefix: "feat",
task_loop_include_summary: false,
effort_level: null,
+ prompt_caching_ttl: null,
});
let showCustomThemeEditor = $state(false);
@@ -740,6 +741,26 @@
+
+
+
+
+
+ Sets ENABLE_PROMPT_CACHING_1H or
+ FORCE_PROMPT_CACHING_5M. Requires Claude Code v2.1.108+.
+
+
+