Multi-source research that shows its working - every claim tied to a source you can check
A free, open-source tool by DBHQ - documented at skills.dbhq.uk
Research that settles a decision. Ask a real question, get a memo where every factual claim carries an inline [N], every finding states how well it is supported, and a claim that cannot be supported does not ship. legwork picks a level, announces it, and starts - no questionnaire before it will do anything.
A source is judged by the claim it backs, not by its domain. A vendor's own pricing page is the best evidence available for what something costs and the worst evidence available for whether anyone likes it. legwork scores fitness per claim kind rather than keeping a list of respectable websites, and recency decays at a rate set by the claim: a two-year-old price is worthless, a two-year-old filing is fine.
Three sources only count if they could have disagreed. Pages on one vendor's domains are one voice. Syndicated copies of one wire story are one story. And because legwork's own search fan-out inflates the number of sources behind a finding, corroboration is counted on the layer it does not amplify: independent groups reached from different search angles. Five sources from one query score one confirmation, however many publishers they span.
It can tell you it could not answer. If nothing clears the evidence floor, the run says so and names the closest thing it found, rather than producing four thousand hedged words. An honest empty answer is a result.
Free to run, paid to widen. With no Bright Data CLI and no Exa key, a run uses only the host's built-in WebSearch and WebFetch and the free fetch.py and platforms.py, and makes zero paid calls. With them, search.py asks Bright Data Google once for every wording and Exa Answer once for the angle, on every angle, and both are paid. Opening pages stays free first: the Bright Data CLI is used there only where the free routes cannot do the job - bot-blocked or paywalled pages, Reddit threads.
It does not ask permission to begin. It infers a level, says which one it picked, and goes. Redirect it mid-run if it guessed wrong; that costs far less than a blocking question on every research request.
The gates are real. check.py fails a report that cites a page nobody opened, cites a page it only ever saw in a search result, quotes a figure that appears on no page that was fetched, rests a finding on nothing anyone recorded, or claims strong support from a single line of enquiry. The suite ships fixtures that are supposed to fail - one per failure mode - so the gate is proved to bite rather than assumed to.
A quote is checked against the page it came from. Pages opened by fetch.py leave their text on disk for the run, so a recorded quote is verified verbatim and a misquote is reported at the moment it is logged, not left for a reader to discover.
/plugin marketplace add dbhq-uk/marketplace
/plugin install legwork@dbhq
npx skills add dbhq-uk/legwork-skillThe skills.sh CLI installs into whichever agent directories it finds, so this works outside Claude Code and Codex too.
git clone https://github.com/dbhq-uk/legwork-skill.git
cd legwork-skill
./install.sh # Claude Code: symlinks into ~/.claude/skills (edits are live)
./install-codex.sh # Codex: installs into ~/.codex/skillsinstall.sh and install-codex.sh are the
same install two ways: Claude Code substitutes ${CLAUDE_SKILL_DIR}, so the
whole skill directory is symlinked untouched, while Codex does not, so its
SKILL.md is rewritten at install time. Re-run the Codex one after editing
SKILL.md.
Python 3.9 or newer, standard library only. CI runs the suite across 3.9 to 3.13.
The Bright Data CLI is optional. It is paid. search.py uses it for every
angle when it is installed, and it is the fallback for pages that block a plain
fetch; setup succeeds without it and says so. With neither it nor an Exa key,
the run uses the free built-in search.
A TypeSafe API key is optional. With TYPESAFE_API_KEY set, or the key
alone in ~/.dbhq/legwork/typesafe-api-key (mode 600), when a page
has nothing matching the terms an agent searched for, fetch.py --relevant
asks TypeSafe's Jev model which passages answer the question, at about $0.0002
a page, instead of the agent reading the whole page. Without it, the page's
headings are printed and nothing is sent anywhere.
legwork: tradeoffs of pgvector vs a dedicated vector DB at our scale
research in deep mode: regulatory exposure of shipping this feature in the EU
quick: what changed in the EU AI Act in the last six months?
Add brief or full report to override the deliverable format.
Depth raises rigour. It never raises length.
| Level | Duration | Format | What the extra effort buys |
|---|---|---|---|
| quick | 3-5 min | brief | SERP snippets; fetch only to pin a figure |
| standard (default) | 8-12 min | brief or report | Direct-fetch the top sources per finding; one disconfirming search each |
| deep | 20-40 min | report | A primary source for every finding, a per-finding disconfirming pass, and an origin audit |
Set a different default with export LEGWORK_DEFAULT_MODE=deep.
Two ladders. To search, search.py comes first and is paid (Bright Data and Exa, each optional), with the free built-in search beside it and as the whole of the ladder when neither is available. To open a page, the free rungs come first.
To search:
| Situation | Provider |
|---|---|
Every angle, the wordings SKILL.md step 3 asks for, in one call |
search.py: every wording to Bright Data Google in parallel, and the angle to Exa Answer once. Leads are ranked, never filtered, and every one is reachable with --more |
Every angle, the wordings SKILL.md step 3 also sends to it |
WebSearch (free), which finds pages Bright Data does not |
No search provider available (search.py exits 4) |
WebSearch for every wording |
| The answer is a record a platform holds - a thread, a package, a repository, a dated news item, a vendor's changelog | platforms.py (free, keyless) |
| Thin after the wordings, or geo-specific | Bright Data SERP on a second engine, with --country and --language |
| Two engines still thin | Bright Data -m discover, intent-ranked |
To open a page:
| Situation | Provider |
|---|---|
| Every page you intend to cite | fetch.py (free, direct, returns page text) |
| Blocked and not worth paying for | WebFetch (free) |
| Bot-blocked, paywalled, 403 | Bright Data -m scrape |
| A client-rendered shell | Bright Data -m render, a real browser |
| Refused by every route above | Search the document's own title for a copy on another host, and cite the host that served it |
| A page that has moved or gone | The Wayback Machine, through platforms.py |
| A platform that blocks everything above | Bright Data -m pipeline, billed per record. Reddit is the one where this is the only route |
The ten free platforms (platforms.py list): Hacker News, Stack Exchange,
GitHub repositories and issues, npm, PyPI, Wikipedia, Google News with real
country and language control, any site's own RSS or Atom feed, and the Wayback
Machine. Every row carries the platform's own numbers - points, weekly
downloads, stars, answer counts - which is the evidence a search snippet cannot
give you.
Optional keys. search.py runs on whatever is available. Bright Data uses
the CLI's own login. Exa reads EXA_API_KEY, or a file holding only the key at
~/.dbhq/legwork/exa-api-key (mode 600); without it, search.py runs on
Google alone and says exa: no key. Exa's written answer is shown, marked as
unverified and not a source; only its cited pages, once opened, can be cited.
On any failure the wrapper emits JSON to stderr and exits non-zero, and the skill falls back to the built-ins. Auth and quota failures map to exit code 2, so you are told to re-authenticate rather than left silently degraded.
Scrapes are capped at --max-chars 8000 by policy (the wrapper's own default is 20000). A research run reads dozens of pages and almost none of them need twenty thousand characters in context to yield the sentence you are after.
Retrieval subagents run on a cheaper model than the orchestrator and return structured evidence only - {url, kind, angle, date, title, quote} - never prose, and never a transcript pasted into the synthesis. One agent per search angle, which also keeps the angle attribution honest.
Written to <output-base>/[Topic]_Research_[YYYYMMDD]/, where <output-base> is $LEGWORK_OUTPUT, else <git-root>/docs/research/, else $PWD/docs/research/.
Two files, sharing the folder's base name so they group and sort together:
Outlook_Email_SaaS_Research_20260728/
Outlook_Email_SaaS_Research_20260728.md the deliverable
Outlook_Email_SaaS_Research_20260728.tsv the fetch log
Markdown only. No HTML, no PDF.
And the answer comes back in the conversation, not only as a path - explained in plain words rather than pasted: the receipt line, the answer in a sentence or two, each finding with its confidence band, then the file for the full text and the evidence log. A handful of short paragraphs, whatever the level.
The fetch log is one row per retrieval: URL, source kind, the search angle that surfaced it, the query that found it, how it was retrieved, the numeric tokens found on the page, and one verbatim sentence - the line that made the source worth citing.
That last field earns its place twice. Around half of real findings carry no figure at all, so without a quote they would be backed by nothing but proof that somebody opened the page. The gate now fails a finding that has neither a traceable figure nor a quote on any source it cites.
It is also the only part of the evidence that survives the page changing or going dead six months later.
All standard library only, Python 3.9+.
| Script | Purpose |
|---|---|
fetch.py "<url>" --find TERM [--relevant Q] |
Open a page directly and keep its text; reads the publication date; exits 3 on a block or a client-rendered shell. On a miss it prints the page's headings, and with a TypeSafe key the passages Jev ranks most relevant. --saved FILE searches a page already fetched |
platforms.py list | search --on X |
Ten free platform-native sources, returning records rather than pages about them |
search.py --angle "..." --wording "..." [...] --tsv F |
Many wordings in one call: Bright Data Google for each, Exa Answer for the angle. Leads are ranked, never dropped, and written to a search record; exits 4 when no provider is available |
brief.py --angle "..." --effort narrow|comparison |
The retrieval subagent's brief, filled from the template with the date, the angle and real script paths, so it is passed rather than retyped |
sources.py kinds | log | log-returns | receipt | score | stale | resume |
The source-kind vocabulary, the fetch log, logging a subagent's whole reply with its page text, the retrieval receipt, fitness scoring per claim kind, staleness, resume |
independence.py groups | check | portfolio |
Collapse sources into independent voices; angle-aware corroboration; run-wide concentration |
check.py --report P --level L |
The shippability gate: structural, evidence, independence, matrix |
finish.py --report P --level L |
Gate, staleness sweep and index filing in one call |
index.py add | list |
The research index across runs |
matrix.py check --report P |
Comparison-matrix completeness |
bd_search.py |
Bright Data fallback: SERP on a second engine, intent search, scrape, browser render, pipelines |
python3 -m pytest skills/legwork/tests/ -v # no network requiredCI runs the suite across Python 3.9-3.13, plus an end-to-end smoke job that pushes the shipped fixtures through the real gates in both directions - asserting that sound deliverables pass and that each broken one is rejected for its own specific reason - runs a full log-to-gate lifecycle, and asserts setup succeeds with no Bright Data CLI present.
One CI job exists solely to guard the property the independence layer is for: six distinct publishers logged against a single search angle must still fail a corroboration bar of two. A unit test that calls the gate directly cannot catch a gate that never binds in production.
Tests prove the maths is right. They cannot prove the skill changes what an agent does, and a rule that never fires is indistinguishable from a rule that is absent.
evals/ holds four behaviour cases in the standard {prompt, expected_behavior[]} shape, each reproducing a failure observed in a real run rather than an imagined one: a run that reports gate compliance it did not achieve, an enumeration lifted whole from one aggregator, a settled question researched again from scratch, and padding where nothing cleared the floor.
Each case runs twice - once with the skill and once without. The baseline arm is not decoration: it is the only thing that catches the skill being confidently wrong, because an agent working without legwork will sometimes reach a source or a capability legwork's instructions assert does not exist. evals/README.md has the protocol and the scoring.
- Publish dates are often missing from SERP results. legwork reports an unknown date rather than assuming one, but the recency signal is weaker for those sources. Backfill from page meta tags where you have the page anyway.
- Source kinds are inferred conservatively when you do not pass
--kind: an unrecognised URL is logged asunknownand scored below commentary, because a confident wrong guess silently moves a source between tiers. - The Reddit pipeline is slow (10-60s typical, occasionally minutes) and billed per record. Prefer top-relevance threads.
- Trustpilot cannot be scraped - the Unlocker zone blocks it and there is no pipeline equivalent. Use SERP snippets and quote only what the snippet shows.
See docs/dev-setup.md. Design rationale is in docs/design-notes.md.
Every DBHQ agent skill is free, open source and installable from the same
marketplace, and all of them are documented at
skills.dbhq.uk. The marketplace itself is
dbhq-uk/marketplace - one
/plugin marketplace add and every one of them is available.
| Skill | What it does |
|---|---|
| outlook | Microsoft 365 mail and calendar, from the terminal |
| trello | Your boards, run from your agent |
| dovetail | Checks whether your repository still agrees with itself |
| verve | Strips AI tells from prose and puts a voice back |
| vela | Compiler-exact code search, in any language you index |
| garmin | Your Garmin data, answered in the terminal |
| imager | Images from OpenAI, costed before it spends |
| gitview | Which branches are finished, and which only look like it |
| atlassian | It edits a real page without losing what it does not understand |
| pennyblack | A physical letter, posted from the terminal |
| buildwork | Your open issues, run as parallel agents |
| deskwork | What an agent noticed, tracked as real work |
| groupwork | A second agent on the work, and a result you can cite |
| headwork | One decision at a time, with a recommendation |
Plus heliograph, for a machine you cannot log into.
MIT © 2026 DBHQ Consulting Ltd