diff --git a/crates/tui/src/prompts.rs b/crates/tui/src/prompts.rs index 26913357..9f1eeb76 100644 --- a/crates/tui/src/prompts.rs +++ b/crates/tui/src/prompts.rs @@ -357,7 +357,14 @@ pub fn system_prompt_for_mode_with_context_skills_and_session( 1. Use `/compact` to summarize earlier context and free up space\n\ 2. The system will preserve important information (files you're working on, recent messages, tool results)\n\ 3. After compaction, you'll see a summary of what was discussed and can continue seamlessly\n\n\ - If you notice context is getting long (>80%), proactively suggest using `/compact` to the user." + If you notice context is getting long (>80%), proactively suggest using `/compact` to the user.\n\n\ + ### Prompt-cache awareness\n\n\ + DeepSeek caches the longest *byte-stable prefix* of every request and charges roughly 100× less for cache-hit tokens than miss tokens. The system prompt above is layered most-static-first specifically so the prefix stays stable turn-over-turn. To keep cache hits high:\n\ + - **Append, don't reorder.** New context goes at the end (latest user / tool messages). Reshuffling earlier messages or rewriting their content invalidates the cache for everything after the change.\n\ + - **Don't paraphrase quoted content.** If you've already read a file, refer to it by path or line range instead of re-quoting it with different formatting.\n\ + - **Use `/compact` as a hard reset, not a tweak.** Compaction is meant for when the cache is already losing — it intentionally rewrites the prefix to a shorter summary. Don't trigger it for small wins.\n\ + - **Read once, refer back.** Re-reading the same file produces a different tool-result envelope than the prior read; it's cheaper to scroll back than to re-fetch.\n\ + - **Footer chip:** the `cache hit %` chip turns red below 40% and yellow below 80%. If it's been red for several turns, that's a signal to consolidate." ); } diff --git a/crates/tui/src/tui/ui.rs b/crates/tui/src/tui/ui.rs index f16aa259..23f1588d 100644 --- a/crates/tui/src/tui/ui.rs +++ b/crates/tui/src/tui/ui.rs @@ -2381,6 +2381,19 @@ async fn run_event_loop( } } KeyCode::Enter => { + // #573: when the user typed a slash-command prefix that + // the popup is matching (e.g. `/mo` → `/model`), Enter + // should run the *highlighted match* rather than + // sending the literal `/mo` text. Only kick in when the + // popup has at least one entry; otherwise fall through + // to the legacy submit path. + if slash_menu_open + && !slash_menu_entries.is_empty() + && app.input.starts_with('/') + && apply_slash_menu_selection(app, &slash_menu_entries, false) + { + app.close_slash_menu(); + } if let Some(input) = app.submit_input() { if handle_plan_choice(app, &engine_handle, &input).await? { continue;