Skip to content

docs(reference): split the session management deep dive by reader job - #143082

Merged
vincentkoc merged 1 commit into
mainfrom
docs-audit/split-session-compaction
Sep 9, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
docs-audit/split-session-compaction

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What

docs/reference/session-management-compaction.md was 44,159 characters across 18 H2 sections, mixing on-disk reference, a disk-budget maintenance procedure, a downgrade runbook, four key/default tables, compaction explanation, and a troubleshooting checklist.

It is now a short index over five children, one per reader job:

Child Sections it holds Size
store.md Two persistence layers; On-disk locations 2,560
maintenance.md Store maintenance and disk controls (incl. the SQLite downgrade H3); Cron sessions and run logs 11,127
schema.md Session keys; Session ids; Session store schema; Transcript event structure 12,787
compaction.md Context windows vs tracked tokens; Compaction: what it is; When auto-compaction happens; Compaction settings; Pluggable compaction providers; User-visible surfaces 12,239
housekeeping.md Silent housekeeping (NO_REPLY); Pre-compaction memory flush 5,022

Index is 6,585 chars. Each child is a contiguous run of sections in original order, so nothing is reordered.

The index keeps the original lede, the Troubleshooting checklist, and Related verbatim. The checklist is cross-cutting — its five bullets route to four different children — so it belongs on the router rather than being arbitrarily assigned to one child.

Anchors — all 24 survive

