Foam-Agent AGENTS.md

Foam-Agent AGENTS.md is an instructions file for Codex, OpenCode from csml-rpi/Foam-Agent. It costs 1,630 tokens per session, scanned A, original, MIT.

Instructions for Foam-Agent, a multi-agent system that turns natural-language requests into Computational Fluid Dynamics simulations using Foundation OpenFOAM v10.

In plain words
What is it for?
Use it to set up Foam-Agent, run simulations with prompts or custom meshes, run tests, or start its MCP server.
Why use it?
It explains the required OpenFOAM version, setup, commands, and incompatibilities that could otherwise produce unusable simulation files.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/csml-rpi/foam-agent/agents-md
Clone the repo
git clone --depth 1 https://github.com/csml-rpi/Foam-Agent

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Foam-Agent AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/csml-rpi/foam-agent/agents-md.svg)](https://agentmods.dev/instructions/csml-rpi/foam-agent/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/csml-rpi/foam-agent/agents-md"><img src="https://agentmods.dev/badge/instructions/csml-rpi/foam-agent/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,630 This file is loaded in full into every session.
When invoked 1,630 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01630 $0.01630
Opus 5 $0.00815 $0.00815
Sonnet 5 $0.00326 $0.00326
Haiku 4.5 $0.00163 $0.00163

Measured 5d ago against content hash 380e69ce8141, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

Foam-Agent AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 134 lines

How it starts

The opening of the file, as written. The whole thing — 134 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

This file helps AI agents (Codex, Cursor, Claude Code, Copilot, etc.) understand and work with this codebase.

What is Foam-Agent?

Foam-Agent is a multi-agent framework that automates CFD (Computational Fluid Dynamics) simulations in Foundation OpenFOAM v10 (openfoam.org) from natural language prompts. It uses LangChain/LangGraph for orchestration, FAISS for RAG-based tutorial retrieval, and supports multiple LLM providers (OpenAI, Anthropic, Bedrock, Ollama).

Important: All generated case files, dictionary names, and solver binaries follow Foundation OpenFOAM v10 conventions. ESI OpenFOAM (openfoam.com, e.g., v2312, v2406, v2512) is not compatible.

Build and Run

# Environment setup
conda env create -n FoamAgent -f environment.yml
conda activate FoamAgent

# Run a simulation
python foambench_main.py --output ./output --prompt_path ./user_requirement.txt

# Run with custom mesh
python foambench_main.py --output ./output --prompt_path ./user_requirement.txt --custom_mesh_path ./mesh.msh

# Run tests
pytest tests/ -v

# Start MCP server
python -m src.mcp.fastmcp_server --transport http --host 0.0.0.0 --port 7860

Requires Foundation OpenFOAM v10 (openfoam.org) at runtime ($WM_PROJECT_DIR must be set). ESI OpenFOAM (openfoam.com) is not compatible. Python 3.12.9 via Conda.

Architecture

Workflow Pipeline (LangGraph StateGraph)

Defined in src/main.py:

PLANNER -> [mesh routing] -> MESHING (if needed) -> INPUT_WRITER -> [HPC/local routing]
-> RUNNER -> [error check] -> REVIEWER -> INPUT_WRITER (retry loop, max 25 iterations)
-> VISUALIZATION (if requested) -> END

All routing decisions (mesh type, HPC vs local, visualization) are LLM calls in src/router_func.py.

Directory Structure

src/
  main.py              # LangGraph workflow definition and entry point
  config.py            # Config dataclass with env var overrides
  utils.py             # GraphState (TypedDict), LLMService (unified LLM interface)
  models.py            # Pydantic models for generated files and plans
  router_func.py       # LLM-based routing decisions
  logger.py            # Structured XML-tagged logging
  nodes/               # LangGraph node functions (thin wrappers calling services)
    planner_node.py
    input_writer_node.py
    meshing_node.py
    local_runner_node.py
    hpc_runner_node.py
    reviewer_node.py
    visualization_node.py
  services/            # Business logic (where the real work happens)
    plan.py            # Case planning and analysis
    input_writer.py    # OpenFOAM file generation via LLM + RAG
    mesh.py            # Mesh generation (blockMesh / Gmsh conversion)
    run_local.py       # Local OpenFOAM execution
    run_hpc.py         # HPC job submission
    review.py          # Error diagnosis and fix planning
    visualization.py   # PyVista-based post-processing
  mcp/                 # FastMCP server exposing workflow as tools
database/
  faiss/               # Pre-built FAISS vector indices (do NOT regenerate unless necessary)
  raw/                 # Raw OpenFOAM tutorial data
tests/                 # pytest tests (service layer + MCP integration)
docker/                # Dockerfile for containerized deployment

Read the full file on GitHub · 134 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 134 lines · 1,630 tokens per session scan A 380e69ce8141

Subscribe to this mod's changes

Foam-Agent AGENTS.md is an instructions file published in the GitHub repository csml-rpi/Foam-Agent (311 stars, last pushed 21d ago), licensed MIT. It adds 1,630 tokens to every session, about $0.0081 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.