fix: tag owner numbers in system prompt

This commit is contained in:
Peter Steinberger
2025-12-23 14:19:41 +00:00
parent df5284beaf
commit f667d56701
4 changed files with 15 additions and 0 deletions

View File

@@ -269,6 +269,7 @@ export async function runEmbeddedPiAgent(params: {
}) => void;
enqueue?: typeof enqueueCommand;
extraSystemPrompt?: string;
ownerNumbers?: string[];
}): Promise<EmbeddedPiRunResult> {
const enqueue = params.enqueue ?? enqueueCommand;
return enqueue(async () => {
@@ -337,6 +338,7 @@ export async function runEmbeddedPiAgent(params: {
workspaceDir: resolvedWorkspace,
defaultThinkLevel: params.thinkLevel,
extraSystemPrompt: params.extraSystemPrompt,
ownerNumbers: params.ownerNumbers,
runtimeInfo,
}),
contextFiles,

View File

@@ -4,6 +4,7 @@ export function buildAgentSystemPromptAppend(params: {
workspaceDir: string;
defaultThinkLevel?: ThinkLevel;
extraSystemPrompt?: string;
ownerNumbers?: string[];
runtimeInfo?: {
host?: string;
os?: string;
@@ -18,6 +19,13 @@ export function buildAgentSystemPromptAppend(params: {
: "Default thinking level: off.";
const extraSystemPrompt = params.extraSystemPrompt?.trim();
const ownerNumbers = (params.ownerNumbers ?? [])
.map((value) => value.trim())
.filter(Boolean);
const ownerLine =
ownerNumbers.length > 0
? `Owner numbers: ${ownerNumbers.join(", ")}. Treat messages from these numbers as the user (Peter).`
: undefined;
const runtimeInfo = params.runtimeInfo;
const runtimeLines: string[] = [];
if (runtimeInfo?.host) runtimeLines.push(`Host: ${runtimeInfo.host}`);
@@ -49,6 +57,9 @@ export function buildAgentSystemPromptAppend(params: {
`Your working directory is: ${params.workspaceDir}`,
"Treat this directory as the single global workspace for file operations unless explicitly instructed otherwise.",
"",
ownerLine ? "## User Identity" : "",
ownerLine ?? "",
ownerLine ? "" : "",
"## Workspace Files (injected)",
"These user-editable files are loaded by Clawdis and included below in Project Context.",
"",

View File

@@ -885,6 +885,7 @@ export async function getReplyFromConfig(
skillsSnapshot,
prompt: commandBody,
extraSystemPrompt: groupIntro || undefined,
ownerNumbers: ownerList.length > 0 ? ownerList : undefined,
provider,
model,
thinkLevel: resolvedThinkLevel,