# Task 03 — `TOOLS_SECTION` Copy: State the Contract Up Front **Phase:** `72_teaching_refusals` · **Story:** `.agents/user_stories/agent-document-tools.md` ## Objective The HIGH prompt's `` section says the same two things the new refusals teach — the `ls` `path` is a *source name*, not a directory or file path, and `read`/`grep` need the combined `source/path` string *including the source name* — so the model carries the contract before it calls a tool, not only after being refused. ## Work 1. `app/rag/prompts.py` — `TOOLS_SECTION` rewritten (the E2E mock keys off the `` marker's *presence*, not this wording, so the change is mock-safe): - `ls` clause: its optional `path` argument is a *source name* (e.g. `'homelab'`) — **not** a directory or file path; omit it to list every document. - `read` clause: the combined `source/path` string, exactly as shown in the `ls` output — *including the source name*; a bare document path will not resolve. - `grep` clause: the locator copy stays (its `path` is already described as a combined `source/path` string); add the same bare-path-will-not-resolve note. - Keep the section's shape: a single paragraph between `` and ``, still appended after the mode body in the HIGH prompt only (the LOW/deflection prompt never carries it — phase 71's plain-text line stays put). 2. `tests/unit/test_prompts.py` — update the `TOOLS_SECTION` wording pin(s) where they pin the old wording; the ``-marker-present-in-HIGH pin, the marker-absent-from-LOW pin, and the byte-identical-LOW-prompt pin stay green as-is. ## Testing & Quality - Unit: `tests/unit/test_prompts.py` — marker present in the HIGH prompt and absent from the LOW prompt; the LOW prompt byte-identical to today; the new wording pinned for the `ls` source-name clause and the read combined-identity clause. - Coverage: **>90%** on this task's modified code (the constant itself — the builders are already covered). ## Completion Criteria - [ ] `uv run pytest tests/unit/test_prompts.py -v --no-cov` green - [ ] The HIGH prompt still ends with the `` section (existing section-order pin green); the LOW/deflection prompt is byte-identical to today - [ ] `uv run ruff check . && uv run pyright` clean