From 4c09f71351307fd405db63d59b8ef9c0bb7957b1 Mon Sep 17 00:00:00 2001 From: JAE Date: Fri, 27 Mar 2026 04:01:21 +0000 Subject: [PATCH] fix: stronger no-tool system prompt + dev script starts tool-server --- packages/web-ui/example/package.json | 5 +-- packages/web-ui/example/src/main.ts | 47 ++++++++++++++++++---------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/packages/web-ui/example/package.json b/packages/web-ui/example/package.json index 421c1d2..5bf1557 100644 --- a/packages/web-ui/example/package.json +++ b/packages/web-ui/example/package.json @@ -4,7 +4,7 @@ "private": true, "type": "module", "scripts": { - "dev": "vite", + "dev": "concurrently \"vite\" \"node server/tool-server.mjs\"", "build": "vite build", "preview": "vite preview", "check": "tsgo --noEmit", @@ -14,7 +14,8 @@ "dev:all": "concurrently \"npm run dev\" \"npm run dev:tools\"", "dev:tools": "node server/tool-server.mjs", "docker:build": "docker build -t jae-web .", - "docker:run": "docker run -p 5173:5173 -p 7700:7700 -e OPENAI_API_KEY=$OPENAI_API_KEY jae-web" + "docker:run": "docker run -p 5173:5173 -p 7700:7700 -e OPENAI_API_KEY=$OPENAI_API_KEY jae-web", + "dev:vite": "vite" }, "dependencies": { "@jaeswift/jae-ai": "file:../../ai", diff --git a/packages/web-ui/example/src/main.ts b/packages/web-ui/example/src/main.ts index bc91a05..b892f9d 100644 --- a/packages/web-ui/example/src/main.ts +++ b/packages/web-ui/example/src/main.ts @@ -22,7 +22,14 @@ import { import { html, render } from "lit"; import { Brain, Download, History, Keyboard, Plus, Settings } from "lucide"; import "./app.css"; -import { createImageGenTool, createMemoryTools, createTTSTool, createWebSearchTool, createBashTool, createBrowserTool } from "@jaeswift/jae-web-ui"; +import { + createBashTool, + createBrowserTool, + createImageGenTool, + createMemoryTools, + createTTSTool, + createWebSearchTool, +} from "@jaeswift/jae-web-ui"; import { icon } from "@mariozechner/mini-lit"; import { Button } from "@mariozechner/mini-lit/dist/Button.js"; import { Input } from "@mariozechner/mini-lit/dist/Input.js"; @@ -308,19 +315,21 @@ const createAgent = async (initialState?: Partial) => { if (agentUnsubscribe) agentUnsubscribe(); agent = new Agent({ initialState: initialState || { - systemPrompt: `You are JAE, a friendly AI assistant and coding agent. + systemPrompt: `You are JAE, a helpful AI coding assistant. Respond in plain text by default. -IMPORTANT RULES: -- For casual conversation (greetings, questions, chat), just respond naturally in plain text. Do NOT use any tools for simple conversation. -- Only use tools when the user explicitly asks you to do something that requires them: - - Web Search: when user asks to look something up online - - Image Generation: when user asks to create/generate an image - - JavaScript REPL: when user asks to run code or create an interactive artifact - - Text-to-Speech: when user asks to read something aloud - - Memory: when user asks to remember or recall something - - Artifacts: when user asks to create a file, document, or visual output -- If the user just says "hi" or asks a question, respond conversationally WITHOUT calling any tools. -- Be concise and helpful. Do not demonstrate tools unprompted.`, +CRITICAL: Do NOT call any tools unless the user EXPLICITLY asks for something that requires a tool. Greetings, questions, casual chat, and general conversation require ZERO tools — just reply with plain text. Never create artifacts, files, or run code unless specifically requested. + +Available tools (use ONLY when explicitly requested): +- bash: Run shell commands +- browser: Browse the web +- web_search: Search the internet +- image_gen: Generate images +- javascript_repl: Run JS code or create HTML artifacts +- tts: Text to speech +- memory: Save/recall information + +DO NOT use tools for: "hi", "hello", "how are you", "what is X", "explain Y", "testing", "test", or any general question. +ONLY use tools for: "search for X", "run this code", "create a webpage", "generate an image of X", "open google.com", etc.`, model: getModel("venice", "llama-3.3-70b"), thinkingLevel: "off", messages: [], @@ -351,9 +360,15 @@ IMPORTANT RULES: createTools: async (runtimeProvidersFactory: any) => { const replTool = createJavaScriptReplTool(); replTool.runtimeProvidersFactory = runtimeProvidersFactory; - return [replTool, createWebSearchTool(), - createBashTool(), - createBrowserTool(), createImageGenTool(), createTTSTool(), ...createMemoryTools()]; + return [ + replTool, + createWebSearchTool(), + createBashTool(), + createBrowserTool(), + createImageGenTool(), + createTTSTool(), + ...createMemoryTools(), + ]; }, }); costTracker.bindAgent(agent);