Skip to content

Comments

Add CLAUDE.md and .claude/rules/ for Claude Code guidance#1255

Merged
sbryngelson merged 7 commits intomasterfrom
add-claude-md
Feb 24, 2026
Merged

Add CLAUDE.md and .claude/rules/ for Claude Code guidance#1255
sbryngelson merged 7 commits intomasterfrom
add-claude-md

Conversation

@sbryngelson
Copy link
Member

@sbryngelson sbryngelson commented Feb 24, 2026

User description

Summary

  • Adds CLAUDE.md (168 lines) with project identity, CLI commands, development workflow contract, system identification/module loading, architecture overview, critical rules, and code review priorities
  • Adds 4 modular .claude/rules/ files for domain-specific knowledge:
    • fortran-conventions.md — naming, precision system (wp/stp), forbidden patterns, module structure
    • gpu-and-mpi.md — GPU macro abstraction (GPU_* → OpenACC/OpenMP target offload), preprocessor defines, compiler-backend matrix, MPI halo exchange patterns
    • parameter-system.md — Python→Fortran parameter flow, 3-location checklist for new parameters
    • common-pitfalls.md — array bounds, blast radius warnings, compiler portability, PR checklist

Core CLAUDE.md stays under the ~200-line threshold for optimal instruction adherence. Rules files load automatically as part of Claude Code's memory system.

Designed for two audiences: Claude Code interactive development sessions and automated PR reviews.

Test plan

  • Verify CLAUDE.md loads correctly: run claude in repo root and check /memory
  • Verify .claude/rules/ files load alongside core: check /memory output
  • Spot-check that Claude follows workflow contract (format → precheck → build → test before commit)
  • Spot-check that Claude uses ./mfc.sh commands rather than raw CMake/Python

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive project guide (CLAUDE.md) with overview, build/run/test, supported systems, and workflow.
    • Introduced Fortran conventions, GPU+MPI usage guidance, and a parameter-system guide.
    • Added a common-pitfalls checklist and PR validation steps.
    • Clarified GPU acceleration options to include OpenACC or OpenMP target offload and backend-agnostic macro usage.

CodeAnt-AI Description

Add developer guide and rule set for contributors and automated reviewers

What Changed

  • Added a repo-level developer guide (CLAUDE.md) that documents recommended commands for building, running, testing, formatting, module loading, and the full development workflow to follow before committing.
  • Added four rule files under .claude/rules/ that give concrete, actionable guidance: Fortran file/module/naming and precision conventions; GPU and MPI usage patterns and allowed macros; parameter lifecycle and the required three-location checklist for adding parameters; and common pitfalls (array bounds, blast radius, compiler quirks, golden-file handling) plus a PR pre-submit checklist.
  • Documented supported systems/backends, GPU build matrix, required use of GPU_* macros (no raw pragmas), and exact verification steps (format → precheck → build → test) to reduce unchecked commits and misconfigured builds.

Impact

✅ Shorter onboarding for new contributors
✅ Fewer build/test mistakes from missing parameter or target updates
✅ Clearer GPU/MPI and precision guidance reducing platform-specific errors

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Adds project-level instructions for Claude Code interactive sessions
and automated PR reviews. Core CLAUDE.md covers commands, development
workflow contract, architecture, and critical rules. Domain-specific
knowledge (Fortran conventions, GPU/MPI patterns, parameter system,
common pitfalls) lives in modular .claude/rules/ files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 24, 2026 00:01
@codeant-ai
Copy link
Contributor

codeant-ai bot commented Feb 24, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

📝 Walkthrough

Walkthrough

Adds five new documentation files under .claude/rules and a new top-level CLAUDE.md; plus a small clarification in .github/copilot-instructions.md. All changes are documentation-only; no source code or API modifications. (50 words)

Changes

