agentleFS
CliMACliMA/Oceananigans.jl/AGENTS.md

Oceananigans.jl

AGENTS.md1.4k starsChanged 9 days agoMITView on GitHub

Oceananigans.jl is a Julia package for fast, friendly, flexible, ocean-flavored fluid dynamics on CPUs and GPUs. It solves the incompressible (Boussinesq) Navier-Stokes equations with models including: nonhydrostatic (with free surfaces), hydrostatic free-surface, and shallow water — on RectilinearGrid, LatitudeLongitudeGrid, ConformalCubedSphereGrid, TripolarGrid, and ImmersedBoundaryGrid. - All structs must be concretely typed - Type annotations are for dispatch, not documentation - Minimize allocation; favor inline computation - Never hardcode Float64: no literal 0.0 or 1.0 in kernels or constructors. Use zero(grid), one(grid),…

Trending

More talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 2 mentionsFeb 2026: 2 mentionsMar 2026: 1 mentionApr 2026: 2 mentionsMay 2026: 0 mentionsJun 2026: 1 mentionJul 2026: 1 mentionAug 2026: 2 mentionsSep 2026: 1 mentionOct 2026: 7 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the CliMA/Oceananigans.jl repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about CliMA/Oceananigans.jl

The biggest 5 of 48 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 48

Talked about on GitHub, Bluesky and Hacker News (48 times).

On GitHub · 45

40 more on GitHub
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository5 other files it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

