Set up
python3.10 -m venv .venv
.venv/bin/pip install -r requirements.lock
.venv/bin/pip install "petrophys==3.0.0"
.venv/bin/pip install -e ".[dev]" --no-deps
.venv/bin/python -m pytest tests -q # tests that need benchmark data or a model server skip
No model server is needed to run the tests. To ask a question you need one (Models).
Where a contribution goes
| You want to add | It goes in | What you write |
|---|---|---|
| A calculation, a method, a correction, a classification | Petrophys | The function, in Petrophys. The harness lists every public Petrophys function for the model with no change here (Tools) |
| A tool of the harness itself (a lookup of the record, a computed table) | src/ (Tools, "Adding a tool") |
The function and one Tool definition. It changes what the model is sent, so it is a measured change: see below |
| A plot | Petrophys (petrophys.) |
The plot, in Petrophys, then one line in DISPLAYS in src/. The harness draws nothing itself |
| Guidance for the model on a topic (how an expert works a kind of question) | A skill library (Development, "The skill library") | A guide folder: text and recipes, no code |
| Support for a model | A model card (Models) | A YAML file of request settings |
| Something that reads an answer: an export, a check list, a table | The session graph (The three graphs) | A node after turn, with its route. It cannot change an answer |
| Something that needs what an answer rests on | The evidence graph (Audit an answer) | A reader of EvidenceGraph, or a new node or link kind built from the session log |
| A change to how a later question of a conversation is answered | The later-question graph (The three graphs) | A node or a route |
| A change to how the first question is answered | The question graph (The three graphs) | A measured change: see below |
Science goes into Petrophys. The harness decides what to compute, records it and checks the answer; it does not
compute petrophysics (tests/ enforces this).
Show that a change is safe
Most changes are meant to alter nothing the model is sent on a first question. Three gates prove it (tests/gate/README.md):
- The public mini set, which anyone can run:
pytest tests/. A recorded conversation on a Petrophys sample well must replay request for request.gate -q - The golden tapes, where the benchmark's data is present:
pytest tests/.agent/ test_ golden_ tapes. py -q - The request gate, run by a maintainer on every saved run of the reference build.
If a gate fails and you did not mean to change what the model is sent, the difference it names is the bug.
A change that is meant to alter what the model is sent on a first question is a behaviour change. It is judged by the answers, not by the tests:
- measure it end to end on a fixed set of questions, against a control run at the same time, two runs of each;
- read the answers yourself before any automatic scoring;
- say in the pull request what you measured;
- record the tapes and the mini set again in the same change.
The rules
The full list with reasons is in Rules for changes. The ones a first contribution meets:
- No dataset names or literals (wells, formations, depths, values) in code, rules or prompts.
tests/test_lint.pychecks every guarded file. - Code computes and states facts; the model interprets. No rule fitted to an expected answer, and code never overrides a decision the model made.
- Every step is one model call rebuilt from the state. No multi-turn chat inside an investigation.
- One model answers. No helper model, and no code path for one model only: what differs is the model card.
- Every fixed text the model reads lives in a component (
src/), so each call's text can be traced to the file it came from.petroharness/ agent/ components/ - Errors say what, why and how to fix it.
A pull request
- One change per pull request, with its test.
ruff check src testsandpytest tests -qpass.- The description says what the change is for, which gate you ran, and, for a behaviour change, what you measured.
- New user-facing behaviour comes with its page in
docs/. - A contribution is released under the repository's licence, CC BY 4.0 (LICENSE).

