Skip to content

Commit 52d376f

Browse files
docs(changelog): record regression-table export surface + agent-native serialization
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0636f3a commit 52d376f

1 file changed

Lines changed: 82 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,88 @@ All notable changes to StatsPAI will be documented in this file.
44

55
## [Unreleased]
66

7+
### Added — agent-native sprint
8+
9+
- **Agent-card metadata overlay (`src/statspai/_agent_cards_extra.py`)**
10+
89 curated Tier-A cards (assumptions / pre_conditions / failure_modes /
11+
alternatives / typical_n_min) for certified + validated estimators that
12+
previously had none, applied via `registry._apply_agent_card_seeds` with
13+
extend-missing semantics (hand-written `FunctionSpec` content always
14+
wins). Lifts curated agent-native field coverage roughly threefold. Every
15+
`alternative` and `exception` is CI-validated to resolve.
16+
- **Relational-integrity contract suite (`tests/test_agent_native_contract.py`)**
17+
— guards that every agent-card `alternatives` / `failure_modes.alternative`
18+
resolves to a real function/MCP tool, every `failure_modes.exception` is a
19+
real class, every advertised MCP tool is executable, every
20+
`_FOLLOWUP_BY_TOOL` next-call is an advertised tool, and every
21+
`_CITATIONS_BY_TOOL` bib key exists in `paper.bib`.
22+
- **Machine-readable schema bundle (`scripts/dump_schemas.py`,
23+
`src/statspai/_schema_export.py`, `schemas/`)** — an import-free, versioned
24+
bundle (`tools.json` / `functions.json` / `agent_cards.json` /
25+
`result.schema.json` / `index.json`) so a non-Python client can discover
26+
the full surface offline. Includes a JSON Schema (draft 2020-12) for the
27+
agent-facing result payload, contract-tested against real `CausalResult`
28+
and `EconometricResults` outputs. `--check` gates drift.
29+
- **MCP-sampling LLM client (`statspai.causal_llm.sampling_client`)**
30+
`SamplingLLMClient` / `resolve_llm_client()` bridge the MCP server→client
31+
`sampling/createMessage` round-trip into the `LLMClient` interface, so
32+
`sp.llm_dag_propose` (and friends) can reuse the connected agent's own
33+
model with no extra API key, falling back to the deterministic heuristic
34+
when sampling is unavailable.
35+
- **Auto-tool citation enrichment**`_enrichment.build_citations` now
36+
falls back to verified citation tokens in a function's registry
37+
`reference` field, so hundreds of carded estimators carry citations in
38+
their MCP output automatically. Only keys that resolve in `paper.bib` are
39+
ever surfaced (CLAUDE.md §10 red line holds).
40+
- **Agent-workflow regression net (`tests/agent_eval/`)** — an end-to-end
41+
transcript test (`detect_design → preflight → fit(as_handle) →
42+
audit_result → sensitivity_from_result`) plus handle-chaining and
43+
graceful-failure UX contracts.
44+
- **Docs**[`docs/guides/agent_native_workflow.md`](docs/guides/agent_native_workflow.md),
45+
an operational playbook for driving StatsPAI as an agent.
46+
47+
### Added — regression-table export
48+
49+
- **Symmetric single-model export surface on `EconometricResults`**
50+
`sp.regress` / `sp.ols` / `sp.iv` results now expose `.to_latex()`,
51+
`.to_html()`, `.to_markdown()`, `.to_excel()`, and `.to_word()`, closing the
52+
asymmetry where these lived only on `CausalResult` (so `sp.did(...).to_latex()`
53+
worked but `sp.regress(...).to_latex()` raised `AttributeError`). Each method
54+
delegates to the canonical `sp.regtable` renderer and forwards every
55+
`regtable` keyword (`coef_labels` / `keep` / `drop` / `order` / `stats` /
56+
`se_type` / `stars` / `fmt` / `template` / `notes` …); `to_latex` adds
57+
`caption=` / `label=`, and the string formats accept an optional `path=`.
58+
- **Agent-native table serialisation (`RegtableResult.to_dict()` /
59+
`.to_json()`)** — a JSON-safe payload with three layers: metadata, the
60+
rendered cell grid (the formatted `"2.067***"` / `"(0.074)"` strings), and
61+
the numeric truth per model (estimate / SE / t / p / CI / stats / depvar).
62+
NaN/Inf coerce to `null`. `renders=True` (or a format list) optionally embeds
63+
rendered strings. `RegtableResult.save()` and `regtable(..., filename=...)`
64+
now recognise the `.json` extension.
65+
- **Docs**
66+
[`docs/guides/exporting-regression-tables.md`](docs/guides/exporting-regression-tables.md):
67+
single- and multi-model export across all six formats, the agent-native
68+
payload, journal templates, multi-panel / `Collection` containers, and a
69+
Stata (`esttab` / `estout` / `outreg2`) and R (`modelsummary` / `stargazer` /
70+
`fixest::etable` / `texreg`) cross-reference table. Every code snippet was
71+
executed to verify it runs. `migration-from-r.md` corrected:
72+
`sp.regress` returns `EconometricResults` (not `CausalResult`) and the
73+
`etable` mapping points at `sp.regtable`.
74+
75+
### Fixed
76+
77+
- **Two dangling enrichment citations**`_CITATIONS_BY_TOOL` referenced a
78+
mistyped `dechaisemartin2020twoway` (corrected to the existing
79+
`dechaisemartin2020two`) and a `cattaneo2015randomization` key absent from
80+
`paper.bib` (added, verified via De Gruyter DOI 10.1515/jci-2013-0010 and
81+
the rdpackages reference). refs verified via aeaweb.org + RePEc
82+
(de Chaisemartin & D'Haultfœuille 2020) and degruyterbrill.com + rdpackages
83+
(Cattaneo, Frandsen & Titiunik 2015).
84+
- **Four dangling agent-card alternatives**`rif_regression`
85+
(→ `rif_decomposition`), `sp.ope_ipw` (→ `sp.ipw`), and two `fixest_in_r`
86+
external references (→ `hdfe_ols`) pointed at non-existent functions; an
87+
agent following them would have hit `AttributeError`.
88+
789
## [1.16.0] — 2026-05-29
890

991
### ⚠️ Correctness fix

0 commit comments

Comments
 (0)