Files
brain-of-reese/.agent/phases/complete/71_scaffolding_guardrails/04_deflect_prompt.md
T

1.8 KiB

Task 04 — Deflect Prompt: Plain-Text-Only Line (Prevention)

Phase: 71_scaffolding_guardrails · Story: n/a (owner request from chat, 2026-09-03)

Objective

Close the door at the prompt: the deflected (LOW) turn offers no tools, so any tool markup there is always wrong — add one plain-text-only instruction line to the DEFLECT_MODE body. This is the owner-permitted change to the otherwise-locked LOW prompt; the DEFLECT_MODE marker and everything else in the prompt stay put (the E2E mock keys on the marker's presence, not the wording).

Work

  1. app/rag/prompts.py — build_deflect_prompt: append one line to the DEFLECT_MODE body (after "…propose 2-3 alternative questions."): "Reply in plain text only — you have no tools in this mode." The weak-hit title list follows exactly as today; build_high_prompt, PERSONA, TOOLS_SECTION, and the section order are untouched. Update the module docstring: the phase-71 note (owner-permitted 2026-09-03 LOW-prompt line; the marker-keying contract unchanged).
  2. tests/unit/test_prompts.py (and test_chat_gate.py where the deflection body is pinned) — pins: the new line present in the LOW prompt; the DEFLECT_MODE marker still present (mock keying); the HIGH prompt unchanged (byte-identical pins stay green — the line must not leak into HIGH); the byte-identical-when- empty steering/overview behavior unchanged.

Testing & Quality

  • Unit: the prompt pins above.
  • Coverage: >90% on this task's modified code (app/rag/prompts.py).

Completion Criteria

  • uv run pytest tests/unit/test_prompts.py tests/unit/test_chat_gate.py -v --no-cov green.
  • LOW prompt = pre-phase text + exactly the one new line (a diff pin, or a reconstruction pin in the test).
  • uv run ruff check . && uv run pyright clean.