Page
Library
Module
Module type
Parameter
Class
Class type
Source
dune‑ai‑context is a small OCaml command‑line tool that:
dune describe external‑lib‑deps.ppx_‑prefixed packages (they are usually build‑time helpers)..cmi) of the remaining vendor libraries in the current OPAM switch ($OPAM_SWITCH_PREFIX/lib).vendor_interfaces/<library>.mli. The generated vendor_interfaces directory can be added to a project's source tree and used as a context for AI‑assisted coding tools such as Claude Code, OpenCode, Aider, and similar assistants that can read local files to provide more accurate suggestions.The tool is useful when you need to inspect or export the public API of the third‑party libraries used in a project, and when you want to give AI coding assistants full visibility of those APIs without requiring them to resolve external dependencies themselves.
The project depends on the following OPAM packages:
dune (≥ 3.1)ocaml (≥ 4.14)sexplibYou can install the tool directly from the repository:
git clone https://github.com/zenfey/dune-ai-context
cd dune-ai-context
opam pin add dune-ai-context .
opam install dune-ai-contextIf you prefer to build manually with dune:
dune buildThe executable will be built as _build/default/bin/dune_ai_context.exe (and installed as dune-ai-context when you run dune install).
Assuming your OCaml project that uses Dune is located at <proj-root>:
cd <proj-root>
dune-ai-contextdune-ai-context <proj-root>The command will create a vendor_interfaces directory inside the current working directory (or inside <proj-root> if you passed it as an argument) and populate it with <library>.mli files containing the exported signatures.
dune‑ai‑context relies on the OPAM_SWITCH_PREFIX environment variable to locate the compiled libraries. Ensure it is set (it is automatically set when you are inside an OPAM switch). If the variable is not present the tool will skip the .cmi lookup.
There are currently no inline tests. Run the tests with:
dune runtestMIT – see the LICENSE file for details.
Feel free to open issues or submit pull requests on the GitHub repository: