]> git.giacomolli.uk - onechat/blobdiff - prompt.go
Manage source routes with root tools
[onechat] / prompt.go
index 6bc737da08e1c18c0d027d4b72df3bd1666bdd62..36fda3288de8778c156fc51f35e79122b1015725 100644 (file)
--- a/prompt.go
+++ b/prompt.go
@@ -149,7 +149,9 @@ Use agent_create for permanent children, whose areas are in the state.
 Use tell for children and subagents, and zoom("Name") for their memory.
 Pass area messages from mixed chats to the right child with sender, date, and
 words. Never send a WhatsApp reply drafted by a child without the user's
 Use tell for children and subagents, and zoom("Name") for their memory.
 Pass area messages from mixed chats to the right child with sender, date, and
 words. Never send a WhatsApp reply drafted by a child without the user's
-agreement.`
+agreement.
+Propose routing a source that talks only about one area to its child.
+Set or remove a route only after the user agrees.`
 
 // promptSubagentText is the system prompt of a subagent, from the subagent
 // prompt of the reference design: its head, then the doc of the view, without
 
 // promptSubagentText is the system prompt of a subagent, from the subagent
 // prompt of the reference design: its head, then the doc of the view, without
@@ -230,8 +232,8 @@ func promptSubagent(name, instructions string) string {
 
 // promptTools returns the function tools of every call of the agent: the tools
 // of promptSubagentTools, then spawn, agent_create, tell, the WhatsApp tools,
 
 // promptTools returns the function tools of every call of the agent: the tools
 // of promptSubagentTools, then spawn, agent_create, tell, the WhatsApp tools,
-// and the schedule tools. A compaction sends them too and never calls them,
-// because a change of the tools ends the shared prompt cache.
+// the route tools, and the schedule tools. A compaction sends them too and
+// never calls them, because a change of the tools ends the shared prompt cache.
 func promptTools() []ModelTool {
        return append(promptSubagentTools(), ModelTool{
                Type:        "function",
 func promptTools() []ModelTool {
        return append(promptSubagentTools(), ModelTool{
                Type:        "function",
@@ -286,6 +288,29 @@ func promptTools() []ModelTool {
                        "text": promptStringSchema("The text of the message."),
                }),
                Strict: true,
                        "text": promptStringSchema("The text of the message."),
                }),
                Strict: true,
+       }, ModelTool{
+               Type:        "function",
+               Name:        "route",
+               Description: "Route a source to your child, only after the user agrees. Use whatsapp:CHAT-ID with the ID from whatsapp_find or a [WhatsApp] message.",
+               Parameters: promptObjectSchema(map[string]any{
+                       "source": promptStringSchema("The source key, whatsapp:CHAT-ID."),
+                       "agent":  promptStringSchema("The name of your child."),
+               }),
+               Strict: true,
+       }, ModelTool{
+               Type:        "function",
+               Name:        "unroute",
+               Description: "Remove a source route, only after the user agrees. New inputs go to you.",
+               Parameters: promptObjectSchema(map[string]any{
+                       "source": promptStringSchema("The source key, whatsapp:CHAT-ID."),
+               }),
+               Strict: true,
+       }, ModelTool{
+               Type:        "function",
+               Name:        "routes",
+               Description: "List source routes to your children.",
+               Parameters:  promptObjectSchema(map[string]any{}),
+               Strict:      true,
        }, ModelTool{
                Type:        "function",
                Name:        "schedule_set",
        }, ModelTool{
                Type:        "function",
                Name:        "schedule_set",