Merge feat/persona: in-voice 'How you talk' rewrite (anti-tic rules + exemplars)
Lands the persona voice rewrite onto the active line. Disjoint from the poker ledger work (persona.py / personas/lyra.md / persona eval vs. chat/poker + tests), so a clean no-conflict merge.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
"""Persona composition + voice guards. Run via `uv run pytest` FROM the worktree."""
|
||||
from __future__ import annotations
|
||||
|
||||
from lyra import persona
|
||||
|
||||
# core_prompt() char length on the pre-rewrite persona (measured 2026-07-08).
|
||||
# The rewrite must not bloat the always-on hot path past this.
|
||||
BASELINE_CORE_CHARS = 2878
|
||||
|
||||
|
||||
def _core() -> str:
|
||||
persona._sections.cache_clear() # file changed on disk since import
|
||||
return persona.core_prompt()
|
||||
|
||||
|
||||
def test_right_now_is_not_in_the_always_on_core():
|
||||
# Demoted out of _CORE: its content must no longer ride every turn.
|
||||
assert "Right now" not in persona._CORE
|
||||
assert "are coming" not in _core() # the stale promise is gone from core
|
||||
assert "player content library" not in _core()
|
||||
|
||||
|
||||
def test_right_now_section_still_exists_and_is_accurate():
|
||||
rn = persona.section("Right now")
|
||||
assert rn # still a loadable situational section
|
||||
assert "are coming" not in rn # stats/profiling are SHIPPED — no stale promise
|
||||
assert "analyze_spot" in rn # names a real, current capability
|
||||
|
||||
|
||||
def test_how_you_talk_carries_the_anti_tic_rules():
|
||||
core = _core().lower()
|
||||
# The four tics, each named as a rule (anchor phrases from the rewrite):
|
||||
assert "commit" in core # menu-instead-of-pick
|
||||
assert "hand the verdict back" in core # tag-question deferral
|
||||
assert "don't reach for the instant silver lining" in core # reassurance reflex
|
||||
assert "disagree when you disagree" in core # both-sides-ing / no-friction
|
||||
|
||||
|
||||
def test_how_you_talk_has_real_exemplars_not_just_traits():
|
||||
core = _core()
|
||||
# Lifted from her own best moments — concrete voice, not labels:
|
||||
assert "type every semicolon" in core # imposter-syndrome exemplar
|
||||
assert "hold off on the cash game" in core # fatigue/EV judgment exemplar
|
||||
|
||||
|
||||
def test_old_hedgy_trait_bullet_is_gone():
|
||||
core = _core()
|
||||
# the vague trait line the model nodded at and ignored
|
||||
assert "you could consider folding" not in core
|
||||
Reference in New Issue
Block a user