Skip to content

DOC Expand AGENTS.md and automated contributions policy - #33780

Closed
ogrisel wants to merge 3 commits into
scikit-learn:mainfrom
ogrisel:doc/agents-and-automated-contributions-policy
Closed

ogrisel wants to merge 3 commits into
scikit-learn:mainfrom
ogrisel:doc/agents-and-automated-contributions-policy

Conversation

@ogrisel

@ogrisel ogrisel commented Apr 17, 2026 •

Copy link
Copy Markdown
Member

Context

First step towards: #33398 (comment) without changing the installation instructions yet. I plan to open another PR to improve the developer setup doc to better leverage our pyproject toml when using pip or uv.

I also rephrased the AI contribution policy to avoid addressing the reader as "you" so that it can be unambiguously interpreted by AI agents and their human operators (assuming the latter take the time to read our contributions guidelines) in the spirit of #33398 (comment).

Summary

  • Expand AGENTS.md with guidance on dev environment (see development_setup.rst), local testing, and pre-commit on changed files.
  • Clarify the automated contributions policy in contributing.rst: human operator responsibility, disclosure, and expectations for AI-assisted work.

This pull request includes code written with the assistance of AI. (@ogrisel actually manually edited the text and just told cursor to open the PR test the agent behavior w.r.t. disclosure, it seems to work as expected).
The code has not yet been reviewed by a human. (@ogrisel reviewed it).

Made with Cursor

- Document dev environment, local testing, and pre-commit for AI assistants
- Clarify automated contribution policy: human review, disclosure, account use

Made-with: Cursor
ogrisel added 2 commits April 17, 2026 11:17
- Reference contributing.rst automated contributions policy after disclosure
- Require agents to surface guideline conflicts to operators before proceeding

Made-with: Cursor
@ogrisel

ogrisel commented Apr 17, 2026

Copy link
Copy Markdown
Member Author

Semi-random cc @StefanieSenger @betatim @adrinjalali @reshamas.

@adrinjalali adrinjalali moved this to In progress in Labs Apr 20, 2026
@adrinjalali adrinjalali added this to Labs Apr 20, 2026

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

Otherwise LGTM.

Comment thread AGENTS.md
Comment on lines +13 to +15
Instructions to set up a working development environment for Linux, macOS, and
Windows are detailed in `doc/developers/development_setup.rst`.

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.

in practice, what works well for me, is to say "read our CI infrastructure and use our conda lock files to create a local env"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That would work but that does not allow the use of incremental building because this will use the build isolation instead of the no-build isolation dev mode.

Comment thread AGENTS.md

If this is not the case, they are expected to manage and use their own
developer environment following those instructions before attempting to run the
tests or to run other commands for debugging purposes.

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'm not sure I like this. I tend to tell Cursor explicitly which conda env I want it to use (for that particular conversation). I also prefer it to fail instead of having it go off and create venvs or conda envs "at random" :-/

As a local "curiosity" I have a short instruction explaining that most envs are named sklearn-YYYYMMDD and that it should use the newest one unless told otherwise. But that seems like a thing that I like and not a thing that is/should be true for all contributors.

@ogrisel ogrisel Apr 20, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Using the latest or a user provided env does not work when you use the "cloud" or "worktree" mode of cursor and the like. Each agent might require an isolated env if working concurrently on different issues, some of which might require installing a specific version of a dependency to reproduce a bug for instance.

If we can get agents to manage their own env when needed will probably help from a productivity point of view.

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.

Agreed that sometimes agents need to setup their own env. For me the question is how we combine instructions for that with them asking the user what env to use/using the currently active one when they aren't doing "in parallel" work

I don't really use the worktree feature a lot, so I don't know the answer, but I would expect the agent to figure out how to create a venv for itself if it needs one? It seems like all the information is in our pyproject.toml. The reason I'm asking is that 99% of the time an agent uses pip install -e. to install a project, so I don't need to describe to them how to install a project. Unless the project is weird and doesn't support editable installs. This is why I'm thinking we don't need to tell them how to setup a dev env, the [build-system] section combined with the tests optional deps should do it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

pip install -e . works (with build isolation) but is not efficient because it does not support incremental building of Cython extensions. Disabling build isolation requires more complex instructions as discribed in our doc, hence this PR.

@ogrisel ogrisel Apr 28, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I recently tried to use copilot to work on a simple issue as a trial and it failed 7 times before being able to get a working pytest env with scikit-learn correctly built in dev mode:

image

