GrepBoard/Manuals
605 manuals ·

Restrict Deep Research to the Sites You Allow

·Tested on ChatGPT Deep Research (per Feb 2026 update coverage) · GNU Awk 5.2.1 · Ubuntu 24.04 (2026-10)·Test scope ↓·7 steps

Name the sites Deep Research may use, then tally the report's cited URLs with awk and list every source outside your allow list, with host-matching pitfalls.

An allow list in the prompt does not guarantee a clean report, so give the instruction up front and check the cited URLs yourself.

[1] Check whether your tool can scope searches to sites. The Decoder reports that ChatGPT's February 2026 Deep Research update lets you search specific websites. Whether that means "only those sites" or "those sites first" could not be confirmed, because OpenAI's help page would not open. Run steps 2–5 either way.

[2] Put the allow list in a file: one host per line, lowercase, no www.. List subdomains separately.

allow.txt
docs.python.orgpeps.python.orgpython.org

[3] Paste the same list into the prompt. Include a line that says what to do when no allowed source exists, so unsupported claims are visible later.

prompt.txt
Research how Python's subprocess module handles timeouts and the shell argument. Use only these sites as sources: docs.python.org, peps.python.org, python.org.Do not cite any other domain. If a claim cannot be supported by these sites,write "no allowed source" for that claim instead of citing something else.Cite every claim with the full page URL.

[4] Save the report as report.md. The one below is a hand-made sample with off-list sources planted on purpose, not model output.

report.md
## Findings The default for `subprocess.run` is `shell=False` ([docs](https://docs.python.org/3/library/subprocess.html#subprocess.run)).F-strings were specified in PEP 498 ([PEP 498](https://peps.python.org/pep-0498/)).Timeouts raise `TimeoutExpired` ([ref](https://docs.python.org/3/library/subprocess.html#subprocess.TimeoutExpired)).One tutorial claims otherwise ([blog](https://www.realpython.com/python-subprocess/)).A forum answer agrees ([SO](https://stackoverflow.com/questions/123/how-to-run)).Mirror of the docs: [mirror](https://DOCS.PYTHON.ORG./3/library/os.html) and[lookalike](https://docs.python.org.example.net/3/library/os.html).Bare URL: https://peps.python.org:443/pep-0008/ and http://www.python.org/downloads/. Sources1. https://docs.python.org/3/library/subprocess.html2. https://medium.com/@someone/subprocess-tips-123

[5] Extract the URLs and count them by host. With awk -F/ the third field is the host. Strip port, trailing dot, case and www. first so the same site counts once.

console
$ grep -oE 'https?://[^] )>"]+' report.md | sed -E 's/[.,;]+$//' > urls.txt$ awk -F/ '{h=$3; sub(/:[0-9]+$/,"",h); sub(/\.$/,"",h); print tolower(h)}' urls.txt | sort | uniq -c | sort -rn      4 docs.python.org      2 peps.python.org      1 www.realpython.com      1 www.python.org      1 stackoverflow.com      1 medium.com      1 docs.python.org.example.net

[6] Wrap the comparison in a script that prints only hosts outside the allow list. It exits 1 if there is at least one.

audit.sh
#!/usr/bin/env bash# usage: audit.sh allow.txt report.md  — print cited URLs whose host is not in the allow listgrep -oE 'https?://[^] )>"]+' "$2" | sed -E 's/[.,;]+$//' | awk -F/ '  NR==FNR { ok[$1]; next }  { h=$3; sub(/:[0-9]+$/,"",h); sub(/\.$/,"",h); h=tolower(h); sub(/^www\./,"",h)    if (!(h in ok)) { print h "\t" $0; bad++ } }  END { exit bad ? 1 : 0 }' "$1" - | sort -uexit "${PIPESTATUS[2]}"
console
$ bash audit.sh allow.txt report.md; echo "exit $?"docs.python.org.example.net	https://docs.python.org.example.net/3/library/os.htmlmedium.com	https://medium.com/@someone/subprocess-tips-123realpython.com	https://www.realpython.com/python-subprocess/stackoverflow.com	https://stackoverflow.com/questions/123/how-to-runexit 1

DOCS.PYTHON.ORG. (different case, trailing dot), the URL with a port, and www.python.org all passed. The look-alike docs.python.org.example.net was caught because the whole host is compared. A grep python.org filter would miss it.

[7] Deal with what was flagged. Re-verify those claims against an allowed source or drop them. With the off-list sources removed, the exit code is 0.

console
$ grep -v -e stackoverflow -e medium -e realpython -e example.net report.md > clean.md$ bash audit.sh allow.txt clean.md; echo "exit $?"exit 0

A pass only means every cited host is on the list. It does not mean the page supports the claim; check that with the method in Verify AI-cited references.

Reference: The Decoder coverage

#deep-research#citations#sources#awk