Declaring AI usage in your code

Do you use AI tools or services like Blablador for writing code? You probably do and even if not, your contributors might. In any case, parts of the code in your repository may not be written by a human being and this can be a problem, in particular when it comes to licensing. Even if you are not a meat proxy and understand the code no matter where it comes from or who produced it, being clear about which parts of it were written or changed by AI is generally a good idea. So, how can you do this?
We recently came across the AI Declaration Format, which addresses exactly this problem. A simple json or yaml file in your repository’s root folder, stating where and how and which AI was used, machine- and human-readable. Sure, it’s just a snapshot and you cannot guarantee that contributors add or change code using AI without declaring it, but at least with this format in place everyone has a chance to do so in a structured way. This is a great first step towards transparent use of AI for software development. Pro tip: when writing code with AI, ask it to update the declaration file on the fly!
If you want to go further, check out git-ai. This is a git extension that tracks AI-generated code right when it is committed. It injects itself into contributions from harnesses like Claude Code, OpenCode, and GitHub Copilot, making their changes traceable right within git itself. Add it as pre-commit hook and you are good to go. Again, you cannot prevent others from just not using this, but it is yet another step towards transparent use of AI code generation in your software or any other git project.
Finally, don’t forget to document all of this in your readme and contributors guidelines. Besides transparency of how you deal with AI-authored contributions, it gives these approaches more visibility.
Written by: Robert Speck