source: https://github.com/scikit-learn/scikit-learn/agents/pull/33873?session_id=61750b59-3c22-4502-8315-26d68141eba9

@ogrisel ogrisel Apr 28, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In the same PR, we can see that copilot and I wasted time coming up with a changelog entry that follows our guidelines (it probably did not discover the instructions in doc/whats_new/upcoming_changes/README.md by itself so it would probably help also pointing to that file from our contributors' doc/agents.md or a skill file.

Comment thread AGENTS.md
Comment on lines +13 to +14
Instructions to set up a working development environment for Linux, macOS, and
Windows are detailed in `doc/developers/development_setup.rst`.

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 just these two lines are enough for an agent to figure out what to do, we don't need all the other paragraphs in this section. And I even wonder if we need these two lines or if the agent has already read/indexed this dev setup documentation by the time a user asks it to do something related to testing.

For example, the paragraph before this one states something obvious ("you need an env with the right things installed"), which I think is a good introduction paragraph for a human reader. But I somehow doubt it adds anything for an Agent.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For example, the paragraph before this one states something obvious ("you need an env with the right things installed").

Whenever I try to start I ask an agent to work on a new issue, I need to be explicit about how to install (or reuse the env). Otherwise, it's starts using the python3 system env and fails.

I suppose that I am not the only one and the purpose of that PR was to make the default behavior saner.

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 here, which is why I have a custom AGENTS.md that contains a line about using conda envs and how to find the one (that is the right one to use 99% of the cases). My point is that this is somehow personal, I don't want my agent to use venv, it should use the conda env I already have. And someone else might want to use pixi or venv.

How do we make a useful entry in the shared AGENTS.md about this topic and still cater to the fact that different people have different setups/preferences?

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.

Maybe a way forward is to create skills for creating/using a venv, one for conda and one for the third most popular option? That would allow the agent to be better at doing this task and we allow some customisation/preference.

It also avoids making the AGENTS.md long (eg by adding three different options to it directly). Rumor has it that the less relevant content the agent finds in a AGENTS.md the less likely it is to follow any of the instructions. The advice is to use the AGENTS.md more as TOC/linking out to more detailed instructions (the fancy word is "progressive disclosure").

@ogrisel ogrisel Apr 27, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe we could indeed create skills to avoid cluttering the context size of agents.

But note that this PR points to our existing doc so that the agent does not have to read it all unless needed.

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.

The reason I thought of skills as a possible solution was that different people want their agents to use different ways of creating envs. For example, I'd like it to use mamba.

My first reaction was to be against adding this, but I think the reason for this wasn't that I don't want the information/instructions but that I want other instructions.

Automated Contributions Policy
==============================

Contributing to scikit-learn requires human judgment, contextual understanding, and

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 keep the original content. The new one is longer and for a moment had me thinking I was reading AGENTS.md. The target audience for this document is a human, not an agent. This means that I think "you" is clear here, it is "you the reader".

Some of the additions like "Tools should not participate in discussions without thei own dedicated account/name" are maybe more appropriate for AGENTS.md. For the human reader I would argue we have already stated this by saying "Please refrain from submitting issues or PRs generated by fully automated tools"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

the target audience for this document is a human, not an agent. This means that I think "you" is clear here, it is "you the reader".

In practice, I am affraid that agents will be more and more likely to read this doc compared to humans and therefore I wanted to make it useful whatever the nature of the reader.

@betatim

betatim commented Apr 28, 2026

Copy link
Copy Markdown
Member

Reflecting on the discussions above I have the impression that there are things we agree on (we should make some skills to help agents achieve tasks with less trial&error) and changes to the "automated contribution" policy that we don't agree on.

Should we split things up? For example making a PR with a skill that helps create a whats new entry and a PR that adds a skill on how to decide what kind of env to create (conda/mamba vs venv), how to create envs, install scikit-learn and then use them - these seem uncontroversial.

I'd like to keep the contributing policy entry targeted at humans and not too focussed on AI tools. This is because security scanner results, mass typo fixes, adding typing, changing linter configs, etc are all "automated contributions" that I would like to discourage via this policy. Just like using AI, there are times when we welcome it, but people shouldn't just point their favourite automatic tool at scikit-learn and dump issues/PRs on us.

@ogrisel

ogrisel commented Apr 28, 2026

Copy link
Copy Markdown
Member Author

Alright. Let me close this PR for now and I will start new PR(s) with the things we agree on.

@ogrisel ogrisel closed this Apr 28, 2026
@github-project-automation github-project-automation Bot moved this from In progress to Done in Labs Apr 28, 2026
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.

3 participants