Skip to content

fix(skills): preserve compact prompt descriptions#88426

Merged
steipete merged 1 commit into
openclaw:mainfrom
abel-zer0:fix/compact-skill-descriptions
Jul 9, 2026
Merged

fix(skills): preserve compact prompt descriptions#88426
steipete merged 1 commit into
openclaw:mainfrom
abel-zer0:fix/compact-skill-descriptions

Conversation

@abel-zer0

@abel-zer0 abel-zer0 commented May 30, 2026

Copy link
Copy Markdown
Contributor

Related: #50677

What Problem This Solves

When a skills catalog exceeded maxSkillsPromptChars, OpenClaw's compact fallback removed every description. Opaque skill names then lost the semantic trigger guidance the model needs to choose the right skill.

Why This Change Was Made

The compact formatter now preserves the existing name/location/version identity set first, then spends only the remaining prompt budget on bounded descriptions. Description truncation reuses the shared UTF-16-safe helper so a limit cannot split a surrogate pair, and the prompt-format version advances so persisted sessions rebuild the changed catalog shape.

This is a current-main rewrite of the original contribution: it keeps the newer version-marker/session-refresh behavior, accounts for the complete rendered notice when enforcing the cap, and avoids trading an identity for description text.

User Impact

Large skills installations retain useful matching descriptions whenever budget remains. At the exact identity-only budget, behavior remains the previous compact contract: all identities fit, descriptions are omitted, and the prompt explains that state. Documentation now describes both compact modes.

Evidence

  • Exact reviewed head: 3bf7b9967330af23b8db52c175192442da3cf178.
  • Sanitized AWS Crabbox focused run run_3ff6ad25c73e: 2 files, 31 tests passed (compact-format and session snapshot coverage).
  • Sanitized AWS Crabbox changed-surface run run_1eeb815a2313: core/core-tests/docs lanes passed, including core and core-test tsgo, changed-file lint, import-cycle and repository guards.
  • Sanitized AWS Crabbox live run run_b4518917d9ec: two real openclaw agent --local turns through the repository mock /v1/responses endpoint. At 18,000 chars, 29 discovered identities/versions and all 12 long fixture descriptions survived with UTF-16-safe truncation. At the exact 6,107-char identity budget, the same 29 identities/versions remained byte-for-byte after description-line removal, with zero descriptions.
  • Local fallback: focused tests passed (31/31), touched files formatted, and git diff --check passed.
  • Fresh autoreview on the final source diff: clean; no accepted or actionable findings.

AI-assisted maintainer takeover: an OpenClaw maintainer agent rebased and rewrote the contributor patch against current main, added regression/live proof, and preserved contributor credit in the commit.

@openclaw-barnacle openclaw-barnacle Bot added size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 30, 2026
@clawsweeper

clawsweeper Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 9, 2026, 3:17 PM ET / 19:17 UTC.

Summary
The PR changes compact skills prompt formatting to keep name/location/version identities first, allocate remaining prompt budget to bounded descriptions, bump the skills prompt format version, and update tests/docs.

PR surface: Source +52, Tests +24, Docs +3. Total +79 across 4 files.

Reproducibility: yes. Current main source shows compact fallback omits all descriptions when full formatting exceeds the prompt budget, and the PR proof exercises the changed compact prompt path with live agent runs.

Review metrics: 1 noteworthy metric.

  • Prompt format marker: 1 changed. Changing WORKSPACE_SKILLS_PROMPT_FORMAT_VERSION intentionally refreshes persisted skills snapshots after upgrade.

Root-cause cluster
Relationship: partial_overlap
Canonical: #50677
Summary: This PR addresses the compact-description part of the broader silent skills truncation problem; another open PR handles omitted-key visibility.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] Existing tight skills.limits.maxSkillsPromptChars or per-agent skillsLimits.maxSkillsPromptChars setups will receive a changed compact prompt shape after merge.
  • [P1] The prompt format marker bump intentionally refreshes persisted skills snapshots, so this is session-state-sensitive even though the refresh path is covered.
  • [P1] The live PR is mergeable but behind current main, so the final merge result should still pass normal maintainer gates before landing.

Maintainer options:

  1. Land After Exact-Head Gates (recommended)
    Accept the changed compact prompt shape once the final merge result passes normal maintainer checks.
  2. Rebase Or Queue First
    Refresh the branch against current main if maintainers want CI and review evidence on the exact final merge base before landing.
  3. Pause For Broader Skills Policy
    Hold the PR if maintainers want compact descriptions decided together with omitted-skill keys, priority, pinning, or smart indexing.

Next step before merge

  • Maintainer should decide whether to accept the compatibility/session refresh risk and land after exact-head gates; no automated repair is needed.

Maintainer decision needed

  • Question: Should maintainers accept the compact skills prompt shape and session snapshot refresh risk now, or hold this for broader skills truncation policy?
  • Rationale: The implementation is narrow and proven, but it changes model-visible prompt bytes and refreshes persisted skills snapshots for existing users with tight skill prompt budgets.
  • Likely owner: steipete — steipete authored the maintainer rewrite/proof commit and is the current assignee for the PR.
  • Options:
    • Land Narrow Formatter Fix (recommended): Accept the compatibility/session refresh risk because the patch preserves identity coverage first and has focused, changed-surface, and live prompt proof.
    • Refresh Exact-Head Gates First: Require a rebase or merge-queue run if maintainers want current-main CI on the final merge result before accepting the prompt change.
    • Pause For Broader Skills Policy: Hold this PR only if compact descriptions should be bundled with omitted-key recovery, priority, pinning, or smart skill indexing decisions.

Security
Cleared: Security review cleared: the diff changes skills prompt formatting, tests, docs, and a format-version constant only, with no dependency, workflow, secret, package, or code-execution surface added.

