fix(claude): preserve attachment context when the prompt is a slash command#388
Open
herikwebb wants to merge 1 commit into
Open
fix(claude): preserve attachment context when the prompt is a slash command#388herikwebb wants to merge 1 commit into
herikwebb wants to merge 1 commit into
Conversation
…ommand The CLI query assembly kept only the last user line whenever it started with '/', silently discarding the context lines NBI had just appended for the same turn (attachment @-mentions, cell pointers, output context) — the footgun previously documented in extension.py's on_message. Extract the join into assemble_client_query: control-only commands (/clear, /cost, ...) still drop the context since it is meaningless to them, while any other command is moved to the front of the query (the CLI only recognizes a command at the start) with the context lines preserved after it, so custom skill and plugin commands receive the user's attachments. Promote claude_sessions' control-command set to a public name (adding /context) and reuse it as the single source of truth.
pjdoland
approved these changes
Jul 9, 2026
pjdoland
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. Nice fix for the context-dropping footgun. The control-command allowlist plus front-hoisting is a clean approach, and I appreciate the documented rationale and the manual verification that the context now rides through into the command arguments.
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.
Problem
The CLI query assembly kept only the last user line whenever it started with
/, silently discarding the context lines NBI had just appended for the same turn (attachment @-mentions, cell pointers, output context) — the footgun previously documented inextension.py'son_message.Change
assemble_client_query:/clear,/cost, ...) still drop the context — it is meaningless to them;claude_sessions' control-command set to a public name (CONTROL_SLASH_COMMANDS, adding/context) and reuse it as the single source of truth; the private alias remains for compatibility.Testing
/nbi-echocommand: an NBI-appended context line (current-directory pointer) thatmaindrops for a slash-command turn now rides through into the command's$ARGUMENTS, confirming the context is preserved.