Cohort / File(s) Summary
Fortran rules & pitfalls
.claude/rules/common-pitfalls.md, .claude/rules/fortran-conventions.md
New guidance covering common pitfalls (array bounds, ghost cells, indexing), module/file/naming conventions, forbidden patterns, precision/kind parameters, and a PR/precheck checklist.
GPU & MPI guidance
.claude/rules/gpu-and-mpi.md
New document describing GPU offload architecture, Fypp GPU_* macros and backend gating (OpenACC/OpenMP), memory/macro semantics, Cray-specific macros, compiler-backend matrix, and MPI halo/error-handling rules.
Parameter system
.claude/rules/parameter-system.md
New documentation of the parameter lifecycle: Python definitions → validation → namelist generation → Fortran runtime reading; includes case management and validation tooling guidance and a four-location checklist for adding parameters.
Project overview
CLAUDE.md
New top-level project documentation covering codebase scope, build/run/test workflow (mfc.sh), supported systems, development workflow, architecture layout, naming/precision rules, and review/checklist guidance.
Repo instruction tweak
.github/copilot-instructions.md
Minor edit clarifying GPU acceleration supports both OpenACC and OpenMP target offload and references GPU_* Fypp macros for backend-agnostic dispatch.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

Review effort 2/5, size:M

Poem

🐇 I hopped through docs with a thump and a cheer,

Rules for Fortran, GPU, MPI appear.
Parameters tidy, pitfalls in view,
A carrot of guidance — crisp and new.
Thump‑thump — docs set, now off to review.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: addition of CLAUDE.md and .claude/rules/ documentation files for Claude Code guidance.
Description check ✅ Passed The pull request description is comprehensive and well-structured, covering the summary, testing approach, and two distinct audience perspectives; all template sections are addressed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-claude-md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codeant-ai codeant-ai bot added the size:L This PR changes 100-499 lines, ignoring generated files label Feb 24, 2026
@codeant-ai
Copy link
Contributor

codeant-ai bot commented Feb 24, 2026

CodeAnt AI finished reviewing your PR.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces comprehensive documentation for Claude Code AI assistance in the MFC codebase. It establishes project identity, workflow contracts, and domain-specific knowledge for both interactive development sessions and automated code reviews.

Changes:

  • Adds CLAUDE.md as the core instruction file covering project identity, CLI commands, development workflow, architecture, and critical coding rules
  • Adds modular .claude/rules/ directory with four domain-specific knowledge files for Fortran conventions, GPU/MPI patterns, parameter system flow, and common pitfalls

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
CLAUDE.md Core Claude Code instruction file with project overview, CLI reference, workflow contract, and critical rules
.claude/rules/parameter-system.md Documents Python→Fortran parameter flow and 3-location checklist for adding parameters
.claude/rules/gpu-and-mpi.md Details GPU macro abstraction system, preprocessor defines, compiler-backend matrix, and MPI patterns
.claude/rules/fortran-conventions.md Specifies Fortran naming conventions, precision types, module structure, and forbidden patterns
.claude/rules/common-pitfalls.md Lists common error patterns including array bounds, blast radius warnings, and PR checklist

sbryngelson and others added 2 commits February 23, 2026 19:14
The GPU section previously only mentioned OpenACC. Now reflects that MFC
supports both OpenACC and OpenMP target offload via backend-agnostic
GPU_* Fypp macros.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Expand 3-location to 4-location checklist: add m_global_parameters.fpp
  as required step for declaring Fortran variables (without this, adding
  a parameter to the namelist in m_start_up.fpp causes a compile error)
- Fix fastjsonschema attribution: JSON schema validation is in case.py
  and params/registry.py, not in case_validator.py which does physics
  constraint checking

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link


Claude Code Review (updated)

Head SHA: cb58059

Files changed: 5

  • CLAUDE.md
  • .claude/rules/common-pitfalls.md
  • .claude/rules/fortran-conventions.md
  • .claude/rules/gpu-and-mpi.md
  • .claude/rules/parameter-system.md

Summary of changes

  • Adds top-level CLAUDE.md (168 lines) with project identity, CLI command reference, development workflow contract, HPC system/module-loading table, architecture overview, critical rules, naming conventions, precision system, and code review priorities
  • Adds .claude/rules/common-pitfalls.md documenting array-bounds pitfalls, blast-radius of src/common/, physics consistency requirements, compiler-specific issues, golden-file workflow, and PR checklist
  • Adds .claude/rules/fortran-conventions.md documenting .fpp/Fypp file format, module structure, naming conventions, forbidden patterns, precision types, and soft size guidelines
  • Adds .claude/rules/gpu-and-mpi.md documenting the GPU offload architecture (OpenACC vs OpenMP target offload), all GPU_* Fypp macro signatures, memory management macros, compiler-backend matrix, #ifdef define reference, and MPI patterns
  • Adds .claude/rules/parameter-system.md documenting the Python to Fortran parameter flow, the 3-location checklist for new parameters, and case file validation

