fix: stronger no-tool system prompt + dev script starts tool-server
Some checks are pending
CI / build-check-test (push) Waiting to run

This commit is contained in:
JAE 2026-03-27 04:01:21 +00:00
parent 0caab5381c
commit 4c09f71351
2 changed files with 34 additions and 18 deletions

View file

@ -4,7 +4,7 @@
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "concurrently \"vite\" \"node server/tool-server.mjs\"",
"build": "vite build", "build": "vite build",
"preview": "vite preview", "preview": "vite preview",
"check": "tsgo --noEmit", "check": "tsgo --noEmit",
@ -14,7 +14,8 @@
"dev:all": "concurrently \"npm run dev\" \"npm run dev:tools\"", "dev:all": "concurrently \"npm run dev\" \"npm run dev:tools\"",
"dev:tools": "node server/tool-server.mjs", "dev:tools": "node server/tool-server.mjs",
"docker:build": "docker build -t jae-web .", "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": { "dependencies": {
"@jaeswift/jae-ai": "file:../../ai", "@jaeswift/jae-ai": "file:../../ai",

View file

@ -22,7 +22,14 @@ import {
import { html, render } from "lit"; import { html, render } from "lit";
import { Brain, Download, History, Keyboard, Plus, Settings } from "lucide"; import { Brain, Download, History, Keyboard, Plus, Settings } from "lucide";
import "./app.css"; 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 { icon } from "@mariozechner/mini-lit";
import { Button } from "@mariozechner/mini-lit/dist/Button.js"; import { Button } from "@mariozechner/mini-lit/dist/Button.js";
import { Input } from "@mariozechner/mini-lit/dist/Input.js"; import { Input } from "@mariozechner/mini-lit/dist/Input.js";
@ -308,19 +315,21 @@ const createAgent = async (initialState?: Partial<AgentState>) => {
if (agentUnsubscribe) agentUnsubscribe(); if (agentUnsubscribe) agentUnsubscribe();
agent = new Agent({ agent = new Agent({
initialState: initialState || { 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: 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.
- 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: Available tools (use ONLY when explicitly requested):
- Web Search: when user asks to look something up online - bash: Run shell commands
- Image Generation: when user asks to create/generate an image - browser: Browse the web
- JavaScript REPL: when user asks to run code or create an interactive artifact - web_search: Search the internet
- Text-to-Speech: when user asks to read something aloud - image_gen: Generate images
- Memory: when user asks to remember or recall something - javascript_repl: Run JS code or create HTML artifacts
- Artifacts: when user asks to create a file, document, or visual output - tts: Text to speech
- If the user just says "hi" or asks a question, respond conversationally WITHOUT calling any tools. - memory: Save/recall information
- Be concise and helpful. Do not demonstrate tools unprompted.`,
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"), model: getModel("venice", "llama-3.3-70b"),
thinkingLevel: "off", thinkingLevel: "off",
messages: [], messages: [],
@ -351,9 +360,15 @@ IMPORTANT RULES:
createTools: async (runtimeProvidersFactory: any) => { createTools: async (runtimeProvidersFactory: any) => {
const replTool = createJavaScriptReplTool(); const replTool = createJavaScriptReplTool();
replTool.runtimeProvidersFactory = runtimeProvidersFactory; replTool.runtimeProvidersFactory = runtimeProvidersFactory;
return [replTool, createWebSearchTool(), return [
createBashTool(), replTool,
createBrowserTool(), createImageGenTool(), createTTSTool(), ...createMemoryTools()]; createWebSearchTool(),
createBashTool(),
createBrowserTool(),
createImageGenTool(),
createTTSTool(),
...createMemoryTools(),
];
}, },
}); });
costTracker.bindAgent(agent); costTracker.bindAgent(agent);