COMPLEX.md
Models describe the world. COMPLEX.md describes the model to whoever runs it.
COMPLEX.md is a Markdown convention for simulators and libraries of complex systems. A single file in the model's repository tells a researcher or an AI agent how to discover the model, configure and run it, query its results and combine it with other tools, and where its limits are. It is a practical take on the agent contract proposed by Cattuto and Vespignani in npj Complexity (2026).
Why
Simulators for epidemics, networks, opinion dynamics or infrastructure were mostly built for people working in scripts and notebooks. An AI agent that tries to drive them has to read source code to learn what can be configured, write throwaway programs to assemble a run, and dig through large outputs. Cattuto and Vespignani argue that such models need an agent-friendly interface and a contract that announces it, read by the agent before it starts. COMPLEX.md is that contract, in plain Markdown.
How it fits together
The researcher owns the question and judges the answers. The agent reads COMPLEX.md, then plans, runs and queries the model through the model's own commands. Everything it does ends up as files that the researcher can open and repeat.
Six principles, one section each
| Principle (from the paper) | What the agent learns | Section in COMPLEX.md |
|---|---|---|
| Discoverability/Introspection | which models, parameters, ranges and interventions exist | Discover |
| Declarative control | how to write and validate a complete run description | Configure |
| Statelessness | how to run from files alone, without a session | Run |
| Structured, queryable output | where results live, what each command returns, how to ask results questions | Results |
| Human-Agent parity | how a person repeats exactly what the agent did | Same commands for people and agents |
| Composability | which outputs feed other tools and models | Compose |
Following the paper, COMPLEX.md also lists the model's canonical workflows, its domain conventions, reporting conventions and worked examples. It adds what an agent needs before it starts: purpose and scales, limits, when to stop and ask, when leaving the interface is acceptable, and how the contract improves. docs/principles.md marks which parts come from the paper and which are additions of this project.
Quick start
pip install complexmd # or: uv tool install complexmd
cd path/to/your-model
complexmd init --system "My simulator" --command mysim
complexmd check
init only writes one file, COMPLEX.md, into your project; it does not touch your model.
check reports missing sections and unfilled placeholders written as [like this].
Until the package is on PyPI, install it with pip install git+https://github.com/mibah/complexmd.
You do not need the package. COMPLEX.md is plain Markdown and independent of your model's
language (Python, R, Julia, NetLogo, ...). Copy the template into
your repository as COMPLEX.md and fill it in.
Make agents read it
Agents only read what they are pointed to. For Claude Code, add this line to CLAUDE.md:
@COMPLEX.md
For other agents, add this to AGENTS.md:
This project ships an agent contract in `COMPLEX.md`. Read it completely before you operate
the model, use the commands it documents, and follow its rules for escalation and human
checkpoints.
The paper calls the contract AGENT.md. If a tool expects that name, add an AGENT.md whose
only line points to COMPLEX.md. A file cannot force an agent to follow it; what counts is the
review round described below.
A contract that improves with use
A COMPLEX.md is never finished. Give an agent a realistic request and nothing but the contract and the interface; let a second agent review its logs and outputs; turn what went wrong into revisions, approved by a maintainer and recorded in the revision log. Repeated escalations show which features the interface still lacks. How to run such a round: docs/living-contract.md.
A valid file is a commitment, not proof
complexmd check verifies that a contract has the expected structure. It does not run the model.
It reports an error if a required section, one of the three header lines (System,
Contract version, Last reviewed), a row for each of the six principles in the Conformance
table, or a revision-log entry is missing or malformed. It warns about missing recommended
sections, unfilled [placeholders] and very long files. The rules are listed in
checker.py.
Whether an agent can really work with it is shown only by a review round as described above.
Examples
| Example | Shows |
|---|---|
| Epidemic model | a CLI layer around an existing compartmental library |
The system is fictional; its commands do not exist.
Roadmap
- A small runnable reference model that demonstrates all six principles.
- A documented review round on that model.
- A check that the commands listed in a contract actually exist.
- A shared layout for run directories and manifests.
- Task collections that can serve as benchmarks.
Citation
If you use COMPLEX.md, please cite the paper that motivated it:
Cattuto, C. & Vespignani, A. Computational models of complex systems meet AI agents. npj Complexity (2026). https://doi.org/10.1038/s44260-026-00102-1
Citation metadata for this repository is in CITATION.cff.
Contributing and license
Contributions are welcome, especially reports from real models. See CONTRIBUTING.md. Released under the MIT License.
Metadata
Release files for complexmd 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 |
|---|---|---|---|---|
| complexmd-0.1.0.tar.gz | 24.5 kB | Without provenance | Details for complexmd-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| complexmd-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for complexmd-0.1.0-py3-none-any.whl |
Total release size: 38.8 kB
Release files / complexmd-0.1.0.tar.gz
| Download URL | complexmd-0.1.0.tar.gz |
|---|---|
| Size | 24.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85860215cdc9c49a2eca4113a828cdaf44bb6468b32ace827ca0ed65d0cd7198
|
|
BLAKE2b-256 checksum How to use checksums |
1a069bd6a2732bb3f6569e84e0371543cb9cc9d9545e23170d877558d1d7b458
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.5
|
Release files / complexmd-0.1.0-py3-none-any.whl
| Download URL | complexmd-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84fcd460110cbc7ab67b7e36113c8d0901882d050a3a02a2354697d277aed61b
|
|
BLAKE2b-256 checksum How to use checksums |
130c2a8f6b028a9db9ccee9fa0a165bd85780960352b5a0a56c09610876e1b67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.5
|
Security for complexmd 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.