| .opencode | ||
| examples | ||
| .gitignore | ||
| AGENTS.md | ||
| opencode.json | ||
| README.md | ||
Web Search Agent
Deep web search for OpenCode (v1 & v2). Fetches 30 search results and up to 20 pages per query — far beyond the typical 10-20 result limit of built-in tools — and delivers a compact digest plus a full report file you can grep.
Why use it
Most LLM search tools return 10-20 results, limiting research depth on complex questions. This tool digs deeper — more sources, smarter extraction, quality filtering, better answers. Works with any LLM through OpenCode.
Quick Start
git clone https://github.com/itohnobue/research-agent-opencode
cp -R research-agent-opencode/.opencode /path/to/your/project/
cp research-agent-opencode/AGENTS.md /path/to/your/project/
cp research-agent-opencode/opencode.json /path/to/your/project/ # skip if you already have one
If you already have an AGENTS.md or opencode.json, keep your own (append this AGENTS.md's instructions) instead of overwriting. This teaches OpenCode to route all web searches through this tool. Test it: "Search for the most performant Rust web frameworks"
On first run, uv is bootstrapped repo-local into <repo>/tmp/uv/ (never system-wide — no installers touch ~/.local/bin, PATH, or shell profiles) and all Python dependencies are resolved from PEP 723 inline metadata via uv run --no-project, so a stray pyproject.toml in your project can never hijack the run. No API keys required.
Usage
.opencode/tools/web_search.sh "React server components best practices" --tech
.opencode/tools/web_search.sh "CRISPR delivery methods" --sci --med
.opencode/tools/web_search.sh "Kalman filter implementations" --sci
.opencode/tools/web_search.sh --url https://example.com # direct page fetch (pages only — never file downloads; use curl -L -o for files)
| Flag | Sources | Best for |
|---|---|---|
| (none) | DuckDuckGo | General web |
--tech |
+ Hacker News, Stack Overflow, Dev.to, GitHub | Software, DevOps |
--sci |
+ arXiv, OpenAlex | CS, physics, math, engineering |
--med |
+ PubMed, Europe PMC, OpenAlex | Medicine, clinical trials |
--url |
direct fetch of one specific URL, skips search | Known-page retrieval only (never file downloads), full page text saved raw to its own report file (no quality filters) |
Key features
- 30 results / up to 20 pages per query via DuckDuckGo
- Anti-bot bypass — Scrapling with TLS fingerprinting, auto-fallback to httpx
- Smart extraction — Trafilatura content-area detection (article body, not sidebars)
- Quality filters — content-farm/syndication detection (F5), recency filtering on time-sensitive queries (F7), stub-page drop, cross-page deduplication
- Non-English support — auto-detects Japanese, Chinese, Korean and sets the appropriate DDG region
- Wayback Machine fallback for paywalled pages
- PDF extraction via pdftotext (poppler)
- Wall-clock watchdog — hard timeout kills hung fetches on all platforms
Full feature list and blocked/API-routed domain documentation in .opencode/agents/web-searcher.md.
Requirements
- Python 3.11+ (managed by
uv; downloaded into uv's cache if needed) pdftotext(optional — from poppler, for PDF content extraction)
License
MIT