Skip to content

Add CLAUDE.md#14012

Merged
larsoner merged 7 commits into
mne-tools:mainfrom
cbrnr:claude
Jul 2, 2026
Merged

Add CLAUDE.md#14012
larsoner merged 7 commits into
mne-tools:mainfrom
cbrnr:claude

Conversation

@cbrnr

@cbrnr cbrnr commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

I think it would be a good idea if we provided a CLAUDE.md, so that contributors using AI can save tokens (energy). I intentionally do not want to add an AGENTS.md, since Claude doesn't read that by default, but other AI tools read CLAUDE.md AFAIK.

I've auto-generated this file with some minor manual edits. Let me know if it's missing something, or if there are any errors.

@cbrnr
cbrnr requested review from drammock and larsoner as code owners July 1, 2026 11:31

@cbrnr cbrnr left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

One thing I would include is that uv should be used for project management tasks if available.

@larsoner larsoner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No expert here (yet!) but this seems like a reasonable starting point!

I think uv vs not isn't something we need to tell AI agents at this stage (seems up to user preference still). But if you think it will benefit most people I can live with it

Comment thread CLAUDE.md Outdated
Comment thread CLAUDE.md Outdated
Comment thread CLAUDE.md Outdated
Comment thread CLAUDE.md Outdated
Comment thread CLAUDE.md
Comment thread CLAUDE.md Outdated
Comment on lines +14 to +20
This project has an explicit policy on AI-generated contributions (`CONTRIBUTING.md`):
- Fully-automated PRs/issues are not accepted; a human must review, understand, and be able to
explain every change before it's submitted under their name.
- Any PR that used AI assistance must disclose that in the PR description (tool + scope of use).
- Do not paste AI-generated text into issue/PR descriptions or comments.
- Be careful that generated code for specialized algorithms doesn't reproduce copyrighted
passages from papers/other codebases (license risk).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am worried about this being non-DRY. If this works it seems preferable

Suggested change
This project has an explicit policy on AI-generated contributions (`CONTRIBUTING.md`):
- Fully-automated PRs/issues are not accepted; a human must review, understand, and be able to
explain every change before it's submitted under their name.
- Any PR that used AI assistance must disclose that in the PR description (tool + scope of use).
- Do not paste AI-generated text into issue/PR descriptions or comments.
- Be careful that generated code for specialized algorithms doesn't reproduce copyrighted
passages from papers/other codebases (license risk).
This project has an explicit policy on AI-generated contributions (`CONTRIBUTING.md`).
Read that document and understand its implications.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I agree, but just mentioning the file is a soft instruction and requires a tool call, which an agent can or cannot follow. I've therefore added a hard instruction to import that file (as it is not very long I think that's OK).

cbrnr and others added 6 commits July 2, 2026 11:45
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
@larsoner

larsoner commented Jul 2, 2026

Copy link
Copy Markdown
Member

Okay this seems reasonable. I worry a bit about this getting out of date, but hopefully people using this can periodically update (or tell Claude to update it)! If it creates too much noise or drifts too badly we can strip out some of the details that are more likely to change over time (e.g., which readers exist). Thanks @cbrnr !

@larsoner
larsoner merged commit 971f4f7 into mne-tools:main Jul 2, 2026
32 checks passed
@cbrnr

cbrnr commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

I agree! But we just have to let Claude check and update it regularly (e.g., for every new release or something).

@cbrnr
cbrnr deleted the claude branch July 2, 2026 15:10

@drammock drammock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I realize this was already merged, but I was on holiday when it came through. Couple of comments that may be worth a follow-up

Comment thread CLAUDE.md

# fetch datasets explicitly if needed
python -c "import mne; mne.datasets.testing.data_path(verbose=True)"
python -c "import mne; mne.datasets.sample.data_path(verbose=True)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
python -c "import mne; mne.datasets.sample.data_path(verbose=True)
python -c "import mne; mne.datasets.sample.data_path(verbose=True)"

missing closing quote

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in #14044, let's use that PR to update/add/modify whatever we missed in the first iteration!

Comment thread CLAUDE.md
- Cross-reference liberally in docstrings/docs using Sphinx roles (`:func:`, `:class:`, `:meth:`,
`:attr:`, `:mod:`, `:ref:`) — but note an API element must appear in `doc/python_reference.rst`
for the cross-reference to resolve.
- Imports: Use absolute imports for new code (historical relative imports are tolerated in

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this surprised me; can you point to where a decision was made to use absolute imports for new code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ah, how quickly we forget 😅

CedricConday pushed a commit to CedricConday/mne-python that referenced this pull request Jul 12, 2026
@neuromechanist

Copy link
Copy Markdown
Contributor

I was making OSCAR and I found out that you now carry a CLAUDE.md. Congrats.

The trick to have AGENTS.md and CLADUE.md is to have instructions in the former and then import it to the latter using @AGENTS.md, it will directly import all the contents of the source file.

An additional trick could be to add Claude-only instructions appended as well. Look at this example: https://github.com/nemarOrg/website/blob/main/CLAUDE.md

Working with Codex and Copilot, they seem to like and follow AGENTS.md more to the words.

@cbrnr

cbrnr commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@neuromechanist yeah, that's a nice setup you have. The main goal here was to start with something very basic and expand as we go. We went for CLAUDE.md because Claude Code seems to be the most widely used coding assistant (I don't have any numbers, just my experience). It is really a pity that it doesn't read AGENTS.md that other assistants use.

Having said that, I'll implement your suggestion (which was already on my plan) in #14044. We don't have any Claude-specific instructions yet, I'd rather add those at a later point when more devs start working with coding assistants. If you have any additions for our current CLAUDE.md (soon-to-be AGENTS.md), let me know in #14044!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants