Skip to content

docs: add AGENTS.md for AI-agent collaboration on the binding#388

Open
phraktle wants to merge 2 commits intoSpaiR:mainfrom
phraktle:docs/agents-md
Open

docs: add AGENTS.md for AI-agent collaboration on the binding#388
phraktle wants to merge 2 commits intoSpaiR:mainfrom
phraktle:docs/agents-md

Conversation

@phraktle
Copy link
Copy Markdown
Contributor

Summary

Adds AGENTS.md at the repo root — a short (~175 line) guidance doc for AI coding agents (Claude Code, Cursor, etc.) working on this repo.

Most of this advice comes from bumping Dear ImGui 1.92.7, ImPlot v1.0, and Gradle 9 in the recent wave (#382-#385) — stuff that was easy to get wrong without orientation. Concretely:

  • Structure orientation: codegen-driven (src/main/java annotated → src/generated/java expanded by the Spoon pass in buildSrc/, both committed), and the "never edit generated code directly" rule.
  • Build/test: the tasks that matter, plus a standalone javadoc -Xdoclint:all recipe for iterating on doclint errors without waiting for Gradle + CI.
  • Upgrading a submodule: orient-first via upstream changelog + header diff (breaking changes, obsoleted APIs, new features worth exposing, AST implications) before the mechanical regen steps.
  • Gotchas: doclint rejecting C++ operator patterns (&, <, >, ->) in copied doc comments; vendor patches under patches/; AST regeneration drift from differing system headers; regen-instead-of-hand-merge when rebasing branches with codegen output.
  • Codegen conventions for buildSrc/: the bound-appropriate Spoon type-arg table that replaced <Nothing> in the Kotlin 2 K2 migration (build(deps): bump Gradle wrapper to 9.4.1 and LWJGL to 3.4.1 #383), and the Gradle 9 configuration-cache pattern.
  • PR workflow: separate commits/PRs for bumps / deps / codegen, and a suggested merge order for stacked PRs.

The doc is intended as a living reference — amend as the project evolves.

Test plan

  • Doc is Markdown; no code changes.
  • All referenced paths, tasks, and files exist in the current tree.

phraktle and others added 2 commits April 21, 2026 22:57
Guidance doc for AI coding agents (Claude Code, Cursor, etc.) working
on this repo. Covers the evergreen stuff that's easy to get wrong
without orientation:

- The codegen-driven structure (src/main/java annotated, src/generated/java expanded by buildSrc Spoon pass, both committed) and the "never edit generated code" rule.
- Project layout, build/test commands, and a fast standalone javadoc recipe for iterating on doclint errors without waiting for Gradle + CI.
- The end-to-end flow for bumping Dear ImGui or an extension: orient via upstream changelog + header diff first (breaking changes / obsoleted APIs / new features worth exposing / AST implications), then the mechanical regen steps.
- Gotchas: doclint rejecting C++ operator patterns in doc comments (with before/after examples), vendor patches under patches/, AST regeneration drift from differing system headers, and the regen-instead-of-hand-merge pattern when rebasing branches with codegen output.
- Codegen conventions for buildSrc (bound-appropriate Spoon type args after the Kotlin 2 K2 migration, configuration-cache patterns).
- PR workflow: separate commits and PRs for bumps/deps/codegen, suggested merge order when multiple are open.

Intended to reduce the onboarding cost for agents bumping submodules in
the future; most of the advice is drawn from the recent 1.92.7 +
ImPlot v1.0 + Gradle 9 bump wave.
… dual-loader note

Refinements based on real agent-session experience:

- Visual smoke test flow (build.sh → copy → :example:run) — static checks
  miss blank atlases, runtime assertions, broken draw calls.
- Native source rewrites in GenerateLibs.groovy silently no-op when imgui
  renames their anchor symbol between versions; flag to grep on bumps.
- Dual stb_truetype + FreeType loader design wasn't documented anywhere;
  non-obvious to a reader touching font code.
- Submodule sync after branch switch — common footgun.
- Scope note that the Spoon <Nothing> section only matters when editing
  the generator itself, not routine source edits.
- CI log fetch: prefer `gh run view --job` for focused output over the
  whole-run `--log-failed` dump.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant