Add AGENTS.md agent instructions - #147
roninsightrx wants to merge 2 commits into
Conversation
Use the harness-agnostic AGENTS.md filename so any AI coding agent picks up the repo instructions, not just one vendor's tool. Extend the content with: the ADVAN vs. ODE dispatch in sim(), the two distinct compilation paths (src/ at install time vs. user models at runtime), ODE compartment index conventions and as_is, the model-as- package scaffold in inst/template/, model_library.R, nlmixr2/NONMEM interop, and the setup.R shared-fixture / NOT_CRAN testing pattern. Also add AGENTS.md to .Rbuildignore so R CMD check --as-cran does not report it as a non-standard top-level file. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
roninsightrx
left a comment
There was a problem hiding this comment.
Changes requested: several factual errors would send coding agents to the wrong execution paths.
AGENTS.md:60andAGENTS.md:73:sim()never dispatches tosim_core(). InR/sim.Rit calls the compiledodedirectly (or the ADVAN path), whilesim_core()is a separate fast entry point that consumes a design such as the object returned bysim(..., return_design = TRUE). Replace the pipeline and file description with those sibling paths.AGENTS.md:79andAGENTS.md:119:R/calculate_parameters.Rdoes not apply IIV or IOV; it is a convenience wrapper aroundsim_ode()for calculating model-specific/effective parameters. IIV sampling and application are inR/sim.R(mvrnorm2()plus theomega_typehandling), while IOV bin/parameter handling is generated fromR/new_ode_model.Rand executed by the compiled solver. Point agents to those files instead. Also name the accepted IIV modes asexponentialandnormal;additivedescribes the formula but is not a supportedomega_typevalue.AGENTS.md:114:pk_codedoes not run before every derivative step.inst/cpp/sim.cppinvokes it initially and once per event interval before integration; RK4 evaluates the ODE multiple times within that interval. Change this to “runs at each event/before each integration interval” so agents do not put per-derivative logic there.AGENTS.md:140-142:test_install_default_literature_model.Rneither installs a package nor uses an explicit temp directory orskip_on_cran(); it mocksmodel_from_api()and tests dispatch. Only the package-installing test intest_model_from_api.Rhas the described temp-dir and CRAN gating behavior. Narrow this guidance accordingly.
Reviewed by Codex
- sim() does not dispatch to sim_core(); they are sibling entry points that both call the compiled ode object directly. - calculate_parameters.R is a sim_ode() wrapper for effective parameters, not where IIV/IOV is applied. Point to R/sim.R (mvrnorm2 + omega_type) for IIV and R/new_ode_model.R + compiled solver for IOV. - omega_type accepts 'exponential' and 'normal' (not 'additive'). - pk_code runs per event interval, not per derivative evaluation. - Narrow the temp-dir/skip_on_cran testing note to the one installing test in test_model_from_api.R. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Thanks — verified all four findings against the source; all were correct and all are now fixed in dce5eb2.
Also re-ran the documented commands to confirm they work: 🤖 Generated with Claude Code |
roninsightrx
left a comment
There was a problem hiding this comment.
Approval verdict: all four prior findings are resolved, and the revised guidance matches the simulation paths, variability handling, pk_code timing, and test behavior in the source. No new inaccuracies or harness-specific references found. GitHub does not permit the authenticated PR author to submit an approval review, so this verdict is recorded as a review comment.
Reviewed by Codex
Summary
Renames
CLAUDE.mdtoAGENTS.mdand extends it.AGENTS.mdis the harness-agnostic convention, so any AI coding agent picks up the repo instructions rather than only one vendor's tool. The content was rewritten to refer to "agents" / "AI coding agents" instead of a specific product.What the file contains
devtools::load_all()/test()/document()/check(),pkgdown::build_site(), plus notes on running a subset of tests withdevtools::test(filter = ...)(which also sourcestests/testthat/setup.R), and on recompiling aftersrc/*.cppedits.sim()→sim_core()→ Boost odeint pipeline, and the branch insim()that routes to the ADVAN analytical path instead whenanalyticalis given.R/entry points, includingmodel_library.R,shift_state_indices.Rand the nlmixr2/NONMEM interop files.src/at package install time vs. user ODE models compiled at runtime), and the-D_HAS_AUTO_PTR_ETC=0flag insrc/Makevars.model_library.Rentries, JSON5 literature models ininst/models/, API models, and the model-as-package scaffold ininst/template/.A[0]vsA[1]indexing and howshift_state_indices()handles both,as_is,declare_variables,pk_code,state_init.setup.Rcompiles shared models once per session and tests should reuse those objects; expensive fixtures are gated onNOT_CRAN; the suite stays offline by pointingmodel_from_api()at local fixtures.R CMD check --as-cranmust stay clean and new hard dependencies need justification.Function and file references were checked against the source.
Also
AGENTS.mdis added to.RbuildignoresoR CMD check --as-crandoes not report it as a non-standard top-level file (CLAUDE.mdwas not ignored previously).🤖 Generated with Claude Code