This repository has been archived on 2026-03-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Timmy-time-dashboard/tests/timmy/test_prompts.py
Kimi Agent 061c8f6628 fix: brevity tuning — plain text prompts, markdown=False, front-loaded brevity
Closes #71: Timmy was responding with elaborate markdown formatting
(tables, headers, emoji, bullet lists) for simple questions.

Root causes fixed:
1. Agno Agent markdown=True flag explicitly told the model to format
   responses as markdown. Set to False in both agent.py and agents/base.py.
2. SYSTEM_PROMPT_FULL used ## and ### markdown headers, bold (**), and
   numbered lists — teaching by example that markdown is expected.
   Rewritten to plain text with labeled sections.
3. Brevity instructions were buried at the bottom of the full prompt.
   Moved to immediately after the opening line as 'VOICE AND BREVITY'
   with explicit override priority.
4. Orchestrator prompt in agents.yaml was silent on response style.
   Added 'Voice: brief, plain, direct' with concrete examples.

The full prompt is now 41 lines shorter (124 → 83). The prompt itself
practices the brevity it preaches.

SOUL.md alignment:
- 'Brevity is a kindness' — now front-loaded in both base and agent prompt
- 'I do not fill silence with noise' — explicit in both tiers
- 'I speak plainly. I prefer short sentences.' — structural enforcement

4 new tests guard against regression:
- test_full_prompt_brevity_first: brevity section before tools/memory
- test_full_prompt_no_markdown_headers: no ## or ### in prompt text
- test_full_prompt_plain_text_brevity: 'plain text' instruction present
- test_lite_prompt_brevity: lite tier also instructs brevity
2026-03-14 17:15:56 -04:00

81 lines
2.7 KiB
Python

from timmy.prompts import STATUS_PROMPT, SYSTEM_PROMPT, get_system_prompt
def test_system_prompt_not_empty():
assert SYSTEM_PROMPT.strip()
def test_system_prompt_no_persona_identity():
"""System prompt should NOT contain persona identity references."""
prompt = SYSTEM_PROMPT.lower()
assert "sovereign" not in prompt
assert "sir, affirmative" not in prompt
assert "christian" not in prompt
assert "bitcoin" not in prompt
def test_system_prompt_references_local():
assert "local" in SYSTEM_PROMPT.lower()
def test_system_prompt_is_multiline():
assert "\n" in SYSTEM_PROMPT
def test_status_prompt_not_empty():
assert STATUS_PROMPT.strip()
def test_status_prompt_no_persona():
"""Status prompt should not reference a persona."""
assert "Timmy" not in STATUS_PROMPT
def test_prompts_are_distinct():
assert SYSTEM_PROMPT != STATUS_PROMPT
def test_get_system_prompt_injects_model_name():
"""System prompt should inject actual model name from config."""
prompt = get_system_prompt(tools_enabled=False)
# Should contain the model name from settings, not the placeholder
assert "{model_name}" not in prompt
assert "llama3.1" in prompt or "qwen" in prompt
def test_full_prompt_brevity_first():
"""Full prompt should front-load brevity instructions before other content."""
prompt = get_system_prompt(tools_enabled=True)
brevity_pos = prompt.find("BREVITY")
tool_pos = prompt.find("TOOL USAGE")
memory_pos = prompt.find("MEMORY")
# Brevity section must appear before tools and memory
assert brevity_pos != -1, "Full prompt must contain BREVITY section"
assert brevity_pos < tool_pos, "Brevity must come before tool usage"
assert brevity_pos < memory_pos, "Brevity must come before memory"
def test_full_prompt_no_markdown_headers():
"""Full prompt should not use markdown headers (## / ###) that teach
the model to respond in markdown."""
prompt = get_system_prompt(tools_enabled=True)
for line in prompt.splitlines():
stripped = line.strip()
assert not stripped.startswith("## "), f"Full prompt uses markdown header: {stripped!r}"
assert not stripped.startswith("### "), (
f"Full prompt uses markdown sub-header: {stripped!r}"
)
def test_full_prompt_plain_text_brevity():
"""Full prompt should explicitly instruct plain text output."""
prompt = get_system_prompt(tools_enabled=True).lower()
assert "plain text" in prompt
def test_lite_prompt_brevity():
"""Lite prompt should also instruct brevity."""
prompt = get_system_prompt(tools_enabled=False).lower()
assert "brief" in prompt
assert "plain text" in prompt or "not markdown" in prompt