What do you want to change?
Add excludeFromContext?: boolean to CustomMessage / pi.sendMessage(), mirroring the flag that bash-execution messages already have. convertToLlm would skip flagged custom messages the same way it already skips !! bash executions.
Why?
I have a /status command that prints a status panel into the chat. Today it works by patching InteractiveMode internals, and I want it to be a plain extension command instead.
Extension commands are supposed to produce output through sendMessage(), and together with registerMessageRenderer() that gives me a persistent, custom-rendered block in chat. The problem is that every custom message is also converted into a user message for the LLM. So the status panel ends up in model context, where it is just noise.
Built-in commands like /session and /changelog can print to chat without the model seeing it. Extension commands have no way to do the same. This flag would close that gap: output persisted in the session, rendered in the TUI, skipped for LLM calls.
How? (optional)
Three small changes: the flag on CustomMessage in core/messages.ts, a skip in convertToLlm's "custom" case, and plumbing through the sendMessage signatures in core/extensions/types.ts. Same shape as #5039, which added this flag to the bash RPC command. Happy to implement it if approved.
What do you want to change?
Add
excludeFromContext?: booleantoCustomMessage/pi.sendMessage(), mirroring the flag that bash-execution messages already have.convertToLlmwould skip flagged custom messages the same way it already skips!!bash executions.Why?
I have a
/statuscommand that prints a status panel into the chat. Today it works by patching InteractiveMode internals, and I want it to be a plain extension command instead.Extension commands are supposed to produce output through
sendMessage(), and together withregisterMessageRenderer()that gives me a persistent, custom-rendered block in chat. The problem is that every custom message is also converted into a user message for the LLM. So the status panel ends up in model context, where it is just noise.Built-in commands like
/sessionand/changelogcan print to chat without the model seeing it. Extension commands have no way to do the same. This flag would close that gap: output persisted in the session, rendered in the TUI, skipped for LLM calls.How? (optional)
Three small changes: the flag on
CustomMessageincore/messages.ts, a skip inconvertToLlm's"custom"case, and plumbing through thesendMessagesignatures incore/extensions/types.ts. Same shape as #5039, which added this flag to the bash RPC command. Happy to implement it if approved.