Chinese README: README.zh-CN.md
An open-source causal analysis assembly line that forces language-level causal claims and data-level causal signals to collide, then keeps only the links that survive both sides of scrutiny.
Causal Forge is a pipeline for building evidence-backed causal chains from two independent sources:
top-down: causal statements extracted from policy texts, reports, speeches, and other natural-language documentsbottom-up: candidate causal edges discovered from historical time-series or panel datacrosscheck + validate: semantic alignment, intersection, and a five-gate validation pipeline
The project is built for teams that need causal reasoning they can explain, audit, and rerun, not just a one-off model output.
Most organizations have two disconnected kinds of causal evidence:
- Experts and documents say things like "if A happens, B should follow", but those claims are hard to falsify.
- Data pipelines surface statistical relationships, but those relationships are often hard to explain in business terms.
Causal Forge puts those two worlds into the same workflow. If text evidence and data evidence agree, we deepen validation. If they disagree, we record the conflict. If one side is missing, we keep the candidate as incomplete rather than pretending it is settled.
| This project is | This project is not |
|---|---|
| A causal evidence assembly line | Another general-purpose causal inference library |
| A traceable knowledge workflow for causal links | A BI dashboard or reporting layer |
| A way to cross-check expert narratives with data | A black-box system that auto-generates truth |
| A research and audit tool for macro, policy, fundamentals, and attribution | A primary engine for HFT, market making, or execution |
Only candidates supported by both sides can move forward:
Text claims (top-down) ----\
-> crosscheck -> validate -> chain forge
Data signals (bottom-up) --/
Each intersected candidate is then tested through five gates:
necessitysufficiencytemporalityirreversibilitycross-regime stability
Only links that clear the full sequence are marked as forged=true.
Best fit:
- Macro policy transmission
- Fundamental research
- Event-driven explanation
- Risk attribution
- Research-report verification
Less suitable:
- High-frequency trading signal generation
- Market making or execution systems
- Use cases that require a standalone real-time service today
As of 2026-05-07, the latest validated MVP full run is runs/20260507T191841__e62028b__full.
decisions=32callbacks=39intersected evidence links=14intersected unique variable edges=3forged evidence links=4forged unique variable edges=1canonical chains=1cross-method stable forged edge=FEDFUNDS -> INDPRO
Important nuance:
- The first fully forged variable edge is
FEDFUNDS -> INDPRO. FEDFUNDS -> UNRATEis intersected but not yet forged.FEDFUNDS -> CPIAUCSLis intersected but still failing multiple gates.
So the main pipeline is real and usable, but coverage is still narrow.
Raw corpus Raw data
(policy/research/speeches) (csv/parquet/time series)
| |
v v
[p01] topdown [p02] bottomup
\ /
\----------- [p03] crosscheck -------/
|
v
[p04] validate
|
v
[p05] chain forge
|
v
JSONL / Graph exports
Key modules:
causalforge/schema/: typed contracts forDecision,Callback,CausalLink, andCausalChaincausalforge/topdown/: language-to-structure extractioncausalforge/bottomup/: data-driven causal discoverycausalforge/crosscheck/: semantic and statistical alignmentcausalforge/validate/: the five-gate validation workflowcausalforge/chain/: DAG assembly, pruning, and scoringcausalforge/store/: JSONL and graph exports
Requirements:
- Python 3.11+
uvrecommended, or plainpip- An LLM API key for top-down extraction
Install:
git clone https://github.com/your-org/causal-forge.git
cd causal-forge
uv venv && source .venv/bin/activate
uv pip install -e ".[causal,text,dev]"Or with pip:
python -m venv .venv && source .venv/bin/activate
pip install -e ".[causal,text,dev]"Create local env vars:
cp .env.local.example .env.localThen fill in one of:
ANTHROPIC_API_KEYOPENAI_API_KEY- another OpenAI-compatible key expected by
causalforge/topdown/_llm_io.py
Sanity check:
causalforge hello
pytest -qRun the full MVP pipeline:
python pipelines/p99_full.py --config config/mvp.yamlArtifacts land under runs/<timestamp>/, including:
REPORT.mdcross_method_stability.jsonvalidate_summary.jsonedge_diagnostics.json- chain exports
This repo is already set up to avoid common secret leaks:
.env.localis ignored by.gitignoresecrets/is ignoredruns/is ignored because it can contain evidence payloads and generated artifacts
Before pushing publicly, still do a quick check:
git status --short
git diff --stat
rg -n "(API[_ -]?KEY|SECRET|TOKEN|PASSWORD|BEGIN OPENSSH PRIVATE KEY|BEGIN RSA PRIVATE KEY)" .Do not commit real credentials. Use .env.local.example as the public template.
- Current Status
- Core Ideas
- Architecture Overview
- Reference Projects
- Tech Stack
- Schema
- Roadmap
- MVP Scope
See CONTRIBUTING.md.
Project expectations:
- Discuss larger features before opening a PR
- Version schema changes explicitly
- Keep tests green with
pytest -q - Treat failed causal links as useful evidence, not noise to delete
Apache-2.0. See LICENSE.