chore: include runtime info in system prompt
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
import type { ThinkLevel, VerboseLevel } from "../auto-reply/thinking.js";
|
||||
import { formatToolAggregate } from "../auto-reply/tool-meta.js";
|
||||
import type { ClawdisConfig } from "../config/config.js";
|
||||
import { getMachineDisplayName } from "../infra/machine-name.js";
|
||||
import { splitMediaFromOutput } from "../media/parse.js";
|
||||
import { enqueueCommand } from "../process/command-queue.js";
|
||||
import { CONFIG_DIR, resolveUserPath } from "../utils.js";
|
||||
@@ -323,11 +324,20 @@ export async function runEmbeddedPiAgent(params: {
|
||||
const contextFiles = buildBootstrapContextFiles(bootstrapFiles);
|
||||
const promptSkills = resolvePromptSkills(skillsSnapshot, skillEntries);
|
||||
const tools = createClawdisCodingTools();
|
||||
const machineName = await getMachineDisplayName();
|
||||
const runtimeInfo = {
|
||||
host: machineName,
|
||||
os: `${os.type()} ${os.release()}`,
|
||||
arch: os.arch(),
|
||||
node: process.version,
|
||||
model: `${provider}/${modelId}`,
|
||||
};
|
||||
const systemPrompt = buildSystemPrompt({
|
||||
appendPrompt: buildAgentSystemPromptAppend({
|
||||
workspaceDir: resolvedWorkspace,
|
||||
defaultThinkLevel: params.thinkLevel,
|
||||
extraSystemPrompt: params.extraSystemPrompt,
|
||||
runtimeInfo,
|
||||
}),
|
||||
contextFiles,
|
||||
skills: promptSkills,
|
||||
|
||||
@@ -4,6 +4,13 @@ export function buildAgentSystemPromptAppend(params: {
|
||||
workspaceDir: string;
|
||||
defaultThinkLevel?: ThinkLevel;
|
||||
extraSystemPrompt?: string;
|
||||
runtimeInfo?: {
|
||||
host?: string;
|
||||
os?: string;
|
||||
arch?: string;
|
||||
node?: string;
|
||||
model?: string;
|
||||
};
|
||||
}) {
|
||||
const thinkHint =
|
||||
params.defaultThinkLevel && params.defaultThinkLevel !== "off"
|
||||
@@ -11,6 +18,17 @@ export function buildAgentSystemPromptAppend(params: {
|
||||
: "Default thinking level: off.";
|
||||
|
||||
const extraSystemPrompt = params.extraSystemPrompt?.trim();
|
||||
const runtimeInfo = params.runtimeInfo;
|
||||
const runtimeLines: string[] = [];
|
||||
if (runtimeInfo?.host) runtimeLines.push(`Host: ${runtimeInfo.host}`);
|
||||
if (runtimeInfo?.os) {
|
||||
const archSuffix = runtimeInfo.arch ? ` (${runtimeInfo.arch})` : "";
|
||||
runtimeLines.push(`OS: ${runtimeInfo.os}${archSuffix}`);
|
||||
} else if (runtimeInfo?.arch) {
|
||||
runtimeLines.push(`Arch: ${runtimeInfo.arch}`);
|
||||
}
|
||||
if (runtimeInfo?.node) runtimeLines.push(`Node: ${runtimeInfo.node}`);
|
||||
if (runtimeInfo?.model) runtimeLines.push(`Model: ${runtimeInfo.model}`);
|
||||
|
||||
const lines = [
|
||||
"You are Clawd, a personal assistant running inside Clawdis.",
|
||||
@@ -51,6 +69,7 @@ export function buildAgentSystemPromptAppend(params: {
|
||||
'If something needs attention, do NOT include "HEARTBEAT_OK"; reply with the alert text instead.',
|
||||
"",
|
||||
"## Runtime",
|
||||
...runtimeLines,
|
||||
thinkHint,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user