23 rules. About 0 are common, 10 are distinctive, and 13 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 13

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use @kernel / @index (KernelAbstractions.jl)

    line 20
  2. Very specific:

    Use ifelse — never short-circuiting if/else in kernels

    line 22
  3. Distinctive:

    No error messages, no Models inside kernels

    line 23
  4. Distinctive:

    All structs must be concretely typed

    line 29
  5. Very specific:

    Never hardcode Float64: no literal 0.0 or 1.0 in kernels or constructors.

    line 32
  6. Very specific:

    Use zero(grid), one(grid), convert(FT, 1//2), or rational literals

    line 33
  7. Very specific:

    Use DocStringExtensions.jl with $(TYPEDSIGNATURES) when the signature does not include default values for args and/or kwargs.

    line 42
  8. Very specific:

    Use unicode for math (Δt, η, ρ), not LaTeX — LaTeX doesn't render in the REPL

    line 46
  9. Distinctive:

    Overconstraining types: use annotations for dispatch, not documentation

    line 100
  10. Very specific:

    Plain julia blocks in docstrings: always use jldoctest

    line 102
  11. Distinctive:

    Expecting unexported names: consider exporting them rather than changing user scripts

    line 104
  12. Distinctive:

    Quick fixes that break correctness: if a test fails after a change, revisit the original edit

    line 107
  13. Distinctive:

    Commented-out code: delete it. Git is the journal — don't leave commented code, debugging artifacts, or stale copy-paste remnants

    line 108
  14. Very specific:

    2D indexing on fields: always use 3D indexing (field[i, j, k]).

    line 110
  15. Very specific:

    Hardcoded Float64: never use 0.0, 1.0 in kernels or constructors.

    line 112
  16. Distinctive:

    Scope creep in PRs: keep changes focused on a single concern.

    line 113
  17. Very specific:

    Modifying Project.toml dependencies: never add, remove, or change [deps] or [weakdeps] in the root Project.toml unless the task absolutely …

    line 115
  18. Very specific:

    Only touch [compat] bounds when explicitly asked.

    line 118
  19. Distinctive:

    Follow ColPrac. Feature branches, descriptive commits, update tests and docs with code changes, check CI before merging.

    line 122
  20. Very specific:

    Dispatch over conditionals: use Julia's type system and multiple dispatch instead of if/else branching.

    line 127
  21. Very specific:

    Defaults serve the common case: avoid nothing defaults when a concrete default (like CPU()) covers 80% of usage.

    line 130
  22. Distinctive:

    Follow established patterns in existing code

    line 139
  23. Distinctive:

    Add tests for new functionality.

    line 140

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Oceananigans.jl — Agent Rules

Project Overview

Oceananigans.jl is a Julia package for fast, friendly, flexible, ocean-flavored fluid dynamics on CPUs and GPUs. It solves the incompressible (Boussinesq) Navier-Stokes equations with models including: nonhydrostatic (with free surfaces), hydrostatic free-surface, and shallow water — on RectilinearGrid, LatitudeLongitudeGrid, ConformalCubedSphereGrid, TripolarGrid, and ImmersedBoundaryGrid.

Language & Environment

  • Julia 1.10+ | CPU and GPU (CUDA, AMD, Metal, OneAPI)
  • Key packages: KernelAbstractions.jl, CUDA.jl, Enzyme.jl, Reactant.jl
  • Style: ExplicitImports.jl for source code; using Oceananigans for examples/tests

Critical Rules

Kernel Functions (GPU compatibility)

  • Use @kernel / @index (KernelAbstractions.jl)
  • Kernels must be type-stable and allocation-free
  • Use ifelse — never short-circuiting if/else in kernels
  • No error messages, no Models inside kernels
  • Mark functions called inside kernels with @inline
  • Never loop over grid points outside kernels — use launch!

Type Stability & Memory

  • All structs must be concretely typed
  • Type annotations are for dispatch, not documentation
  • Minimize allocation; favor inline computation
  • Never hardcode Float64: no literal 0.0 or 1.0 in kernels or constructors. Use zero(grid), one(grid), convert(FT, 1//2), or rational literals

Imports

  • Source code: explicit imports (checked by tests)
  • Examples/docs: rely on using Oceananigans; never explicitly import exported names

Docstrings

  • Use DocStringExtensions.jl with $(TYPEDSIGNATURES) when the signature does not include default values for args and/or kwargs.
  • ALWAYS jldoctest blocks, NEVER plain julia blocks — doctests are tested; plain blocks rot
  • Include # output with verifiable output; prefer show methods over boolean comparisons
  • Use unicode for math (Δt, η, ρ), not LaTeX — LaTeX doesn't render in the REPL

Model Constructors

  • grid is positional: NonhydrostaticModel(grid; closure=nothing)
  • ShallowWaterModel(grid, gravitational_acceleration; ...) — both positional
  • Omit semicolon when there are no keyword arguments: NonhydrostaticModel(grid) not NonhydrostaticModel(grid;)

Naming Conventions

  • Files: snake_case matching the type they define — nonhydrostatic_model.jl
  • Types/Constructors: PascalCase only for true constructors — NonhydrostaticModel
  • Functions: snake_case — time_step!; functions that return values are never PascalCase
  • Kernels: may prefix with underscore — _compute_tendency_kernel
  • Variables: English long name or readable unicode math notation — never mix abbreviated and full forms (e.g., cond vs condition) to imply a difference; be specific

Module Structure

src/
├── Oceananigans.jl                 # Main module, exports
├── Architectures.jl                # CPU/GPU architecture abstractions
├── Grids/                          # Grid types and constructors
├── OrthogonalSphericalShellGrids/  # Tripolar and other curvilinear spherical-shell grids
├── ImmersedBoundaries/             # ImmersedBoundaryGrid and immersed boundary conditions
├── MultiRegion/                    # Multi-region grids (ConformalCubedSphereGrid)
├── DistributedComputations/        # MPI-distributed architectures and halo communication
├── Fields/                         # Field types and operations
├── AbstractOperations/             # Lazy operations on fields (KernelFunctionOperation, etc.)
├── Operators/                      # Finite difference operators
├── BoundaryConditions/             # Boundary condition types
├── Forcings/                       # Forcing functions
├── Coriolis/                       # Coriolis formulations
├── BuoyancyFormulations/           # Buoyancy models
├── Advection/                      # Advection schemes
├── TurbulenceClosures/             # LES and eddy viscosity models
├── Models/                         # Model implementations
│   ├── NonhydrostaticModels/
│   ├── HydrostaticFreeSurfaceModels/
│   ├── ShallowWaterModels/
│   └── LagrangianParticleTracking/
├── TimeSteppers/                   # Time stepping schemes
├── Solvers/                        # Poisson and tridiagonal solvers
├── Simulations/                    # High-level simulation interface
├── Diagnostics/                    # Diagnostics and callbacks
├── OutputWriters/                  # File I/O
├── OutputReaders/                  # FieldTimeSeries and output loading
└── Utils/                          # Utilities and helpers

Common Pitfalls

  1. Type instability in kernels ruins GPU performance
  2. Overconstraining types: use annotations for dispatch, not documentation
  3. Missing imports: tests will catch this — add to using statements
  4. Plain julia blocks in docstrings: always use jldoctest
  5. Subtle bugs from missing method imports, especially in extensions
  6. Expecting unexported names: consider exporting them rather than changing user scripts
  7. Extending getproperty to fix undefined property bugs: fix on the caller side instead
  8. "Type is not callable" errors: variable name shadows a function — rename or qualify
  9. Quick fixes that break correctness: if a test fails after a change, revisit the original edit
  10. Commented-out code: delete it. Git is the journal — don't leave commented code, debugging artifacts, or stale copy-paste remnants
  11. 2D indexing on fields: always use 3D indexing (field[i, j, k]). 2D indexing works by coincidence on some fields but is unsupported and will break
  12. Hardcoded Float64: never use 0.0, 1.0 in kernels or constructors; use zero(grid) etc.
  13. Scope creep in PRs: keep changes focused on a single concern. Unrelated cleanup goes in a separate PR
  14. Modifying Project.toml dependencies: never add, remove, or change [deps] or [weakdeps] in the root Project.toml unless the task absolutely requires it. Dependency changes have wide-reaching consequences — they affect CI, load time, and downstream compatibility. Only touch [compat] bounds when explicitly asked.

Git Workflow

Follow ColPrac. Feature branches, descriptive commits, update tests and docs with code changes, check CI before merging.

Design Principles

  • Dispatch over conditionals: use Julia's type system and multiple dispatch instead of if/else branching. Backend-specific code goes in ext/ extensions, not if branches in src/
  • Use on_architecture for data transfers — never manual Array() / CuArray() calls
  • Defaults serve the common case: avoid nothing defaults when a concrete default (like CPU()) covers 80% of usage. Minimize boilerplate for the typical user.
  • Keyword argument names must be consistent across related types and constructors
  • Always use explicit return in functions longer than one expression
  • One operation per line as default; break long expressions across lines

Agent Behavior

  • Prioritize type stability and GPU compatibility
  • Follow established patterns in existing code
  • Add tests for new functionality; update exports when adding public API
  • Reference physics equations in comments when implementing dynamics

Further Reading

Detailed reference docs are in .agents/ — read on demand:

DocumentContent
.agents/testing.mdFull testing guidelines, running tests, debugging
.agents/documentation.mdBuilding docs, fast builds, doctest details, writing examples
.agents/validation.mdReproducing paper results step-by-step

Auto-loading Rules

Rules in .claude/rules/ load automatically when you touch matching files:

  • kernel-rules.md — GPU kernel requirements (src/)
  • docstring-rules.md — docstring and jldoctest conventions (src/)
  • testing-rules.md — test writing and running (test/)
  • docs-rules.md — documentation building and style (docs/)
  • examples-rules.md — Literate.jl example conventions (examples/)
  • style-rules.md — naming, notation, and comment style (src/, test/, validation/, examples/)
  • restriction-rules.md — small diffs, no scaffolding, scarce comments, and a self-review checklist (src/, test/, validation/, examples/)
  • julia-repl-rules.md — prefer an MCP Julia REPL over Bash when available (always)

Skills (slash commands)

  • /run-tests — run targeted tests, prioritized by what's likely to break
  • /build-docs — build documentation locally
  • /add-feature — checklist for adding new physics/features
  • /new-simulation — set up, run, and visualize a new simulation (with or without a reference paper)
  • /babysit-ci — monitor CI, auto-fix small issues, pause on bigger problems, retrigger flaky runs

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.