Dreamer: prompt versioning, Early REM v1.1, prompt signature in headers

This commit is contained in:
2026-04-27 16:50:21 +00:00
parent 6776637178
commit 03b3f012c3
+38 -17
View File
@@ -20,6 +20,7 @@ from pathlib import Path
from datetime import datetime, timedelta from datetime import datetime, timedelta
from dotenv import load_dotenv from dotenv import load_dotenv
import psycopg2 import psycopg2
import hashlib
load_dotenv(Path.home() / "aaronai" / ".env") load_dotenv(Path.home() / "aaronai" / ".env")
@@ -47,6 +48,21 @@ MODE_RANGES = {
"lucid": (0.32, 0.72), "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 ─────────────────────────────────────────────────────── # ─── Stage 1: Observe ───────────────────────────────────────────────────────
def observe_corpus(): 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): 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]) 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 prompt = f"""Something was noticed earlier tonight, moving through Aaron's recent 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:
{nrem_output} {nrem_output}
That observation has been with you. Now, here is material from his That observation is still with you. Now here is material from a different
corpus that has been on your mind alongside it: time — pulled from further back, from different parts of his corpus:
{chunk_text} {chunk_text}
Write to him the way a close friend who has read everything he You are not analyzing. You are recognizing.
has ever written would write — someone who knows where the
professional and personal are tangled together and is not afraid Something in the earlier observation and something in this older material
to say so. Let what was noticed earlier inform what you say now, are the same thing wearing different clothes. Find it. Don't explain why
but don't just repeat it — go further into the personal territory they're connected — just let the connection speak. Write from inside the
it opens up. Personal register. Specific citations. Do not avoid recognition, not from above it.
the difficult thing. No headers, no bullet points. 200-350 words.
End with something forward-facing — a question or an offer.""" 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) return _call_claude(prompt)
@@ -272,7 +292,8 @@ def deliver(dream_text, mode, task=None):
import requests import requests
date_str = datetime.now().strftime("%Y-%m-%d") date_str = datetime.now().strftime("%Y-%m-%d")
filename = f"{date_str}-{mode}.md" 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: if task:
header += f"*Task: {task}*\n\n" header += f"*Task: {task}*\n\n"
header += "---\n\n" header += "---\n\n"