fix(cache): address CR feedback — blank lines, heading hierarchy, debug_assert

- 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.
This commit is contained in:
zLeoAlex
2026-06-07 15:15:12 +08:00
parent 427bd5d52f
commit 0b5d574e63
2 changed files with 11 additions and 5 deletions
+9 -3
View File
@@ -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");
+2 -2
View File
@@ -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