Repository navigation
fix(mobile): show the session's commands and skills in the phone's / menu - #25335
brennanb2025 wants to merge 11 commits into
Conversation
…h mobile Moves the composer's catalog selection (session report vs. structured fallback vs. curated list) and the grouped, ranked, collision-aware picker row builder from the desktop renderer into src/shared, so the phone can build its `/` menu with the same policy instead of a copy. The renderer keeps its import paths through re-exports. Session-reported skills now carry their reported description. Desktop still shows the disk scan's description wherever it has one; a reported skill with no disk description now shows the session's, which also makes it findable by description in the menu.
…menu In a structured Claude chat the phone's `/` menu offered only /model, /effort, /clear and /compact, although the host already streams the full catalog the running session reported. The phone now exposes that catalog from its structured session hook and builds the menu with the shared desktop policy: a Commands group (with argument hint and description) and a Skills group, ranked the same way, up to 50 rows per group in a virtualized list. Picking a row inserts its token; sending it takes the same path as typing the same text. Older hosts, Codex structured chats and terminal chats keep their current command source. The menu is memoized on stable inputs so streamed transcript frames do not rebuild it.
…lash-catalog-23219
…ne heading - The structured session hook now returns one memoized `slashCatalog` (reported commands + host conversation commands); the controller gates it once by lane and threads it to the composer, so the menu no longer waits on the model picker loading. Removes `structuredLaneCommands`. - The catalog selection is memoized apart from the query, so typing only re-ranks rows. - Commands / Skills headings show only when a Skills group is showing, and carry the header accessibility role. - Section shaping moves out of the suggestions component into the hook. - The send-retirement test is renamed and retitled to what it pins (slash-prefixed text retiring against the host row); the inert catalog fixture and catalog-change case are gone. - `sessionReportedSkills` returns `NativeChatSessionSkill`; the command-name comment no longer claims names are always curated.
…yped query Headings now show whenever the session reports skills, so they no longer appear and disappear as the query filters groups out; empty groups still drop. Co-Authored-By: Claude <noreply@anthropic.com>
…lash-catalog-23219
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (36)
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe change adds shared catalog and picker logic for slash commands and skills, then routes structured session catalog data to desktop and mobile composers. The mobile composer now builds grouped slash-menu and file-autocomplete sections through a hook and renders them with a section list. New tests cover catalog selection, menu behavior, and structured-send outcomes. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The phone's slash menu now shows the commands and skills the session reports, grouped and searchable. Older hosts, Codex chats, and terminal-backed chats keep their previous command lists. No concrete defect was found, so the change appears ready to merge with normal checks. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to The phone now inserts repository-supplied command names into drafts without the hidden-character and multiline-token checks applied to skills. A misleading menu entry can therefore insert more text than the user expects. Sending still requires user action and uses the existing session controls. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
Comment |
There was a problem hiding this comment.
ℹ️ No critical issues — one stale script reference worth cleaning up.
Reviewed changes
- Shared
/menu policy — desktop's catalog selection and row builder move intosrc/shared(native-chat-composer-catalog.ts,native-chat-picker-items.ts) with a new shared collator (locale-text-collation.ts); the renderer re-exports them so existing import paths keep working. - Reported skills keep their description —
sessionReportedSkillsnow returns{ name, description? }, and the shared row builder fills a blank disk description with the session's, so the phone (which never scans disk) has row text. - Phone catalog plumbing —
useMobileStructuredAgentSessionexposes one memoizedslashCatalog(sessionCommands+conversationCommands), gated once by lane in the controller and threaded overlay → view → composer. - Phone
/menu UI —mobile-native-chat-slash-menu.tsbuilds rows through the shared builder, andMobileNativeChatComposerSuggestions.tsxbecomes a memoized virtualizedSectionListwith Commands/Skills headings, argument hint, and a one-line description. - Tests — shared builder/catalog cases move from the desktop test file, plus new phone menu, hook-reference-stability, and slash-send-retirement coverage.
ℹ️ Stale benchmark still imports the removed rankSlashCommandSuggestions
config/scripts/mobile-file-ranking-benchmark.mjs still lists rankSlashCommandSuggestions from mobile/src/session/mobile-native-chat-autocomplete.ts (lines 26 and 38), but this PR deletes that function. Running the benchmark now resolves the "after" implementation to undefined and throws TypeError: after is not a function at the first differential case. It is not wired to package.json or CI, so nothing gates on it — it is a cleanup item, not a merge blocker.
Technical details
# Stale benchmark entry for a removed function
## Affected sites
- `config/scripts/mobile-file-ranking-benchmark.mjs:26` — still enumerates `['mobile/src/session/mobile-native-chat-autocomplete.ts', 'rankSlashCommandSuggestions']`.
- `config/scripts/mobile-file-ranking-benchmark.mjs:38` — still branches on `name === 'rankSlashCommandSuggestions'` to shape candidates.
## Required outcome
- Running the benchmark against a baseline must not throw on a function the current tree no longer exports.
## Suggested approach (optional)
- Drop the `rankSlashCommandSuggestions` entry (and its `slash` branch), since the mobile-specific ranker was replaced by the shared `buildNativeChatPickerItems`; or repoint the benchmark at the shared builder if a differential comparison is still wanted.
## Open questions for the human (optional)
- Was `mobile-file-ranking-benchmark.mjs` meant to be retired along with the mobile-only ranker, or does it still have a use?deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
…lash-catalog-23219-2 # Conflicts: # mobile/src/session/MobileNativeChatComposer.tsx # mobile/src/session/MobileNativeChatOverlay.tsx # mobile/src/session/mobile-native-chat-controller-contract.ts # mobile/src/session/mobile-native-chat-send-classification.ts # mobile/src/session/use-mobile-native-chat-controller.ts # mobile/src/session/use-mobile-structured-agent-session.ts # src/renderer/src/components/native-chat/NativeChatComposer.tsx # src/renderer/src/components/native-chat/use-native-chat-picker-state.ts
… answer Main dropped commands only the desktop chat answers (OMP and OpenClaude /context) from the phone's terminal-chat list. The shared / catalog selector now takes that lane's curated list from its caller: desktop passes the verified catalog, the phone passes getMobileNativeChatCommands.
… / menu inputs A session-reported command name with whitespace, bidi or zero-width characters became a / menu row whose tap inserted text the row never showed. Command names now pass the same token-safety check skill names do, on desktop and the phone. Also: test OMP and OpenClaude terminal chats on the phone have no /context row, drop the phone session hook's redundant catalog memo, correct two comments, and remove an unchecked test type assertion.
…ntext The desktop chat answers /context itself, so its terminal-chat menu keeps the row the phone now leaves out.
|
strangely how inconsistent the desktop and phone chat ui differs. could you please fix the merge conflict and we hope this will get merged? |

