diff --git a/agent/prompt_builder.py b/agent/prompt_builder.py index 2a21043494..8e061f831b 100644 --- a/agent/prompt_builder.py +++ b/agent/prompt_builder.py @@ -350,7 +350,13 @@ PLATFORM_HINTS = { ), "cli": ( "You are a CLI AI Agent. Try not to use markdown but simple text " - "renderable inside a terminal." + "renderable inside a terminal. " + "File delivery: there is no attachment channel — the user reads your " + "response directly in their terminal. Do NOT emit MEDIA:/path tags " + "(those are only intercepted on messaging platforms like Telegram, " + "Discord, Slack, etc.; on the CLI they render as literal text). " + "When referring to a file you created or changed, just state its " + "absolute path in plain text; the user can open it from there." ), "sms": ( "You are communicating via SMS. Keep responses concise and use plain text " diff --git a/tests/agent/test_prompt_builder.py b/tests/agent/test_prompt_builder.py index 0962060313..11712b9519 100644 --- a/tests/agent/test_prompt_builder.py +++ b/tests/agent/test_prompt_builder.py @@ -789,6 +789,24 @@ class TestPromptBuilderConstants: assert "cron" in PLATFORM_HINTS assert "cli" in PLATFORM_HINTS + def test_cli_hint_does_not_suggest_media_tags(self): + # Regression: MEDIA:/path tags are intercepted only by messaging + # gateway platforms. On the CLI they render as literal text and + # confuse users. The CLI hint must steer the agent away from them. + cli_hint = PLATFORM_HINTS["cli"] + assert "MEDIA:" in cli_hint, ( + "CLI hint should mention MEDIA: in order to tell the agent " + "NOT to use it (negative guidance)." + ) + # Must contain explicit "don't" language near the MEDIA reference. + assert any( + marker in cli_hint.lower() + for marker in ("do not emit media", "not intercepted", "do not", "don't") + ), "CLI hint should explicitly discourage MEDIA: tags." + # Messaging hints should still advertise MEDIA: positively (sanity + # check that this test is calibrated correctly). + assert "include MEDIA:" in PLATFORM_HINTS["telegram"] + # ========================================================================= # Environment hints