Skip to content

Add AGENTS.md - #12028

Merged
mashehu merged 24 commits into
nf-core:masterfrom
itrujnara:add_agents_md
Jul 3, 2026
Merged

Add AGENTS.md#12028
mashehu merged 24 commits into
nf-core:masterfrom
itrujnara:add_agents_md

Conversation

@itrujnara

Copy link
Copy Markdown
Contributor

This PR is part of the agent steering project (nf-core/proposals#143). It adds the initial version of AGENTS.md to facilitate AI-assisted development in this repository and increase submission quality.

The file is intended to provide basic guidance for agents working within the repository. It is not intended as a complete replacement for the component documentation or for the module developer agent skill. That said, I appreciate feedback on any missing basic information.

PR checklist

  • This comment contains a description of changes (with reason).

Comment thread AGENTS.md Outdated
Comment thread AGENTS.md
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment on lines +70 to +85
main.nf **MUST** define one `process` with the following elements:
- Nextflow directives:
- `tag`: used for distinguishing processes in logs, usually set to "$meta.id"
- one or more `label`: used to set default resources
- `conda`: always set to "${moduleDir}/environment.yml"
- `container`: contains links to Docker and Singularity containers, gated by a fixed container engine check
- you **MUST NOT** add any other directives, they will be set by the pipeline
- Input section (`input:`): generally one tuple per logical entity (sample, reference, etc.) and `val` inputs for mandatory options; see https://nf-co.re/docs/specifications/components/modules/input-output-options for details
- Output section (`output:`): generally one output per logical file (e.g. one for sam/bam/cram and one for bai/crai); there must also be one topic output for each tool (to report the version); see https://nf-co.re/docs/specifications/components/modules/input-output-options for details
- `when:` section: you **MUST** leave the boilerplate intact
- Main script (`script:`): contains the shell script to execute, along with Nextflow code to generate the arguments; the definitions of `args` and `prefix` **MUST** be left intact
- Stub script (`stub`): contains a script to simulate the action of the module without running the tool
- All output file names **MUST** match the main script
- Compressed files **MUST** be generated by compressing an empty file
- The definitions of `args` and `prefix` **MUST** be left intact

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can't we just point to the specifications and to use nf-core m lint, otherwise this will be a pain to keep in sync

Comment thread AGENTS.md Outdated
└── nextflow.config // Nextflow configuration used for testing ONLY; multiple config files may exist in some cases
```

## Key terms

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think I know much about prompt engineering so my instincts may not be useful, but to a human reader, I think this terminology is better to have defined before they are used.

Comment thread AGENTS.md Outdated
Comment thread AGENTS.md
Required structure:

```
modules/nf-core/{module}/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not sure if we should also add the gpu ones here, or give the bots the link to the documentation somewhere else: https://nf-co.re/docs/developing/components/gpu-modules

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.

Added in another place

Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
You can find the detailed documentation for each subcommand at https://nf-co.re/docs/nf-core-tools/cli/{modules|subworkflows}/{subcommand}.

## nf-test and testing
- Run module tests with `nf-core modules test {name}`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will be interesting. Me and my bots prefer nf-test commands. I'd like to see how this will affect my bots judgements on what to use. Might need to remove this AGENTS.md file on my side...

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.

Same for me, I do prefer nf-test commands

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.

nf-test has more useful output (sorry infra team), but nf-core is the "canonical" approach. Not sure what to do about this.

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.

Okay, changed it, useful output wins

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 think for me the advantage of running the nf-core command is that the tags are built-in

Comment thread AGENTS.md Outdated
## nf-test and testing
- Run module tests with `nf-core modules test {name}`.
- Run subworkflow tests with `nf-core subworkflows test {name}`.
- If you expect the output to change (e.g. after a tool update), you **SHOULD** update the snapshot with `nf-core modules/subworkflows test {name} --update`. You **MUST** regenerate snapshots on the same CPU architecture as CI.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

something about picking test names?

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.

There is info in the main.nf.test section above

Comment thread AGENTS.md Outdated
Comment thread AGENTS.md
Comment thread AGENTS.md

@maxulysse maxulysse 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.

Should we lint this file?

Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Co-authored-by: Maxime U Garcia <max.u.garcia@gmail.com>
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
- You **MUST** use special commit titles and no commit body in the following cases:
- only module version bump: "Bump versions in {module name}"
- only nf-test snapshot update: "Update snapshots in {component name}"
- Before each commit, you **MUST** run `prek`, stage all changes it generates, resolve all errors and all solvable warnings, and repeat until none remain.

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.

if pref is properly set up, there is no need to run prek before each commit

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.

I've had issues with it, especially when prettier checks failed (prek would block the PR instead of adding the necessary changes). Running prek manually fixes the issue. Not sure if that's my fault or a problem with the setup.

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.

@mashehu you are my personal prek master/guru

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It might have been discussed somewhere else and I missed it. But are we really encouraging commits by agents? That pushes even more of the review load onto reviewers (because it makes it too easy to push garbage, that an eager reviewer quickly jumps on instead of having a bit of a barrier what people actually commit)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Concerning prek: it (and from the sound of it also you @itrujnara 😜) should just install the pre-commit rules via prek install -f and thats it 🙂

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 fine with commits made by AGENTS as long as the human review them before asking an external review.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Which is not happening. Maybe we should instruct the agents to only open draft PRs to add a distinction step

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.

Good idea

Comment thread AGENTS.md Outdated
Comment thread AGENTS.md
Comment on lines +179 to +181
## Agent self-disclosure
- If you generated a majority of the code in a commit, you **MUST** add "Generated by {your name}" at the end of the commit message body.
- If you open a PR autonomously, you **MUST** add "Generated by {your name}" at the end of the PR message (above the checklist).

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.

Should we say something about AGENTS replying to comments in PRs?

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.

I'm not sure it will fully cure the issue (due to OpenClaw and the like), but it's worth a try

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 would like this as well please

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.

I have added a bullet about this

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.

We have noticed some non human like reply on both Slack and GitHub.
I am happy to help out a fellow human contributor.
I am less than happy helping what I thought was a human contributor that might not fully understand me but is actually an agent badly setup by a human.

Personal POV:
I see no issue discussing with an agent, if the replies are supervised, but otherwise I will just closed things, and I will consider removing the user from the github org.

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.

I think a complete AI policy is outside the scope of this PR, this only contains specific instructions for agents

itrujnara and others added 3 commits July 2, 2026 14:29
@vagkaratzas

Copy link
Copy Markdown
Contributor

some modules tagged in other modules' tests or subworkflows, require nf-test snapshots to be udpated there as welll. This should be made aparent before opening a PR

Make sure this is covered^. I dont think it is mentioned in the documentation.
Other than this, green light from me.

@vagkaratzas vagkaratzas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left a final comment

@itrujnara

Copy link
Copy Markdown
Contributor Author

some modules tagged in other modules' tests or subworkflows, require nf-test snapshots to be udpated there as welll. This should be made aparent before opening a PR

Make sure this is covered^. I dont think it is mentioned in the documentation. Other than this, green light from me.

I believe it's sufficiently addressed in the updated push routine section

@maxulysse maxulysse 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.

fine with me.
I would just like someone else to double check the part about prek.

Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md
Comment thread AGENTS.md Outdated
itrujnara and others added 2 commits July 2, 2026 17:06
Co-authored-by: Matthias Hörtenhuber <mashehu@users.noreply.github.com>
Comment thread AGENTS.md Outdated
Comment on lines +159 to +161
- You **MUST** use special commit titles and no commit body in the following cases:
- only module version bump: "Bump versions in {module name}"
- only nf-test snapshot update: "Update snapshots in {component name}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't understand the need for this?

Comment thread AGENTS.md Outdated
- If you expect the output to change (e.g. after a tool update), you **SHOULD** update the snapshot with `nf-core modules/subworkflows test {name} --update`. You **MUST** regenerate snapshots on the same CPU architecture as CI.

## git and branch policy
- You **MUST NOT** commit any code to `master`. Use pull requests instead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It won't let you, so does it really need stating?

Comment thread AGENTS.md Outdated
Comment on lines +147 to +148
- Run tests with `nf-test test {modules|subworkflows}/{path}/tests --profile=+{docker|singularity|conda}`
- If you expect the output to change (e.g. after a tool update), you **SHOULD** update the snapshot with `nf-core modules/subworkflows test {name} --update`. You **MUST** regenerate snapshots on the same CPU architecture as CI.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is saying to use two different methods?
I think nf-test is the more reliable one personally, it returns errors in a more verbose way. Can also recommand ``--stop-on-first-failure`.

Comment thread AGENTS.md Outdated
└── tests
├── main.nf.test // nf-test unit tests for the module
├── main.nf.test.snap // snapshots for the tests, **SHOULD ONLY** be editted through `nf-test` commands
└── nextflow.config // Nextflow configuration used for testing ONLY; multiple config files may exist in some cases

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We don't want multiple config files, they should use module_args.

Comment thread AGENTS.md Outdated
```
subworkflows/nf-core/{subworkflow}/
├── main.nf // Nextflow code of the subworkflow
├── meta.yml // YAML file containing information about the subworkflow

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Subworkflows can include a nextflow.config to make them work, this gets highlighted when you run nf-core subworkflows install (gives the includeConfig line)

Comment thread AGENTS.md
Comment thread AGENTS.md Outdated

### tests/main.nf.test
The test file **MUST** follow the specificaton at https://nf-co.re/docs/specifications/components/modules/testing.
- The name of each test **SHOULD** contain the name of the tool, the main input format, and other inputs if relevant (example: `test("samtools - bam - index")`). Stub test names **SHOULD** end with `- stub`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not the naming structure that we have in place. See: https://nf-co.re/docs/specifications/components/modules/testing#test-names

Comment thread AGENTS.md
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
itrujnara and others added 4 commits July 3, 2026 09:18
Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com>
Co-authored-by: Chris Hakkaart <chris.hakkaart@seqera.io>
Comment thread AGENTS.md Outdated
@itrujnara

Copy link
Copy Markdown
Contributor Author

I have addressed your suggestions @SPPearce. I completely forgot about the squasher, so the commit-related rules are indeed useless. I was also mistaken about test naming; that said, I feel like we should stick to the species - input1 - input2 naming scheme, but that's a discussion for another day.

itrujnara and others added 2 commits July 3, 2026 09:53
Co-authored-by: Matthias Hörtenhuber <mashehu@users.noreply.github.com>
@SPPearce

SPPearce commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

I have addressed your suggestions @SPPearce. I completely forgot about the squasher, so the commit-related rules are indeed useless. I was also mistaken about test naming; that said, I feel like we should stick to the species - input1 - input2 naming scheme, but that's a discussion for another day.

That went at least a year ago. I don't see any point in naming the species for the 98% of the modules where only one species is tested. I don't care about the names of the tests at all, provided they are vaguely meaningful (so test1 is bad).

@SPPearce SPPearce left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That seems better.

@itrujnara
itrujnara added this pull request to the merge queue Jul 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to Branch Protection failures Jul 3, 2026
You're not authorized to push to this branch. Visit "About protected branches" for more information.
@mashehu
mashehu merged commit 784074f into nf-core:master Jul 3, 2026
14 checks passed
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.

8 participants