dragon-harness
The tool layer that turns a small local model into a competent finance agent.
Runs entirely locally. No API key, no network at inference time, no GPU required for the tools themselves.
Where to start. The state of the whole work β what has been done and when, every checkpoint with its hashes, how to verify any claim, what is still open, and what the older documents get wrong β is indexed in one place:
dragon-state/docs/00-START-HERE.md
file answers 01every repository, what it holds, which file is its entry point 02the history, session by session, with measured results 03the register of every run, checkpoint, hash and verdict 04how to check any claim yourself 05what is not done and what it is blocked on 06bringing a fresh box back 07corrections β read before trusting any other document, this one included
Why this exists
A 7B model has a fixed, small capacity for memorised fact. A retrieval index does not.
Measured against Dragon-Finance-Eval β 6,802 verified items β with no model in the
loop at all:
| strategy | accuracy |
|---|---|
| pick an arbitrary candidate | 1.7% |
| lexical narrowing | 11.7% |
| this harness | 99.8% |
| oracle (ground-truth keys) | 100.0% |
Per family: fact_lookup 99.8% Β· arithmetic 100% Β· period_trap 100% Β·
unit_trap 100%. Large-cap split 100% (1,303/1,303).
An LLM answers these closed-book at roughly 0%. The harness carries the performance; the model supplies language.
Install
β οΈ Install (corrected 2026-11-21)
git clone https://huggingface.co/dragonlimited/dragon-harness pip install "./dragon-harness"does not work, and it fails in a way that looks like a network problem but is not:fatal: expected 'packfile' fatal: could not fetch a6344aac... from promisor remotepip clones with
--filter=blob:none(a partial clone) and the Hub's git server does not serve the promisor fetch that follows, so the install aborts. Clone first, then install locally:git clone https://huggingface.co/dragonlimited/dragon-harness pip install "./dragon-harness[mcp]" # drop [mcp] if you do not need the MCP serverVerified 2026-11-21: clone + local install succeeds and
dragon filer "3M CO"returns CIK 66740.
git clone https://huggingface.co/dragonlimited/dragon-harness
pip install "./dragon-harness[mcp]"
# or from a checkout:
pip install -e ".[mcp]"
Requires a local RAG index and the fact database. Defaults:
| env var | default | what |
|---|---|---|
DRAGON_RAG_DIR |
/home/marimo/dragon_rag |
LanceDB index over the corpus |
DRAGON_FACTS_DB |
/home/marimo/dragon_fsds/facts.duckdb |
SEC XBRL facts |
DRAGON_EMBED_MODEL |
BAAI/bge-small-en-v1.5 |
embedding model |
DRAGON_DEVICE |
cpu |
cuda if you have it |
The two tools
They cover different substrates and are not interchangeable.
| tool | substrate | use for |
|---|---|---|
search_knowledge |
chunked corpus (vector + full-text) | narrative: risk factors, MD&A, footnotes, policy |
query_financials |
SEC XBRL (num / sub) |
any specific reported number |
query_financials returns the candidate set
A filing+period exposes a median of 43 candidate tags (max 132). Expecting a model
to name a tag is the wrong design β so the tool returns the set and the caller chooses.
resolve() does that choice deterministically.
CLI
dragon filer "3M CO"
dragon candidates --adsh 0000066740-23-000092 --ddate 20220930 --qtrs 1
dragon resolve "what is gross profit for the period ending 2022-09?" \
--adsh 0000066740-23-000092 --ddate 20220930 --qtrs 1
dragon facts --name "WALMART INC" --form 10-Q --ddate 20231031 --qtrs 1
dragon search "interest rate risk disclosure" -k 5
Verified:
$ dragon resolve "Using 3M CO's reported total revenue and cost of revenue for the \
period ending 2022-09, what is gross profit in millions of US dollars?" \
--adsh 0000066740-23-000092 --ddate 20220930 --qtrs 1
{"value": 3891.0, "method": "formula:gross_profit"} # expected 3891
MCP server
Exposes all five functions to any harness that speaks the Model Context Protocol (OpenCode, Claude Desktop, β¦):
python -m dragon_harness.mcp_server # stdio
Tools published: search_knowledge_tool, query_financials_tool, resolve_filer_tool,
candidate_tags_tool, resolve_question_tool.
Python
from dragon_harness import search_knowledge, query_financials, candidate_tags
from dragon_harness.resolve import resolve
cands = candidate_tags("0000066740-23-000092", "20220930", 1)
value, method = resolve("what is gross profit?", dict(zip(cands["tag"], cands["val"])))
Design notes
- One DuckDB connection per call, always closed. A connection held across a timeout deadlocks the process β learned the hard way.
- Tag priorities are ordered, not arbitrary.
RevenuesbeforeRevenueFromContractWithCustomerExcludingAssessedTaxtook gross-profit arithmetic from 90.1% to 100%; filing practice differs by company. - ~0.2% is irreducible. Some filings expose several near-synonymous revenue tags and the question gives no signal which was intended. That is the task, not the harness.
Licence
Apache-2.0. Data attribution is per-source β see the corpus ATTRIBUTION.md.