Skip to content

feat(native-chat): describe slash commands from the provider's own report - #19928

Merged
brennanb2025 merged 3 commits into
mainfrom
brennanb2025/claude-command-descriptions
Sep 11, 2026
Merged

brennanb2025 merged 3 commits into
mainfrom
brennanb2025/claude-command-descriptions

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​232 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​228
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​114 $\color{#cf222e}{\Huge{\mathbf{−}}}$​27 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​87

Before / After

In a Claude native chat, typing / lists the commands that session actually loaded — 48 of them on this machine. Before this PR, 45 of those 48 rows were a bare command name with no explanation, because Orca described them from a hand-written 5-entry map instead of the text Claude already sends. /goal, /code-review's arguments, /effort's options — none of it reached the picker.

After, the picker shows what the provider reports: 38 of the 48 commands carry a one-line description — every one of them the provider's own text, including the three the curated map used to answer for — and 19 also show the argument sketch beside the token (/debug [issue description], /code-review [low|medium|high|xhigh|max] [--fix] [--comment] …). Nothing else about the row changed, and skill rows are untouched.

Before (base commit) After (this branch)
before-slash-all.png after-slash-all.png

The same list, filtered to /g — /goal goes from a bare token to an explained row:

Before After
before-slash-g.png after-slash-g.png

Counted from the rendered picker in both apps (same Mac, same Claude install, same session report of 67 entries = 48 commands + 19 skills):

Rows in the / picker Before After
Commands listed 48 48
…with a description 3 38
…with an argument hint 0 19
Skills listed / described 19 / 19 19 / 19 (unchanged)

Problem

Native chat renders Claude's slash commands from the catalog the session reports, but the descriptions came from a hand-written map (CLAUDE_COMMANDS in src/shared/native-chat-slash-commands.ts) that covers 5 commands. A real session reports far more — 67 entries here — so most rows, /goal among them, rendered with a blank description. Only 3 of the 5 curated names were even in what this session reported.

The data was already arriving and being dropped: the provider's descriptors carry name, description and argumentHint, and descriptorNames() in src/main/claude/claude-slash-command-catalog.ts kept only .name.

Fix

Carry the provider's own text through to the picker:

  • claude-slash-command-catalog.ts — descriptor-shaped sources (control initialization, commands_changed with commands) now contribute description/argumentHint, bounded the same way names already are: non-strings, blanks, and values over 200 (description) / 100 (argument hint) characters are dropped rather than truncated, whitespace is collapsed to one line, and the map is capped at MAX_COMMANDS. A descriptor frame replaces the text wholesale, so a later report that omits a description clears it.
  • The text is retained by name across the name-only frames. The stream init message carries slash_commands as plain strings, and it is what classifies commands vs skills — without this it would wipe the descriptions the control seed just supplied. Change detection now compares the text too, so a description-only refresh still republishes.
  • agent-session-wire.ts — AgentSessionSlashCommand gains optional description / argumentHint. Nothing is renamed or made required, so old clients and old hosts are unaffected.
  • native-chat-slash-commands.ts — sessionSlashCommandSuggestions prefers the reported description and falls back to the curated map. No entries were added to CLAUDE_COMMANDS / CODEX_COMMANDS: that map also drives which commands the structured dispatcher claims, so growing it would change dispatch behaviour. Keeping description sourcing separate from it is the point of the change.

The terminal_slash_commands hide-list and skill classification are unchanged, and a terminal-only command stays hidden however well the provider describes it (covered by a test).

argumentHint is rendered too, beside the command token — /debug reads /debug [issue description] on the token line, with "Enable debug logging for this session and help diagnose issues" below it. It uses the row's existing 11px muted tier — subordinate to the description, no new tokens or sizes — sits in a min-w-0 flex row so it truncates instead of pushing the row wide, and the picker caps it at 80 characters before it reaches the DOM. The mobile composer is deliberately untouched (no file under mobile/ is changed): it builds its rows from the curated catalog, not the session report, so a hint would never be populated there.

Visual proof

Both screenshots above are the real app, driven over CDP with the window kept off screen:

  • After — this branch (5c8dbd0), Orca dev instance on a fresh profile, real Claude structured native chat in a folder workspace, / typed into the composer. No message was sent; the catalog arrives with the session.
  • Before — an identically-driven second instance built from a worktree at 12f2c6b (an ancestor of this branch's base 721a269, i.e. without these commits), same folder workspace, same Claude, same 48-command report.

The row counts in the table above were read out of the rendered DOM of each instance, per picker group.

What the screenshots do not show: the hint's 80-character cap and description truncation (asserted in the render test, not reproducible with the text this Claude reports), the Codex lane, and mobile.

Ablation

Argument hint rendering (second commit): reverted the three source files that carry and render the hint, test kept — 1 failed / 6 passed in NativeChatAutocompleteMenus.test.tsx. Restored: 7 passed. The test drives the real chain — a wire entry through sessionSlashCommandSuggestions and buildNativeChatPickerItems into the rendered option — and asserts both the hint text and that an over-long hint arrives capped.

Description sourcing (first commit): reverted only the three source files, tests kept: 8 failed / 21 passed. Restored: 29 passed / 0 failed (claude-slash-command-catalog.test.ts + native-chat-slash-commands.test.ts). The one new test that passes in both states is the "describes nothing when the session reported names only" case, which asserts the unchanged string-only behaviour.

New coverage: descriptor text preserved; over-long / wrong-type / blank / multi-line text bounded; text carried across the name-only stream init; description-only change detected and later cleared; string-only reports still description-free; hide-list unchanged; reported description beating the curated one; curated fallback intact.

Two pre-existing tests were updated because they now legitimately carry descriptions (claude-slash-command-catalog.test.ts descriptor reload, and the claude-structured-session-commands.test.ts control-initialization seed, which now proves the text survives the stream init end-to-end through the adapter).

Gates

  • pnpm test src/main/claude/claude-slash-command-catalog.test.ts src/shared/native-chat-slash-commands.test.ts src/main/claude/claude-structured-session-commands.test.ts — 3 files, 33 tests passed.
  • pnpm tc — exit 0.
  • pnpm run check:code-quality:changed — passed, 0 new findings across 9 changed files (code quality, type-aware, React Doctor).
  • pnpm test src/renderer/src/components/native-chat … — 130 files, 1355 tests passed.
  • pnpm test src/main/claude src/shared — 8457 passed. The remaining failures are pre-existing: the same files fail with this change fully reverted at the base commit (remote-runtime-shared-control-connection, feature-interactions, claude-tui-resume-real-binary.integration, claude-structured-real-cli), and claude-agent-sdk-exit-proof / claude-stream-json-connection / claude-agent-sdk-import-boundary fail non-deterministically under load in both states (a different test name each run).

…port

The Claude session reports a description and argument hint for every
command it can run, but the catalog kept only the name, so the `/` picker
described the handful of commands our curated map covers and left the rest
— `/goal` included — with a blank row.

Carry `description`/`argumentHint` through the catalog and the session wire
(both optional, so mixed-version hosts are unaffected), and let a reported
description win over the curated one, which stays as the fallback for the
name-only report shape. The curated maps are untouched, so structured
dispatch still claims exactly the commands it claimed before.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Carry provider row text through the catalog — claude-slash-command-catalog.ts now extracts description/argumentHint from descriptor-shaped frames via descriptorDetails + rowText (non-strings, blanks, and over-length values dropped rather than truncated; whitespace collapsed to one line; map capped at MAX_COMMANDS), and re-attaches the text across name-only stream init frames through a details map.
  • Prefer reported text in the picker — sessionSlashCommandSuggestions prefers the reported description and falls back to the curated map, with no additions to CLAUDE_COMMANDS/CODEX_COMMANDS (preserving structured-dispatch behavior).
  • Wire type — AgentSessionSlashCommand gains optional description/argumentHint; additive host→client fields, safe for mixed-version clients and hosts.
  • Change detection — the catalog's equality check now compares the text too, so a description-only refresh still produces a new array reference and republishes through the subscribers' reference-equality check.

Verified: the detai merge order, the name-only-frame retention, the wholesale-replace semantics of descriptor frames (a later report that omits a description clears it), and the bounded/type-checked text extraction all hold up against the raw diff and surrounding code. The new tests assert exact objects (no loose truthiness/snapshot absorption), and the targeted suites pass (33/33).

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 1c9b6898-1694-45b3-917f-b961a8304fc2

📥 Commits

Reviewing files that changed from the base of the PR and between 5c8dbd0 and 384fa7a.

📒 Files selected for processing (2)
  • src/main/claude/claude-slash-command-catalog.test.ts
  • src/main/claude/claude-slash-command-catalog.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/claude/claude-slash-command-catalog.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The wire type now supports optional provider-authored descriptions and argument hints. The slash-command catalog validates, normalizes, stores, and propagates this text across descriptor and name-only frames. Text-only changes now trigger updates. Session suggestions prefer reported descriptions and use curated descriptions as a fallback. Picker rows render sanitized argument hints. Tests cover filtering, reclassification, malformed text, rendering, and precedence.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 384fa

Provider-authored command text is validated, propagated, and rendered with covered fallback and clearing behavior. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description thoroughly explains the problem, implementation, testing, visual behavior, compatibility impact, and remaining failures. However, it omits the required linked issue reference under “Fi… Add a valid linked issue reference under the Linked Issue section, such as “Fixes #123”. Keep the existing implementation, testing, and visual-proof details.
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: native chat slash commands now use descriptions from the provider report.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description thoroughly explains the problem, implementation, testing, visual behavior, compatibility impact, and remaining failures. However, it omits the required linked issue reference under “Fixes #”.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 2ca5992b-286d-49df-bf8a-d117a8cd1a8f

📥 Commits

Reviewing files that changed from the base of the PR and between 721a269 and ea7c2bf.

📒 Files selected for processing (6)
  • src/main/claude/claude-slash-command-catalog.test.ts
  • src/main/claude/claude-slash-command-catalog.ts
  • src/main/claude/claude-structured-session-commands.test.ts
  • src/shared/agent-session-wire.ts
  • src/shared/native-chat-slash-commands.test.ts
  • src/shared/native-chat-slash-commands.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.

`argumentHint` was carried to the renderer but nothing read it. Show it
beside the command token — `/goal <objective>` over the description — so a
row says how the command is invoked, not just what it does.

It sits at the row's existing 11px muted tier, subordinate to the
description, and truncates in a min-width-0 flex row; the picker also caps
the hint at 80 characters, so a provider cannot swamp the row.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Render the provider's argument hint beside the command token — NativeChatAutocompleteMenus.tsx lays the token and argumentHint out in a min-w-0 flex row, showing the hint in the row's existing 11px muted tier so it truncates rather than pushing the row wide.
  • Plumb the hint into the picker, capped at 80 chars — native-chat-picker-items.ts adds argumentHint to the command picker item via sanitizePickerText, and sessionSlashCommandSuggestions passes the wire field through unchanged when present.
  • Cover the chain end-to-end — a new renderer test drives a wire entry through sessionSlashCommandSuggestions and buildNativeChatPickerItems into the rendered option, asserting the hint text, the hintless-row fallback, and the 80-char cap; the shared suite's "reported text the curated catalog never claims" case now also asserts the hint survives.

Verified: the render narrows on item.kind === 'command' (the union's only member carrying argumentHint), the cap math in the test matches sanitizePickerText(..., 80) exactly, and the mobile composer builds its rows from the curated catalog, so the new optional field is inert there.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Normalized descriptor name handling — a shared commandName validator (trim, length, and no-whitespace) now backs both names() and descriptorCatalog(), so a malformed descriptor name is rejected before it can consume the MAX_COMMANDS budget.
  • Single validated pass for names and text — descriptorCatalog returns { names, details } from one dedup seen set, replacing the prior descriptorNames + descriptorDetails pair whose name and detail budgets could disagree.
  • Merged duplicate descriptors — repeated names within one frame now combine non-empty fields (previous?.description ?? rowText(...)) instead of the last descriptor overwriting earlier text.
  • Bounded raw length before collapsing — rowText rejects over-length values before the whitespace-collapse regex runs, so a pathological input never reaches the regex.

Verified the budget-accounting fix (the new "malformed descriptor names" test would fail against the prior details.size counter), the duplicate-merge order, and that the shared seen set keeps name/detail caps consistent. New tests assert exact objects with no loose truthiness or snapshot absorption.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status

PASS WITH RISK — no proven code findings remain.

  • Reviewed and fixed through four same-model adversarial rounds; the focused fix is pushed as 384fa7a57dc350ffffea30c513eff04f9497651b.
  • Fixed bounded descriptor normalization: malformed names cannot consume the metadata budget, duplicate descriptors preserve complementary fields, and oversized whitespace-heavy text is rejected before normalization.
  • Validation passed: 120 focused tests, 13 cross-version structured-session wire tests, pnpm tc, changed-file code-quality checks, and the performance audit.
  • Final readiness pass found 0 P0, 0 P1, and 0 P2 findings. Optional wire fields remain backward-compatible; no mobile-facing source, persisted state, SSH execution, Windows/WSL, or platform-specific logic changed.
  • The requested independent Grok Electron/CDP proof could not run because the Grok provider stopped at its weekly usage-limit screen before executing. No screenshot was attached; no Electron, SSH, mobile-emulator, or Windows/WSL runtime evidence is claimed.
  • Worktree is clean and PR HEAD matches the pushed commit.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Update: all required PR checks are now green, including package (macOS and Windows), typecheck, static analysis, the 8 Node 24 test shards, and cross-version wire compatibility. The only skipped jobs are path-gated checks unrelated to this data-only native-chat change.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron CDP validation

PASS on PR HEAD 384fa7a.

  • Launched this exact worktree in a hidden Orca dev instance with ORCA_BACKGROUND_LAUNCH=1 and an isolated profile; app identity reported branch brennanb2025/claude-command-descriptions.
  • Added a disposable local git workspace, enabled structured native chat in that isolated profile, opened Claude from the real New Tab menu, and typed / and /g into the rendered composer through Playwright CDP. No message was sent.
  • The live / picker rendered 48 commands: 38 with descriptions and 19 with argument hints, plus 19 skills. Visible examples include /debug [issue description] with its diagnostic description, /design-sync with its argument sketch, and /goal with Set a goal — keep working until the condition is met.
  • The picker remained within its pane with no horizontal overflow. Renderer console had no errors, and log inspection found no native-chat or Claude-session failures.

Full Claude slash picker

Filtered /g picker

Unverified in this run: sending a command, the Codex lane, mobile, SSH, and Windows/WSL.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Correction: replacement Electron validation completed successfully after the earlier provider-limit block.

Remaining unverified: sending a command, Codex-specific behavior, mobile, SSH, and Windows/WSL.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron send-path validation

Validated the exact PR head (384fa7a) in an isolated background profile through the real Claude structured-chat UI.

  • Selected the provider-reported /context entry from the slash-command picker.
  • Pressing Enter submitted exactly /context.
  • Structured session history recorded the user text block as /context and the submission as dispatchState: accepted with a Claude provider item ID.
  • The visible chat rendered the Claude Context Usage response and completed normally (Worked for 1s).

Submitted /context command and rendered Claude response

@brennanb2025
brennanb2025 merged commit 9b83f97 into main Sep 11, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant