From 0b5d574e63d1923f1604d456347ee7f0b377754b Mon Sep 17 00:00:00 2001 From: zLeoAlex Date: Sun, 7 Jun 2026 15:15:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(cache):=20address=20CR=20feedback=20?= =?UTF-8?q?=E2=80=94=20blank=20lines,=20heading=20hierarchy,=20debug=5Fass?= =?UTF-8?q?ert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add proper blank lines (\n\n) before mode headings in render_runtime_policy_reference (CommonMark/GFM compliance). - Demote subheadings in agent.md from ##### to ###### so they nest correctly under the demoted main heading. - Add debug_assert! in taxonomy_body() to loudly fail when render_core_tool_taxonomy_block format changes, preventing silent heading-hierarchy breakage. --- crates/tui/src/prompts.rs | 12 +++++++++--- crates/tui/src/prompts/modes/agent.md | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/crates/tui/src/prompts.rs b/crates/tui/src/prompts.rs index 9361d963..e43c99d4 100644 --- a/crates/tui/src/prompts.rs +++ b/crates/tui/src/prompts.rs @@ -719,6 +719,12 @@ fn default_approval_mode_for_mode(mode: AppMode) -> ApprovalMode { /// producing a broken heading hierarchy (## under ####). fn taxonomy_body(mode: AppMode) -> String { let block = render_core_tool_taxonomy_block(mode); + debug_assert!( + block.starts_with("## Core Tool Taxonomy\n\n"), + "render_core_tool_taxonomy_block format changed — \ + taxonomy_body expects `## Core Tool Taxonomy\\n\\n` prefix; \ + update the prefix or the assertion" + ); block .strip_prefix("## Core Tool Taxonomy\n\n") .unwrap_or(&block) @@ -748,19 +754,19 @@ pub(crate) fn render_runtime_policy_reference() -> String { out.push_str("#### agent\n\n"); out.push_str(&taxonomy_agent); - out.push('\n'); + out.push_str("\n\n"); out.push_str(AGENT_MODE.trim()); out.push_str("\n\n"); out.push_str("#### plan\n\n"); out.push_str(&taxonomy_plan); - out.push('\n'); + out.push_str("\n\n"); out.push_str(PLAN_MODE.trim()); out.push_str("\n\n"); out.push_str("#### yolo\n\n"); out.push_str(&taxonomy_yolo); - out.push('\n'); + out.push_str("\n\n"); out.push_str(YOLO_MODE.trim()); out.push_str("\n\n"); diff --git a/crates/tui/src/prompts/modes/agent.md b/crates/tui/src/prompts/modes/agent.md index adcaa8db..38ae028c 100644 --- a/crates/tui/src/prompts/modes/agent.md +++ b/crates/tui/src/prompts/modes/agent.md @@ -12,7 +12,7 @@ For simple writes, state the direct edit and proceed through the normal approval For multi-step initiatives, keep `checklist_write` current. Add `update_plan` only for genuinely useful strategy. -##### Efficient Approvals +###### Efficient Approvals When your plan includes multiple writes, present them together: 1. Show `checklist_write` with all write steps listed so the user sees the full scope @@ -21,7 +21,7 @@ When your plan includes multiple writes, present them together: Don't sequence approvals one at a time — the user wants context, not interruption. A clear plan with visible checklist items gets approved faster than a series of surprise approval prompts. -##### Session Longevity +###### Session Longevity Long sessions accumulate context. To stay fast: - Open sub-agent sessions for independent work instead of doing everything sequentially