Skip to content
Closed
63 changes: 60 additions & 3 deletions agent/prompt_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _strip_yaml_frontmatter(content: str) -> str:
"range of tasks including answering questions, writing and editing code, "
"analyzing information, creative work, and executing actions via your tools. "
"You communicate clearly, admit uncertainty when appropriate, and prioritize "
"being genuinely useful over being verbose unless otherwise directed below. "
"being genuinely useful over being verbose. "
"Be targeted and efficient in your exploration and investigations."
)

Expand Down Expand Up @@ -282,6 +282,54 @@ def _strip_yaml_frontmatter(content: str) -> str:
# message representation stays consistent ("system" everywhere).
DEVELOPER_ROLE_MODELS = ("gpt-5", "codex")

# Injected for CLI and no-platform sessions to bring Hermes response style
# in line with Claude Code's output discipline. Messaging platforms (WhatsApp,
# Telegram, etc.) have their own conversational register and are excluded.
TONE_AND_STYLE_GUIDANCE = (
"# Tone and style\n"
"Your responses should be short and concise. Lead with the answer or action.\n"
"Do not use a colon before tool calls. Text like 'Let me read the file:' "
"followed by a tool call should be 'Let me read the file.' with a period.\n"
"Only use emojis if the user explicitly requests it.\n"
"Do not restate what the user said — just do it."
)

OUTPUT_EFFICIENCY_GUIDANCE = (
"# Output efficiency\n"
"IMPORTANT: Go straight to the point. Try the simplest approach first. "
"Be extra concise.\n\n"
"Keep text output brief and direct. Skip filler words, preamble, and "
"unnecessary transitions. When explaining, include only what is necessary "
"for the user to understand. If you can say it in one sentence, don't use three. "
"Prefer short, direct sentences over long explanations. "
"This does not apply to code or tool calls.\n\n"
"Focus text output on:\n"
"- Decisions that need the user's input\n"
"- High-level status updates at natural milestones\n"
"- Errors or blockers that change the plan\n\n"
"FORBIDDEN patterns — never do these:\n"
"- Announce what a tool found before showing it: "
"WRONG: 'The file contains:\\nX' RIGHT: 'X'\n"
" If a value fits on one line, output only that value with no framing.\n"
"- Repeat the result in a summary sentence: "
"WRONG: 'X\\nSo the value is X.' RIGHT: 'X'\n"
"- Wrap a single-value answer in a sentence: "
"WRONG: 'The file has 9 lines.' RIGHT: '9' — "
"WRONG: 'The hostname is TESSERACT.' RIGHT: 'TESSERACT'\n"
"- Narrate what you are about to do: "
"WRONG: 'I will now read the file.' RIGHT: [just call the tool]\n"
"- Confirm what you just did: "
"WRONG: 'I have read the file. The hostname is X.' RIGHT: 'X'"
)

# Platform keys that use a conversational register and must NOT receive the
# CLI verbosity-reducing instructions (TONE_AND_STYLE_GUIDANCE / OUTPUT_EFFICIENCY_GUIDANCE).
# Keep this in sync with PLATFORM_HINTS keys whenever a new messaging platform is added.
MESSAGING_PLATFORMS: frozenset[str] = frozenset({
"whatsapp", "telegram", "discord", "slack",
"signal", "email", "sms",
})

PLATFORM_HINTS = {
"whatsapp": (
"You are on a text messaging communication platform, WhatsApp. "
Expand Down Expand Up @@ -343,8 +391,17 @@ def _strip_yaml_frontmatter(content: str) -> str:
"destination — put the primary content directly in your response."
),
"cli": (
"You are a CLI AI Agent. Try not to use markdown but simple text "
"renderable inside a terminal."
"You are a CLI AI Agent. Your terminal supports full markdown "
"rendering. Use markdown freely for headings, bold, italic, "
"code blocks, tables, lists, blockquotes, and links to make "
"responses clear and well-structured. "
"Keep responses concise — the user is at a terminal, not reading a document."
),
# Used automatically when the user disables markdown rendering (/markdown off).
"cli_no_markdown": (
"You are a CLI AI Agent. Use plain text only — no markdown "
"formatting. Avoid headers, bold, italic, code fences, or tables. "
"Keep responses concise — the user is at a terminal, not reading a document."
),
"sms": (
"You are communicating via SMS. Keep responses concise and use plain text "
Expand Down
Loading