Skip to content

docs(tools): split the code mode page by reader job - #142425

Merged
vincentkoc merged 2 commits into
mainfrom
docs-audit/split-code-mode
Sep 8, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
docs-audit/split-code-mode

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What

docs/tools/code-mode.md was 79,412 characters with 43 headings in a flat run of 32 H2 sections. It mixed a how-to quickstart, explanation, reference for exec, wait, the guest API, error codes and telemetry, and a contributor test plan. This splits it into an index plus eight children, one per reader job.

Page Chars Read it when
/tools/code-mode (index) 12,586 Orientation, the Codex disambiguation, and where each section went.
/tools/code-mode/quickstart 8,481 Turn it on, override one model, recover from tool errors, Swarm fan-out.
/tools/code-mode/configuration 10,565 Fields, automatic per-model activation, preferred models, activation order.
/tools/code-mode/tool-surface 13,276 Model-visible tools, exec, wait, hidden catalog, Tool Search, collisions.
/tools/code-mode/guest-api 8,408 Guest globals, catalog handles, MCP namespaces, paginated file data.
/tools/code-mode/output 14,411 Declared output contracts and the output API.
/tools/code-mode/internals 10,162 Runtime status, scope, terms, nested execution, snapshots, QuickJS-WASI, security.
/tools/code-mode/troubleshooting 5,203 Error codes, telemetry, debugging.
/tools/code-mode/maintainers 5,003 Implementation layout, validation checklist, E2E test plan.

Anchor preservation

