Repository navigation
Add AGENTS.md with code generation conventions - #5105
Merged
ChrisRackauckas merged 1 commit intoSep 10, 2026
Merged
ChrisRackauckas merged 1 commit into
ChrisRackauckas merged 1 commit into
Conversation
Records three conventions that came up in review of SciML#5045: no `gensym` in names that reach generated code (it defeats the RuntimeGeneratedFunctions Expr-hash cache), build `Expr`s by pushing onto `args` instead of splatting, and keep codegen-side containers concretely typed vectors rather than tuples. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Agent-Harness: Claude Code 2.0.14 Agent-Model: claude-opus-5[1m] Agent-Session: https://claude.ai/code/session_01GdSpCLd7NBZuuePJmcDzU7 Claude-Session: https://claude.ai/code/session_01GdSpCLd7NBZuuePJmcDzU7
ChrisRackauckas
marked this pull request as ready for review
September 10, 2026 15:53
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 11, 2026
- Add AGENTS.md with code generation conventions (#5105) - Fall back to the solver default when an integrator carries no tolerances (#5106) Agent-Harness: Claude Code Agent-Model: claude-opus-5[1m] Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
Adds a root
AGENTS.md— the repository had none. It records three code-generationconventions raised in review of #5045:
gensyma name that ends up in generated code. Agensymembeds aprocess-global counter, so the same system lowers to a different
Exprin theprecompile process than in the user session, defeating the
RuntimeGeneratedFunctionsExpr-hash cache. Use a fixed sentinel (__mtk_prefixas in
generated_argument_name, or theₘₜₖsuffix as inHOMOTOPY_LAMBDA).Exprs by pushing ontoargs, not splatting.@ChrisRackauckas asked for the
gensymrule to be written down in#5045 (comment) ("Yeah we
do want to avoid gensym, good catch, should probably agents.md that"). The other two
come from @AayushSabharwal's review comments on the same PR.
The
gensymclaim is not just style — it is measured. On #5045, before that PR'sgensyms were replaced with fixed sentinels, building the same system twice producedtwo distinct
RuntimeGeneratedFunctiontypes:After the fixed sentinels, the two types are identical.
Verification
Documentation only — no code changes, so no test suite applies.
What I did not verify
Nothing was run beyond
typosandgit diff --check; there is no executable contentin this PR. No docs build was run —
AGENTS.mdis not part of the rendereddocumentation.
Anything a reviewer should push back on
AGENTS.mdunderlib/ModelingToolkitBase/src/systems/. The rules are about codegen specifically, butcodegen lives in more than one directory.
gensymrule carves out an exception for names that never reach generated code(e.g. the default
nameof amodelingtoolkitized system). If that exception iswrong, the wording needs tightening —
src/systems/problem_utils.jl:2638andsrc/systems/abstractsystem.jlstillgensymin places I have not audited.Ignore this draft until reviewed by @ChrisRackauckas.
🤖 Generated with Claude Code (model: claude-opus-5[1m])
https://claude.ai/code/session_01GdSpCLd7NBZuuePJmcDzU7