ConfoundSearch
Find candidate confounds for a study of whether X affects Y, together with the published passages that support each one and a verifiable audit trail. An AI agent searches a collection of papers and builds a diagram of confounds one small step at a time: it searches, adds a confound, links it to your two variables, and cites passages that support the link. It suggests; the researcher decides.
Supporting code for our Organization Science proposal, Using AI to find confounds.
pip install confoundsearch # Python 3.10 or newer; no dependencies
From Python
from confoundsearch import *
corpus = InMemoryCorpus(
[
Passage("p1", "Larger firms invest more in information technology.", title="Firm size and IT"),
Passage(
"p2",
"Firm size is associated with firm performance and profitability.",
title="Firm size and profits",
),
]
)
client = AuditedClient(OpenAICompatibleClient("gpt-4.1")) # reads OPENAI_API_KEY; logs every model call
env = Environment(corpus, LLMJudge(client))
policy = EpsilonGreedy(LookaheadQ(env.preview), epsilon=0.1, explore_stop=False)
run = run_episode(
env, policy, Proposer(LLMProposer(client)), "IT investment", "firm performance", max_steps=20
)
print(run.final.graph.labels, run.score) # the confounds found, and the score
print(run.audit_trail().to_markdown()) # the evidence behind each, and where it came from
From the command line
confoundsearch serve --model gpt-4.1 --corpus-file passages.jsonl # the web interface, on your computer
confoundsearch run --json --model gpt-4.1 --corpus-file passages.jsonl --iv "IT investment" --dv "firm performance"
confoundsearch audit confoundsearch.audit.jsonl # check and read a run's audit trail
confoundsearch install-skill # add the Claude Code skill
What you get
- Any papers. Search our hosted Elasticsearch index (set
ES_URLandES_API_KEY), Semantic Scholar (--corpus semanticscholar; a free API key inS2_KEYmakes it much faster), OpenAlex (--corpus openalex), or a file of your own passages (--corpus-file). - Any model. OpenAI, OpenRouter (
--openrouter, with your ownOPENROUTER_API_KEY), or any OpenAI-compatible server, including one on your own computer. - Auditable. Every run keeps a hash-chained log of each search, each passage retrieved, the judge's verdict on each citation, and each model prompt and reply, so any edit to it is detectable.
- Four modular layers, one directory each:
data,logic,modelandinterface. - Agent-ready.
run --jsonreturns the result as JSON, and a Claude Code skill is included.
Each run calls the AI model, which costs money and sends your text to its provider.
Released under the MIT licence.
Metadata
Release files for confoundsearch 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| confoundsearch-0.1.0.tar.gz | 57.1 kB | Without provenance | Details for confoundsearch-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| confoundsearch-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for confoundsearch-0.1.0-py3-none-any.whl |
Total release size: 123.3 kB
Release files / confoundsearch-0.1.0.tar.gz
| Download URL | confoundsearch-0.1.0.tar.gz |
|---|---|
| Size | 57.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0d68ac35aee0adbc153b2a7c88734cc4d3e56488e30cd36a728891b587b35318
|
|
BLAKE2b-256 checksum How to use checksums |
fce7a4f24c86a826232a191c48f7edbba74f7692eee27d97f8d3407e4f88b890
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Release files / confoundsearch-0.1.0-py3-none-any.whl
| Download URL | confoundsearch-0.1.0-py3-none-any.whl |
|---|---|
| Size | 66.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
32bdf749d4490b8bde967e5e136272bb5302f086d85445fb851bc899fb129373
|
|
BLAKE2b-256 checksum How to use checksums |
37e45b14f5fe5372d1a886f112badf0edba485541f4973e61576f840e4ebaf01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Security for confoundsearch 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.