From 32c199e4b97c2998e5cbb602020c5f80b834f763 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Thu, 20 Aug 2026 19:55:26 -0700 Subject: [PATCH] docs(native-chat): record the measured limits of the slash-token rule Measured against the real binary rather than reasoned about: - ` /clear` comes back as a stamped replay, so this lane reads an indented token as prose too. The no-trim rule was inherited from a comment about the TUIs; it is now verified for `claude -p --input-format stream-json`. - `/clear` and `/model` answer with a bare `result` and NO echo, which is the only case acceptsResult exists for. - A CUSTOM project command (`/probeit`) and a path-leading message (`/tmp what is in here?`) both DO produce a stamped replay. So shape cannot separate `/tmp` from `/clear`, and the command catalog cannot either: getVerifiedNativeChatCommands('claude') is a curated `/` menu (clear, compact, init, review, help) that omits `/model` and `/permissions`. Gating on it strands those sends - tried, and the pre-existing `/permissions` test caught it immediately. Recording the residual and why the two obvious fixes are wrong, so the next reader does not retry them. Found by the review loop on #15657. --- src/main/claude/claude-structured-dispatch.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/claude/claude-structured-dispatch.ts b/src/main/claude/claude-structured-dispatch.ts index 870efa04a4b..276561a93a8 100644 --- a/src/main/claude/claude-structured-dispatch.ts +++ b/src/main/claude/claude-structured-dispatch.ts @@ -199,8 +199,18 @@ const SLASH_COMMAND_TOKEN = /^\/[a-z0-9][\w:-]*$/i * treats any `/`-leading token as command-ish: over-classifying is safe there * (it only suppresses an echo) and unsafe here. * - * No trimming, matching that classifier's documented rule: the supported TUIs - * only treat a LINE-LEADING token as a command, so ` /clear` is prose. + * No trimming, and MEASURED rather than inherited from the TUI rule: ` /clear` + * came back from `claude -p --input-format stream-json` as a stamped replay, so + * this lane also reads an indented token as prose. + * + * Residual, unfixable by shape: `/tmp what is in here?` matches, because `/tmp` + * is indistinguishable from `/clear`. The agent's command catalog cannot close + * it either - `getVerifiedNativeChatCommands('claude')` is a curated `/` menu + * (clear, compact, init, review, help) and omits real built-ins like `/model` + * and `/permissions`, both measured as answering with a bare `result` and no + * echo; gating on it would strand those sends instead. Measured mitigation: a + * path-leading message DOES get a stamped replay, so it only mis-settles if an + * unrelated `result` beats that replay. */ function isSlashCommandText(text: string): boolean { return SLASH_COMMAND_TOKEN.test(text.split(/\s/, 1)[0] ?? '')