Skip to content

Add the AGENTS.md - #2092

Draft
eap wants to merge 4 commits into
JCSDA:developfrom
eap:feature/agentsmd
Draft

Add the AGENTS.md#2092
eap wants to merge 4 commits into
JCSDA:developfrom
eap:feature/agentsmd

Conversation

@eap

@eap eap commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Add an AGENTS.md file. This file sets ground rules for how agents interact with spack-stack and gives documentation pointers and agent-specific instructions.

This file was primarily generated by claude using notes from a long-running install and debug session.

Motivations

  • Constrain unwanted agent behaviors; no autonomous pull requests, tool attributions, destructive behavior.
  • Give agents advice on common tasks; install, debug, site updates.
  • Agent-specific advice on managing spack commands; executing and following commands with overwhelming output or long runtimes like concretize and install

Comment thread AGENTS.md Outdated
@mathomp4

mathomp4 commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Might be interesting to look at mom-ocean/MOM6#1699

In that @adcroft made a sort of symlink or reference nest of various markdown files to support a few different agents (CLAUDE.md, AGENTS.md, .github/copilot-instructions.md, etc.).

This might not be needed anymore?

@climbfuji climbfuji left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A few minor comments and corrections, other than that I am fine with merging this and making incremental changes as we go.

Comment thread AGENTS.md
Comment on lines +201 to +211
- Never `module load` the vendor toolchain in the shell running `spack install`:
an already-loaded module reads as a *failed* load — `ModuleLoadError` for a
module that loads fine by hand. `module use` the directory, purge, let spack
load.
- No module may appear in two externals' `modules:` lists in one DAG; the second
load is a no-op and errors. Each list must also be self-sufficient and in
prereq order, since spack loads externals in DAG order. When those two collide,
drop `modules:` from the dependent external and rely on `prefix:` — many vendor
packages (e.g. intel-oneapi-mkl) self-configure.
- It fails *late* and blames the wrong thing (concretize never loads modules).
Probe cheaply: `spack build-env <mpi-using-spec> -- true`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is no longer true thanks to the bug fix from @mathomp4 that we merged into spack (the submodule spack) recently.

Comment thread AGENTS.md
the config for its *variants*, not its version. Scope them: `- spec: ~crypt` +
`when: '@:3.12'`.

**4. Every external needs `prefix:`** (and `buildable: false`). Spack silently

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You don't need prefix if you have modules, I think

Comment thread AGENTS.md
`setup_build_environment`, external `modules:`, all of it) without building:
`-- bash` for a shell in it, `-- bash -c 'echo $CFLAGS'` to check a flag reached
the build, `-- true` to test whether it assembles at all (the cheap module-trap
probe). Highest-value, most underused command in spack.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The command to use is

spack build-env <spec> -- bash --norc --noprofile

which is what Spack uses when it runs spack install.

Comment thread AGENTS.md

| Symptom | Likely cause |
|---|---|
| `ModuleLoadError` but it loads by hand | preloaded module, or two externals list it (§5.1) |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ditto, no longer true

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants