feat(engine): context-limit handoff replaces routine compaction (closes #664)#667
feat(engine): context-limit handoff replaces routine compaction (closes #664)#667merchloubna70-dot wants to merge 6 commits into
Conversation
All system prompts were English-only, causing DeepSeek V4 to reason and respond in English even when users wrote in Chinese or other languages. Add a Language Mirror section to base.md and base.txt that instructs the model to detect the user's primary language and use it for both reasoning (thinking tokens) and the final reply.
base.txt is not referenced via include_str! in prompts.rs. Only base.md is loaded (BASE_PROMPT). Remove the redundant change to base.txt as noted by Gemini Code Assist review.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Review notes from v0.8.12 integrationThanks for this PR. I've reviewed the code as part of merging it into the v0.8.12 branch. One finding:
|
v0.8.12: removed dead
|
…follow-up) `prefer_handoff: Option<bool>` was added to CompactionConfig but never read — setting it had no effect. When `Some(true)`, skip automatic LLM compaction so the handoff threshold system in handoff.rs can instruct the model to write `.deepseek/handoff.md` instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Fixed — |
Updated per Hunter's v0.8.12 review: `prefer_handoff: Option<bool>` was removed from CompactionConfig rather than being partially wired. A half-wired field that prevents LLM compaction without writing a handoff file is worse than no compaction — context would accumulate unchecked. The field can be re-introduced once the full handoff implementation (file writer + context-clear) is ready. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Updated to align with your v0.8.12 approach — removed |
The match guard at tui/ui.rs:1603 used `&& let Some(...) = ...` inside an `if` guard, which requires the `if_let_guard` nightly feature on Rust < 1.94. Reported by an external user attempting `cargo install deepseek-tui` on stable rustc — it failed with E0658. Rewrite as a plain match guard with a nested `if let` inside the arm body so the language-picker hotkeys compile on every supported rustc. Workspace also now declares `rust-version = "1.88"` to match the codebase's actual reliance on `let_chains` in if/while conditions, so users on too-old toolchains see a clear cargo error instead of a confusing rustc one. `AGENTS.md` and `CLAUDE.md` gain a "stable Rust only" section documenting the trap and how to rewrite around it. Also annotate the deferred `TuiPrefs` (#657) and `handoff::THRESHOLDS` (#667) APIs with `#[allow(dead_code)]` so CI's `-D warnings` flag stays green while the call sites are staged for v0.8.13. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
47 fmt drifts had accumulated from the squash-merged community PRs on this branch (#653, #654, #655, #645, #658, #668, #659, #661, #660, #667, #656). Pure formatting — no behavioural changes — applied via `cargo fmt --all` to satisfy CI's `cargo fmt --all -- --check` gate. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…mbown#664) THRESHOLDS and threshold_message() are reserved for the planned context-ratio tracking + system-prompt injection. Add #[allow(dead_code)] and doc comments so the compiler does not warn and reviewers understand these are future-wiring, not stale leftovers. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Added |
…terminal_colors (Hmbown#671) Neither field had any code path that read it. Shipping config knobs that do nothing trains users to mistrust config. Remove until the implementation exists.
…terminal_colors (Hmbown#671) Neither field had any code path that read it. Shipping config knobs that do nothing trains users to mistrust config. Remove until the implementation exists.
The match guard at tui/ui.rs:1603 used `&& let Some(...) = ...` inside an `if` guard, which requires the `if_let_guard` nightly feature on Rust < 1.94. Reported by an external user attempting `cargo install deepseek-tui` on stable rustc — it failed with E0658. Rewrite as a plain match guard with a nested `if let` inside the arm body so the language-picker hotkeys compile on every supported rustc. Workspace also now declares `rust-version = "1.88"` to match the codebase's actual reliance on `let_chains` in if/while conditions, so users on too-old toolchains see a clear cargo error instead of a confusing rustc one. `AGENTS.md` and `CLAUDE.md` gain a "stable Rust only" section documenting the trap and how to rewrite around it. Also annotate the deferred `TuiPrefs` (Hmbown#657) and `handoff::THRESHOLDS` (Hmbown#667) APIs with `#[allow(dead_code)]` so CI's `-D warnings` flag stays green while the call sites are staged for v0.8.13. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
47 fmt drifts had accumulated from the squash-merged community PRs on this branch (Hmbown#653, Hmbown#654, Hmbown#655, Hmbown#645, Hmbown#658, Hmbown#668, Hmbown#659, Hmbown#661, Hmbown#660, Hmbown#667, Hmbown#656). Pure formatting — no behavioural changes — applied via `cargo fmt --all` to satisfy CI's `cargo fmt --all -- --check` gate. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Shipped on |
Three-stage awareness 70/80/90%. Closes #664