Skip to content

Add AGENTS.md to guide AI agents and developers#170

Merged
dscho merged 6 commits into
mainfrom
add-an-AGENTS.md-file
Apr 30, 2026
Merged

Add AGENTS.md to guide AI agents and developers#170
dscho merged 6 commits into
mainfrom
add-an-AGENTS.md-file

Conversation

@dscho

@dscho dscho commented Apr 29, 2026

Copy link
Copy Markdown
Member

AI-assisted contributions are a reality of open source, and that includes the maintainers themselves. Over recent
months, AI has proven increasingly useful for the kind of menial, tedious work that does not require much creativity
but is highly boring when done by hand: chasing down CI failures, tracing cross-repository automation flows, and
adapting workflows to upstream changes.

This AGENTS.md provides enough context about the repository's architecture, conventions, and contracts that AI tools
can produce reasonable results even when a human contributor fails to steer carefully. Similar files have been added
to other repositories in the Git for Windows project: git and MINGW-packages.

So let's add an AGENTS.md file to provide guidance for AI agents (and developers) working with this repository. It documents:

  • The repository's purpose and architecture (slash commands, GitForWindowsHelper dispatch, check-run mirroring)
  • Critical contracts with gfw-helper-github-app (workflow filenames, check-run names, artifact names)
  • Key workflows, JavaScript modules, and shell scripts
  • The MSYS2 runtime stack and how it relates to Git Bash
  • Coding conventions (JS, shell, YAML) including the YAML block scalar indentation pitfall
  • Known pitfalls (sparse checkout commits, git describe in merging-rebase topologies, version update script environments)
  • GitHub workflow secrets' names and purposes, cross-repo relationships, and validation guidance
  • The maintainer development environment layout

dscho added 6 commits April 29, 2026 16:01
This repository's role in the Git for Windows ecosystem is not immediately
apparent from examining the code alone. It works in tandem with the
GitForWindowsHelper GitHub App, which receives slash commands and triggers
workflows here to perform the heavy lifting. Understanding this relationship,
along with patterns like check-run mirroring and the various workflow triggers,
requires cross-referencing multiple repositories and piecing together context
from workflow definitions, JavaScript modules, and shell scripts.

To reduce this onboarding burden for both human contributors and AI agents
assisting with maintenance, this document consolidates the essential
architectural knowledge: how workflows are triggered, what each module does,
which secrets are required, and how the pieces connect to other Git for Windows
repositories.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <[email protected]>
The initial version focused on describing what exists, but contributors also
need to know what must not change without coordination. Workflow filenames,
check-run names, artifact naming patterns, and summary text formats are parsed
by the GitForWindowsHelper GitHub App to drive cascading behavior. Changing
these without updating the helper app will silently break the automation
pipeline.

This revision reframes the guidance to be more prescriptive: preserve these
contracts, validate changes against the helper app's expectations, and treat
cross-repository updates as API boundaries. The expanded list of affected
repositories and the new validation checklist should help contributors avoid
accidentally breaking downstream consumers.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <[email protected]>
While reviewing the MSYS2 sync automation in PR #152, we discovered
that multi-line content inside `run: |` and `script: |` blocks
silently gets truncated when any line falls below the block's base
indentation level. This is particularly treacherous for heredoc bodies
and JS template literals whose content naturally starts at column 0.

Document the pitfall and the two mitigations that worked: indenting
heredoc bodies to match the YAML block's base indentation, and using
`[...].join('\n')` for multi-line JS strings.

See #152 (comment)
for the context that prompted this.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <[email protected]>
After rebasing onto current main, several files that were added since
the original AGENTS.md commit are now missing from the documentation:
the rebase-shears.yml and remove-packages-from-pacman-repository.yml
workflows, the gently.js and get-workflow-run-artifact.js modules, and
five root shell scripts (rebase-branch.sh, stash-with-conflicts.sh,
apply-stash-with-conflicts.sh, gh-cli-auth-as-app.sh, and
prepare-embargoed-branches.sh). This commit adds them all, together
with the .github/agents/ directory in the tree overview.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <[email protected]>
The previous version documented specific bugs (the v2.54.0 MSYS2 sync
deletion, the msys2-runtime version mis-detection) as if they were
open issues. They are fixed. What matters for AGENTS.md is the
generalizable learning that prevents the same class of mistake in
future, unrelated code:

Sparse checkout with --no-checkout leaves the index empty, so a bare
`git commit` sees deletions for every path outside the cone. This
applies anywhere worktrees are created this way, not just the MSYS2
sync branch.

`git describe` is unreliable for finding the nearest ancestor tag in
merging-rebase topologies. The `for-each-ref %(ahead-behind)`
approach generalizes to any repository with a similarly complex DAG.

