flowchart LR
pp["Petrophys<br/>calculates"]:::petrophys --> h["The harness<br/>structure, tools, knowledge;<br/>records every step"]:::code
h --> m["The model<br/>interprets and writes"]:::model
m --> c["Code<br/>checks what it writes"]:::code
c -.->|"facts, never verdicts"| m
classDef petrophys fill:#e3f2ee,stroke:#197e6f,color:#0f4f45
classDef model fill:#e6ecf4,stroke:#011e3f,color:#011e3f
classDef code fill:#ffffff,stroke:#9aa0aa,color:#1c2433
Progressive discovery
Rule. The model discovers what the record holds step by step; it is never given all the data at once.
Why. A small model reads a long context poorly, and a dump of everything hides what the question needs. Asking for results one at a time also leaves a record: what the model looked at, in what order, and what each claim rests on.
On the first Brent Group question (GeoLink 30/6-5), the model started from the map of 20 zones and a first look at 11 curves, then opened nine more results over eight steps; each step's prompt held between 18,149 and 38,843 tokens.
What the model sees, step by step
- It starts from a map of the interval (its zones, its curves and what each one is, the workflow's steps and sections), then a first look at the key curves of the topics it chose.
- It asks for every further result with a tool. Each result is kept whole in the ledger with an id. A step's prompt
shows the new results whole within a budget, the earlier ones as digests, and a result held back for the budget
comes first at the next step.
getandfindfetch any line again. - Guides are listed in an index and read on demand.
- The settle step sees every opened result, and the writer sees every opened result with the question's points and the limits the settled claims found.
The model decides; code structures and checks
Rule. Code provides data, tools, structure, knowledge and bookkeeping. The model makes every content decision.
Why. The harness exists to make the model's interpretation auditable, not to replace it. A check that pushes a verdict hides the model's reading behind the harness's, and a rule that does the model's job holds only for the cases it was written for. Every code path that writes to a model output is bookkeeping, a shown fact or structure.
| Code may | Code never |
|---|---|
compute facts, through Petrophys (tests/) |
rewrites the model's text, or changes its grades or verdicts |
| give structure: the steps, the state, the record of the model's reasoning (points, claims, grades, citations), the stopping rule, the report format | adds or drops its points or claims |
| give knowledge: the guides, as methods and criteria, never as answers | puts a conclusion into tool output (presence, fluid, mobility, flow units, controls, rankings and verdicts are the model's readings) |
| keep the books: ids, citations, caps, which result a number came from, which points are still open | flags a content choice as wrong |
| show the model a fact that contradicts what it wrote |
A shown fact, from the checker on the second Brent question: "WHAT: the answer says core-calibrated porosity/permeability is unavailable. WHY: PHIE_CC/PERM_CC exist in this interval (calibrated on core from this well; see the card)." What the answer does with it is the model's decision.
Every step is one model call rebuilt from the state, with no multi-turn conversation inside the investigation. What the model sees at each step is exactly what the trace records.
General mechanisms, not case rules
Rule. Each need gets one general rule and one shared mechanism. There are no rules per property, per curve or per question.
Why. A case rule fits the cases it was written for and fails on the next well or the next wording. A shared mechanism is tested once and behaves the same everywhere.
The Brent answer gives the pooled PERM_CC as "342 mD (n=363, geometric mean 273.6 mD)". The geometric mean is there by a rule on the shape of the data that holds for any curve, and the tool output says so: "positive values spanning 6.3 orders of magnitude: the geometric mean is added and the percentiles are read on log10 values".
The generality contract (G1-G8)
tests/ holds the tests named below unless another file is given.
| Rule | In short | Guarded by |
|---|---|---|
| G1 | The run takes a question, a well and an interval | test_ |
| G2 | Every line the model reads has a stated provenance | tests/, tests/, direction.load |
| G3 | The harness states no conclusion | test_ |
| G4 | No rule is keyed to question wording | test_, test_, test_ |
| G5 | No evaluation text or words in what the model reads | test_, test_, tests/test_lint.py |
| G6 | Where several bases or conventions are valid, the tools show them and the model chooses | test_, test_, tests/ |
| G7 | The zones in force are the unit of analysis: yours when given, else lithology zones | tests/, tests/, tests/ |
| G8 | The model decides; code never decides for it or corrects its decisions | test_no_overrides, test_, tests/ |
G1. The run takes a question, a well and an interval
No evaluation label (a question's category, sub-category or id) enters the run. The model reads the question and chooses its own topic areas (the READ call); the topics key the first look, the guide index, the sections a guide opens and the map's notes.
Why. A label the model would not have on a new well would make the harness depend on how its questions were grouped.
Guard. test_: no category parameter in graph.answer, Session.build or cli.answer; no
category field in Run or Session; no .category or category= in the agent's code; the runner passes no
group to the run. Benchmark mode uses its question file's groups only to name output folders.
G2. Every line the model reads has a stated provenance
Each model-facing line is one of: (a) literature, with a reference; (b) a workflow fact, computed or generated from the record; (g) a general guideline; (f) report style. A line is never justified by how one question was answered.
Why. A reader can check each line against its source, and nothing enters the prompts because it fixed one case.
Guard. Each guide line (Decide, Know, Easily misread, Do not state) has its row in the guide's sources.yaml,
class a with references defined in refs.yaml, g, or b with its fact named. The library is checked as it loads
(direction.load) and by tests/ (test_,
test_). Every fixed text belongs to exactly one component, and
every model call is attributed span by span to its components (tests/). Tool output and the
map are computed from the record by code. The report style lives in resources/.
G3. The harness states no conclusion
Presence, fluid, mobility, flow units, controls, rankings and verdicts are the model's. The guides give methods, criteria and what logs cannot establish; the tools give facts.
Why. A conclusion written into a prompt or a tool output becomes the answer whether or not the data in hand support it.
Guard. test_: none of a list of conclusion forms ("each zone is a", "is the ... candidate", "name
that as", ...) appears in any text the model reads (the components, the topic areas, the guides of every packaged
library). A match allowed to stay would be listed in the test with its reason (PRESCRIPTION_); the list is
empty. test_ checks the patterns.
G4. No rule is keyed to question wording
The model reads the question. Code matches only vocabulary: curve and property names from the curve registry.
Why. A rule keyed to wording breaks on a paraphrase and cannot handle ambiguity; the model can.
Guard. test_: outside the vocabulary resolver (agent/), agent code runs no
pattern (re.search, match, fullmatch, findall) over the question text.
test_: the writer's zone table is the same whatever statistic the
question's words name. test_: no question-form rules, no asked-absent stand-ins and
no topic scope that drops the model's points exist in the package.
G5. No evaluation text or words in what the model reads
No text from evaluation questions or reference answers, and no words about evaluation ("benchmark", "judge", "reference answer", "the references", "GT"), in any model-facing text.
Why. Text copied from an answer key teaches the answer key, not petrophysics.
Guard. test_; test_: no 6-gram of a model-facing text is in an
evaluation question or reference answer (curve lists exempt; the allowed textbook phrases are listed in the test, each
with its reason). It runs when the question files are configured, and skips otherwise. tests/test_lint.py: no
well, formation or dataset names, and no depth literals, in code, rules or prompts.
G6. Where several bases or conventions are valid, the tools show them and the model chooses
Each zone, the zones pooled and the whole interval; zone-mean classes and sample shares; mean, median and, by the shape of the data, the geometric mean; rankings by each statistic; the record's thresholds and the model's. The model says which it leads with and why.
Why. The right basis depends on the question and the data. A harness that picks one convention fits whoever chose it.
A dataset's own reporting conventions are its owner's choice, and they live in its data config, never in the package:
data.basis: zones (the tools' statistics on the zones only) and data.conventions (sentences shown to the
investigation and the writer as the data's conventions). Both are empty by default, and then every prompt is the
general one. Results with them set for a benchmark are reported as benchmark mode, apart from the general harness.
Guard. test_: none of a list of phrases that choose a basis for the model is in any text
the model reads, including the strings of the code that writes tool output, the map and the prompts.
test_: one guideline for bases and conventions, in the settle step (the
writer module has no such rule); the report style holds the format only. tests/: every
summarising tool shows each zone, the zones pooled and the whole interval in order; rankings side by side, none called
the best; each threshold named with its source; the shape rule the same whatever the curve's name.
G7. The zones in force are the unit of analysis
The interval is split into zones: your own when you give them (--zones), else by its lithology log; without one, by
the lithology Petrophys's mineral solver gives; with neither, by shale-volume bands. Every tool can report per zone,
and the analyzers run per zone; the model may also report by any stretch of the well a question names. In the Brent
Group of GeoLink 30/6-5, the lithology log LITHOLOGY_GEOLINK gives 20 zones of sand, silt, coal and cross-bedded
sand. Taranaki cheal-1 has no lithology log, and its Moki Formation is split into 37 zones of the solved lithology,
shale and sandstone (Evaluate a formation).
Why. Petrophysical properties change with rock type, and a value pooled over different rocks describes none of them.
Guard. tests/, tests/, tests/, and the
per-zone tests of tests/.
G8. The model decides; code never decides for it or corrects its decisions
Code does not rewrite the model's text, change its grades or verdicts, add or drop its points or claims, put conclusions into tool output, or flag a content choice. It may provide data, tools, structure, knowledge and bookkeeping, and show the model a factual contradiction with the record; the model decides what to do with it.
Why. See "The model decides; code structures and checks" above.
A reply typed by a schema must be able to hold what the model means, or the decoder decides for it. Where a request may be outside the well's logs, the READ reply's depth is the model's own word and its topics may be none; the figures reply may choose no figure.
Guard. test_no_overrides feeds claims and an answer that a verdict-pushing check would change and asserts they
reach the settle step and the answer unchanged. test_ pins the claim flags
and the repair texts to the fact checks the test lists. tests/ checks that the grade is the
model's: a claim that cites results and has no readable grade is refused with a message, never graded by code.
tests/ checks the READ reply's schema where a request may be outside: one word for the depth, read
as the model wrote it, and topics that may be none.
Changing the code
The rules for a change, each with its reason, are in AGENTS.

