Skip to main content

Header image which says “global .gitignore files” and has a centaur using a laptop

Before we dive into the problem, let’s set the stage for all the terms which maybe new to someone.

AI Centaur

Cory Doctorow describes Centaurs as

The idea of “centaurs” comes from automation theorists: it describes a system where a human and a machine collaborate to do more than either one could do on their own

I have recently heard this also referred to as an “AI Native”, no doubt a play on “Digital Native” - but Centaurs are a better term in isolation and paired with Reverse-Centaur (see the link above for this is).

AGENTS files

So you may work with a centaur, or you may be one yourself - and if you are in that situation, you have seen the increasing AGENTS.md format slowly creeping up into a variety of your code bases. Some tools have different filenames, like Warp (which I highly recommend) uses a `WARP.md, but I am going to call them AGENTS files for this post.

A key detail on AGENTS files though is while there is a standard name, there is no standard for the content - just recommendations that your favourite AI agent/tool should use.

Problem

In theory, teams could commit their AGENTS file to the repo, and everyone in the team benefits from a single file. However, this seems to fail in 2 ways

  1. Most teams I have worked with do not have a standard AI tool plan and each developer is using their own favourite (some maybe not even using a tool) - this does mean each tool will want to tweak this differently or could hallucinate in odd ways getting context it does not expect or understand. In theory this should not be an issue, especially if you handcraft your AGENTS file - but theory and practise don’t always align… especially with LLMs.
  2. In some cases, the different team members will want the AI agent they work with to work in a way that is slightly different from the rest of the team. Warp handles this nicely with Rules, but many tools don’t - and now you have each team member either compromising or having battles on whose file is correct.

In these situations, the outcome is often not committing the AGENTS file and when one has a lot of code basis to flip through, this can lead to situations where one forgets and accidentally commits it, or you need to update every .gitignore all the time.

Recently though, I found core.excludesFile which is a setting in Git, which allows one to set a specific file to use inconjuction with the standard .gitignore in your project. Why this is useful is one can set this to point to a file in their home directory and set the global config for Git… which means every Git project will use that and this will let you or an AI Centaur you know put the AGENTS file in say ~/.config/.gitIgnore and then use the command git config --global core.excludesFile ~/.config/.gitIgnoreto set the file and problem solved!

Maybe you don’t need the config?

While writing this up, I learnt you don’t even need to set this as there is already a default value of $XDG_CONFIG_HOME/git/ignore set and if (like I think many people) have not set the XDG_CONFIG_HOME environment variable then it falls back to $HOME/.config/git/ignore.

Bonus trick

Also from the documentation, I learnt another trick

Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user’s workflow) should go into the $GIT_DIR/info/exclude file.

$GIT_DIR is the .git folder in the root of your project (normally - Git allows you to customise everything)