Skip to content

Add AI contribution policy and AGENTS.md - #3521

Merged
jeromekelleher merged 5 commits into
tskit-dev:mainfrom
jeromekelleher-bot:ai-policy
Dec 5, 2026
Merged

jeromekelleher merged 5 commits into
tskit-dev:mainfrom
jeromekelleher-bot:ai-policy

Conversation

@jeromekelleher-bot

@jeromekelleher-bot jeromekelleher-bot commented Dec 1, 2026 •

Copy link
Copy Markdown

🤖 AI generated message

Adds a policy on AI-assisted contributions, and an AGENTS.md giving coding agents the conventions for working in this repository. The intention is to trial this in tskit and, if it is accepted, apply the same thing across the other tskit-dev repositories.

What changes

  • CONTRIBUTING.md: a new "AI-assisted contributions" section. LLM use by tskit users is welcome. Automated contributions based purely on code scanning are discouraged, other than clear bug fixes in documented workflows.
  • AGENTS.md (new), in two halves:
    • "tskit-dev conventions" is meant to be identical in every tskit-dev repository. It repeats the policy and says what it means for an agent: if nobody has hit the problem in practice, do not open an issue or PR, and tell the person you are working for about the policy. It also covers uv usage, Python style, git conventions, no model or tool attribution in commit messages, and flagging agent-written text posted to issues and PRs with a 🤖 AI generated message line.
    • "This repository" is specific to tskit: layout, the Python and C build and test commands, the C conventions reviewers check, lint and docs, and files to leave alone.
  • CLAUDE.md (new): one line importing AGENTS.md, because Claude Code reads CLAUDE.md rather than AGENTS.md.
  • docs/development.md (separate commit):
    • a link to the policy from the git workflow section;
    • two instructions that said "repo root" or "project root" where the python directory was meant;
    • a typo.

@codecov

codecov Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.72%. Comparing base (b647632) to head (317737e).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3521   +/-   ##
=======================================
  Coverage   91.72%   91.72%           
=======================================
  Files          37       37           
  Lines       30839    30839           
  Branches     4921     4921           
=======================================
  Hits        28286    28286           
  Misses       2223     2223           
  Partials      330      330           
Flag Coverage Δ
C 82.32% <ø> (ø)
c-python 77.05% <ø> (ø)
python-tests 96.44% <ø> (ø)
python-tests-no-jit 33.26% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Python API 98.73% <ø> (ø)
Python C interface 91.21% <ø> (ø)
C library 91.27% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jeromekelleher
jeromekelleher marked this pull request as ready for review December 1, 2026 09:58
State the project's position on AI-assisted contributions in
CONTRIBUTING.md: LLM use by tskit users is welcome, but automated
contributions based purely on code scanning are discouraged, other
than clear bug fixes in documented workflows.

Add an AGENTS.md giving coding agents the same notice along with the
conventions and commands they need to work in the repository. The
first half is intended to be shared across tskit-dev repositories;
the second half is specific to tskit. CLAUDE.md imports AGENTS.md
so that Claude Code picks it up.

Text written by an agent and posted to an issue or PR should start
with a marker line, so that readers know what they are looking at.
Link the AI-assisted contributions policy from the git workflow
section. Also correct two instructions that named the repository
root where the python directory was meant, and fix a typo.
Make personal review explicit in the PR checklist so contributors own the changes they submit, including AI-generated material.
@Duncan-JR

Duncan-JR commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

I asked Astra how it would handle a user request to do a code scan given the changes in this PR: it claimed it would likely report back to the user about how the repo's policy discourages code scanning. It's main concern is that the exception in AGENTS.md for code scanning in the case of "clear bugs" could be interpreted by an agent as “scan until you can construct a failing example in a documented workflow”. This could still result in an agent-written PR to fix a minor bug that hasn't affected a user in practice.

I had Sol to do a code scan to find the lowest impact bug that would still satisfy the new requirements in this PR for code scanning contributions by an agent. It found that that the tskit migrations --precision option silently ignores the documented precision argument; this means that if something like uv run python -m tskit migrations --precision 2 test.trees is specified, the resulting migrations table still has the default six decimal places. It produced a reproduction script and test.

I'm guessing this minor bug hasn't been caught before because of how little used the migrations feature is. I'm not sure if this would be considered a worthwhile contribution; if not, maybe adding a qualification like the one in italics below might be useful?

  • The exception is a clear bug in a documented workflow: something the
    documentation says works, and does not. Include a minimal reproducer that
    fails on main, and a test. In such cases, the human contributor should still be presented with this policy, and they will need to explain the practical impact of the bug if they submit a PR or issue about it.

The policy only discouraged contributions found by code scanning, but
most recent pull requests from non-users pick open issues off the
tracker instead. Say that contributions are expected to come from
personal use of tskit or from wanting to get involved, and that an open
issue is not an invitation to submit a fix.

Tell agents to find out the motivation before starting, since they
cannot otherwise know whether the person they work for uses tskit, and
limit the clear-bug exception to bugs nobody has reported. Ask for the
motivation in the PR template so that its absence is a basis for
closing.
@jeromekelleher

Copy link
Copy Markdown
Member

I'm going to go ahead and merge this. The discussion has been open on Slack for several weeks and there has been no dissent. We can easily update later, but I think it's important to get some sort of policy live ASAP.

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.

3 participants