feat(journal): closeout system prompt with structured-field guard

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-12 14:33:57 -04:00
parent 2576be9e49
commit 552943d6c0
2 changed files with 27 additions and 0 deletions
+11
View File
@@ -51,3 +51,14 @@ def test_build_transcript_keeps_only_last_20_messages():
# Newest 20 means msg-10 through msg-29
assert lines[0] == "USER: msg-10"
assert lines[-1] == "USER: msg-29"
def test_system_prompt_lists_structured_fields_to_exclude():
"""The prompt must explicitly tell the LLM not to restate structured
fields, so the freeform learned_summary stays a narrow lane."""
from fabledassistant.services.journal_closeout import SYSTEM_PROMPT
text = SYSTEM_PROMPT.lower()
for field in ("name", "job title", "industry", "expertise", "response style", "tone", "interests"):
assert field in text, f"system prompt should mention '{field}'"
assert "(nothing to note)" in SYSTEM_PROMPT