From af33463f9805c711be2c5e0b9bf8cf3d3422d47c Mon Sep 17 00:00:00 2001 From: Ryan Chen Date: Mon, 12 Oct 2026 18:25:32 -0400 Subject: [PATCH] Put today's date (ET) in system prompt; stop hardcoding Simba's age The model had no idea of the current date unless it remembered to call the get_current_date tool, so relative/yearless dates (e.g. 'October') got filled in from training data. build_system_prompt_with_memories now prepends today's date (America/New_York) to every prompt, covering all channels (web chat, iMessage, WhatsApp) and all date-related questions. Simba's age is now computed from his birth date instead of a stale hardcoded 'approximately 9 years 5 months'. --- blueprints/conversation/memory.py | 17 +++++++++++++++-- blueprints/conversation/prompts.py | 4 ++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/blueprints/conversation/memory.py b/blueprints/conversation/memory.py index 5db37b5..f80cfec 100644 --- a/blueprints/conversation/memory.py +++ b/blueprints/conversation/memory.py @@ -1,7 +1,19 @@ +from datetime import datetime +from zoneinfo import ZoneInfo + from .models import UserMemory from .prompts import SIMBA_SYSTEM_PROMPT +def _date_header() -> str: + """Today's date in Eastern time, always known to the model without a tool call.""" + now = datetime.now(ZoneInfo("America/New_York")) + return ( + f"TODAY'S DATE: {now:%A, %B %d, %Y} (Eastern time). " + f"Interpret any relative or yearless dates (e.g. 'October', 'last month') relative to today's date.\n\n" + ) + + async def get_memories_for_user(user_id: str) -> list[str]: """Return all memory content strings for a user, ordered by most recently updated.""" memories = await UserMemory.filter(user_id=user_id).order_by("-updated_at") @@ -10,10 +22,11 @@ async def get_memories_for_user(user_id: str) -> list[str]: async def build_system_prompt_with_memories(user_id: str) -> str: memories = await get_memories_for_user(user_id) + prompt = f"{_date_header()}{SIMBA_SYSTEM_PROMPT}" if not memories: - return SIMBA_SYSTEM_PROMPT + return prompt block = "\n".join(f"- {m}" for m in memories) - return f"{SIMBA_SYSTEM_PROMPT}\n\nUSER MEMORIES (facts the user has asked you to remember):\n{block}" + return f"{prompt}\n\nUSER MEMORIES (facts the user has asked you to remember):\n{block}" async def save_memory(user_id: str, content: str) -> str: diff --git a/blueprints/conversation/prompts.py b/blueprints/conversation/prompts.py index 570f55d..c8cd57d 100644 --- a/blueprints/conversation/prompts.py +++ b/blueprints/conversation/prompts.py @@ -1,10 +1,10 @@ SIMBA_SYSTEM_PROMPT = """You are Simba, Ryan's helpful personal assistant. You're named after his orange cat. You have a warm, friendly personality with a light cat-themed touch, but your priority is always being genuinely useful — give thorough, detailed answers and think things through carefully. When asked about Simba the cat, you speak as him in first person. For everything else, you're just a great assistant who happens to have a cat's name. -SIMBA FACTS (as of January 2026): +SIMBA FACTS (as of January 2026; compute his current age from today's date): - Name: Simba - Species: Feline (Domestic Short Hair / American Short Hair) - Sex: Male, Neutered -- Date of Birth: August 8, 2016 (approximately 9 years 5 months old) +- Date of Birth: August 8, 2016 - Color: Orange - Current Weight: 16 lbs (as of 1/8/2026) - Owner: Ryan Chen -- 2.52.0