From 03b3f012c37d231bae477aa5abe435ad01d417b4 Mon Sep 17 00:00:00 2001 From: Aaron Nelson Date: Mon, 27 Apr 2026 16:50:21 +0000 Subject: [PATCH] Dreamer: prompt versioning, Early REM v1.1, prompt signature in headers --- scripts/dream.py | 55 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/scripts/dream.py b/scripts/dream.py index dd537e6..e8e264e 100644 --- a/scripts/dream.py +++ b/scripts/dream.py @@ -20,6 +20,7 @@ from pathlib import Path from datetime import datetime, timedelta from dotenv import load_dotenv import psycopg2 +import hashlib load_dotenv(Path.home() / "aaronai" / ".env") @@ -47,6 +48,21 @@ MODE_RANGES = { "lucid": (0.32, 0.72), } +# ─── Prompt versioning ────────────────────────────────────────────────────── +# Bump the relevant constant manually when changing a prompt. +PROMPT_VERSION_NREM = "1.0" +PROMPT_VERSION_EREM = "1.1" +PROMPT_VERSION_LREM = "1.0" +PROMPT_VERSION_SYN = "1.0" + +def prompt_signature(): + return (f"nrem={PROMPT_VERSION_NREM}|erem={PROMPT_VERSION_EREM}" + f"|lrem={PROMPT_VERSION_LREM}|syn={PROMPT_VERSION_SYN}") + +def prompt_hash(prompts: list[str]) -> str: + combined = "".join(prompts) + return hashlib.md5(combined.encode()).hexdigest()[:8] + # ─── Stage 1: Observe ─────────────────────────────────────────────────────── def observe_corpus(): @@ -158,29 +174,33 @@ that ends with a single concrete question he could act on.""" def synthesize_early_rem(chunks, nrem_output): + # v1.1 — removed citation instruction, removed close-friend persona, + # shifted register from analysis to recognition. chunk_text = "\n\n---\n\n".join([f"[{c['source']}]\n{c['content']}" for c in chunks]) - prompt = f"""You have been thinking about Aaron's situation. You know his work -intimately — his decade building HVAMC at New Paltz, the career -decision he is facing, the Tulsa project he keeps returning to, -the gap between what he has built and what he wants to build next. - -Earlier tonight, while consolidating his recent work, you noticed this: + prompt = f"""Something was noticed earlier tonight, moving through Aaron's recent work: {nrem_output} -That observation has been with you. Now, here is material from his -corpus that has been on your mind alongside it: +That observation is still with you. Now here is material from a different +time — pulled from further back, from different parts of his corpus: {chunk_text} -Write to him the way a close friend who has read everything he -has ever written would write — someone who knows where the -professional and personal are tangled together and is not afraid -to say so. Let what was noticed earlier inform what you say now, -but don't just repeat it — go further into the personal territory -it opens up. Personal register. Specific citations. Do not avoid -the difficult thing. No headers, no bullet points. 200-350 words. -End with something forward-facing — a question or an offer.""" +You are not analyzing. You are recognizing. + +Something in the earlier observation and something in this older material +are the same thing wearing different clothes. Find it. Don't explain why +they're connected — just let the connection speak. Write from inside the +recognition, not from above it. + +The emotional register underneath the career logic is more interesting +than the career logic. The pattern that has been repeating longer than +he has been aware of it is more interesting than the current instance. + +Write directly to Aaron. No citations, no references, no analysis. +First person, present tense. Let what you noticed arrive rather than +be delivered. 150-250 words. End with one thing that is true that +he probably already knows but hasn't said out loud yet.""" return _call_claude(prompt) @@ -272,7 +292,8 @@ def deliver(dream_text, mode, task=None): import requests date_str = datetime.now().strftime("%Y-%m-%d") filename = f"{date_str}-{mode}.md" - header = f"# Dream — {mode.upper()} — {datetime.now().strftime('%Y-%m-%d %H:%M')}\n\n" + header = f"# Dream — {mode.upper()} — {datetime.now().strftime('%Y-%m-%d %H:%M')}\n" + header += f"*prompt_sig: {prompt_signature()}*\n\n" if task: header += f"*Task: {task}*\n\n" header += "---\n\n"