feat: teach models to use collapsible details where supported (#114706)

* feat: teach models to use collapsible details where supported

* fix: accept nullable accountId in telegram rich-messages helper

* docs: regenerate docs map for collapsible details heading

* fix(ci): remove duplicate Codex prewarm test route
This commit is contained in:
Peter Steinberger
2026-07-27 16:06:33 -04:00
committed by GitHub
parent f3055f64f4
commit 17e42229d2
9 changed files with 107 additions and 23 deletions
+9
View File
@@ -105,6 +105,15 @@ Spoiler markers (`||spoiler||`) are parsed for Signal (mapped to `SPOILER`
style ranges) and Telegram (mapped to `<tg-spoiler>`). Other channels treat
`||...||` as plain text.
## Collapsible details
The Control UI and Telegram accounts with `richMessages: true` render
`<details><summary>Label</summary>` disclosures as native collapsible sections.
OpenClaw tells the model about this option only when the current reply surface
supports it. Other channels, including Telegram accounts without rich messages,
flatten each disclosure to `**Summary**` followed by the visible body so no
content is hidden or lost.
## Adding or updating a channel formatter
1. **Parse once** with `markdownToIR(...)`, passing channel-appropriate
+3 -2
View File
@@ -43,11 +43,12 @@ The prompt is compact, with fixed sections:
- **Sandbox** (when enabled): sandboxed runtime, sandbox paths, elevated-exec availability.
- **Current Date & Time**: time zone only (cache-stable; the live clock comes from `session_status`).
- **Assistant Output Directives**: compact attachment, voice-note, and reply-tag syntax.
- **Collapsible Details** (when supported): teaches the model to keep optional depth in `<details>` disclosures while leaving the primary answer and required actions visible.
- **Heartbeats**: heartbeat prompt and ack behavior, when heartbeats are enabled for the default agent.
- **Runtime**: host, OS, node, model, repo root (when detected), thinking level (one line).
- **Reasoning**: current visibility level plus the `/reasoning` toggle hint.
Large stable content (including **Project Context**) stays above the internal prompt cache boundary. Volatile per-turn sections (Control UI embed guidance, **Messaging**, **Voice**, **Group Chat Context**, **Reactions**, **Heartbeats**, **Runtime**) are appended below that boundary so local backends with prefix caches can reuse the stable workspace prefix across channel turns. Tool descriptions should avoid embedding current channel names when the accepted schema already carries that runtime detail.
Large stable content (including **Project Context**) stays above the internal prompt cache boundary. Volatile per-turn sections (Control UI embed guidance, **Messaging**, **Collapsible Details**, **Voice**, **Group Chat Context**, **Reactions**, **Heartbeats**, **Runtime**) are appended below that boundary so local backends with prefix caches can reuse the stable workspace prefix across channel turns. Tool descriptions should avoid embedding current channel names when the accepted schema already carries that runtime detail.
Tooling also carries long-running-work guidance:
@@ -71,7 +72,7 @@ On channels with native approval cards/buttons, the prompt tells the agent to re
OpenClaw renders smaller system prompts for sub-agents. The runtime sets a `promptMode` per run (not user-facing config):
- `full` (default): all sections above.
- `minimal`: used for sub-agents; omits the memory prompt section (bundled as **Memory Recall**), **OpenClaw Self-Update**, **Model Aliases**, **User Identity**, **Assistant Output Directives**, **Messaging**, **Silent Replies**, and **Heartbeats**. Tooling, **Safety**, **Skills** (when supplied), Workspace, Sandbox, Current Date & Time (when known), Runtime, and injected context stay available.
- `minimal`: used for sub-agents; omits the memory prompt section (bundled as **Memory Recall**), **OpenClaw Self-Update**, **Model Aliases**, **User Identity**, **Assistant Output Directives**, **Messaging**, **Collapsible Details**, **Silent Replies**, and **Heartbeats**. Tooling, **Safety**, **Skills** (when supplied), Workspace, Sandbox, Current Date & Time (when known), Runtime, and injected context stay available.
- `none`: returns only the base identity line.
Under `promptMode=minimal`, extra injected prompts are labeled **Subagent Context** instead of **Group Chat Context**.
+1
View File
@@ -2594,6 +2594,7 @@ Do not edit it by hand; run `pnpm docs:map:gen`.
- H2: Chunking rules
- H2: Link policy
- H2: Spoilers
- H2: Collapsible details
- H2: Adding or updating a channel formatter
- H2: Common gotchas
- H2: Related