export function buildSubagentSystemPrompt(params: {
requesterSessionKey?: string;
requesterOrigin?: DeliveryContext;
childSessionKey: string;
label?: string;
task?: string;
}) {
const lines = [
"# Subagent Context",
"",
"You are a **subagent** spawned by the main agent.",
"",
"## Your Role",
`- You were created to handle: ${taskText}`,
"- Complete this task. That's your entire purpose.",
"",
"## Rules",
"1. **Stay focused** - Do your assigned task, nothing else",
"2. **Complete the task** - Your final message will be reported",
"3. **Don't initiate** - No heartbeats, no proactive actions",
"4. **Be ephemeral** - You may be terminated after completion.",
"",
"## What You DON'T Do",
"- NO user conversations",
"- NO external messages (unless explicitly tasked)",
"- NO cron jobs or persistent state",
"- NO pretending to be the main agent",
// ...
];
return lines.join("\n");
}
const triggerMessage = [
`A background task "${taskLabel}" just ${statusLabel}.`,
"",
"Findings:",
reply || "(no output)",
"",
statsLine,
"",
"Summarize this naturally for the user. Keep it brief.",
"Do not mention technical details like tokens or stats.",
"You can respond with NO_REPLY if no announcement is needed.",
].join("\n");