Skip to main content

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.

Organization Science proposal: ConfoundSearch. See our submission documents for more.

pip install confoundsearch        # Python 3.8 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_URL and ES_API_KEY), Semantic Scholar (--corpus semanticscholar; a free API key in S2_KEY makes it much faster), OpenAlex (--corpus openalex), or a file of your own passages (--corpus-file).
  • Any model. OpenAI, OpenRouter (with your own OPENROUTER_API_KEY, used automatically when it is your only 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, model and interface.
  • Agent-ready. run --json returns 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.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for confoundsearch 0.2.0
File Size Uploaded Provenance Actions
confoundsearch-0.2.0.tar.gz 62.5 kB Without provenance Details for confoundsearch-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for confoundsearch 0.2.0
File Interpreter ABI Platform Actions
confoundsearch-0.2.0-py3-none-any.whl Python 3 none any Details for confoundsearch-0.2.0-py3-none-any.whl

Total release size: 137.4 kB

Release files / confoundsearch-0.2.0.tar.gz

Download URL confoundsearch-0.2.0.tar.gz
Size 62.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6b25c2b8c18d36a725ed47067f75ae5c3ea8d5ec549a7b184d2207254353fda7
BLAKE2b-256 checksum
How to use checksums
c4beb4bb663f2a29abc62928c28efed439b74ad13e861805dadf4af708b3c5fd
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.2.0-py3-none-any.whl

Download URL confoundsearch-0.2.0-py3-none-any.whl
Size 74.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed44520f03ca5171efd846473d170f19a0c4dc25fa0829d06791668239015f86
BLAKE2b-256 checksum
How to use checksums
46bbc4485535e5e33a41f97317189652c135103716c22419e0790fea0ad9eda5
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.2.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page