Findings

Issue 1 - Wrong Fypp call prefix for all GPU macros (@: vs $:)

File: .claude/rules/gpu-and-mpi.md - Key GPU Macros section

Every GPU macro in the reference list is documented with the @: Fypp call prefix:

@:GPU_PARALLEL_LOOP(collapse=N, ...)
@:END_GPU_PARALLEL_LOOP()
@:GPU_UPDATE(host=[...])
@:GPU_ENTER_DATA(create=[...])

The entire codebase uses $: for these macros. $:GPU_* appears 1,733 times in src/; @:GPU_* appears 0 times. An AI agent following this documentation would write @:GPU_PARALLEL_LOOP(...) when the correct form is $:GPU_PARALLEL_LOOP(...). The @: prefix is correct for ALLOCATE, DEALLOCATE, and ACC_SETUP_* (which are defined differently in Fypp and correctly documented elsewhere), but GPU_* macros are all $:-prefix call macros.

Fix: Replace @:GPU_* and @:END_GPU_* with $:GPU_* and $:END_GPU_* throughout the Key GPU Macros section.

Evidence:

$:GPU_PARALLEL_LOOP(collapse=3, private='[x,y,z,divergence]')
do x = ix_s%beg, ix_s%end


Issue 2 - Block macros documented with wrong calling convention

File: .claude/rules/gpu-and-mpi.md - Key GPU Macros section

Three macros that take a code block parameter are documented as inline @: calls:

@:GPU_PARALLEL(code, ...)
@:GPU_DATA(code, copy=..., create=..., ...)
@:GPU_HOST_DATA(code, use_device_addr=[...])

The actual calling convention for these block macros is #:call/#:endcall syntax:

#:call GPU_PARALLEL(copyout='[icfl_max_loc]', copyin='[icfl_sf]')
  ! Fortran code here
#:endcall GPU_PARALLEL

An AI agent following the documented @:GPU_DATA(code, ...) form would produce invalid Fypp.

Evidence:

#:if rdma_mpi
#:call GPU_HOST_DATA(use_device_addr='[buff_send, buff_recv]')
call nvtxStartRange("RHS-COMM-SENDRECV-RDMA")
call MPI_SENDRECV( &
buff_send, buffer_count, mpi_p, dst_proc, send_tag, &
buff_recv, buffer_count, mpi_p, src_proc, recv_tag, &


Issue 3 - Precheck coverage overstated for goto, stop, COMMON, save

File: .claude/rules/fortran-conventions.md - Forbidden Patterns section

The section header reads "These are caught by ./mfc.sh precheck (source lint step 4/5):" and includes:

- goto, COMMON blocks, global save variables
- stop, error stop - use call s_mpi_abort()
- Raw !$acc or !$omp directives - use Fypp GPU_* macros

Only the last bullet (raw !$acc/!$omp directives) and the double-precision intrinsics are actually checked by precheck step 4/5. goto, COMMON, save, stop, and error stop have no grep checks in toolchain/bootstrap/precheck.sh. An AI agent relying on this would assume those patterns are tooling-enforced when they are only convention-enforced.

Fix: Split the list into patterns actually caught by precheck vs. patterns enforced only by convention/code review.


In mixed-precision mode (--mixed), stp is set to half_precision (kind=2),
not single_precision, as confirmed in src/common/m_precision_select.f90.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- GPU macros use $: prefix (inline), not @: — matches all 400+ usages in src/
- GPU_PARALLEL, GPU_DATA, GPU_HOST_DATA are block macros using #:call/#:endcall
- Add block macro usage example
- Fix GPU_ROUTINE args: parallelism='[seq]', not function_name=
- Split forbidden patterns into precheck-enforced vs convention-enforced
  (goto, COMMON, save, stop are not checked by precheck.sh)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
CLAUDE.md (1)

113-125: Add a language to the fenced code block to satisfy MD040.

markdownlint flags the architecture block as missing a language specifier.

🔧 Proposed fix
-```
+```text
 src/
   common/         # Shared code (used by ALL three executables — wide blast radius)
   pre_process/    # Grid generation and initial conditions
   simulation/     # CFD solver (GPU-accelerated via OpenACC / OpenMP target offload)
   post_process/   # Data output and visualization
 toolchain/        # Python CLI, build system, testing, parameter management
   mfc/params/definitions.py   # ~3300 parameter definitions (source of truth)
   mfc/case_validator.py       # Physics constraint validation
   mfc/test/                   # Test runner and case generation
 examples/         # Example simulation cases (case.py files)
 tests/            # 500+ regression test golden files
-```
+```
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLAUDE.md` around lines 113 - 125, The fenced code block in CLAUDE.md is
missing a language specifier causing markdownlint MD040; update the opening
fence from ``` to ```text (or another appropriate language like ```none) so the
block becomes language-tagged, ensuring the directory tree snippet is fenced as
```text and the closing fence stays ```.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/rules/parameter-system.md:
- Around line 26-29: Update the heading "Adding a New Parameter (3-location
checklist)" to match the body by changing it to "Adding a New Parameter
(4-location checklist)" (or "4-step checklist") so the heading and the line "YOU
MUST update all 4 locations" are consistent; locate the heading string in the
file and edit only that text.