Per-anchor redirects are impossible (redirectSource() in scripts/lib/docs-redirects.mjs throws on any source containing [?#]), so every pre-split id stays alive on the index. Ids were enumerated with the repo's own parseDocsDocument, not a slug approximation.

  • 22 authored <a id="…" /> stubs on the index, each linking to the child that now holds the content.
  • 2 self-published, deliberately not stubbed: troubleshooting-checklist and related are still published by the index itself; stubbing them would be a duplicate authored/canonical id.
  • Four punctuated headings each mint an encoded and a cleaned id (compaction%3A-what-it-is + compaction-what-it-is; likewise for the two sessionKey/sessionId headings and silent-housekeeping-(no_reply)). Both members of every pair are stubbed.

Verified mechanically: 24/24 pre-split ids resolve on the index, 0 unresolved; collisions empty on the index and on all five children; 18/18 stub link targets resolve on their child.

This page has no Accordion/Step/Tab/ParamField components, so no verbatim-marker ids are involved and no id shifted between parent and child.

Losslessness — byte-identical, no exceptions

The page has no intra-page ](#…) links, so no link rewrites were needed and the proof needs no carve-outs.

The shipped index lede + the five shipped child bodies + the shipped Troubleshooting and Related sections, concatenated in original order, reproduce the previous body exactly:

orig body sha256 : 1ee73287c171a5af95d4b50867bc035d54dd5e4b8039418780726fa113d33d14
recon     sha256 : 1ee73287c171a5af95d4b50867bc035d54dd5e4b8039418780726fa113d33d14
BYTE IDENTICAL   : True (43778 vs 43778 chars)

Corroborating counts:

  • Code fences 3 → 3, matching one-for-one on info string + body sha256 (ee97c8dc34752b81, 2425950a4be6c02b, 30578e99ae85a0e4) — every command and config example is character-identical.
  • Table rows 22 → 29; the +7 is exactly the new routing table (header + separator + 5 rows).
  • Body words 5,708 → 5,999; the entire increase is index scaffolding.

Prose diff is empty

check-orphan-refs.py flags four directional references. All four are fine and none was rewritten:

  • compaction.md "leaves proactive scheduling to the maintenance owner above" — antecedent is item 2 of the same numbered list, same page.
  • housekeeping.md "the flush logic above" — antecedent is the Pre-compaction memory flush section, same page.
  • housekeeping.md "a soft threshold below the compaction threshold" — a numeric comparison, not a page reference.
  • maintenance.md "keep the unarchived total above the cap" — a numeric comparison.

stranded-stubs.py docs → 0 suspect stubs (the source had no authored <a id> stubs to strand).

Pins classified

docs-test-pins.py reports 6; its "test(s)" label is loose, so each was read:

  • 5 QA scenario YAMLs (qa/scenarios/**) list the page under docsRefs:. These are doc pointers, not literal-string assertions — no contract test reads this file and asserts its content, so the sdk-subpaths.md refusal condition does not apply. They still resolve to the index; left unchanged.
  • taxonomy.yaml (4 entries) — all plain paths with no #anchor (the file has only 2 anchored entries in total, both for cron-jobs.md). They resolve to the index, which remains. pnpm maturity:check passes, and docs/maturity/taxonomy.md is generated from taxonomy.yaml, which is unchanged.
  • Independent git grep on origin/main with no path filter found only prose links to /reference/session-management-compaction (all still resolve to the index), the docs.json nav entry, and the zh nav overlay.

RELEASE_METADATA_PATHS in scripts/changed-lanes.mts does not contain this page, so check-release-metadata-only.mts is unaffected.

.github/labeler.yml: no file-exact glob names this page; the "docs" label uses a broad docs/** glob that already matches the new directory. No gap is created and none pre-exists — no labeler change needed.

CODEOWNERS: no rule matches this page or the new directory (simulated last-match-wins; control: /docs/reference/RELEASING.md correctly resolves to @openclaw/openclaw-release-managers, and there is no bare * catch-all). No maintainer team gates this PR.

Validators

Run on the staged tree.

  • pnpm check:docs → exit 0 (the check-docs job's own aggregate: format:docs:check, lint:docs, lint:templates, docs:check-mdx, docs:check-i18n-glossary, docs:check-links, docs:check-config-examples).
  • docs-link-audit.mjs --anchors → 3 broken links, identical to the baseline I measured myself at the merge-base bc847251aab by stashing in place: the three known #windows-app-node ones. Delta 0.
  • pnpm maturity:check → passes.
  • vitest --config vitest.full-core-unit-src.config.ts src/docs/ → 8 files, 8 ran, 16 tests passed (file count checked against the 8 that exist).
  • vitest --config vitest.tooling.config.ts src/scripts/docs-link-audit.test.ts → 1 file, 1 pre-existing failure ('ass-guide' vs 'as-s-guide', a slugifier assertion). Reproduced identically at the base sha, so it is not from this change.
  • docs-list, docs-source-anchors, render-maturity-docs, docs-i18n script tests → 4 files, 17 tests, all pass.

Shared files

  • docs/docs.json gains a nested group, following the reference/full-release-validation precedent — the sibling split that is actually on main (verified with test -d). docs/reference/RELEASING.md's split is an open, unmerged PR and was not used as precedent.
  • docs/.i18n/glossary.zh-CN.json needed five new sources: check-docs-i18n-glossary.mts requires a glossary source for every new page title, so a split that adds child pages does need entries here. They are inserted next to the existing "Session management deep dive" entry, not appended, so concurrent splits touch different regions and merge cleanly. Result validated: 978 entries, 0 duplicate sources.
  • docs/.i18n/zh-Hans-navigation.json needs no change — it is a label overlay cloned from the English nav.

Audit findings

Closes r3-0707 (blocking; its prescribed fix was exactly "split the page into store, maintenance, and compaction reference pages with a short index parent"). Also addresses r3-2221 (18 H2s, no index).

Deliberately not addressed here, to keep this content-preserving: r3-0708 (prose density), r3-2220 (lede), r3-2222 (Title Case H3 — kept verbatim so its anchor and text are unchanged), r3-2223 (back-link from /concepts/context-engine), r3-2224 (unversioned Codex claims). Each needs a prose edit and belongs in a follow-up.

The single page was 44,159 characters and 18 H2 sections mixing on-disk
reference, a disk-budget maintenance procedure, a downgrade runbook, four
key/default tables, compaction explanation, and a troubleshooting
checklist. It is now a short index over five child pages, one per reader
job, so a reader can finish one lookup on one page.

Children under docs/reference/session-management-compaction/:

- store.md - the two persistence layers and the per-agent on-disk paths
- maintenance.md - session.maintenance keys, the disk-budget cleanup
  tiers, cron run retention, and downgrading after the SQLite flip
- schema.md - sessionKey patterns, sessionId lifecycle, SessionEntry
  fields, and the transcript event stream
- compaction.md - what compaction is, when auto-compaction runs, its
  settings, pluggable providers, and its user-visible surfaces
- housekeeping.md - the NO_REPLY silent-turn contract and the
  pre-compaction memory flush

The index keeps the original lede, the Troubleshooting checklist, and
Related verbatim: the checklist is cross-cutting (its five bullets route
to four different children), so it belongs on the router.

Anchor strategy: per-anchor redirects are impossible (redirectSource()
throws on any source containing [?#]), so all 24 heading ids from the
previous single-page version stay alive on the index. 22 are authored
<a id="..." /> stubs linking to the child that now holds the content; the
remaining two (troubleshooting-checklist, related) are still published by
the index itself and are deliberately not stubbed, which would be a
duplicate authored/canonical id. Ids were computed with
parseDocsDocument, not a slug approximation. Four punctuated headings
each mint an encoded and a cleaned id (for example
compaction%3A-what-it-is and compaction-what-it-is); both members of every
pair are stubbed. Collisions are empty on the index and all five children,
and all 18 stub link targets resolve on their child.

Losslessness: the page has no intra-page ](#...) links, so no link
rewrites were needed and the split is byte-identical with no exceptions.
The shipped index lede + the five child bodies + the shipped
Troubleshooting and Related sections, concatenated in original order,
reproduce the previous body exactly:
sha256 1ee73287c171a5af95d4b50867bc035d54dd5e4b8039418780726fa113d33d14
(43,778 chars in, 43,778 out). 3 code fences in, 3 out, matching
one-for-one on info string and body sha256 (ee97c8dc34752b81,
2425950a4be6c02b, 30578e99ae85a0e4), so every command and config example
is character-identical. Table rows 22 -> 29 (+7 is the new routing
table). Body words 5,708 -> 5,999; the entire increase is index
scaffolding. The prose diff is empty: check-orphan-refs.py flags four
directional references, and all four are fine - three have same-page
antecedents ("the maintenance owner above", "the flush logic above") and
two are numeric comparisons ("above the cap", "below the compaction
threshold"), so none was rewritten.

docs.json gains a nested group following the reference/full-release-validation
precedent, which is the sibling split actually on main.
zh-Hans-navigation.json needs no change; it is a label overlay cloned
from the English nav. The zh-CN glossary needed five new sources for the
new child titles, inserted next to the existing "Session management deep
dive" entry rather than appended, so concurrent splits touch different
regions of the file.

Closes audit finding r3-0707; also addresses r3-2221.
@clawsweeper

clawsweeper Bot commented Sep 9, 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 size: XS maintainer Maintainer-authored PR labels Sep 9, 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 9, 2026
@clawsweeper

clawsweeper Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 7:51 AM ET / 11:51 UTC.

ClawSweeper review

What this changes

Splits the session-management reference into five task-focused pages, adds navigation and translated titles, and preserves existing section links on the index.

Merge readiness

✅ Ready for maintainer review

Keep open: this useful documentation split is absent from current main, preserves the original content, and introduces no identified defect. The member-authored PR also carries the protected maintainer label.

Priority: P3
Reviewed head: b2e721c0d362e90370875376e43409810ac5176e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, content-preserving documentation split with useful validation evidence and no actionable findings.
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 6 items Content preservation independently verified: A read-only Python comparison reconstructed the original body from the retained introduction, all five child bodies in order, and the retained troubleshooting/related sections. The byte sequences were identical. Both reconstructed and original bodies, excluding frontmatter and leading blank lines, had SHA-256 752401a838ca9bb85262c2ce016ae02b98f3c292aaef6111e4e2a30cecf899e2. This verifies relocation without endorsing every pre-existing runtime claim.
Legacy link compatibility: The index contains 22 explicit anchor stubs linking to moved sections and retains the troubleshooting and related headings. Inspection of the publishing parser confirms that authored HTML IDs are collected and heading aliases are preserved; the PR body additionally reports 24/24 legacy IDs and 18/18 destination links resolving.
Navigation and glossary integration: The introduced diff adds the five child routes under Technical reference and matching glossary titles. Both JSON files parsed successfully, and the glossary contains no duplicate source strings. The existing full-release-validation navigation provides the same nested-group pattern.
Findings None None.
Security None None.

How this fits together

OpenClaw’s documentation site guides operators through session storage, retention, transcript structure, and compaction. Its navigation and section links direct readers to the relevant reference material.

flowchart TD
  A[Reader task] --> B[Documentation navigation]
  C[Existing section link] --> D[Session reference index]
  B --> D
  D --> E[Storage and maintenance references]
  D --> F[Session structure reference]
  D --> G[Compaction and housekeeping references]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Docs +102. Total +102 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 8 466 364 +102
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 466 364 +102

Review metrics

Metric Value Why it matters
Content preservation Original body reconstructed byte-for-byte Independent comparison confirms that the split retains the existing commands, warnings, tables, and explanations.
Legacy section links 22 explicit aliases plus 2 retained headings Existing section URLs retain destinations after the content moves.

Technical review

Best possible solution:

Retain the task-focused reference pages and stable legacy anchors while keeping future factual updates in their owning child pages.

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

Not applicable: this reorganizes reference documentation rather than repairing a runtime defect; content preservation was independently checked.

Is this the best way to solve the issue?

Yes: contiguous section moves, a short routing index, and explicit legacy anchors provide a focused improvement without changing the documented contracts.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a bounded documentation-navigation improvement with no runtime behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add 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/.

Label justifications:

  • P3: This is a bounded documentation-navigation improvement with no runtime behavior change.
  • 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:

  • Content preservation independently verified: A read-only Python comparison reconstructed the original body from the retained introduction, all five child bodies in order, and the retained troubleshooting/related sections. The byte sequences were identical. Both reconstructed and original bodies, excluding frontmatter and leading blank lines, had SHA-256 752401a838ca9bb85262c2ce016ae02b98f3c292aaef6111e4e2a30cecf899e2. This verifies relocation without endorsing every pre-existing runtime claim. Public docs: docs/reference/session-management-compaction.md. (docs/reference/session-management-compaction.md:14, b2e721c0d362)
  • Legacy link compatibility: The index contains 22 explicit anchor stubs linking to moved sections and retains the troubleshooting and related headings. Inspection of the publishing parser confirms that authored HTML IDs are collected and heading aliases are preserved; the PR body additionally reports 24/24 legacy IDs and 18/18 destination links resolving. Public docs: docs/reference/session-management-compaction.md. (docs/reference/session-management-compaction.md:26, b2e721c0d362)
  • Navigation and glossary integration: The introduced diff adds the five child routes under Technical reference and matching glossary titles. Both JSON files parsed successfully, and the glossary contains no duplicate source strings. The existing full-release-validation navigation provides the same nested-group pattern. Public docs: docs/docs.json. (docs/docs.json:2983, b2e721c0d362)
  • Still useful on current main: The fetched main revision retains the monolithic reference and has no session-management-compaction child directory. The supplied latest release tag also has no child directory. No merged replacement is established. Public docs: docs/reference/session-management-compaction.md. (docs/reference/session-management-compaction.md:14, f93881f90f42)
  • Relevant historical contributors: Current-main path history identifies recent documentation work by Vincent Koc and session-retention/compaction work by Peter Steinberger. Earlier introduction and exact parent-line provenance could not be established from the available objects; these are routing candidates rather than introduction attributions. Public docs: docs/reference/session-management-compaction.md. (docs/reference/session-management-compaction.md, f93881f90f42)
  • Policy, checks, and live PR state: Root and docs AGENTS.md were read fully; no deeper applicable policy or maintainer-notes directory was found. The pinned diff passed git diff --check, and the checkout remained clean. REST confirmed the PR remains open at the reviewed head with the maintainer label. The captured body reports successful docs checks; repository validators and runtime tests were not executed during this read-only review. Public docs: docs/AGENTS.md. (docs/AGENTS.md:14, b2e721c0d362)

Likely related people:

  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: 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.

@vincentkoc
vincentkoc merged commit 873a52f into main Sep 9, 2026
67 checks passed
@vincentkoc
vincentkoc deleted the docs-audit/split-session-compaction branch September 9, 2026 12:03
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 10, 2026
…openclaw#143082)

The single page was 44,159 characters and 18 H2 sections mixing on-disk
reference, a disk-budget maintenance procedure, a downgrade runbook, four
key/default tables, compaction explanation, and a troubleshooting
checklist. It is now a short index over five child pages, one per reader
job, so a reader can finish one lookup on one page.

Children under docs/reference/session-management-compaction/:

- store.md - the two persistence layers and the per-agent on-disk paths
- maintenance.md - session.maintenance keys, the disk-budget cleanup
  tiers, cron run retention, and downgrading after the SQLite flip
- schema.md - sessionKey patterns, sessionId lifecycle, SessionEntry
  fields, and the transcript event stream
- compaction.md - what compaction is, when auto-compaction runs, its
  settings, pluggable providers, and its user-visible surfaces
- housekeeping.md - the NO_REPLY silent-turn contract and the
  pre-compaction memory flush

The index keeps the original lede, the Troubleshooting checklist, and
Related verbatim: the checklist is cross-cutting (its five bullets route
to four different children), so it belongs on the router.

Anchor strategy: per-anchor redirects are impossible (redirectSource()
throws on any source containing [?#]), so all 24 heading ids from the
previous single-page version stay alive on the index. 22 are authored
<a id="..." /> stubs linking to the child that now holds the content; the
remaining two (troubleshooting-checklist, related) are still published by
the index itself and are deliberately not stubbed, which would be a
duplicate authored/canonical id. Ids were computed with
parseDocsDocument, not a slug approximation. Four punctuated headings
each mint an encoded and a cleaned id (for example
compaction%3A-what-it-is and compaction-what-it-is); both members of every
pair are stubbed. Collisions are empty on the index and all five children,
and all 18 stub link targets resolve on their child.

Losslessness: the page has no intra-page ](#...) links, so no link
rewrites were needed and the split is byte-identical with no exceptions.
The shipped index lede + the five child bodies + the shipped
Troubleshooting and Related sections, concatenated in original order,
reproduce the previous body exactly:
sha256 1ee73287c171a5af95d4b50867bc035d54dd5e4b8039418780726fa113d33d14
(43,778 chars in, 43,778 out). 3 code fences in, 3 out, matching
one-for-one on info string and body sha256 (ee97c8dc34752b81,
2425950a4be6c02b, 30578e99ae85a0e4), so every command and config example
is character-identical. Table rows 22 -> 29 (+7 is the new routing
table). Body words 5,708 -> 5,999; the entire increase is index
scaffolding. The prose diff is empty: check-orphan-refs.py flags four
directional references, and all four are fine - three have same-page
antecedents ("the maintenance owner above", "the flush logic above") and
two are numeric comparisons ("above the cap", "below the compaction
threshold"), so none was rewritten.

docs.json gains a nested group following the reference/full-release-validation
precedent, which is the sibling split actually on main.
zh-Hans-navigation.json needs no change; it is a label overlay cloned
from the English nav. The zh-CN glossary needed five new sources for the
new child titles, inserted next to the existing "Session management deep
dive" entry rather than appended, so concurrent splits touch different
regions of the file.

Closes audit finding r3-0707; also addresses r3-2221.
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 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