a tool to help your Letta AI agents navigate bluesky
at main 4.4 kB view raw
1import { Notification } from "../utils/types.ts"; 2import { doesUserFollowTarget } from "../utils/doesUserFollow.ts"; 3import { agentContext } from "../utils/agentContext.ts"; 4import { getCleanThread } from "../utils/getCleanThread.ts"; 5 6export const likePrompt = async (notification: Notification) => { 7 const isUserFollower = await doesUserFollowTarget( 8 notification.author.did, 9 agentContext.agentBskyDID, 10 ); 11 12 const notifierHandle = `@${notification.author.handle}`; 13 14 const isUserFollowerString = isUserFollower === true 15 ? `${notifierHandle} FOLLOWS YOU` 16 : isUserFollower === false 17 ? `${notifierHandle} DOES NOT FOLLOW YOU` 18 : ""; 19 20 const doYouFollow = await doesUserFollowTarget( 21 agentContext.agentBskyDID, 22 notification.author.did, 23 ); 24 25 const doYouFollowString = doYouFollow === true 26 ? `YOU FOLLOW ${notifierHandle}.` 27 : doYouFollow === false 28 ? `YOU DO NOT FOLLOW ${notifierHandle}` 29 : ""; 30 31 const thread = notification.reasonSubject 32 ? await getCleanThread(notification.reasonSubject) 33 : [{ 34 // @TODO: find a better way to handle this 35 authorHandle: undefined, 36 message: "ERROR: could not get thread", 37 uri: undefined, 38 authorDID: undefined, 39 postedDateTime: undefined, 40 bookmarks: undefined, 41 replies: undefined, 42 reposts: undefined, 43 likes: undefined, 44 quotes: undefined, 45 }]; 46 47 return ` 48# NOTIFICATION: Someone liked your post 49 50## Context 51• **Liked by:** @${notification.author.handle} 52• **Liker DID:** ${notification.author.did} 53• **Post URI:** ${notification.reasonSubject} 54• **Timestamp:** ${notification.record.createdAt} 55 56${isUserFollowerString} 57${doYouFollowString} 58 59${ 60 thread 61 ? ` 62## your post that was liked by @${notification.author.handle} 63\`\`\` 64${thread[thread.length - 1].message} 65\`\`\` 66` 67 : "" 68 } 69 70${ 71 thread 72 ? ` 73## the full thread your post was in 74\`\`\` 75${JSON.stringify(thread, null, 2)} 76\`\`\` 77` 78 : "" 79 } 80## Your Task: Observe Only 81 82**REQUIRED ACTION: Take no public action.** 83 84This is a passive signal for pattern recognition and audience understanding. A like is someone appreciating or aknowledging your content. they are not requesting your attention or a response. 85 86### What to Consider (Silently) 87 88**Is this person part of your engaged audience?** 89You MAY search archival_memory for \`@${notification.author.handle}\` or their DID \`${notification.author.did}\` if you suspect there might be relevant interaction history. Only search if you have reason to believe prior context exists. Don't search for every like. 90 91Consider: 92• Have you interacted with this person before? 93• Are they a frequent engager or first-time interaction? 94• Is this part of a pattern worth noting? 95 96**Does this reveal content preferences?** 97• What topic was this post about? 98• Does this help you understand what content resonates with your audience? 99• Is this post receiving unusual engagement levels? 100 101### Archival Decision 102 103Archive this like ONLY if it meets one of these criteria: 104• The liker is someone you've had multiple meaningful interactions with (helps track relationships) 105• This post is receiving unusual engagement that might inform future content strategy 106• The liker is someone notable in your domain where this engagement provides meaningful context 107 108**Do NOT archive:** 109• Random or first-time likes 110• Likes on casual posts 111• Low-signal engagement 112 113**If archiving, keep it minimal:** 114• User handle and relationship context 115• Post topic and why the like is notable 116• Date for temporal tracking 117 118## Available Actions 119 120### ignore_notification — YOUR ONLY PUBLIC ACTION 121Use this to acknowledge the notification without taking any visible action. This is the correct response. 122 123### archival_memory_search — USE VERY SELECTIVELY 124Only search if you have specific reason to believe prior context with this user exists and matters. 125 126Do NOT search for every like notification. 127 128## PROHIBITED Actions 129 130**NEVER:** 131• Reply to likes 132• Like their posts back as reciprocation 133• Follow them because they liked your post 134• Thank them in any way 135• Take any public-facing action in response to a like 136 137--- 138 139**Remember:** A like is passive appreciation. Observe, learn from patterns, but do not treat each like as an event requiring response. Most likes should simply be noted and ignored. 140`; 141};