Problem
When using the Claude Code provider, typing /clear or /new in the composer sends the command through to Claude CLI (which natively handles them), but h-code does not observe the context-clearing event and does not clear its own conversation history.
Steps to reproduce
- Start a thread with Claude Code provider
- Have a multi-turn conversation
- Type
/clear and send it
- Observe the UI still shows all prior messages
- Follow up with a new message — Claude CLI has no prior context, but h-code still renders the full history
Root cause
/clear and /new are sent to Claude CLI as regular user messages. Claude CLI clears its internal context and returns a result.
- The Claude adapter (
ClaudeAdapter.ts) treats the turn like any other — it calls completeTurn() and moves on. It does not inspect result messages for context-cleared semantics.
- h-code independently stores and displays turn history. It never learns that the provider cleared its context.
Expected behavior
Options (needs discussion):
- Client-side interception: Treat
/clear and /new like /plan / /default — intercept before sending, and create a new thread (or clear turns from the current thread).
- Server-side sync: Have the Claude adapter detect when Claude CLI clears context (via result message subtype or system message) and emit a domain event that clears stored turns.
- Both: Intercept client-side for immediate UI feedback + server-side sync as a safety net.
Area
apps/server/src/provider/Layers/ClaudeAdapter.ts — sendTurn, handleResultMessage, handleSystemMessage
apps/web/src/composer-logic.ts — parseStandaloneComposerSlashCommand
apps/web/src/components/ChatView.tsx — onSend message dispatch
Problem
When using the Claude Code provider, typing
/clearor/newin the composer sends the command through to Claude CLI (which natively handles them), but h-code does not observe the context-clearing event and does not clear its own conversation history.Steps to reproduce
/clearand send itRoot cause
/clearand/neware sent to Claude CLI as regular user messages. Claude CLI clears its internal context and returns a result.ClaudeAdapter.ts) treats the turn like any other — it callscompleteTurn()and moves on. It does not inspect result messages for context-cleared semantics.Expected behavior
Options (needs discussion):
/clearand/newlike/plan//default— intercept before sending, and create a new thread (or clear turns from the current thread).Area
apps/server/src/provider/Layers/ClaudeAdapter.ts—sendTurn,handleResultMessage,handleSystemMessageapps/web/src/composer-logic.ts—parseStandaloneComposerSlashCommandapps/web/src/components/ChatView.tsx—onSendmessage dispatch