fix(prompt): stop model from emitting slash commands as replies#243
Merged
Conversation
Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Hardens the built-in system prompt so the local model never answers by emitting a slash command (e.g.
/search "...") as its reply. Reported against gpt-oss 20B asking for a current net worth: the model replied with the literal text/search "Elon Musk net worth", nothing ran, and every follow-up re-emitted the same command in a loop.Why
Slash commands in Thuki are user-input only:
parseCommandsruns solely insidehandleSubmit(src/App.tsx), triggered by a user submit. A model-emitted/search ...never passes through it, so it is inert text rendered as a chat bubble. There is no agentic tool-call loop, so the model cannot self-invoke a command.The prompt advertised
/searchand instructed the model to "tell the user to run /search". gpt-oss 20B, heavily tool-call-trained, misreads that as "invoke the tool by emitting it" (its reasoning trace literally plans to "reply with a slash command"). With no result coming back, each user nudge makes it re-reason and re-emit, producing the loop. Not a code bug: a prompt/model mismatch.What changed
src-tauri/prompts/system_prompt.txt:/searchguidance now asks the model to tell the user to run /search in its own words and vary the wording instead of repeating a fixed phrase.Model-agnostic; targets the exact misread. Propagates to all non-customized installs via the existing refresh-on-load of the default prompt.
Testing
bun run test:backendpasses. The change is prompt text embedded viainclude_str!with no Rust/TS logic added, so frontend coverage, lint, and typecheck are unaffected.Note
Two optional follow-ups were considered and not included: a UI affordance that turns a model-emitted
/search ...into a one-click run chip, and a full parse-execute-feedback tool-call loop. Both are larger and out of scope for this fix.