You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(chat): add /compact and /compact-and slash commands (3.53.6)
Adds two user-triggered slash commands to the webview chat input:
- /compact — manually runs the same context-condensing flow used when
auto-condense fires near the context window limit.
- /compact-and <message> — condenses first, then dispatches <message>
as the next user turn once the condense response is received.
Both commands are registered as built-in slash commands so they appear
in autocomplete with descriptions (compact-and shows an argument hint).
The webview intercepts submission in handleSendMessage before posting
to the backend, so the empty content field of these built-ins is never
expanded server-side.
Implementation details:
- src/services/command/built-in-commands.ts: register compact and
compact-and entries.
- webview-ui/src/components/chat/ChatView.tsx:
- Hoist handleCondenseContext into a useCallback above
handleSendMessage so the interception can live at the top of the
send path.
- Add pendingPostCompactRef to stash the follow-up message for
/compact-and.
- Regex-match /compact and /compact-and at the top of
handleSendMessage, fire the existing condenseTaskContextRequest
message, and clear the input.
- useEffect watches isCondensing and sendingDisabled; once both fall
back to false, any stashed follow-up is dispatched through
handleSendMessage.
- src/services/command/__tests__/built-in-commands.spec.ts: bump the
expected built-in command count from 1 to 3.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments