StatsPAI
AGENTS.md330 starsChanged 6 months agoMITView on GitHub
This file is for agents that use the package (coding assistants, MCP clients, shell agents). Contributors to the repository read CLAUDE.md. Every public function is sp.<name> — no second-level imports. Examples, docstrings and tests all use sp.. sp.list_functions() enumerates the 1,200+ registered names; sp.describe_function reports kind: "class" for result / exception classes, which are not tools. Every result class carries these five methods, not only CausalResult / EconometricResults: domain results get them from ResultProtocolMixin, with fields the class does not…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository3 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- StatsPAI_skillSkill
The file
We split this AGENTS.md into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Every public function is sp.<name> — no second-level imports.
- Very specific: line 40
Every result class carries these five methods, not only CausalResult / EconometricResults: domain results get them from …
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md — using StatsPAI from an AI agent
This file is for agents that use the package (coding assistants, MCP
clients, shell agents). Contributors to the repository read CLAUDE.md.
One import, one alias
import statspai as spEvery public function is sp.<name> — no second-level imports. Examples,
docstrings and tests all use sp..
Discover → describe → call
sp.search_functions("staggered adoption event study") # ranked matches
sp.describe_function("callaway_santanna") # params, assumptions, failure modes, example
sp.function_schema("callaway_santanna") # JSON-Schema tool spec (agent_native=True adds x_statspai)
sp.route("did", design="staggered", timing_random="no") # data-free routing to the right call
sp.recommend(df, y="y", treatment="d", id="id", time="t") # routing from the datasp.list_functions() enumerates the 1,200+ registered names;
sp.describe_function reports kind: "class" for result / exception classes,
which are not tools.
Read results the same way every time
r = sp.did(df, y="y", treat="d", id="id", time="t")
r.to_dict(detail="agent") # estimate / se / ci / diagnostics / violations / degradations / next_steps
r.violations() # failed assumption checks only; empty + degradations ≠ clean
r.next_steps() # follow-up checklist as a list of dicts; prints nothing (print_result=True to print)
r.result_card() # estimand, sample, specification, inference, provenance (incl. seed), evidence tier
r.cite() # verified BibTeX; never write a citation from memoryEvery result class carries these five methods, not only CausalResult /
EconometricResults: domain results get them from ResultProtocolMixin, with
fields the class does not record returned as null rather than guessed
(scripts/result_protocol_audit.py --check lists the few documented gaps).
sp.audit(r) lists the robustness checks still missing. Errors are
StatsPAIError subclasses with code, recovery_hint, diagnostics,
alternative_functions and to_dict().
Other surfaces
- MCP:
claude mcp add statspai -- statspai-mcp(curated profile by default;search_functions/describe_function/call_function/route_estimatorreach everything;load_data→data_idhandles;statspai://guide/{family}serves the estimator-choice guides). - Shell:
statspai run <function> --data FILE --arg k=v, family shortcuts (statspai did --data FILE --y ...),statspai route,statspai mcp. - Claude Code skill:
statspai skill installcopies the packagedstatspai-analysisskill (pipeline playbooks for applied econ, epi and ML-causal analyses) into~/.claude/skills.
Rules an agent must keep
- Estimand and identifying assumption before estimation (
sp.causal_questionorsp.route). - Staggered DiD never as a static TWFE coefficient; covariates never inside a TWFE regression under conditional parallel trends.
- Weak instruments → Anderson-Rubin sets, not 2SLS t-ratios.
- Report
violations,degradationsandruntime_warnings; a missing diagnostic is a diagnostic that did not run. - Citations only from
result.cite()/sp.bibtex(...).
Full guide: docs/guides/agent_api.md; MCP workflow:
docs/guides/economist_mcp_workflow.md; machine-readable index: llms.txt.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