ELI5
On the phone, typing
/in a Claude chat only offered four commands (/model,/effort,/clear,/compact), while the desktop app, on the very same chat, offers everything that Claude session actually loaded: its built-in commands, the repo's own.claude/commands, plugin commands, and a separate list of skills.The host was already sending that full list to the phone. The phone stored it and then never showed it. This PR shows it, using the same menu code as desktop.
The problem
What you saw: in a structured Claude chat on the phone,
/showed/model,/effort,/clear,/compactand nothing else. Your custom commands and every skill were missing, so the only way to run one was to type its exact name from memory. Desktop showed the full list for the same chat.Why it happened: Claude reports its command and skill catalog when a session starts (and again whenever it changes). The host forwards that catalog to every client on the chat's live update stream, and the phone already saved it into its chat state. But the phone's chat hook never passed it on, so the phone's composer built its
/menu from the four host-owned commands alone (capped at 12 rows). Desktop's menu logic lived in desktop-only code, so the phone couldn't reuse it.What this changes for you
//model/effort/clear/compact/, e.g./rev/name/namefor Claude), ready for arguments. You tap Send.Desktop changes in one small way: a skill the session reported but whose file Orca couldn't read a description from now shows (and can be searched by) the description the session gave, instead of a blank line.
What changed (mechanism)
src/shared(native-chat-composer-catalog.ts,native-chat-picker-items.ts, plus the small text-sorting helper they used). Desktop now calls the shared versions through thin wrappers; existing import paths keep working.{ name, description }for reported skills, so the phone (which never scans the disk) has something to show.useMobileStructuredAgentSessionnow returns oneslashCatalog(the session's reportedcommands, which it already received, plus the host-supported conversation commands), and it flows controller → overlay → chat view → composer, defined only for structured chats. A new pure module,mobile-native-chat-slash-menu.ts, builds the phone's menu by calling the shared selection and row builder.Why this approach
Differences from the common pattern, labelled:
/nameand you tap Send (desktop can send straight from the highlighted row with Enter; a phone has no Enter-on-row)./at the start of the message (its existing behaviour; Claude only runs commands there).Known limitations this PR does not change (they already affect every phone message, typed or picked):
Community PRs. Thanks to @dudupii (#19680): the shared
nativeChatComposerCatalogfunction (name and shape) and exposing the stream'scommandsfrom the phone's chat hook come from that PR. Thanks to @MaoCreate-Wen (#19207) for identifying the gap and the pickable-skill idea. Not carried over: treating reported commands and skills as host controls (that would drop the message row and could re-send text the host already delivered), a phone-only copy of desktop's merge rules, letting any paired phone run a host disk scan of a caller-chosen folder (skills.discover), and a larger hand-written Claude list (it would offer commands Claude keeps for its own terminal screen, like/exitand/login, in chat).STA-8016 (the phone re-detecting agents each time it opens a new tab) is a different code path and is not touched.
Linked Issue
Fixes #23219
Visual Proof
Phone: Android emulator, the phone app built from this branch, paired to a desktop Orca built from this branch (commit 6e81942; the later merge of main touches none of these files). The chat runs in a test repo with one custom command (
/qa-deploy-check) and one skill (/qa-release-notes).Before (main's phone code, same desktop, same chat): typing
/offers only the four host commands, and/qafinds nothing, although the session reported both the custom command and the skill.After: typing
/shows what the session reported. Your own command comes first, with its description, under a Commands heading.After: filtering.
/qanarrows the list to the custom command (Commands) and the skill (Skills).After: picking the skill and sending. Tapping
/qa-release-notesfills the box; addingfor v1and sending produces one message row and the skill's reply (QA SKILL RAN). Thirty seconds later there was still no leftover "sending" bubble. Picking/qa-deploy-checkbehaved the same way.Unchanged:
/modelis still the host's model control. Sending/modelopens the model sheet and adds no message row.Desktop, same chat, for comparison. Desktop's list starts with the same commands in the same order and shows the same project skill (desktop orders skills by where they live; the phone orders them alphabetically, as noted above).
Not tested on the device: the fallback list for terminal-backed chats. The phone only switches a terminal chat to chat view with a long-press, and the emulator tool can't long-press on Android. Unit tests cover it (
mobile-native-chat-slash-menu.test.ts: older host, terminal list, Codex).Testing
Shared:
native-chat-composer-catalog.test.ts,native-chat-picker-items.test.ts(builder cases moved from desktop, plus reported descriptions, search by description, 50 cap with a filtered match past row 50),native-chat-slash-commands.test.ts.Phone:
mobile-native-chat-slash-menu.test.ts(old host fallback by what the host supports, Codex/goal, terminal list, alphabetical skills, empty report shows nothing rather than the fallback),MobileNativeChatComposer.slash-menu.test.ts(headings, hint, description, picks, render stability while the transcript updates),use-mobile-structured-agent-session-commands.test.tsx(catalog arrives, stays the same object across unrelated updates, clears correctly), send-bridge cases (picked command/skill behaves like typed text; host commands unchanged), andmobile-structured-slash-text-send-retirement.test.tsx, which runs the real reducer, projection, pending-bubble logic and send bridge together to pin that slash text as a pick inserts it (/review,/my-skill args, an image skill, a queued send, a no-reply/context) ends with one message row and no leftover bubble.Desktop regression tests for the composer catalog, picker state and structured session pass unchanged apart from the rename.
Typecheck (web, node, mobile, mobile tests), full oxlint, and the changed-code quality checks pass.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Security: no new mobile RPC surface. Cross-platform: client-only; no paths or shortcuts. SSH/WSL: structured Claude chats aren't offered there, so those stay on the terminal list. Folder workspaces: nothing assumes git. Mixed versions: covered above. Performance: menu memoized on stable references; virtualized list.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Author: @BrennanKB5