Standardize on the .agents/ directory (shared with project skills): phases/, user_stories/, reports/, screenshots/, validate.sh, and phase-sessions/ + pipeline.log all move to .agents/ (git mv preserves history; runtime artifacts move alongside). Updates every reference in AGENTS.md, README.md, .gitignore, app docstrings, and test story headers. Historical KB content in data/ and the runtime pipeline.log transcript are left untouched.
1.8 KiB
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
app/rag/prompts.py—build_deflect_prompt: append one line to theDEFLECT_MODEbody (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).tests/unit/test_prompts.py(andtest_chat_gate.pywhere the deflection body is pinned) — pins: the new line present in the LOW prompt; theDEFLECT_MODEmarker 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-covgreen.- 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 pyrightclean.