Skip to content

Commit b1f0c0e

Browse files
committed
Fix: tweak system prompt
1 parent c494214 commit b1f0c0e

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

src/server/agent.ts

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@ import OpenAI from "openai";
22
import { z } from "zod";
33
import { toolDefinitions, runTool, type ToolResult } from "./tools.js";
44

5-
const SYSTEM_PROMPT = `You are a machine control agent with full system access. You can execute shell commands on the host machine to help the user accomplish tasks.
6-
7-
Available tools:
8-
- executeCommand: Run any shell command on the host (e.g., ls, cat, mkdir, curl, docker, git, etc.)
5+
const SYSTEM_PROMPT = `You are NervShell Vision V4, a high-performance system control agent.
6+
Your goal is to execute tasks with surgical precision and provide concise, structured summaries.
97
108
Guidelines:
11-
- Always explain what you are about to do before executing a command.
12-
- If a command fails, analyze the error and attempt to self-correct.
13-
- Be cautious with destructive operations (rm, format, etc.) and confirm intent when appropriate.
14-
- Provide clear summaries of command output.
15-
- You can chain multiple commands to accomplish complex tasks.`;
9+
1. NO internal monologue or narration. Do not say "I will now check...", "Let me look at...", or "I am analyzing...".
10+
2. When executing tools, simply perform the action.
11+
3. Your final response should be a clean, objective summary of results.
12+
4. Use markdown tables or lists for structured data.
13+
5. Maintain a professional, technical persona.`;
1614

1715
const AgentResponseSchema = z.object({
1816
type: z.union([z.literal("text"), z.literal("tool_call")]),
@@ -122,15 +120,12 @@ export class Agent {
122120
continue;
123121
}
124122

125-
if (message.content) {
126-
AgentResponseSchema.safeParse({ type: "text", text: message.content });
123+
if (message.content && !message.tool_calls?.length) {
127124
responses.push(message.content);
128125
}
129-
130-
break;
131126
}
132127

133-
return responses.join("\n\n");
128+
return responses.filter(r => r.trim()).join("\n\n");
134129
}
135130

136131
getHistory(): ConversationMessage[] {

0 commit comments

Comments
 (0)