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

@@ -20,6 +20,7 @@
- Typing indicators now start only once a reply payload is produced (no "thinking" typing for silent runs).
- WhatsApp group typing now starts immediately only when the bot is mentioned; otherwise it waits until real output exists.
- Streamed `<think>` segments are stripped before partial replies are emitted.
- System prompt now tags allowlisted owner numbers as the user identity to avoid mistaken “friend” assumptions.
- Canvas defaults/A2UI auto-nav aligned; debug status overlay centered; redundant await removed in `CanvasManager`.
- Gateway launchd loop fixed by removing redundant `kickstart -k`.
- CLI now hints when Peekaboo is unauthorized.

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,