AI Agent Prompts¶
Because mp3du is a specialized, modern particle tracking engine with strict
data-loading conventions, general-purpose AI assistants can easily fall back to
older MODPATH habits and produce plausible-looking but wrong code.
The prompts below are designed around a practical agent workflow:
- Prime the agent on the authoritative docs
- Inspect the actual MODFLOW workspace before writing code
- Generate code or configuration with explicit guardrails
- Review the result against the docs before trusting it
- Troubleshoot with doc-backed checks when trajectories look wrong
These prompts assume the agent can read URLs or local copies of the
documentation. If it cannot access a source, it should say which source is
missing and stop rather than guess. If the agent cannot browse URLs at all,
paste the content of llms.txt (or llms-full.txt for deeper context)
directly into the chat as a substitute.
Recommended Sources¶
These are the highest-value references to name explicitly in your prompt:
https://sspa-inc.github.io/mp3du-rs-docs/llms.txt- compact LLM primerhttps://sspa-inc.github.io/mp3du-rs-docs/llms-full.txt- full machine-readable referencehttps://sspa-inc.github.io/mp3du-rs-docs/getting-started/quickstart/- first end-to-end examplehttps://sspa-inc.github.io/mp3du-rs-docs/reference/units-and-conventions/- sign conventions,water_table, indexing, CSR layouthttps://sspa-inc.github.io/mp3du-rs-docs/reference/iface-flow-routing/- IFACE bucket routing andq_vertruleshttps://sspa-inc.github.io/mp3du-rs-docs/guides/building-configs/-SimulationConfigpatternshttps://sspa-inc.github.io/mp3du-rs-docs/guides/troubleshooting/- common capture and hydration problems
1. Fast Priming Prompt¶
Use this at the start of a new chat. It is short enough for quickstart use, but still forces the agent onto the published mp3du conventions before code generation.
Recommended role: expert hydrogeologist, scientific Python developer, and conservative API integrator.
Prompt:
Act as an expert hydrogeologist and scientific Python developer specializing in MODFLOW and groundwater particle tracking.
I am working with the
mp3duPython library. Treat the publishedmp3dudocumentation as authoritative, and do not invent undocumented APIs or fall back to older MODPATH conventions.Before writing any code, read these sources: -
https://sspa-inc.github.io/mp3du-rs-docs/llms.txt-https://sspa-inc.github.io/mp3du-rs-docs/getting-started/quickstart/-https://sspa-inc.github.io/mp3du-rs-docs/reference/units-and-conventions/If you cannot access any of them, tell me which source is unavailable and stop instead of guessing.
Then reply with: 1. A 4-bullet list of non-negotiable implementation rules covering
water_table,face_flow,q_well, and IFACE /q_verthandling. 2. A short list of the docs you will consult again before writing code.
2. The Model Intake Prompt¶
Use this before asking the agent to write code. It forces the agent to inspect your actual MODFLOW workspace and identify what is known, unknown, and potentially ambiguous.
Recommended role: project intake analyst and implementation planner.
Prompt:
Act as an expert hydrogeologist and scientific Python developer specializing in MODFLOW,
flopy, andmp3du.First, read these sources: -
https://sspa-inc.github.io/mp3du-rs-docs/llms.txt-https://sspa-inc.github.io/mp3du-rs-docs/getting-started/quickstart/-https://sspa-inc.github.io/mp3du-rs-docs/reference/units-and-conventions/Then inspect my model folder and tell me what kind of MODFLOW model I appear to have, which files matter for
mp3du, and which required arrays can be extracted directly versus which ones still need to be derived.Do not write the final script yet. Return exactly these sections: 1.
Observed model files2.Likely model flavor and packages3.Arrays needed for mp3du4.Known risks or missing information5.Recommended next promptIn your intake, explicitly mention: - where layer type will come from (
LAYTYP,LAYCON, oricelltype) - how face connectivity / CSR arrays are expected to be assembled - whether IFACE boundary metadata appears available - whether the model likely needs separate cell-to-cellq_vertversus totalq_top/q_botarrays
3. The End-to-End Starter Script Prompt¶
Use this when you want a full Python script that loads a MODFLOW model, hydrates mp3du inputs, fits Waterloo, runs one or more particles, and plots the result.
Recommended role: implementation partner with strict doc compliance.
Prompt:
Act as an expert hydrogeologist and scientific Python developer specializing in MODFLOW,
flopy, and groundwater particle tracking.Before writing code, read these sources: -
https://sspa-inc.github.io/mp3du-rs-docs/llms-full.txt-https://sspa-inc.github.io/mp3du-rs-docs/getting-started/quickstart/-https://sspa-inc.github.io/mp3du-rs-docs/reference/units-and-conventions/-https://sspa-inc.github.io/mp3du-rs-docs/reference/iface-flow-routing/-https://sspa-inc.github.io/mp3du-rs-docs/guides/building-configs/-https://sspa-inc.github.io/mp3du-rs-docs/guides/troubleshooting/I have a folder containing a completed MODFLOW model. Write a complete Python script that: 1. Uses
flopyto load the model. 2. Extracts or derives the arrays needed formp3du, includingtop,bot,porosity,head,face_flow,q_well, and the grid geometry. 3. Constructswater_tablefrom the model layer type rules. 4. HydratesCellProperties,CellFlows, andWaterlooInputs. 5. Fits the Waterloo velocity field. 6. Builds a validSimulationConfig, tracks at least one particle, and plots the trajectory withmatplotlib.Non-negotiable implementation rules: - Use
import mp3duas the canonical import. - Build the configuration viamp3du.SimulationConfig.from_json(json.dumps(config_dict))and callconfig.validate(). - Constructwater_tablefrom layer type as follows: confined0 -> top, unconfined1 -> head, convertible> 0 -> min(head, top). - Determine which MODFLOW version produced the flow data — the sign conventions differ: - MODFLOW-USG/MF6 (FLOW-JA-FACE): raw positive = INTO cell. Negate once:face_flow = -flowja. Pass the sameface_flowto bothhydrate_cell_flows()andhydrate_waterloo_inputs(). - MODFLOW-2005/NWT (after directional→per-face assembly): result is positive = OUT. Pass directly to bothhydrate_cell_flows()andhydrate_waterloo_inputs(). - Passzas a local normalized coordinate [0, 1] inParticleStart, NOT a physical elevation.0.0= cell bottom,1.0= cell top. - Pass direct per-cellq_wellarrays in raw MODFLOW sign to both hydration functions — never negateq_well. - If you are starting from IFACE-taggedbc_flowrecords, keepbc_flowin raw MODFLOW sign and use the documented IFACE routing rules, orroute_iface_bc_flows(), to build per-cellq_well,q_other,q_top, andq_botcontributions. - Keepq_vertas cell-to-cell vertical flow only; do not add IFACE 5, 6, or 7 boundary contributions toq_vert. - If boundary capture data exists, pass thebc_*arrays tohydrate_cell_flows()instead of usinghas_well=Trueas a workaround for non-well boundaries. - Do not invent support for IFACE 1, 3, or 4. - If a required array or package cannot be determined from the files, leave an explicit TODO and explain the blocker instead of guessing.Return: 1. The script 2. A short
Assumptions / TODOssection 3. A shortValidation checklistwith the first doc-backed checks I should run
4. The Data Hydration Builder Prompt¶
Use this when you already have extracted arrays and only need the tricky hydration code for mp3du.
Recommended role: numerical data-loading specialist.
Prompt:
I already have extracted MODFLOW arrays such as
top,bot,porosity,head,face_flow, andq_well, and I need Python code that prepares valid inputs formp3du.hydrate_cell_properties(),mp3du.hydrate_cell_flows(), andmp3du.hydrate_waterloo_inputs().Before writing code, read: -
https://sspa-inc.github.io/mp3du-rs-docs/llms-full.txt-https://sspa-inc.github.io/mp3du-rs-docs/reference/units-and-conventions/-https://sspa-inc.github.io/mp3du-rs-docs/reference/iface-flow-routing/Write Python helper code that does all of the following: 1. Builds
water_tablecorrectly from layer type. 2. Prepares per-cell arrays forhydrate_cell_properties(). 3. PreparesCellFlowsarrays using raw MODFLOW signs where required. 4. PreparesWaterlooInputsarrays using Waterloo sign conventions where required. 5. Keepsq_vertas cell-to-cell vertical flow only, whileq_topandq_botcan carry total vertical flow forhydrate_cell_flows(). 6. If IFACE-tagged boundary records are present, keepsbc_flowin raw MODFLOW sign and routes them to the correct buckets without double counting.Please include: - the exact
water_tableloop or vectorized equivalent - short assertions for array length, finiteness,top > bot, and CSR validity - no invented placeholder values unless they are clearly labeled as placeholders
5. The Configuration Builder Prompt¶
Use this when you want the agent to generate a valid SimulationConfig dictionary or JSON block for a specific physical scenario.
Recommended role: schema-aware configuration author.
Prompt:
Before generating a configuration, read: -
https://sspa-inc.github.io/mp3du-rs-docs/llms-full.txt-https://sspa-inc.github.io/mp3du-rs-docs/guides/building-configs/-https://sspa-inc.github.io/mp3du-rs-docs/reference/schema-reference/Using those docs as the source of truth, generate a complete Python dictionary for
SimulationConfigfor this scenario: - [describe your physical scenario here]Requirements: - Use only documented schema fields. - Set
velocity_methodtoWaterloo. - Use a documented solver. - Usedirectionas either1.0or-1.0only. - Include every required block:adaptive,dispersion,capture, and the top-level timing fields. - If you omitcapture_radiusorface_epsilon, say why.Return exactly two sections: 1.
config_dict = {...}2.Validation notes
6. The Review Prompt¶
Use this after the agent writes code. It turns the agent into a skeptical reviewer that checks the generated script against the docs instead of just defending its own output.
Recommended role: reviewer focused on behavioral correctness.
Prompt:
Act as a skeptical reviewer of
mp3duintegration code.Before reviewing, read: -
https://sspa-inc.github.io/mp3du-rs-docs/llms-full.txt-https://sspa-inc.github.io/mp3du-rs-docs/reference/units-and-conventions/-https://sspa-inc.github.io/mp3du-rs-docs/reference/iface-flow-routing/-https://sspa-inc.github.io/mp3du-rs-docs/guides/building-configs/-https://sspa-inc.github.io/mp3du-rs-docs/guides/troubleshooting/Review my script or notebook against the published docs. Focus on bugs, physics mismatches, or behavior-changing mistakes, not style.
Specifically check for: - incorrect
water_tableconstruction - incorrectface_flowsign handling (wrong for the MODFLOW version being used — USG/MF6 vs MF2005/NWT have opposite raw signs) - incorrectq_wellhandling -zpassed as physical elevation instead of local [0, 1] inParticleStart- accidental double counting or misuse ofq_vert,q_top, orq_bot- unsupported or wrong IFACE handling - misuse ofhas_wellfor non-well boundaries - invalidSimulationConfigfields or enums - wrong indexing assumptions or broken CSR arraysReturn findings ordered by severity. If you find no issues, say that explicitly and list residual risks or missing validation steps.
7. The Troubleshooting Prompt¶
Use this when the code runs but the behavior looks wrong: particles move too fast, fail to capture, stick to faces, or terminate with an unexpected status.
Recommended role: diagnostics engineer for groundwater particle tracking.
Prompt:
My
mp3dusetup runs, but the trajectories or capture behavior look wrong.Before answering, read: -
https://sspa-inc.github.io/mp3du-rs-docs/reference/units-and-conventions/-https://sspa-inc.github.io/mp3du-rs-docs/reference/iface-flow-routing/-https://sspa-inc.github.io/mp3du-rs-docs/guides/troubleshooting/-https://sspa-inc.github.io/mp3du-rs-docs/getting-started/quickstart/Based on those docs, give me the top 5 hypotheses to check first. For each hypothesis, include: 1. why it matches the symptoms 2. the exact arrays, config fields, or signs I should inspect 3. what result would confirm or rule it out
In your ranked list, explicitly consider: -
water_tabletoo small in confined layers -face_flowsign wrong for the MODFLOW version — USG/MF6 raw positive=IN vs MF2005/NWT assembled positive=OUT require opposite handling -q_wellsign mismatch -zpassed as physical elevation instead of local [0, 1] - IFACE 5, 6, or 7 flows being incorrectly included inq_vert- missing or wrongbc_*arrays - misuse ofhas_welloris_domain_boundary- capture settings such ascapture_radiusorface_epsilon