Review details

Best possible solution:

Land the maintainer rewrite after exact-head gates, preserving identity-first compact budgeting, UTF-16-safe description truncation, version-driven session refresh, and docs aligned with both compact modes.

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

Yes. Current main source shows compact fallback omits all descriptions when full formatting exceeds the prompt budget, and the PR proof exercises the changed compact prompt path with live agent runs.

Is this the best way to solve the issue?

Yes. The PR fixes the existing skills prompt formatter and budget decision point, preserves identity-first compact behavior, reuses the existing prompt-format refresh mechanism, and leaves omitted-skill lookup policy to separate related work.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8656c3b357f6.

Label changes

Label justifications:

  • P2: This is a normal-priority skills prompt fix with bounded blast radius, but it affects model access to skill trigger guidance under prompt-budget pressure.
  • merge-risk: 🚨 compatibility: Existing tight maxSkillsPromptChars configurations will receive a changed compact skills prompt shape after merge.
  • merge-risk: 🚨 session-state: The PR bumps the skills prompt format marker so persisted session snapshots refresh to the new compact catalog format.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body and maintainer comment include exact-head focused checks plus sanitized AWS live output from real openclaw agent --local turns showing the new compact prompt behavior after the fix.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body and maintainer comment include exact-head focused checks plus sanitized AWS live output from real openclaw agent --local turns showing the new compact prompt behavior after the fix.
Evidence reviewed

PR surface:

Source +52, Tests +24, Docs +3. Total +79 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 83 31 +52
Tests 1 69 45 +24
Docs 1 6 3 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 158 79 +79

What I checked:

Likely related people:

  • steipete: Current-main blame and shortlog heavily route the refactored skills loading area through Peter, and he authored the maintainer rewrite/proof commit for this PR head. (role: recent area contributor and PR takeover author; confidence: high; commits: aaf5af2fbc87, 3bf7b9967330; files: src/skills/loading/workspace.ts, src/skills/loading/compact-format.test.ts, src/skills/types.ts)
  • snese: snese authored the merged compact skills prompt fallback that first added the identity-only compact tier this PR refines. (role: compact fallback feature introducer; confidence: high; commits: 3a85a11d83e1, f8bcfb9d73f0; files: src/agents/skills/workspace.ts, src/agents/skills/compact-format.test.ts, src/skills/loading/workspace.ts)
  • frankekn: frankekn merged the compact fallback PR and authored the adjacent compact fallback docs commit. (role: compact fallback merger and docs contributor; confidence: medium; commits: d2090e06a079, f8bcfb9d73f0; files: docs/tools/skills.md, src/agents/skills/workspace.ts)
  • koala73: koala73 authored the merged skills prompt bloat guard that introduced the prompt budget behavior this PR works within. (role: prompt budget contributor; confidence: medium; commits: 3eac98b793a1; files: src/agents/skills/workspace.ts, src/config/types.skills.ts, src/config/zod-schema.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (1 earlier review cycle)
  • reviewed 2026-07-09T16:56:16.406Z sha 3bf7b99 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels May 30, 2026
@byungskers

Copy link
Copy Markdown

The adaptive compact-description sizing is a nice idea. One tiny edge case to think about: truncateSkillDescription() slices UTF-16 code units, so a description containing emoji / some non-BMP characters could get split mid-surrogate when the compact budget lands in the middle of one. Probably rare, but if skill descriptions are user-authored it may be worth truncating on code points/graphemes instead of raw .slice().

@clawsweeper

clawsweeper Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@abel-zer0 thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward.

Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive.

Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it.

@steipete steipete self-assigned this Jul 9, 2026
@steipete
steipete force-pushed the fix/compact-skill-descriptions branch from aa9b475 to 3bf7b99 Compare July 9, 2026 15:59
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 9, 2026
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Maintainer takeover is complete at exact head 3bf7b9967330af23b8db52c175192442da3cf178.

Best-fix review: the rewritten patch keeps current main's version markers and session refresh, preserves the prior compact identity set before allocating description budget, accounts for the complete rendered notice, and uses the shared UTF-16-safe truncator. No sibling compact-prompt path needs a parallel change.

Proof:

  • Focused sanitized AWS run run_3ff6ad25c73e:
    pnpm test src/skills/loading/compact-format.test.ts src/skills/runtime/session-snapshot.test.ts
    — 2 files, 31 tests passed.
  • Changed-surface sanitized AWS run run_1eeb815a2313:
    pnpm check:changed -- docs/tools/skills.md src/skills/loading/compact-format.test.ts src/skills/loading/workspace.ts src/skills/types.ts
    — core, core-tests, and docs lanes passed, including core/core-test tsgo and changed-file lint.
  • Real behavior sanitized AWS run run_b4518917d9ec: two openclaw agent --local turns reached the repository mock /v1/responses provider. The roomy compact turn rendered 29 identities, 29 versions, and 29 bounded descriptions in 11,459/18,000 chars; all 12 long fixtures retained descriptions and the deliberate emoji boundary remained UTF-16-safe. The exact-tight turn rendered the same 29 identity/version records in 6,107/6,107 chars, zero descriptions, and byte-identical XML after removing only the roomy description lines.
  • Source-blind behavior validation against the captured artifact: 6/6 contract clauses and 5/5 anti-cheat probes passed.
  • Touched files formatted; git diff --check passed.
  • Fresh autoreview and independent final review: clean, no accepted/actionable findings.

Known proof gaps: none. The source head is frozen; failed earlier live attempts were assertion-harness calibration only, while every underlying real agent/provider turn completed successfully.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 9, 2026
@steipete
steipete merged commit b474059 into openclaw:main Jul 9, 2026
153 of 163 checks passed
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 10, 2026
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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants