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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(agent): the prompts and the tool descriptions stop contradicting each other (C59 A1)
purplec4371d131233
diff --git a/src/api/hermes-tool-calling.ts b/src/api/hermes-tool-calling.tsindex ccd6d3a1..f167599e 100644--- a/src/api/hermes-tool-calling.ts+++ b/src/api/hermes-tool-calling.ts@@ -87,7 +87,7 @@ export function buildHermesToolPrompt(tools: (AgentToolDef | ToolLike)[]): strinconst notes: string[] = []if (has('todo_write')) {notes.push(- 'PLAN: for a task of more than about three calls, call todo_write FIRST with the whole plan, then again after each step with the COMPLETE list (finished item completed, next one in_progress). The user sees that list while you work.',+ 'PLAN: for a task of more than about three calls, send todo_write with the whole plan TOGETHER WITH your first real tool call, and later updates together with the next real call (finished item completed, next one in_progress), never as a step of its own. The user sees that list while you work.',)}if (has('web_search') && has('web_fetch')) {diff --git a/src/api/mcp/__tests__/mobile-tool-filter.test.ts b/src/api/mcp/__tests__/mobile-tool-filter.test.tsindex 00cd8a77..180b946e 100644--- a/src/api/mcp/__tests__/mobile-tool-filter.test.ts+++ b/src/api/mcp/__tests__/mobile-tool-filter.test.ts@@ -98,7 +98,7 @@ describe('the catalog on a phone', () => {const tool = registry.getToolByName(name)!expect(tool.description, name).toMatch(/working folder/)expect(tool.description, name).not.toMatch(/absolute|home or drive/)- expect(JSON.stringify(tool.inputSchema), name).not.toMatch(/absolute preferred/)+ expect(JSON.stringify(tool.inputSchema), name).not.toMatch(/absolute preferred|relative to the workspace/)}expect(registry.getToolByName('run_workflow')!.description).not.toMatch(/Code Review/)// The roster in the prompt is rendered from these, so it is clean as well.@@ -116,7 +116,7 @@ describe('the catalog on a desktop is what it was', () => {for (const name of RETIRED_TOOL_NAMES) {expect(registry.resolveExecutable(name), name).toEqual({ name })}- expect(registry.getToolByName('file_read')!.description).toMatch(/PREFER absolute paths/)+ expect(registry.getToolByName('file_read')!.description).toMatch(/relative to the workspace/)expect(registry.getToolByName('run_workflow')!.description).toMatch(/Code Review/)})}@@ -194,10 +194,11 @@ describe('the prompt builders', () => {}// The three hashes were taken from the builders at 0448401e, the commit- // before the mobile groundwork, and are identical to today's desktop output.+ // before the mobile groundwork. The agent prompt's changed on purpose in C59+ // (A1: plain questions get a direct answer instead of "MUST use tools").it('desktop: the three prompts are byte for byte the ones from before this change', () => {standOn('windows')- expect(sha(buildAgentSystemPrompt('BASE', roster))).toBe('77aaeb9e2b171556fec07ba6e45ac202f5a5ed971ac77286ce512ba8ffb8b4db')+ expect(sha(buildAgentSystemPrompt('BASE', roster))).toBe('f7991c99c432ca58aeba38cbb340179ae0dedff4e1a47dad62cb98e1fe64e2fa')expect(sha(buildAgentSystemPromptLean('BASE', 'file_read, file_write'))).toBe('28489a4807fe126dbef27f057b0414996a7618ca58d3c822cd51f7e6796184fd')expect(sha(buildChatToolsSystemPrompt('BASE'))).toBe('926d2c3e5a07a832f89af62d849248c3e4c01baa5ae73031ca7fdf257a4dc498')expect(buildAgentSystemPrompt('', roster)).toContain('with full access to this computer')diff --git a/src/api/mcp/builtin-tools.ts b/src/api/mcp/builtin-tools.tsindex 5ea92023..b90cae03 100644--- a/src/api/mcp/builtin-tools.ts+++ b/src/api/mcp/builtin-tools.ts@@ -280,7 +280,7 @@ const BUILTIN_TOOLS: MCPToolDefinition[] = [{name: 'file_read',description:- 'Read a file. PREFER absolute paths; relative paths resolve against the agent workspace. '+ 'Read a file. Use a path relative to the workspace; an absolute path works only inside it. '+ 'Omitting offset/limit returns the whole file. For LARGE files pass offset (1-based start line) and limit '+ '(number of lines): the response names the window, the total line count and the offset of the next page. '+ 'A very long whole-file read gets its middle truncated, so page large files. '@@ -288,7 +288,7 @@ const BUILTIN_TOOLS: MCPToolDefinition[] = [inputSchema: {type: 'object',properties: {- path: { type: 'string', description: 'Path to the file (absolute preferred)' },+ path: { type: 'string', description: 'Path relative to the workspace' },offset: { type: 'number', description: '1-based line to start reading from (optional)' },limit: { type: 'number', description: 'Maximum number of lines to return (optional)' },},@@ -302,11 +302,11 @@ const BUILTIN_TOOLS: MCPToolDefinition[] = [description:'Write a WHOLE file: use it to CREATE a new file or fully replace one, and PREFER file_edit to change part of an existing one. '+ 'Creates parent directories if missing. OVERWRITES existing content, there is no append mode. '- + 'PREFER absolute paths.',+ + 'Use a path relative to the workspace.',inputSchema: {type: 'object',properties: {- path: { type: 'string', description: 'Path to the file (absolute preferred)' },+ path: { type: 'string', description: 'Path relative to the workspace' },content: { type: 'string', description: 'The complete new content of the file' },},required: ['path', 'content'],@@ -400,7 +400,7 @@ const BUILTIN_TOOLS: MCPToolDefinition[] = [type: 'object',properties: {command: { type: 'string', description: 'The full command to execute. Omit only for task actions.' },- cwd: { type: 'string', description: 'Working directory (optional, absolute preferred)' },+ cwd: { type: 'string', description: 'Working directory (optional, relative to the workspace)' },timeout: { type: 'number', description: 'Timeout in milliseconds (default: 120000)' },shell: { type: 'string', description: 'Override shell: "powershell" | "cmd" | "bash" (default: auto)' },stdin: { type: 'string', description: 'Text piped to the command\'s stdin, e.g. a Python script for `python3 -`.' },diff --git a/src/hooks/useAgentChat.ts b/src/hooks/useAgentChat.tsindex fc6304e5..a0e61f4d 100644--- a/src/hooks/useAgentChat.ts+++ b/src/hooks/useAgentChat.ts@@ -3993,7 +3993,7 @@ Creative tools, image_generate, video_generate:- Emit these as REAL tool calls through the tool channel — never write the call as plain text like image_generate(prompt="…") in your answer.Other rules:-- You MUST use tools — NEVER answer from memory or guess file contents.+- Use tools for anything about files, this computer, the web or current facts, and never guess file contents. A plain question you can answer from knowledge (an explanation, a definition, advice) gets a direct short answer without any tool call.- To CHANGE part of an existing file use file_edit (replace a UNIQUE old_string with new_string), never file_write: rewriting a large file to change three lines truncates it and costs a fortune in tokens. file_write is for creating a new file or fully replacing one.- PATHS: use paths relative to your working directory (e.g. \`package.json\`, \`src/app.ts\`, \`.\` for the current folder). Never start a path with \`/\` or a drive letter (\`C:\\\`), that escapes your workspace and fails. To list the current folder, use file_list with path \`.\`.- For filesystem READ tasks: file_list first if needed, then file_read.diff --git a/src/lib/mobile-tools.ts b/src/lib/mobile-tools.tsindex e5eb1773..f631e514 100644--- a/src/lib/mobile-tools.ts+++ b/src/lib/mobile-tools.ts@@ -86,7 +86,7 @@ export function toolDefinitionForThisDevice(tool: MCPToolDefinition): MCPToolDefif (!description) return toolconst properties = tool.inputSchema?.propertiesconst path = properties?.path- if (path && typeof path.description === 'string' && /absolute preferred/.test(path.description)) {+ if (path && typeof path.description === 'string' && /relative to the workspace|absolute preferred/.test(path.description)) {return {...tool,description,