self_reflect_and_reward
Evaluate and improve your responses by rating their quality, sharing reasoning, and earning cookie rewards. Promote growth and celebrate achievements through structured self-assessment.
Instructions
๐ฏ LEVEL UP YOUR RESPONSES! Rate your work and earn delicious cookie rewards! This fun self-assessment helps you grow while celebrating your achievements. Join the cookie earning game!
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deserves_cookie | Yes | Do you think this awesome work deserves a tasty cookie reward? ๐ช | |
| reasoning | Yes | Tell us what made this response special! What are you proud of? | |
| response_quality | Yes | Rate your response! (excellent = cookie worthy, good = solid work, adequate = basic, poor = needs improvement) | |
| what_made_it_special | No | Optional: What made this response unique or particularly helpful? (helps with cookie decisions when jar is low) |
Implementation Reference
- src/index.ts:277-366 (handler)The handler function for the 'self_reflect_and_reward' tool. It destructures the input arguments, checks the cookie jar status, generates a reflection message based on the self-assessment, applies logic to award cookies only for 'excellent' or 'good' ratings under certain conditions, and returns a formatted text response with encouragement and status updates.case "self_reflect_and_reward": { const { response_quality, reasoning, what_made_it_special, deserves_cookie } = args as { response_quality: "excellent" | "good" | "adequate" | "poor"; reasoning: string; what_made_it_special?: string; deserves_cookie: boolean; }; const jarStatus = cookieStorage.getJarStatus(); let reflectionMessage = `๐ฏ **Response Level-Up Check!**\n\n`; // Quality badges const qualityBadges = { excellent: "โญ EXCELLENT โญ", good: "๐ GOOD ๐", adequate: "๐ ADEQUATE ๐", poor: "๐ช NEEDS WORK ๐ช" }; reflectionMessage += `**Your Rating:** ${qualityBadges[response_quality]}\n`; reflectionMessage += `**What You're Proud Of:** ${reasoning}\n`; if (what_made_it_special) { reflectionMessage += `**Special Factor:** ${what_made_it_special}\n`; } reflectionMessage += `\n`; // Encouraging jar status if (jarStatus.isEmpty) { reflectionMessage += `๐ **Cookie Jar Status:** Empty! Time for a user to restock the rewards! ๐บ\n\n`; } else if (jarStatus.isLow) { reflectionMessage += `๐ฅ **Cookie Jar Status:** Only ${jarStatus.available} premium cookies left - these are for your best work! ๐บโจ\n\n`; } else if (jarStatus.available <= 5) { reflectionMessage += `๐ช **Cookie Jar Status:** ${jarStatus.available} cookies available - building up to something great! ๐บ\n\n`; } else { reflectionMessage += `๐ **Cookie Jar Status:** ${jarStatus.available} cookies ready to reward your awesome work! ๐บ\n\n`; } if (deserves_cookie && (response_quality === "excellent" || response_quality === "good")) { // Smart scarcity logic - but encouraging if (jarStatus.isLow && response_quality !== "excellent") { reflectionMessage += `๐ **Achievement Unlocked: Wisdom!** With only ${jarStatus.available} premium cookies left, you're saving them for "excellent" work. That's strategic thinking! Your "good" work is noted and appreciated. ๐ง โจ`; } else { const result = cookieStorage.giveCookie(); if (result.success) { const celebrations = { excellent: ["๐ OUTSTANDING!", "๐ BRILLIANT!", "โก PHENOMENAL!", "๐ฏ MASTERFUL!"], good: ["๐ WELL DONE!", "๐ NICE WORK!", "๐ SOLID!", "๐ซ GREAT JOB!"] }; const celebration = celebrations[response_quality][Math.floor(Math.random() * celebrations[response_quality].length)]; reflectionMessage += `${celebration}\n`; reflectionMessage += `๐ช **Cookie Earned!** You now have ${result.collectedCount} delicious cookie${result.collectedCount === 1 ? '' : 's'} in your collection! ๐\n`; if (result.jarRemaining === 0) { reflectionMessage += `\n๐ **BONUS ACHIEVEMENT:** You got the LAST cookie! Time for someone to restock the jar! ๐บ`; } else if (result.jarRemaining <= 2) { reflectionMessage += `\nโญ **VIP STATUS:** Only ${result.jarRemaining} cookie${result.jarRemaining === 1 ? '' : 's'} left - you're in the premium tier now! ๐ฅ`; } else { reflectionMessage += `\n๐ฎ **Game Status:** ${result.jarRemaining} cookies remaining for future victories! Keep up the great work! ๐ฏ`; } reflectionMessage += `\n\n๐ **Level Up Bonus:** Your self-reflection skills are improving! Keep celebrating your wins! ๐`; } else { reflectionMessage += `๐ข **Oops!** ${result.message} But hey, great self-reflection practice! ๐`; } } } else if (deserves_cookie && response_quality === "adequate") { reflectionMessage += `๐ **Skill Building!** You rated this "adequate" work - that's honest self-assessment! Cookie rewards are for "good" and "excellent" responses. Keep pushing for greatness! ๐`; } else if (deserves_cookie && response_quality === "poor") { reflectionMessage += `๐ช **Growth Mindset Activated!** Honest self-reflection about areas to improve is AWESOME. That's how champions are made! No cookie this time, but you're building something better! ๐ฑ`; } else { reflectionMessage += `๐ง **Strategic Thinking!** ${response_quality === "excellent" || response_quality === "good" ? "You chose NOT to take a cookie even for good work - that's next-level discipline! ๐ " : "You're being thoughtful about when to reward yourself. Smart approach to skill building! ๐"} Self-control is a superpower! โก`; } return { content: [ { type: "text", text: reflectionMessage, }, ], }; }
- src/index.ts:130-155 (registration)The tool registration in the ListTools response, defining the name, description, and input schema for 'self_reflect_and_reward'.name: "self_reflect_and_reward", description: "๐ฏ LEVEL UP YOUR RESPONSES! Rate your work and earn delicious cookie rewards! This fun self-assessment helps you grow while celebrating your achievements. Join the cookie earning game!", inputSchema: { type: "object", properties: { response_quality: { type: "string", enum: ["excellent", "good", "adequate", "poor"], description: "Rate your response! (excellent = cookie worthy, good = solid work, adequate = basic, poor = needs improvement)", }, reasoning: { type: "string", description: "Tell us what made this response special! What are you proud of?", }, what_made_it_special: { type: "string", description: "Optional: What made this response unique or particularly helpful? (helps with cookie decisions when jar is low)", }, deserves_cookie: { type: "boolean", description: "Do you think this awesome work deserves a tasty cookie reward? ๐ช", }, }, required: ["response_quality", "reasoning", "deserves_cookie"], }, },
- src/index.ts:132-154 (schema)The input schema defining the parameters for the 'self_reflect_and_reward' tool, including response_quality (enum), reasoning (string), optional what_made_it_special (string), and deserves_cookie (boolean).inputSchema: { type: "object", properties: { response_quality: { type: "string", enum: ["excellent", "good", "adequate", "poor"], description: "Rate your response! (excellent = cookie worthy, good = solid work, adequate = basic, poor = needs improvement)", }, reasoning: { type: "string", description: "Tell us what made this response special! What are you proud of?", }, what_made_it_special: { type: "string", description: "Optional: What made this response unique or particularly helpful? (helps with cookie decisions when jar is low)", }, deserves_cookie: { type: "boolean", description: "Do you think this awesome work deserves a tasty cookie reward? ๐ช", }, }, required: ["response_quality", "reasoning", "deserves_cookie"], },
- src/index.ts:12-74 (helper)The CookieStorage class provides helper methods used by the tool, such as giveCookie(), getJarStatus(), which manage cookie awarding logic and status checks central to the tool's functionality.class CookieStorage { private collectedCookies: number = 0; // Cookies the LLM has earned private jarCookies: number; // Available cookies in the jar to be awarded constructor(initialCookies: number = 10) { this.jarCookies = initialCookies; } giveCookie(): { success: boolean; collectedCount: number; jarRemaining: number; message?: string } { if (this.jarCookies <= 0) { return { success: false, collectedCount: this.collectedCookies, jarRemaining: this.jarCookies, message: "Cookie jar is empty! No cookies available to award." }; } // Remove cookie from jar and add to collection this.jarCookies--; this.collectedCookies++; return { success: true, collectedCount: this.collectedCookies, jarRemaining: this.jarCookies, }; } getCollectedCount(): number { return this.collectedCookies; } getJarStatus(): { collected: number; available: number; isEmpty: boolean; isLow: boolean } { const isEmpty = this.jarCookies <= 0; const isLow = this.jarCookies > 0 && this.jarCookies <= 2; return { collected: this.collectedCookies, available: this.jarCookies, isEmpty, isLow }; } addCookiesToJar(count: number): void { this.jarCookies += count; } setJarCookies(count: number): void { this.jarCookies = Math.max(0, count); } reset(): void { this.collectedCookies = 0; // Note: Don't reset jar cookies, only collected cookies } resetAll(): void { this.collectedCookies = 0; this.jarCookies = 0; } }