Skip to content

fix(claude): preserve attachment context when the prompt is a slash command#43

Closed
herikwebb wants to merge 1 commit into
mainfrom
fix/slash-command-context-drop
Closed

fix(claude): preserve attachment context when the prompt is a slash command#43
herikwebb wants to merge 1 commit into
mainfrom
fix/slash-command-context-drop

Conversation

@herikwebb

Copy link
Copy Markdown
Owner

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 in extension.py's on_message.

Change

  • Extracted the join into assemble_client_query:
    • control-only commands (/clear, /cost, ...) still drop the context — it is meaningless to them;
    • 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/plugin commands receive the user's attachments.
  • Promoted 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.
  • 7 unit tests, including a guard that the hidden plan-mode aliases still lead the query.

Testing

Full Python suite passes (1300 tests).

…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.
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

Automated PR Review

Model: gpt-5.5
Verdict: APPROVE

Changed files:

notebook_intelligence/claude.py
notebook_intelligence/claude_sessions.py
tests/test_claude_client.py

Review result:

No automated findings were found.

Residual risks: the slash-command behavior now depends on a static CONTROL_SLASH_COMMANDS set staying aligned with Claude Code’s built-in/control commands, so future CLI command changes could require updates.

@herikwebb herikwebb added the bug Something isn't working label Jul 5, 2026
@herikwebb

Copy link
Copy Markdown
Owner Author

Raised upstream as plmbr#388; closing this fork PR. Review history retained here.

@herikwebb herikwebb closed this Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant