Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

feat(agent): 10 Claude-Code-style slash commands + "/" autocomplete (David 2026-06-11)

purpled900bb7d70ee
diff --git a/src/components/chat/ChatInput.tsx b/src/components/chat/ChatInput.tsx
index 14004e08..8b7cccdd 100644
--- a/src/components/chat/ChatInput.tsx
+++ b/src/components/chat/ChatInput.tsx
@@ -1,6 +1,7 @@
import { useState, useRef, useEffect, useCallback } from 'react'
import { motion } from 'framer-motion'
-import { Send, Square, Paperclip, X, Brain } from 'lucide-react'
+import { Send, Square, Paperclip, X, Brain, Terminal } from 'lucide-react'
+import { matchAgentCommands, type AgentCommand } from '../../lib/agent-commands'
import { VoiceButton } from './VoiceButton'
import { useVoiceStore } from '../../stores/voiceStore'
import { useSettingsStore } from '../../stores/settingsStore'
@@ -37,6 +38,10 @@ export function ChatInput({ onSend, onStop, isGenerating, pendingApproval, onApp
const [images, setImages] = useState<ImageAttachment[]>([])
const [isDragOver, setIsDragOver] = useState(false)
const [isVoiceRecording, setIsVoiceRecording] = useState(false)
+ // Slash-command autocomplete (v2.5.3). When the input is a lone "/token", show
+ // the matching agent commands; ↑/↓ to move, Enter/Tab to pick, Esc to dismiss.
+ const [cmdMenu, setCmdMenu] = useState<AgentCommand[]>([])
+ const [cmdIndex, setCmdIndex] = useState(0)
const textareaRef = useRef<HTMLTextAreaElement>(null)
const fileInputRef = useRef<HTMLInputElement>(null)
// Text already in the box when dictation started. Interim + final transcripts
@@ -88,10 +93,51 @@ export function ChatInput({ onSend, onStop, isGenerating, pendingApproval, onApp
onSend(trimmed || '(image)', images.length > 0 ? images : undefined)
setInput('')
setImages([])
+ setCmdMenu([])
if (textareaRef.current) textareaRef.current.style.height = 'auto'
}
+ // Update the input + the slash-command typeahead together.
+ const updateInput = (value: string) => {
+ setInput(value)
+ const matches = matchAgentCommands(value)
+ setCmdMenu(matches)
+ setCmdIndex(0)
+ }
+
+ // Fill the input with the chosen command (trailing space so args can follow)
+ // and dismiss the menu. The user then types any args and presses Enter.
+ const pickCommand = (cmd: AgentCommand) => {
+ setInput(`/${cmd.name} `)
+ setCmdMenu([])
+ setCmdIndex(0)
+ textareaRef.current?.focus()
+ }
+
const handleKeyDown = (e: React.KeyboardEvent) => {
+ // Slash-command menu navigation takes precedence while it's open.
+ if (cmdMenu.length > 0) {
+ if (e.key === 'ArrowDown') {
+ e.preventDefault()
+ setCmdIndex((i) => (i + 1) % cmdMenu.length)
+ return
+ }
+ if (e.key === 'ArrowUp') {
+ e.preventDefault()
+ setCmdIndex((i) => (i - 1 + cmdMenu.length) % cmdMenu.length)
+ return
+ }
+ if (e.key === 'Tab' || (e.key === 'Enter' && !e.shiftKey)) {
+ e.preventDefault()
+ pickCommand(cmdMenu[cmdIndex])
+ return
+ }
+ if (e.key === 'Escape') {
+ e.preventDefault()
+ setCmdMenu([])
+ return
+ }
+ }
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault()
if (isVoiceRecording || isTranscribing) return
@@ -141,7 +187,7 @@ export function ChatInput({ onSend, onStop, isGenerating, pendingApproval, onApp
they belong to. ChatView owns the Enter/Esc keyboard layer. */}
<div
- className={`flex flex-col rounded-lg border px-2.5 py-1 transition-colors ${
+ className={`relative flex flex-col rounded-lg border px-2.5 py-1 transition-colors ${
isDragOver
? 'bg-blue-500/5 border-blue-500/30'
: 'bg-gray-50 dark:bg-white/[0.03] border-gray-200 dark:border-white/[0.06]'
@@ -150,6 +196,29 @@ export function ChatInput({ onSend, onStop, isGenerating, pendingApproval, onApp
onDragLeave={handleDragLeave}
onDrop={handleDrop}
>
+ {/* Slash-command autocomplete — floats above the composer */}
+ {cmdMenu.length > 0 && (
+ <div className="absolute bottom-full left-0 right-0 mb-1.5 z-50 max-h-64 overflow-y-auto scrollbar-thin rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-[#1f1f1f] shadow-xl py-1">
+ <div className="px-2.5 py-1 flex items-center gap-1 text-[0.5rem] uppercase tracking-widest text-gray-400 dark:text-gray-600">
+ <Terminal size={9} /> Agent commands
+ </div>
+ {cmdMenu.map((cmd, i) => (
+ <button
+ key={cmd.name}
+ onMouseDown={(e) => { e.preventDefault(); pickCommand(cmd) }}
+ onMouseEnter={() => setCmdIndex(i)}
+ className={`w-full text-left px-2.5 py-1 flex items-baseline gap-2 transition-colors ${
+ i === cmdIndex ? 'bg-gray-100 dark:bg-white/[0.07]' : 'hover:bg-gray-50 dark:hover:bg-white/[0.04]'
+ }`}
+ >
+ <span className="text-[0.72rem] font-medium text-gray-800 dark:text-gray-100 shrink-0">/{cmd.name}</span>
+ {cmd.argHint && <span className="text-[0.6rem] text-gray-400 dark:text-gray-500 shrink-0">{cmd.argHint}</span>}
+ <span className="text-[0.6rem] text-gray-500 dark:text-gray-400 truncate ml-auto">{cmd.summary}</span>
+ </button>
+ ))}
+ </div>
+ )}
+
{/* Image previews */}
{images.length > 0 && (
<div className="flex gap-1.5 mb-1.5 flex-wrap">
@@ -210,8 +279,9 @@ export function ChatInput({ onSend, onStop, isGenerating, pendingApproval, onApp
<textarea
ref={textareaRef}
value={input}
- onChange={(e) => setInput(e.target.value)}
+ onChange={(e) => updateInput(e.target.value)}
onKeyDown={handleKeyDown}
+ onBlur={() => setTimeout(() => setCmdMenu([]), 120)}
onPaste={handlePaste}
placeholder={disabled ? "Unavailable" : isDragOver ? "Drop images here..." : isTranscribing ? "Transcribing..." : isVoiceRecording ? "Recording..." : "Message..."}
disabled={disabled}
diff --git a/src/components/chat/MessageBubble.tsx b/src/components/chat/MessageBubble.tsx
index c3418caa..a9294437 100644
--- a/src/components/chat/MessageBubble.tsx
+++ b/src/components/chat/MessageBubble.tsx
@@ -90,7 +90,8 @@ export function MessageBubble({ message, onRegenerate, onEdit, pendingApprovalId
}
const startEdit = () => {
- setEditContent(message.content)
+ // Edit the short slash command, not its expanded instruction.
+ setEditContent(message.displayContent || message.content)
setIsEditing(true)
}
@@ -242,7 +243,9 @@ export function MessageBubble({ message, onRegenerate, onEdit, pendingApprovalId
</div>
</div>
) : isUser ? (
- <p className="text-[0.78rem] leading-relaxed text-gray-800 dark:text-gray-200 whitespace-pre-wrap">{message.content}</p>
+ // Slash command: show the short "/commit" (displayContent), not the
+ // long expanded instruction held in content (which drives the model).
+ <p className="text-[0.78rem] leading-relaxed text-gray-800 dark:text-gray-200 whitespace-pre-wrap">{message.displayContent || message.content}</p>
) : (
// Answer-blocks (when present) already rendered the per-iteration
// text chronologically above; skip message.content here to avoid
diff --git a/src/hooks/useAgentChat.ts b/src/hooks/useAgentChat.ts
index a8b2ca8f..1eaf7365 100644
--- a/src/hooks/useAgentChat.ts
+++ b/src/hooks/useAgentChat.ts
@@ -163,7 +163,9 @@ export function useAgentChat() {
// here with a CURATED allow-list (the 5 chat tools) + a chat-style prompt,
// so web/file/image/video work without flipping to full Agent mode. When
// unset, this is the normal autonomous-agent path (full tool catalog).
- opts?: { curatedTools?: readonly string[]; chatToolsMode?: boolean },
+ // displayContent: a slash command shows the raw "/commit" the user typed
+ // while `userContent` carries the expanded instruction the model receives.
+ opts?: { curatedTools?: readonly string[]; chatToolsMode?: boolean; displayContent?: string },
) => {
const { activeModel } = useModelStore.getState()
const { settings } = useSettingsStore.getState()
@@ -309,6 +311,8 @@ export function useAgentChat() {
id: uuid(),
role: 'user' as const,
content: userContent,
+ // Slash command: show "/commit" to the user, keep the expansion in content.
+ ...(opts?.displayContent ? { displayContent: opts.displayContent } : {}),
images: userImages,
timestamp: Date.now(),
}
diff --git a/src/hooks/useChat.ts b/src/hooks/useChat.ts
index 3593750b..b5fd7b47 100644
--- a/src/hooks/useChat.ts
+++ b/src/hooks/useChat.ts
@@ -13,6 +13,7 @@ import { useAgentChat } from "./useAgentChat"
import { useMemory } from "./useMemory"
import { useAgentModeStore } from "../stores/agentModeStore"
import { detectChatToolIntent, CHAT_TOOLS } from "../lib/chat-tool-intent"
+import { parseAgentCommand } from "../lib/agent-commands"
import { getProviderForModel, getProviderIdFromModel } from "../api/providers"
import { syncOllamaHealthFromError } from "../lib/sync-ollama-health"
import { isThinkingCompatible, isPlainTextPlanner } from "../lib/model-compatibility"
@@ -41,6 +42,22 @@ export function useChat() {
const store = useChatStore.getState()
const persona = useSettingsStore.getState().getActivePersona()
+ // Agent slash commands (David 2026-06-11): "/review", "/commit", "/test",
+ // … are shorthand for an AGENT task. Expand the template, enable agent mode
+ // for this conversation (so the run has the full tool catalog + the agent
+ // UI), and hand the expanded instruction to the agent executor. The raw
+ // "/cmd args" the user typed is shown as their message; the expansion drives
+ // the model. Unknown "/foo" returns null and falls through to normal chat.
+ if (activeModel) {
+ const slash = parseAgentCommand(content)
+ if (slash) {
+ let convId = store.activeConversationId
+ if (!convId) convId = store.createConversation(activeModel, persona?.systemPrompt || "")
+ useAgentModeStore.getState().setAgentModeActive(convId, true)
+ return agentChat.sendAgentMessage(slash.expanded, images, { displayContent: content })
+ }
+ }
+
// Agent mode delegation: if active for this conversation, use agent chat
if (store.activeConversationId && useAgentModeStore.getState().isActive(store.activeConversationId)) {
return agentChat.sendAgentMessage(content, images)
diff --git a/src/lib/__tests__/agent-commands.test.ts b/src/lib/__tests__/agent-commands.test.ts
new file mode 100644
index 00000000..5d28a320
--- /dev/null
+++ b/src/lib/__tests__/agent-commands.test.ts
@@ -0,0 +1,100 @@
+import { describe, it, expect } from 'vitest'
+import {
+ AGENT_COMMANDS,
+ parseAgentCommand,
+ matchAgentCommands,
+} from '../agent-commands'
+
+describe('AGENT_COMMANDS registry', () => {
+ it('ships exactly the 10 named commands', () => {
+ expect(AGENT_COMMANDS.map((c) => c.name).sort()).toEqual(
+ ['commit', 'docs', 'explain', 'fix', 'init', 'optimize', 'refactor', 'review', 'security', 'test'].sort(),
+ )
+ })
+
+ it('every command has a summary and a non-empty expansion', () => {
+ for (const c of AGENT_COMMANDS) {
+ expect(c.summary.length).toBeGreaterThan(5)
+ expect(c.build('').length).toBeGreaterThan(40)
+ expect(c.build('src/app.ts').length).toBeGreaterThan(40)
+ }
+ })
+
+ it('command names are unique', () => {
+ const names = AGENT_COMMANDS.map((c) => c.name)
+ expect(new Set(names).size).toBe(names.length)
+ })
+
+ it('read-only commands never instruct file_write in their template', () => {
+ for (const c of AGENT_COMMANDS.filter((c) => c.readOnly)) {
+ expect(c.build('x').toLowerCase()).toContain('read-only')
+ expect(c.build('x')).not.toMatch(/\bfile_write\b/)
+ }
+ })
+})
+
+describe('parseAgentCommand', () => {
+ it('parses a bare command', () => {
+ const r = parseAgentCommand('/init')
+ expect(r?.command.name).toBe('init')
+ expect(r?.args).toBe('')
+ expect(r?.expanded).toContain('AGENTS.md')
+ })
+
+ it('parses a command with args and threads them into the expansion', () => {
+ const r = parseAgentCommand('/explain src/hooks/useChat.ts')
+ expect(r?.command.name).toBe('explain')
+ expect(r?.args).toBe('src/hooks/useChat.ts')
+ expect(r?.expanded).toContain('src/hooks/useChat.ts')
+ })
+
+ it('is case-insensitive on the command name', () => {
+ expect(parseAgentCommand('/REVIEW changes')?.command.name).toBe('review')
+ })
+
+ it('handles multi-line / quoted args', () => {
+ const r = parseAgentCommand('/fix TypeError: cannot read "x" of undefined\nat foo.ts:10')
+ expect(r?.command.name).toBe('fix')
+ expect(r?.expanded).toContain('TypeError')
+ })
+
+ it('returns null for unknown commands so they fall through to chat', () => {
+ expect(parseAgentCommand('/notacommand do thing')).toBeNull()
+ expect(parseAgentCommand('/')).toBeNull()
+ })
+
+ it('returns null for normal text and for a slash mid-sentence', () => {
+ expect(parseAgentCommand('hello there')).toBeNull()
+ expect(parseAgentCommand('what is 1/2 of 8')).toBeNull()
+ expect(parseAgentCommand('please run the /review later')).toBeNull()
+ })
+
+ it('commit template forbids pushing', () => {
+ expect(parseAgentCommand('/commit')?.expanded.toLowerCase()).toContain('do not push')
+ })
+})
+
+describe('matchAgentCommands (autocomplete)', () => {
+ it('returns all commands for a lone slash', () => {
+ expect(matchAgentCommands('/').length).toBe(10)
+ })
+
+ it('prefix-filters by name', () => {
+ expect(matchAgentCommands('/re').map((c) => c.name).sort()).toEqual(['refactor', 'review'])
+ expect(matchAgentCommands('/sec').map((c) => c.name)).toEqual(['security'])
+ })
+
+ it('returns [] once the user has typed a space (now typing args, not picking)', () => {
+ expect(matchAgentCommands('/review ')).toEqual([])
+ expect(matchAgentCommands('/review changes')).toEqual([])
+ })
+
+ it('returns [] for a non-slash input', () => {
+ expect(matchAgentCommands('review')).toEqual([])
+ expect(matchAgentCommands('')).toEqual([])
+ })
+
+ it('returns [] for an unmatched prefix', () => {
+ expect(matchAgentCommands('/zzz')).toEqual([])
+ })
+})
diff --git a/src/lib/agent-commands.ts b/src/lib/agent-commands.ts
new file mode 100644
index 00000000..a26b6af3
--- /dev/null
+++ b/src/lib/agent-commands.ts
@@ -0,0 +1,159 @@
+/**
+ * Agent slash commands (v2.5.3, David 2026-06-11: "10 funktionelle slash
+ * commands für den agent mode, guck dir die besten von claude code ab").
+ *
+ * Each command is a high-quality prompt template modeled on Claude Code's most
+ * popular commands (/review, /commit, /test, /fix, /explain, /refactor, /docs,
+ * /security, /optimize, /init). A slash command is shorthand for an AGENT task:
+ * the chat hook expands it to the full instruction below, enables agent mode
+ * for that conversation, and runs it through the normal agent executor (full
+ * tool catalog — file_*, shell_execute, web_*, …). So the templates are written
+ * for an agent that ACTS via tools, not one that describes.
+ *
+ * Pure data + pure functions here — no React, no side effects — so it unit-tests
+ * cleanly and the ChatInput autocomplete + the useChat router share one source.
+ */
+
+export interface AgentCommand {
+ /** Command word without the leading slash, e.g. "review". */
+ name: string
+ /** One-line summary shown in the autocomplete dropdown. */
+ summary: string
+ /** Argument hint shown after the name, e.g. "[file | \"changes\"]". */
+ argHint?: string
+ /** True when the command is read-only (no file/shell mutations). */
+ readOnly?: boolean
+ /** Expand to the full agent instruction. `args` is the trimmed text after the command. */
+ build: (args: string) => string
+}
+
+/** Shared closing line so every command nudges the agent to act, not narrate. */
+const ACT = 'Use your tools to do this for real — do not just describe the steps. Be concise in text; the work happens in tool calls. Reply in the user\'s language.'
+
+export const AGENT_COMMANDS: AgentCommand[] = [
+ {
+ name: 'review',
+ summary: 'Review code for bugs, security and style',
+ argHint: '[file | "changes"]',
+ readOnly: true,
+ build: (a) => {
+ const target = a.trim() || 'the current uncommitted changes (use shell_execute "git diff" / "git status"; if not a git repo, review the most relevant source files)'
+ return `Do a focused code review of ${target}. Read the actual code with file_read / file_list first — never review from memory. Report findings grouped by severity (Critical / Major / Minor), each with the file:line, what's wrong, and a concrete fix. Cover correctness/bugs, security, error handling, and clarity. This is a READ-ONLY review — do not modify files. End with a one-line verdict. ${ACT}`
+ },
+ },
+ {
+ name: 'commit',
+ summary: 'Stage changes and write a clean git commit',
+ argHint: '[message hint]',
+ build: (a) => {
+ const hint = a.trim() ? `\nThe user suggests this focus for the message: "${a.trim()}".` : ''
+ return `Create a git commit for the current changes. Steps, each as a real tool call: 1) "git status" and "git diff" to see what changed. 2) Group the changes and stage the right files ("git add"). 3) Write a clear Conventional-Commits message (type(scope): summary, then a short body explaining WHY). 4) Commit. 5) Show the resulting "git log -1 --stat".${hint} Do NOT push. If this is not a git repository, say so and stop. ${ACT}`
+ },
+ },
+ {
+ name: 'test',
+ summary: 'Find, run and report the project tests',
+ argHint: '[file | pattern]',
+ build: (a) => {
+ const scope = a.trim() ? `Focus on tests matching "${a.trim()}".` : 'Run the most relevant test suite.'
+ return `Run the project's tests and report the result. 1) Detect the test runner (look for package.json scripts, pytest, cargo test, go test, etc. via file_read / file_list). 2) ${scope} Run it with shell_execute. 3) Summarize pass/fail counts and quote the first few real failures with their file:line. 4) If a failure has an obvious, low-risk fix, apply it and re-run to confirm; otherwise just report it. ${ACT}`
+ },
+ },
+ {
+ name: 'fix',
+ summary: 'Diagnose and fix a bug or failing test end-to-end',
+ argHint: '<error text | file>',
+ build: (a) => {
+ const what = a.trim() || 'the failing test or error in the current project (run the tests / build to surface it first)'
+ return `Diagnose and fix: ${what}. 1) Reproduce — run the test/build/command that fails and read the real error. 2) Locate the root cause with file_search / file_read (fix the cause, not the symptom). 3) Apply the minimal correct fix with file_write. 4) Re-run to prove it's fixed. 5) Briefly state the root cause and the fix. ${ACT}`
+ },
+ },
+ {
+ name: 'explain',
+ summary: 'Explain how a file, function or the codebase works',
+ argHint: '<file | function | topic>',
+ readOnly: true,
+ build: (a) => {
+ const what = a.trim() || 'this project: scan the structure with file_list and read the entry points'
+ return `Explain ${what}. Read the actual code first (file_read / file_list / file_search) — do not guess. Give: a one-paragraph overview, then the key pieces (what each does and how they connect), the important data flow or control flow, and any non-obvious gotchas. Use short concrete references like file:line. This is read-only — do not modify anything. ${ACT}`
+ },
+ },
+ {
+ name: 'refactor',
+ summary: 'Refactor code for clarity without changing behavior',
+ argHint: '<file | function>',
+ build: (a) => {
+ const what = a.trim() || 'the file the user is focused on (ask which if it is unclear)'
+ return `Refactor ${what} to improve readability and structure WITHOUT changing its observable behavior. 1) Read it fully first. 2) Make the change with file_write — improve names, remove duplication, simplify control flow, tighten types; keep the public API identical. 3) If tests exist, run them to prove behavior is unchanged. 4) Summarize what you changed and why. Do not mix in unrelated changes. ${ACT}`
+ },
+ },
+ {
+ name: 'docs',
+ summary: 'Generate or update documentation',
+ argHint: '[file | "readme"]',
+ build: (a) => {
+ const target = a.trim()
+ ? `documentation for "${a.trim()}"`
+ : 'the project README (create or update README.md)'
+ return `Write or update ${target}. Read the real code first so the docs are accurate. For a README: a clear title + one-line description, install/setup, usage with a runnable example, and key features — match the project's actual stack. For a file/module: concise doc-comments on the public functions. Write the file(s) with file_write. Keep it accurate and skimmable, no filler. ${ACT}`
+ },
+ },
+ {
+ name: 'security',
+ summary: 'Security audit — find vulnerabilities by severity',
+ argHint: '[file | "."]',
+ readOnly: true,
+ build: (a) => {
+ const scope = a.trim() || 'the project (scan the most security-relevant files: auth, input handling, file/network/shell access, secrets, dependencies)'
+ return `Do a security audit of ${scope}. Read the real code with file_read / file_search. Look for: injection (SQL/command/path), unsafe input handling, auth/authorization gaps, SSRF, secrets committed in code, unsafe deserialization, and risky dependencies. Report each finding with severity (Critical/High/Medium/Low), the file:line, why it's exploitable, and the fix. READ-ONLY — do not modify files. If you find nothing serious, say so honestly. ${ACT}`
+ },
+ },
+ {
+ name: 'optimize',
+ summary: 'Find and apply performance improvements',
+ argHint: '<file | function>',
+ build: (a) => {
+ const what = a.trim() || 'the hottest path in the current project (identify it first by reading the code)'
+ return `Optimize the performance of ${what}. 1) Read it and identify the real bottleneck (algorithmic complexity, redundant work, N+1 calls, unnecessary allocations, blocking I/O) — measure with a quick benchmark via shell_execute if feasible. 2) Apply the highest-impact change with file_write, preserving behavior. 3) Verify correctness (run tests if present) and, if you benchmarked, report before/after. Don't micro-optimize cold paths. ${ACT}`
+ },
+ },
+ {
+ name: 'init',
+ summary: 'Scan the project and write an AGENTS.md overview',
+ argHint: '',
+ build: () =>
+ `Analyze this project and write an AGENTS.md at its root that helps an AI agent work here effectively. 1) Explore the structure with file_list and read the key config + entry-point files. 2) Write AGENTS.md with file_write containing: project purpose (one paragraph), the tech stack, how to build / run / test (the real commands), the directory layout (what lives where), and any important conventions or gotchas you observed. Keep it factual and based on what you actually read — no guessing. If an AGENTS.md already exists, update it. ${ACT}`,
+ },
+]
+
+const BY_NAME = new Map(AGENT_COMMANDS.map((c) => [c.name, c]))
+
+/**
+ * Parse a chat input into a slash command + expanded agent prompt, or null if
+ * it isn't a known command. Matches only `/<name>` at the very start (optionally
+ * followed by args). `/notacommand` and a bare `/` return null so they fall
+ * through to normal chat. The leading slash and name are case-insensitive.
+ */
+export function parseAgentCommand(
+ input: string,
+): { command: AgentCommand; args: string; expanded: string } | null {
+ const m = /^\/([a-z][a-z0-9_-]*)(?:\s+([\s\S]*))?$/i.exec(input.trim())
+ if (!m) return null
+ const command = BY_NAME.get(m[1].toLowerCase())
+ if (!command) return null
+ const args = (m[2] ?? '').trim()
+ return { command, args, expanded: command.build(args) }
+}
+
+/**
+ * Autocomplete: given what the user has typed after a leading `/`, return the
+ * matching commands (prefix match on the name, case-insensitive). An empty
+ * prefix returns all of them. Returns [] when the text isn't a lone slash token
+ * (e.g. there's already a space → the user is typing args, not picking).
+ */
+export function matchAgentCommands(input: string): AgentCommand[] {
+ const m = /^\/([a-z0-9_-]*)$/i.exec(input)
+ if (!m) return []
+ const prefix = m[1].toLowerCase()
+ return AGENT_COMMANDS.filter((c) => c.name.startsWith(prefix))
+}
diff --git a/src/types/chat.ts b/src/types/chat.ts
index 8235e6ee..2112668b 100644
--- a/src/types/chat.ts
+++ b/src/types/chat.ts
@@ -12,6 +12,11 @@ export interface Message {
id: string
role: Role
content: string
+ /** When set, the UI renders THIS instead of `content` for a user message.
+ * Agent slash commands (v2.5.3): the user sees the short "/commit" they
+ * typed, while `content` holds the full expanded instruction the model
+ * actually receives. Display-only — never sent to the model. */
+ displayContent?: string
thinking?: string
timestamp: number
images?: ImageAttachment[]