Per-anchor redirect routes are not possible here: redirectSource() in scripts/lib/docs-redirects.mjs throws on any source containing [?#]. Every anchor is kept alive on the parent index instead.

All 44 pre-split IDs were computed with parseDocsDocument, not a slug approximation:

  • 4 stay natively published on the index (what-it-does, why-use-it, technical-tour, related)
  • 40 became authored <a id="..." /> stubs in a Where each section moved list, each linking to the page that now holds the content
  • the one punctuated heading (The \compat.codeMode` catalog flag`) emits both an encoded and a cleaned ID; both are stubbed
  • no ID the index still publishes itself is stubbed, so there is no duplicate authored/canonical ID collision

A passing docs-link-audit is not evidence here, because the split rewrote the repo's own links. A separate script enumerated the pre-split IDs and asserted each resolves end to end against the post-split pages:

collisions across index + 8 children: 0

pre-split ids: 44
  still published natively on the index: 4 (what-it-does, why-use-it, technical-tour, related)
  kept alive as authored stubs on the index: 40
  resolving end-to-end (index anchor -> child anchor): 44

OK: every pre-split anchor resolves, and every stub destination resolves.

External deep links keep working, including the CHANGELOG.md and appcast.xml entries pointing at docs.openclaw.ai/tools/code-mode#guest-runtime-api, and the Labs registry docsUrl for /tools/code-mode.

Losslessness

A. SECTION-BODY LOSSLESSNESS  (original body == destination body)
  --> 43 sections byte-identical, 0 mismatched

B. FENCE-BY-FENCE EQUALITY (info string + body)
  original fences: 23   post-split fences: 23
  --> all 23 fences character-identical (info string and body)

C. COUNTS
  words        before=10630   after=11081   delta=+451
  links        before=18      after=65      delta=+47
  table rows   before=40      after=52      delta=+12
  code fences  before=23      after=23      delta=+0

Every delta is accounted for by index-only additions: the two child tables contribute 12 table rows and 8 links, and the moved-section list contributes 39 links.

Two structural notes:

  • the empty ## Quickstart heading became the quickstart page title; its ID is stubbed to /tools/code-mode/quickstart
  • its five H3 children were promoted to H2 with identical heading text, so their IDs are unchanged (verified above)

Prose

Prose was not rewritten. Five orphaned cross-references were repaired, since the split is what orphaned them:

  • four same-page fragment links now point at the child holding the target (#automatic-per-model-activation, #override-one-model twice, #recover-from-tool-errors)
  • the Technical tour signpost said "The rest of this page covers" and now says "These pages cover"

Six inbound deep links from other docs pages were retargeted at the children. docs/releases/2026.9.2.md was left alone as an archival release note; its link still resolves through the index stub.

Remaining above / below phrasing in the children was checked by hand and each still refers to same-page content.

Validation

node scripts/check-docs-mdx.mjs docs README.md
  Docs MDX check passed (899 files).

OPENCLAW_DOCS_SYNC_CLAWHUB_REPO=... node scripts/docs-link-audit.mjs
  checked_internal_links=9479
  broken_links=0

OPENCLAW_DOCS_SYNC_CLAWHUB_REPO=... node scripts/docs-link-audit.mjs --anchors
  checked_internal_links=9838
  broken_links=0
  omitted_compatibility_aliases=1   (pre-existing; identical on main)

node scripts/format-docs.mts --check
  Docs formatting clean (886 files).

node --import ./scripts/tsx.mjs scripts/check-docs-i18n-glossary.mts
  clean (8 child titles added to docs/.i18n/glossary.zh-CN.json, 0 duplicate sources)

No .ts files are touched, so oxfmt does not apply.

.audit/docs-test-pins.py reports 0 tests pinning the parent page and 0 pinning seven of the eight children. The single hit on troubleshooting.md is a false positive from the bare-filename heuristic: scripts/docs-i18n/*_test.go write their own temporary gateway/troubleshooting.md fixture and assert nothing about this tree. src/config/schema.hints.test.ts (13 tests, passing) resolves SECTION_DOCS_URLS against the docs tree but contains no Code Mode entry, and /tools/code-mode still resolves regardless.

Audit findings

Closes: r3-0783 (blocking, page mixes four Diataxis modes), r3-0784 (major, 43 headings in a flat H2 run).

Deferred, since the rules for this PR forbid rewriting prose during a split:

  • r3-0785 long paragraphs, now on output.md, guest-api.md, and tool-surface.md
  • r3-2337 empty header row in the Runtime status table, now on internals.md
  • r3-2338 three Related targets do not link back to Code Mode
  • r3-2339 the feature name rotates between three spellings
  • r3-2340 version-locked wording has no version scope
  • r3-2341 the debug block and recovery rules are duplicated with drift, now split across quickstart.md and troubleshooting.md, which makes the duplication easier to reconcile in a follow-up

Ownership

No .github/CODEOWNERS rule matches any changed path. Every changed file was checked against every pattern in the file; there is no catch-all rule. Nothing was restructured to move around an ownership boundary, and the original page had no owner either.

The page was 79,412 characters with 43 headings in a flat run of 32 H2
sections, mixing a how-to quickstart, explanation, reference for exec,
wait, the guest API, error codes, and telemetry, plus a contributor test
plan. It is now an index with eight children, one per reader job.

Children:

- /tools/code-mode/quickstart - enable it, override one model, recover
  from tool errors, verify the surface, Swarm fan-out
- /tools/code-mode/configuration - fields, automatic per-model
  activation, the preferred-model list, activation precedence
- /tools/code-mode/tool-surface - model-visible tools, exec, wait, the
  hidden catalog, Tool Search interaction, name collisions
- /tools/code-mode/guest-api - guest globals, catalog handles, MCP
  namespaces, virtual API declarations, paginated file data
- /tools/code-mode/output - declared output contracts and the output API
- /tools/code-mode/internals - runtime status, scope, terms, nested tool
  execution, snapshot lifecycle, QuickJS-WASI, TypeScript, security
- /tools/code-mode/troubleshooting - error codes, telemetry, debugging
- /tools/code-mode/maintainers - implementation layout, validation
  checklist, E2E test plan

Anchor strategy: per-anchor routes are impossible because redirectSource()
rejects any source containing [?#]. All 44 pre-split IDs computed with
parseDocsDocument stay alive on the parent index instead: 4 remain
natively published (what-it-does, why-use-it, technical-tour, related)
and 40 became authored <a id="..." /> stubs in a "Where each section
moved" list, each linking to the page that now holds the content. The one
punctuated heading emits both an encoded and a cleaned ID; both are
stubbed. No ID the index still publishes itself is stubbed, so there is no
duplicate authored/canonical ID collision. A script enumerated the
pre-split IDs and asserted each resolves end to end: 44/44 pass, and the
9 pages report 0 collisions. External deep links such as the CHANGELOG
and appcast entries to #guest-runtime-api still land correctly.

Losslessness: 43 of 43 section bodies are byte-identical at their
destination, and all 23 code fences are character-identical on both info
string and body. Words 10,630 -> 11,081, links 18 -> 65, table rows
40 -> 52, fences 23 -> 23; every delta is accounted for by the index's two
child tables (12 rows, 8 links) and the 39-entry moved list. The empty
"## Quickstart" heading became the quickstart page title, and its five H3
children were promoted to H2 with identical heading text, so their IDs are
unchanged.

Prose was not rewritten. Five orphaned cross-references were repaired:
four same-page fragment links that now point at the child holding the
target, and the "Technical tour" signpost, which said "The rest of this
page covers" and now says "These pages cover". Six inbound deep links from
other docs pages were retargeted at the children.

Closes audit findings: r3-0783, r3-0784
@clawsweeper

clawsweeper Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: XS maintainer Maintainer-authored PR labels Sep 8, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 8, 2026
@clawsweeper

clawsweeper Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 8, 2026, 2:54 PM ET / 18:54 UTC (Revision 2).

ClawSweeper review

What this changes

Reorganizes the Code Mode guide into an overview and eight task-focused pages, updating navigation, incoming links, and translation glossary entries.

Merge readiness

✅ Ready for maintainer review

The split remains useful and is not present on current main. No introduced correctness defects were found; the documentation preserves the existing guidance and provides compatibility links for moved sections.

Priority: P3
Reviewed head: 8106d106b61ff7e6e32885f59248a73b52f17c49

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused documentation split with preserved examples, explicit anchor compatibility, and useful validation evidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required because this PR only changes files under docs/.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required because this PR only changes files under docs/.
Evidence reviewed 7 items Pinned scope and review continuity: The introduced delta is documentation-only. Comparing the previous reviewed head with this head shows no changes to the overview or eight child pages; the previous review contained no findings.
Content and example preservation: Read the overview and all eight children. The section comparison found only the described cross-reference repairs, index additions, signpost wording change, and removal of the empty Quickstart heading. A separate read-only comparison confirmed that all 23 code fences retain identical language annotations and bodies.
Published-link compatibility: The overview retains explicit anchors linking to the moved sections. The publishing parser reserves authored HTML IDs, and the redirect implementation rejects fragment-bearing redirect sources, supporting the chosen compatibility approach. The supplied PR body reports all 44 prior IDs resolving through the resulting pages.
Findings None None.
Security None None.

How this fits together

The Code Mode documentation helps operators configure tool orchestration and helps developers understand its execution contracts. The documentation index and existing deep links direct readers to setup, reference, troubleshooting, and implementation guidance.

flowchart TD
  A[Documentation navigation] --> C[Code Mode overview]
  B[Existing section links] --> D[Preserved section anchors]
  C --> E[Setup and configuration]
  C --> F[Tool and guest API reference]
  C --> G[Troubleshooting and internals]
  D --> E
  D --> F
  D --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Docs +169. Total +169 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 16 1667 1498 +169
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 1667 1498 +169

Review metrics

None.

Technical review

Best possible solution:

Keep the task-focused documentation structure and stable legacy anchors while maintaining each technical section in one canonical location.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this is a documentation reorganization, and its content-preservation claims can be checked directly against the pinned base.

Is this the best way to solve the issue?

Yes. Task-focused pages with preserved parent anchors improve navigation without duplicating implementation or changing the documented contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a9707e15bcda.

Labels

Label justifications:

  • P3: This improves documentation navigation without changing runtime behavior or configuration.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required because this PR only changes files under docs/.

Evidence

What I checked:

  • Pinned scope and review continuity: The introduced delta is documentation-only. Comparing the previous reviewed head with this head shows no changes to the overview or eight child pages; the previous review contained no findings. Public docs: docs/tools/code-mode.md. (docs/tools/code-mode.md:1, 8106d106b61f)
  • Content and example preservation: Read the overview and all eight children. The section comparison found only the described cross-reference repairs, index additions, signpost wording change, and removal of the empty Quickstart heading. A separate read-only comparison confirmed that all 23 code fences retain identical language annotations and bodies. Public docs: docs/tools/code-mode.md. (docs/tools/code-mode.md:54, 8106d106b61f)
  • Published-link compatibility: The overview retains explicit anchors linking to the moved sections. The publishing parser reserves authored HTML IDs, and the redirect implementation rejects fragment-bearing redirect sources, supporting the chosen compatibility approach. The supplied PR body reports all 44 prior IDs resolving through the resulting pages. Public docs: docs/tools/code-mode.md. (docs/tools/code-mode.md:139, 8106d106b61f)
  • Current-main and release necessity: The fetched main revision retains the same unsplit guide as the pinned base. Neither fetched main nor v2026.9.3 contains the proposed child directory. The bounded related-PR search identified no replacement documentation split. Public docs: docs/tools/code-mode.md. (docs/tools/code-mode.md, a9707e15bcda)
  • Implementation boundary: The existing OpenClaw worker directly loads QuickJS-WASI. This patch moves documentation without changing execution contracts; its unchanged Codex disambiguation does not make the documentation split depend on the Codex implementation. (src/agents/code-mode-worker.ts:39, 8106d106b61f)
  • Area-history routing: The guide's main-branch history includes repeated work by Peter Steinberger and RoboClaw. GitHub commit metadata identifies their accounts as steipete and roboclaw-bot. These are routing signals, not claims of feature introduction; deeper historical inspection was incomplete. Public docs: docs/tools/code-mode.md. (docs/tools/code-mode.md, a9707e15bcda)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • roboclaw-bot: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-08T18:43:17.359Z sha e0212f5 :: needs maintainer review before merge. :: none

Glossary conflict only; union keyed on source, 678 entries, 0 duplicate
sources. No page conflicted.

Re-checked the invariant no validator covers: every surviving
'above'/'below' in the children still refers to same-page content.
configuration.md:124 points at 'Shipped preferred models' at :74,
:127 is semantic rather than directional, and internals.md:123 refers to
the suspended-run cap five lines above at :118.

docs-link-audit --anchors: 0 broken links.
@vincentkoc
vincentkoc merged commit c61d773 into main Sep 8, 2026
55 checks passed
@vincentkoc
vincentkoc deleted the docs-audit/split-code-mode branch September 8, 2026 18:55
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 9, 2026
The page was 79,412 characters with 43 headings in a flat run of 32 H2
sections, mixing a how-to quickstart, explanation, reference for exec,
wait, the guest API, error codes, and telemetry, plus a contributor test
plan. It is now an index with eight children, one per reader job.

Children:

- /tools/code-mode/quickstart - enable it, override one model, recover
  from tool errors, verify the surface, Swarm fan-out
- /tools/code-mode/configuration - fields, automatic per-model
  activation, the preferred-model list, activation precedence
- /tools/code-mode/tool-surface - model-visible tools, exec, wait, the
  hidden catalog, Tool Search interaction, name collisions
- /tools/code-mode/guest-api - guest globals, catalog handles, MCP
  namespaces, virtual API declarations, paginated file data
- /tools/code-mode/output - declared output contracts and the output API
- /tools/code-mode/internals - runtime status, scope, terms, nested tool
  execution, snapshot lifecycle, QuickJS-WASI, TypeScript, security
- /tools/code-mode/troubleshooting - error codes, telemetry, debugging
- /tools/code-mode/maintainers - implementation layout, validation
  checklist, E2E test plan

Anchor strategy: per-anchor routes are impossible because redirectSource()
rejects any source containing [?#]. All 44 pre-split IDs computed with
parseDocsDocument stay alive on the parent index instead: 4 remain
natively published (what-it-does, why-use-it, technical-tour, related)
and 40 became authored <a id="..." /> stubs in a "Where each section
moved" list, each linking to the page that now holds the content. The one
punctuated heading emits both an encoded and a cleaned ID; both are
stubbed. No ID the index still publishes itself is stubbed, so there is no
duplicate authored/canonical ID collision. A script enumerated the
pre-split IDs and asserted each resolves end to end: 44/44 pass, and the
9 pages report 0 collisions. External deep links such as the CHANGELOG
and appcast entries to #guest-runtime-api still land correctly.

Losslessness: 43 of 43 section bodies are byte-identical at their
destination, and all 23 code fences are character-identical on both info
string and body. Words 10,630 -> 11,081, links 18 -> 65, table rows
40 -> 52, fences 23 -> 23; every delta is accounted for by the index's two
child tables (12 rows, 8 links) and the 39-entry moved list. The empty
"## Quickstart" heading became the quickstart page title, and its five H3
children were promoted to H2 with identical heading text, so their IDs are
unchanged.

Prose was not rewritten. Five orphaned cross-references were repaired:
four same-page fragment links that now point at the child holding the
target, and the "Technical tour" signpost, which said "The rest of this
page covers" and now says "These pages cover". Six inbound deep links from
other docs pages were retargeted at the children.

Closes audit findings: r3-0783, r3-0784
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant