Repository navigation
fix(claude-code): hoist a selected skill to the front of the prompt - #6576
Merged
ymichael merged 1 commit intoOct 29, 2026
Merged
Conversation
Claude Code only expands a slash command that leads the prompt. When a user picked a skill mid-sentence or in a later input fragment, the bridge only swapped "$" for "/" in place, so the skill body never reached the model. Skills with disable-model-invocation: true could not be recovered through the Skill tool either. When exactly one skill is selected, remove its token and send "/<skill> <remaining text>", matching the Pi provider. Multiple selections keep the existing in-place translation. Fixes #6562 Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
deleted the
bb/fix-broken-link-in-documentation-thr_qxhkw7c2ae
branch
October 29, 2026 20:34
ymichael
added a commit
that referenced
this pull request
Oct 29, 2026
…it (#6581) ## Human comments ## What was wrong A composer pill (skill, file, thread, …) is an atomic node whose text (`/poteto-mode`, `@src/foo.ts`) was joined directly to the text beside it. The only separator was the space the picker inserts at pick time, and that space is easy to lose: - Send trims it when the pill is the last token. - History recall and queued/sent-message edit rebuild the draft from that trimmed text, leaving the caret right after the pill. - Voice insertion reads the pill as `"\n"` and decides it needs no leading space. - Deleting the space by hand. Text typed next to the pill is then sent glued to it (`/poteto-modeAlso testing`). The pill has a border but no margin, so it looks separated on screen. The model and `bb thread log` see the corrupted word, and a file pill sends a broken path. Investigation report: https://get-bb.github.io/reports/issues/2318.html Since #6576, all three providers (Claude Code, Codex, Pi) find a skill by its mention range, so the glue no longer stops the skill from running. This PR fixes the text. ## What changed - `plugins/composer/src/editor/prompt-editor-serialization.ts`: when the editor contents are turned into text, one space is emitted where a pill directly touches a letter, a digit or another pill on the same line. - Punctuation is left alone: `@foo.ts,` stays as typed. - The separator is not mapped in `offsetMapping`, like the `"\n"` for hard breaks. Mention ranges still cover exactly the pill text. - The editor document is untouched, so the caret, undo and IME composition are unaffected. - This covers every entry path: typing, restore, voice, paste and copy. - I considered and rejected giving the pill node a `leafText`. An explicit `leafText` argument to `textBetween` takes priority over the node spec, every caller passes `"\n"`, and trigger detection relies on the pill reading as a line break. - No wire, protocol, CLI or SDK changes. ## How you verified - New serialization table in `prompt-editor-serialization.test.ts`: - Pill/word, word/pill, pill/pill and pill-in-quote cases separate. - Each result is stable when converted back and forth. - Punctuation, whitespace and line breaks are unchanged. - Two `PromptBoxInternal` tests: typing after a restored trailing pill, and a voice transcript inserted after it. - The separation cases and both composer tests fail on unchanged code and pass with the fix. - `pnpm exec turbo run test typecheck lint --filter=bb-plugin-bb--composer --filter=@bb/app` passes (96 + 6,474 tests). - Live, on an isolated dev app with Claude Code: - Picked a skill, deleted the space the picker added, typed `Also testing`. The editor had the pill directly followed by the text; the server stored `I am lost. /poteto-mode Also testing` with the mention on `/poteto-mode`. - Typing `, then reply.` straight after a pill was stored as `/poteto-mode, then reply.`. Fixes #2318 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
Claude Code expands a skill only when its
/skill-namecommand leads the prompt. When a user selected a skill mid-sentence or in a later input fragment, the Claude bridge only swapped$for/in place, so the command stayed embedded and Claude treated it as plain text. The skill body never reached the model. Skills withdisable-model-invocation: truehad no fallback, because the model can't load them through the Skill tool. Investigation report: https://get-bb.github.io/reports/issues/6562.htmlWhat changed
plugins/provider-claude-code/src/bridge/bridge.ts(buildPromptText): when exactly one skill is selected, the bridge removes its token from the text and sends/<skill> <remaining text>. This matches the Pi provider (plugins/provider-pi/src/bridge/turn-input.ts). With multiple selections, the existing in-place$to/translation still applies, since only one command can lead.How you verified
$skill, mid-sentence/skill, leading skill, skill in a later input fragment, and multiple skills. On unchanged production code, the three non-leading single-skill cases fail; with the fix, all five pass.@anthropic-ai/claude-agent-sdkagainst a local capture endpoint with adisable-model-invocation: truefixture skill. The skill body reaches the outgoing model request for the prompt shapes the fix produces (/manual-probe Please use to inspect the fixture,/manual-probe Inspect this fixture.\n), and not for the old embedded form (Please use /manual-probe to inspect the fixture).pnpm exec turbo run test lint typecheck --filter=bb-plugin-provider-claude-code: 414/414 tests pass; lint and typecheck are clean.Fixes #6562
🤖 Generated with Claude Code