---

Nitpick comments:
In `@CLAUDE.md`:
- Around line 113-125: The fenced code block in CLAUDE.md is missing a language
specifier causing markdownlint MD040; update the opening fence from ``` to
```text (or another appropriate language like ```none) so the block becomes
language-tagged, ensuring the directory tree snippet is fenced as ```text and
the closing fence stays ```.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7895c6f and 5427de1.

📒 Files selected for processing (4)
  • .claude/rules/fortran-conventions.md
  • .claude/rules/gpu-and-mpi.md
  • .claude/rules/parameter-system.md
  • CLAUDE.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • .claude/rules/gpu-and-mpi.md
  • .claude/rules/fortran-conventions.md

…patterns

- Fix "3-location checklist" heading to "4-location" (parameter-system.md)
- Fix "all 3 locations" to "all 4 locations" in PR checklist (common-pitfalls.md)
- Remove non-existent $:END_GPU_LOOP() from block macro example (gpu-and-mpi.md)
- Add d0 literals, double precision, dcos/dsin/dtan to forbidden patterns list
- Reference toolchain/bootstrap/precheck.sh for full forbidden pattern list
- Fix Frontier system slug: OpenACC/OpenMP, not just OpenACC
- Clarify stp as "field data arrays and I/O", not just "I/O"
- Document @:PROHIBIT, @:ASSERT, @:LOG error-checking macros
- Document @:PREFER_GPU unified memory macro
- Document m_checker*.fpp Fortran-side runtime validation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

Claude Code Review (updated)

Head SHA: 20da91f

6 files changed:

  • CLAUDE.md
  • .claude/rules/common-pitfalls.md
  • .claude/rules/fortran-conventions.md
  • .claude/rules/gpu-and-mpi.md
  • .claude/rules/parameter-system.md
  • .github/copilot-instructions.md

Summary

  • Introduces CLAUDE.md (169 lines) as the primary instruction file for Claude Code, covering ./mfc.sh commands, development workflow contract, HPC system/module table, architecture layout, critical rules, naming conventions, and precision system.
  • Adds four .claude/rules/ domain files: Fortran conventions, GPU/MPI patterns, parameter system lifecycle, and common pitfalls — each extending the core CLAUDE.md with deeper technical detail.
  • Updates .github/copilot-instructions.md to document both the OpenACC and OpenMP target offload GPU backends and the GPU_* macro abstraction layer.
  • Documentation is purely additive — no source code (.fpp, Python toolchain, or tests) is changed.

Findings

Issue 1 — Wrong Fypp call prefix for GPU macros in gpu-and-mpi.md (lines 25–39)

All 14 GPU macros in the "Key GPU Macros" section are listed with the @: Fypp prefix:

- `@:GPU_PARALLEL_LOOP(...)`
- `@:GPU_UPDATE(...)`
- `@:GPU_PARALLEL(code, ...)`
...

The actual source uses two distinct prefixes depending on macro type:

Note: @: is correct for the non-GPU memory macros @:ALLOCATE / @:DEALLOCATE / @:ACC_SETUP_VFs — those are Fypp call-statement macros and are correctly documented. Only the GPU_* macros in the "Key GPU Macros" table need the prefix updated.

Affected lines: .claude/rules/gpu-and-mpi.md lines 25–39


Issue 2 — Frontier GPU backend listed as OpenACC; should be OpenMP in CLAUDE.md (line 78)

The HPC system table lists Frontier as:

| `f` | OLCF Frontier | OpenACC (Cray ftn) | ...

Frontier runs AMD MI250X GPUs (craype-accel-amd-gfx90a per toolchain/modules lines 44–46). AMD GPUs use OpenMP target offload, not OpenACC. This is also internally inconsistent: the PR's own compiler-backend matrix in gpu-and-mpi.md line 59 marks Cray ftn's primary GPU backend as OpenMP, not OpenACC.

The entry should read OpenMP (Cray ftn), matching the tuo (Tuolumne) entry which correctly uses the same backend.

Affected line: CLAUDE.md line 78


Issue 3 — Parameter location count inconsistency: "3" vs "4" across files

Three files give conflicting counts for how many locations require updating when adding a parameter:

File Says
CLAUDE.md line 139 ✅ "in 4 places"
parameter-system.md line 26 ❌ "3-location checklist" heading, then "all 4 locations" in body
common-pitfalls.md line 39 ❌ "all 3 locations updated"

The correct count is 4 (definitions.py, m_global_parameters.fpp, m_start_up.fpp, case_validator.py). The heading in parameter-system.md and the checklist item in common-pitfalls.md should both say "4".


Generated with Claude Code

@github-actions
Copy link

Claude Code Review (updated)

Head SHA: 3286cfa


6 files changed:

  • .claude/rules/common-pitfalls.md (new, +42)
  • .claude/rules/fortran-conventions.md (new, +58)
  • .claude/rules/gpu-and-mpi.md (new, +124)
  • .claude/rules/parameter-system.md (new, +54)
  • .github/copilot-instructions.md (modified, +1/-1)
  • CLAUDE.md (new, +170)

Summary

  • Adds CLAUDE.md (170 lines) as the primary Claude Code instruction file: CLI commands, development workflow contract, HPC cluster module-loading table, architecture overview, critical rules, naming conventions, and code review priorities.
  • Adds four modular .claude/rules/ files covering Fortran conventions, GPU/MPI macro patterns, the parameter system, and common pitfalls — automatically loaded by Claude Code alongside the core CLAUDE.md.
  • Updates .github/copilot-instructions.md to mention both OpenACC and OpenMP target offload backends instead of only OpenACC.
  • The GPU/MPI rules file documents the full GPU_* Fypp macro abstraction layer, the compiler-backend matrix (gfortran/nvfortran/Cray/ifx/AMD flang), preprocessor feature-gating defines, and MPI coherence requirements.
  • The parameter-system rules file describes the Python→Fortran namelist flow and the 4-location checklist for adding new parameters.

Findings

1. Internal contradiction in parameter-system.md: mandatory vs. conditional for location 4

File: .claude/rules/parameter-system.md, lines 28 and 36–37

Line 28 states:

"YOU MUST update all 4 locations. Missing any causes silent failures or compile errors."

But location #4 (line 36–37) is explicitly conditional:

"Add validation rules if the parameter has physics constraints."

The blanket "MUST update all 4 / missing any causes errors" statement is factually wrong for location 4 — omitting a case_validator.py entry for a parameter that has no physics constraints is correct behavior, not an error. CLAUDE.md handles this correctly with the (if constraints exist) qualifier. The contradiction in parameter-system.md could cause Claude to always add unnecessary validation entries.

Suggested fix for line 28:

YOU MUST update at least the first 3 locations. Missing any of those causes silent
failures or compile errors. Location 4 is required only if the parameter has physics
constraints (consistent with CLAUDE.md: "if constraints exist").

2. Namelist format example is inaccurate in parameter-system.md

File: .claude/rules/parameter-system.md, line 20

The documented format is:

Format: `&user_inputs / ... / &end`

The actual format produced by toolchain/mfc/case.py line 80 is:

return f"&user_inputs\n{dict_str}&end/\n"

i.e. &user_inputs\nkey = value\n...\n&end/ — the terminator is &end/ (slash after), not / ... / &end.

Suggested fix:

Format: `&user_inputs` … `&end/`

Improvement opportunities

  • CLAUDE.md test count (CLAUDE.md, testing section): States "500+ regression test golden files." The actual count is currently 561. Consider updating to "560+" for better accuracy; "500+" is technically true but understates coverage.
  • CLAUDE.md parameter count (CLAUDE.md, architecture section): States "~3300 parameter definitions." The registry currently registers ~3,403 parameters. Consider updating to "~3,400" to match toolchain/mfc/params/definitions.py's actual scope.
  • PR description vs. file content: The PR description bullet for parameter-system.md says "3-location checklist for new parameters" but the file correctly says "4-location checklist." Low impact (description only), but worth correcting for future readers.

- Fix parameter checklist: first 3 mandatory, #4 only if constraints exist
- Fix namelist format: &user_inputs ... &end/ (not &user_inputs / ... / &end)
- Update counts: ~3,400 params (was ~3,300), 560+ tests (was 500+)
- Add ghost cell allocation pattern (-buff_size:m+buff_size, idwint/idwbuff)
- Add field variable indexing system (cont_idx, mom_idx, E_idx, adv_idx, sys_size)
- Add test system details: programmatic generation, CaseGeneratorStack, UUID hashing
- Add scalar_field uses stp (not wp) to precision types
- Add analytical IC available variables (x, y, z, xc, yc, zc, lx, ly, lz, r, e, t)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sbryngelson sbryngelson merged commit 7997663 into master Feb 24, 2026
29 of 30 checks passed
@sbryngelson sbryngelson deleted the add-claude-md branch February 24, 2026 01:26
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.claude/rules/fortran-conventions.md (1)

8-15: Module Structure section is missing two enforced requirements.

The section covers implicit none and explicit intent but omits:

  1. private/public declarations — every new .fpp module must include explicit private/public declarations for all entities.
  2. docs/module_categories.json registration — new modules must be registered there; the precheck linter will fail if missing.
✏️ Proposed additions
 ## Module Structure
 Every Fortran module follows this pattern:
 - File: `m_<feature>.fpp`
 - Module: `module m_<feature>`
 - `implicit none` required
+- Explicit `private` by default; explicitly list all `public` symbols
+- Register module in `docs/module_categories.json` (precheck linter enforces this)
 - Explicit `intent(in)`, `intent(out)`, or `intent(inout)` on ALL subroutine/function arguments
 - Initialization subroutine: `s_initialize_<feature>_module`
 - Finalization subroutine: `s_finalize_<feature>_module`

Based on learnings: every new .fpp module must include explicit private/public declarations for all entities, and new modules must be registered in docs/module_categories.json (precheck linter will fail if missing).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/rules/fortran-conventions.md around lines 8 - 15, Update the "Module
Structure" section to require (1) explicit private/public declarations for every
entity in new modules (files following the m_<feature>.fpp pattern and modules
named module m_<feature>) and (2) registration of the new module in
docs/module_categories.json so the precheck linter passes; mention that these
rules apply to all modules including their initialization/finalization
subroutines s_initialize_<feature>_module and s_finalize_<feature>_module and
that missing either will cause the precheck to fail.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.claude/rules/fortran-conventions.md:
- Around line 8-15: Update the "Module Structure" section to require (1)
explicit private/public declarations for every entity in new modules (files
following the m_<feature>.fpp pattern and modules named module m_<feature>) and
(2) registration of the new module in docs/module_categories.json so the
precheck linter passes; mention that these rules apply to all modules including
their initialization/finalization subroutines s_initialize_<feature>_module and
s_finalize_<feature>_module and that missing either will cause the precheck to
fail.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5427de1 and 7104b11.

📒 Files selected for processing (5)
  • .claude/rules/common-pitfalls.md
  • .claude/rules/fortran-conventions.md
  • .claude/rules/gpu-and-mpi.md
  • .claude/rules/parameter-system.md
  • CLAUDE.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • .claude/rules/common-pitfalls.md
  • .claude/rules/gpu-and-mpi.md

@github-actions
Copy link

Claude Code Review (updated)

Head SHA: 7104b11

6 files changed:

  • .claude/rules/common-pitfalls.md (new, 63 lines)
  • .claude/rules/fortran-conventions.md (new, 63 lines)
  • .claude/rules/gpu-and-mpi.md (new, 124 lines)
  • .claude/rules/parameter-system.md (new, 66 lines)
  • .github/copilot-instructions.md (modified)
  • CLAUDE.md (new, 170 lines)

Summary

  • Adds a root-level CLAUDE.md covering MFC project identity, CLI commands, HPC system identification, development workflow contract, architecture overview, critical rules, naming/precision conventions, and code review priorities
  • Adds four modular .claude/rules/ files splitting domain-specific knowledge into common pitfalls, Fortran conventions, GPU/MPI patterns, and the parameter system
  • Updates .github/copilot-instructions.md to reflect that GPU acceleration supports both OpenACC and OpenMP target offload backends, not just OpenACC
  • The .claude/rules/gpu-and-mpi.md file documents the GPU macro abstraction layer (GPU_* Fypp macros), the compiler-backend matrix, preprocessor defines, and MPI patterns
  • The .claude/rules/parameter-system.md file documents the full Python → Fortran parameter flow and the 4-location checklist for adding new parameters

Findings

1. Misleading GPU_PARALLEL + GPU_LOOP block macro example

File: .claude/rules/gpu-and-mpi.md lines 44–53

The documented example shows a pattern with GPU_PARALLEL wrapping GPU_LOOP, but this pattern does not exist anywhere in the simulation codebase. All 331+ parallel spatial loops use GPU_PARALLEL_LOOP/END_GPU_PARALLEL_LOOP inline macros. GPU_PARALLEL is used only 3 times, all wrapping scalar reductions (minval/maxval), never wrapping a loop.

More critically, this example would produce silent serial execution on Cray and AMD compilers via the OpenMP backend. OMP_LOOP (the underlying OpenMP implementation of GPU_LOOP) emits an empty string for Cray (CCE) and AMD (LLVMFlang) compilers, leaving the loop with no scheduling directive inside a target teams region.

Suggested fix: Replace the block macro usage example with the actual GPU_PARALLEL_LOOP pattern that is used throughout the codebase.


2. Compiler-backend matrix has incorrect entries for Intel ifx and GNU gfortran

File: .claude/rules/gpu-and-mpi.md lines 65–74

The matrix marks both Intel ifx and GNU gfortran as No for --gpu mp (OpenMP target offload). However, CMakeLists.txt has explicit compiler-specific handling for both:

  • Intel ifx: CMakeLists.txt adds -fopenmp -fopenmp-targets=spir64 for Intel compilers in the OpenMP GPU path
  • GNU gfortran: CMakeLists.txt adds -foffload=amdgcn-amdhsa flags for GNU compilers when GPU is enabled

The corrected matrix should mark Intel ifx as Yes and GNU gfortran as Yes (experimental, AMD GCN only) for --gpu mp.


3. AMD flang inconsistency across documentation files

AMD flang is treated inconsistently across the docs:

  • CLAUDE.md line 6: Lists gfortran, nvfortran, Cray ftn, and Intel ifx as the four required compilers
  • CLAUDE.md Code Review Priority 7: States Compiler portability (all four compilers)
  • common-pitfalls.md line 39: Code must compile on gfortran, nvfortran, Cray ftn, and Intel ifx
  • common-pitfalls.md line 42: GPU builds only work with nvfortran, Cray ftn, and AMD flang

The last two points in common-pitfalls.md are self-contradictory: AMD flang is simultaneously not in the required compiler list and required for GPU builds. An AI assistant or developer following the all four compilers portability requirement would never flag AMD flang regressions.

Suggested fix: Add a note distinguishing CI-gated compilers (the four) from additionally supported GPU compilers (AMD flang for --gpu mp), or explicitly add AMD flang to the compiler list everywhere it appears.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Development

Successfully merging this pull request may close these issues.

1 participant