Version update scripts are hard to debug because they operate on a
specific layout of bare clones, worktrees, and alternates files. The
key principle is object visibility: objects fetched into one clone are
invisible to another unless they share an object store or alternates
are configured.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <[email protected]>
Document the Cygwin -> MSYS2 -> Git for Windows fork chain for the
POSIX emulation runtime, and how it relates to what users call "Git
Bash" (which is actually mintty launching Bash on top of the
msys2-runtime). Note that the most common class of user-reported
bugs traces back to the pseudo-console emulation in the
msys2-runtime, not to Bash or mintty.

Document the maintainer development environment: the Git for Windows
SDK is typically installed on a Dev Drive (D:\) for I/O performance,
and repositories live under /usr/src/ inside the SDK. Beyond the
obvious core repos (git, MINGW-packages, MSYS2-packages,
build-extra, git-for-windows-automation), maintainers also commonly
have 7-Zip, setup-git-for-windows-sdk, rss-to-issues,
track-website-changes, and msys2-runtime checked out there.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <[email protected]>
@dscho
dscho force-pushed the add-an-AGENTS.md-file branch from 71df4d7 to b23cc23 Compare April 29, 2026 14:22
@dscho dscho self-assigned this Apr 29, 2026
@dscho
dscho requested review from mjcheetham and rimrul April 29, 2026 14:47
@dscho
dscho marked this pull request as ready for review April 29, 2026 14:47
@dscho
dscho merged commit 3fecfa3 into main Apr 30, 2026
@dscho
dscho deleted the add-an-AGENTS.md-file branch April 30, 2026 07:31
dscho added a commit to git-for-windows/build-extra that referenced this pull request Jun 20, 2026
AI-assisted contributions are a reality of open source, and that
includes the maintainers themselves. Over recent months, AI has proven
increasingly useful for the kind of menial, tedious work that does not
require much creativity but is highly boring when done by hand: chasing
down CI failures across the installer/portable/MinGit build matrix,
tracing cross-repository packaging flows, adapting file-list exclusions
when upstream MSYS2 packages shuffle their contents.

This `AGENTS.md` provides enough context about the repository's
architecture, conventions, and contracts that AI tools can produce
reasonable results even when a human contributor fails to steer
carefully. It documents the repository structure (artifact generators,
custom Pacman packages, key scripts), the two-layer exclusion mechanism
in `make-file-list.sh` and how it interacts with
`check-for-missing-dlls.sh`, the `please.sh` subcommands that remain
after the migration to `git-for-windows-automation`, platform
considerations (all four architecture variants including the ongoing
UCRT64 migration), coding conventions for shell/Node.js/Inno
Setup/PKGBUILD files, the relationship with sibling repositories, and
expectations around commit quality and AI slop avoidance.

Similar `AGENTS.md` files have been added to other repositories in the
Git for Windows project:
[git](git-for-windows/git#6198),
[git-for-windows-automation](git-for-windows/git-for-windows-automation#170),
[MINGW-packages](git-for-windows/MINGW-packages#194),
[MSYS2-packages](git-for-windows/MSYS2-packages#289),
and
[git-for-windows.github.io](git-for-windows/git-for-windows.github.io#88).
dscho added a commit to git-for-windows/gfw-helper-github-app that referenced this pull request Jun 23, 2026
AI-assisted contributions are a reality of open source, and that
includes the maintainers themselves. Over recent months, AI has proven
increasingly useful for the kind of menial, tedious work that does not
require much creativity but is highly boring when done by hand: chasing
down webhook delivery failures, tracing how a single slash command fans
out into cross-repository workflow dispatches and check-run cascades,
and adapting to GitHub API changes that quietly break the automation.

This `AGENTS.md` provides enough context about the repository's
architecture, conventions, and contracts that AI tools can produce
reasonable results even when a human contributor fails to steer
carefully. It documents the
thin-Azure-Function-that-delegates-to-`git-for-windows-automation`
architecture and the two contracts holding it together (workflows
dispatched by file name; check-run names and summaries parsed by
`cascading-runs.js`), the slash commands and how `/deploy` maps packages
to architectures, the `embargoed-builds/` worktree that must _not_ be
edited from `main`, and the build/test/lint commands and test-harness
quirks. It mirrors `git-for-windows-automation`'s `AGENTS.md` and points
back at it, since the two describe opposite ends of the same contract.

Similar `AGENTS.md` files have been added to other repositories in the
Git for Windows project:
[git](git-for-windows/git#6198),
[git-for-windows-automation](git-for-windows/git-for-windows-automation#170),
[build-extra](git-for-windows/build-extra#718),
[MINGW-packages](git-for-windows/MINGW-packages#194),
and
[MSYS2-packages](git-for-windows/MSYS2-packages#289).

It is stacked on #220 on purpose, so that what it says about `/deploy`
matches the code there; until that lands, the diff below also includes
#220's commit.
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.

2 participants