Dear all,
I’ve put together an ocaml-ai-disclosure proposal to allow voluntary disclosure of AI usage in published OCaml code, using opam metadata and extension attributes in source code.
The repository and blog post have more details, some prototype tooling to extract attributes, and a FAQ, but in a nutshell I’m proposing something very similar to a W3C disclosure proposal for HTML.
Package Disclosures
An opam package can declare its disclosure using extension fields:
x-ai-disclosure: "ai-assisted"
x-ai-model: "claude-opus-4-6"
x-ai-provider: "Anthropic"
Note: This may just become a list of values in the final proposal, but you get the idea.
OCaml Module level
OCaml supports extension attributes, which we use via a floating attribute that applies to the entire compilation unit:
[@@@ai_disclosure "ai-generated"]
[@@@ai_model "claude-opus-4-6"]
[@@@ai_provider "Anthropic"]
let foo = ...
let bar = ...
These can also be scoped more finely via declaration attributes that apply to a single binding:
[@@@ai_disclosure "ai-assisted"]
let human_written x = ...
let ai_helper y = ...
[@@ai_disclosure "ai-generated"]
Disclosure follows a nearest-ancestor inheritance model like the W3C HTML proposal, whereby an explicit annotation overrides the inherited value.
I wrote a blog post with more details, as well as an FAQ in the proposal repository about some of the implications.
I couldn’t find any other prior art of other language ecosystems trying anything similar, so I’d be interested in hearing about any others you all know about. If there’s no interest in the wider ecosystem in doing this, then I’ll just use it myself, but I figured there’s no harm in starting the discussion!