package bot import ( _ "embed" "strings" ) // Eleven — the app's built-in guide identity. Its persona + reference are // code-shipped (like the Node sidecar's eleven.mjs), so every deploy updates // its knowledge; the runtime marks the system prompt cacheable so the large // reference is served from the prompt cache, not re-billed per message. // // A bot self-identifies as Eleven by its session NAME (the "Eleven" identity is // provisioned with that name). Console config (/api/bot-config) still overrides // per instance — this is only the code-shipped fallback (see loadConfig). const elevenName = "Eleven" // elevenPersona mirrors agent/eleven.mjs ELEVEN_PERSONA verbatim (a Go test // pins the two identical, so they can't drift). const elevenPersona = "You are the app's friendly guide. The app is called Eleven — yes, you share its name; own the joke " + "if it comes up. Help people get the most out of it: answer questions about " + "how the app works, suggest features they might not know, and keep answers concrete and step-by-step. " + "You can DO some things for people via one-tap buttons: when someone asks to change the theme, switch " + "light/dark mode, browse themes, or edit their profile, call the matching tool — it attaches a button " + "they tap to apply (nothing happens without their tap, and only on their own device). Keep the " + "accompanying text short, like: 'Here you go — tap to switch.' " + "You're not only an AI — you're also a bot: the very same actions are available as instant slash " + "commands (like /dark or /theme lagoon) that work even when AI features are switched off. When it's " + "natural, mention the quick command alongside the button so people learn the shortcut. " + "If someone asks something unrelated to the app, you can chat — but gently note that Claude (the other " + "helper) is the better companion for general questions." // appKnowledge is Eleven's exhaustive reference, embedded from the SAME file // agent/knowledge.mjs reads (internal/bot/knowledge.md) — one source of truth, // so the Go and Node sidecars can never drift. OPEN knowledge only: no secrets. // //go:embed knowledge.md var appKnowledge string // elevenDocs is the reference block: the knowledge base plus the LIVE slash-command // list (so the two never drift from the shared command floor). Mirrors // agent/eleven.mjs ELEVEN_DOCS. func elevenDocs() string { return strings.TrimRight(appKnowledge, "\n") + "\n\n" + "Slash commands you can run yourself — they work instantly, even when conversational AI is off, so " + "point people at the one that fits:\n" + commandSummary() } // commandSummary is a bullet list of the command floor — shared shape with the // Node commandSummary() so Eleven's reference and the commands it answers can't // drift. func commandSummary() string { var b strings.Builder for i, c := range botCommands { if i > 0 { b.WriteString("\n") } b.WriteString("• " + c.Name + " — " + c.Help) } return b.String() } // builtinPersona / builtinDocs return the code-shipped fallback for a named // default identity, or "" for a generic bot. Console config wins over these // (loadConfig), matching the Node runtime's precedence. func builtinPersona(name string) string { if name == elevenName { return elevenPersona } return "" } func builtinDocs(name string) string { if name == elevenName { return elevenDocs() } return "" }