Kestrel Search
Kestrel Search is a local web-search capability for coding assistants. Install it once, let your assistant discover its generated SKILL.md, and it can search the web, retrieve readable page content, and return focused results while you stay in your coding workflow.
Under the hood, it searches DuckDuckGo, fetches result pages concurrently, extracts their main text, and re-ranks the results with BM25. The command line stays pipe-friendly: data goes to stdout and progress goes to stderr.
Note Kestrel Search is an independent project and is not affiliated with DuckDuckGo.
Install
Requires Python 3.13 or later.
# With uv
uv tool install kestrelsearch
# Or with pip
pip install kestrelsearch
Quick start
# Search, fetch the matching pages, and rank them by relevance
kestrelsearch search "python dataclasses"
# Send structured results to another program or agent
kestrelsearch search "rust ownership" --output json
# A fast snippet-only search, without fetching pages
kestrelsearch search "openai news" --no-fetch
What it does
- Searches DuckDuckGo’s HTML endpoint, with optional region and recency filters.
- Fetches result pages concurrently over HTTP/2.
- Removes common page chrome and extracts headings, paragraphs, and list content.
- Re-ranks fetched results against the original query using BM25.
- Returns readable terminal output or clean JSON.
For agents
Use JSON output when Kestrel Search is called from an agent, script, or pipeline. Progress messages are written to stderr, leaving stdout safe to parse.
kestrelsearch search "recent Python packaging changes" \
--time-filter m \
--top-k 3 \
--output json > results.json
Each result contains the search metadata plus extracted content when fetching is enabled:
| Field | Description |
|---|---|
title |
Result title |
url |
Result URL |
display_url |
Shortened URL shown in the search result |
snippet |
Search-result snippet |
content |
Extracted page text, prefixed with its source URL; null if unavailable |
bm25_score |
Relevance score when ranking is enabled |
To make the command discoverable to supported coding agents, install its generated SKILL.md:
# Prompts for the agent and whether to install locally or globally
kestrelsearch skill install
# Or install for every supported agent without prompts
kestrelsearch skill install --agent all --scope global
It supports Claude Code, Codex, and GitHub Copilot in VS Code. Use --agent claude, --agent codex, or --agent vscode to target one agent; --agent both remains available for Claude Code and VS Code Copilot. Installed skill locations are tracked locally, so kestrelsearch skill uninstall can remove them later.
| Agent | Project install | Global install |
|---|---|---|
| Claude Code | .claude/skills/kestrelsearch/SKILL.md |
~/.claude/skills/kestrelsearch/SKILL.md |
| Codex | .codex/skills/kestrelsearch/SKILL.md |
~/.codex/skills/kestrelsearch/SKILL.md |
| GitHub Copilot in VS Code | .github/skills/kestrelsearch/SKILL.md |
~/.copilot/skills/kestrelsearch/SKILL.md |
Useful options
# Return three results
kestrelsearch search "climate change" --top-k 3
# Limit results to the past day; use d, w, m, or y
kestrelsearch search "breaking news" --time-filter d
# Narrow the DuckDuckGo region
kestrelsearch search "local elections" --region us-en
# Tune fetching for a pipeline
kestrelsearch search "machine learning" \
--concurrency 8 --timeout 15 --content-limit 3000
# Keep DuckDuckGo ordering rather than applying BM25 ranking
kestrelsearch search "python typing" --no-rank
Run kestrelsearch search --help for the complete CLI reference.
How it works
- Kestrel Search submits the query to DuckDuckGo’s HTML endpoint and parses the result list.
- Unless
--no-fetchis used, it fetches eligible result pages concurrently. - It strips common boilerplate, focuses on likely main content, and keeps meaningful headings and body text.
- BM25 scores the extracted text against the original query and returns the best matches.
PDFs are skipped during page fetching. If fetching or extraction fails for a result, the result is retained with content: null; BM25 ranking may omit zero-relevance results.
Development
git clone https://github.com/rafaelpierre/kestrelsearch
cd kestrelsearch
uv sync
uv run kestrelsearch search "test"
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kestrelsearch-1.0.1.tar.gz.
File metadata
- Download URL: kestrelsearch-1.0.1.tar.gz
- Upload date:
- Size: 261.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db3def95b658be772c3b59ea6587f1edb98c4811a5a94e351796ab799cdd4a74
|
|
| MD5 |
e7eb711cef95236bcd380366ec2fb588
|
|
| BLAKE2b-256 |
31c4b5502f765f8be24300c07a31fb86b1e88e9c3e7b773c115a565864e4795b
|
Provenance
The following attestation bundles were made for kestrelsearch-1.0.1.tar.gz:
Publisher:
release.yml on rafaelpierre/kestrelsearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kestrelsearch-1.0.1.tar.gz -
Subject digest:
db3def95b658be772c3b59ea6587f1edb98c4811a5a94e351796ab799cdd4a74 - Sigstore transparency entry: 2625591106
- Sigstore integration time:
-
Permalink:
rafaelpierre/kestrelsearch@888093c65ca1cce18ed3cc01068e2b491619be9a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/rafaelpierre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@888093c65ca1cce18ed3cc01068e2b491619be9a -
Trigger Event:
push
-
Statement type:
File details
Details for the file kestrelsearch-1.0.1-py3-none-any.whl.
File metadata
- Download URL: kestrelsearch-1.0.1-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8909476fcb6966ddb2f5c3d4ed41658c01b90cccb6e60a3109841ba2656ea351
|
|
| MD5 |
b3c62355140f2ca287017c06439d290d
|
|
| BLAKE2b-256 |
35f15087679ba7cbe87e8de0e74b53151ededf15be919a86dd0d85db65382365
|
Provenance
The following attestation bundles were made for kestrelsearch-1.0.1-py3-none-any.whl:
Publisher:
release.yml on rafaelpierre/kestrelsearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kestrelsearch-1.0.1-py3-none-any.whl -
Subject digest:
8909476fcb6966ddb2f5c3d4ed41658c01b90cccb6e60a3109841ba2656ea351 - Sigstore transparency entry: 2625591174
- Sigstore integration time:
-
Permalink:
rafaelpierre/kestrelsearch@888093c65ca1cce18ed3cc01068e2b491619be9a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/rafaelpierre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@888093c65ca1cce18ed3cc01068e2b491619be9a -
Trigger Event:
push
-
Statement type: