X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/a606686934b4028c29dca8e9dae6b2e188cee9c5..2a276c273c21a1752d541bf87e074c5d1c27e30f:/prompt.go?ds=inline diff --git a/prompt.go b/prompt.go index 694ad68..934491f 100644 --- a/prompt.go +++ b/prompt.go @@ -192,6 +192,24 @@ func prompt(name, instructionsPath, instructions string) string { return promptWithInstructions(text, promptTaskSentence, promptInstructionsClause, instructions) } +// promptChild returns the prompt of a child with its area and reporting rules. +// Its instructions file belongs to the child, not to the parent. +func promptChild(name, parent, responsibility, instructionsPath, instructions string) string { + text := prompt(name, instructionsPath, "") + text = strings.Replace(text, "You are "+name+", an AI agent that works for one user in a single chat that never\nends.", "You are "+name+", a child agent of "+parent+".", 1) + text = strings.Replace(text, promptTaskSentence, `Do the tasks of your area yourself, with your tools. +You are responsible for: `+responsibility+` +Work only in this area. Report to `+parent+` only what needs the parent or the +user: a decision, a deadline, a problem, a question you cannot settle, or a +message outside your area. Your final reply is your report to the parent. +End your turn with an empty reply when nothing needs the parent or the user. +Send nothing to WhatsApp. Draft replies in your report instead, so the parent +can ask the user before sending.`, 1) + text = strings.Replace(text, "You act again only when the user writes.", "You act again when a message or your own schedule wakes you.", 1) + + return promptWithInstructions(text, "Do the tasks of your area yourself, with your tools.", promptInstructionsClause, instructions) +} + // promptSubagent returns the system prompt of a subagent of the agent name, // with the instructions of the user at its end, as prompt does. func promptSubagent(name, instructions string) string {