|
| 1 | +# ABACUS Agent Instructions |
| 2 | + |
| 3 | +This file is the entry point for AI agents, automated review tools, and human |
| 4 | +contributors who want the short operational version of the ABACUS development |
| 5 | +rules. Read the complete governance document before making or reviewing changes: |
| 6 | + |
| 7 | +- `docs/developers_guide/agent_governance.md` |
| 8 | + |
| 9 | +## Required Baseline |
| 10 | + |
| 11 | +- Follow the seven ABACUS coding rules summarized from the project governance: |
| 12 | + 1. Do not introduce new cross-layer control through `GlobalV`, `GlobalC`, or |
| 13 | + `PARAM`; pass dependencies explicitly. |
| 14 | + 2. Do not hide workflow switches in mutable member variables that can be |
| 15 | + changed from multiple places. |
| 16 | + 3. Keep header dependencies minimal. |
| 17 | + 4. Avoid adding `.hpp` implementation headers or propagating them through |
| 18 | + other headers unless there is a narrow reason. |
| 19 | + 5. Do not add default arguments to existing interfaces; update call sites or |
| 20 | + design a clearer extension. |
| 21 | + 6. Add focused tests for key features, bug fixes, INPUT behavior changes, |
| 22 | + heterogeneous kernels, and core-module refactors. |
| 23 | + 7. Keep code compatible with the repository C++11 baseline. |
| 24 | +- Use LF line endings for text files. Only `.bat` and `.cmd` files may use CRLF. |
| 25 | +- Keep source file additions deterministic: update the relevant `CMakeLists.txt` |
| 26 | + or explain why the file is generated or included indirectly. |
| 27 | +- INPUT parameter behavior changes must update `docs/parameters.yaml` and |
| 28 | + `docs/advanced/input_files/input-main.md`, or the PR must state why no update |
| 29 | + is required. |
| 30 | +- Report the exact verification performed. Do not claim completion without |
| 31 | + fresh test or check output. |
| 32 | + |
| 33 | +## Repository Map |
| 34 | + |
| 35 | +- Core C++ implementation lives under `source/`; source additions must be wired |
| 36 | + through the relevant `CMakeLists.txt`. |
| 37 | +- INPUT parsing and help metadata live under `source/source_io/`; user-facing |
| 38 | + INPUT docs live in `docs/parameters.yaml` and |
| 39 | + `docs/advanced/input_files/input-main.md`. |
| 40 | +- Unit tests are colocated under module `test/` directories such as |
| 41 | + `source/source_md/test/`; integration and workflow tests are selected through |
| 42 | + CTest labels and patterns. |
| 43 | +- Developer and user build/install references live in `docs/quick_start/`, |
| 44 | + `docs/advanced/`, `toolchain/`, `Dockerfile.gnu`, `Dockerfile.intel`, and |
| 45 | + `Dockerfile.cuda`. |
| 46 | + |
| 47 | +## Build And Test Entry Points |
| 48 | + |
| 49 | +- Prefer the repository CMake/CTest flow already used by CI. For focused local |
| 50 | + checks, use commands such as `ctest --test-dir build -V -R MODULE_MD` after a |
| 51 | + usable build exists. |
| 52 | +- For INPUT-related changes, verify both documentation and CLI behavior when an |
| 53 | + executable is available: `./build/abacus -h <parameter>` and |
| 54 | + `./build/abacus --check-input` from a valid case directory. |
| 55 | +- For executable identity, record `./build/abacus --version` or the equivalent |
| 56 | + installed `abacus --version` command used during verification. |
| 57 | +- Reuse existing Docker and toolchain assets. Do not add a new container, |
| 58 | + compiler setup, or calculation-task skill unless the PR explicitly requires |
| 59 | + and justifies it. |
| 60 | + |
| 61 | +## Local Runtime Testing |
| 62 | + |
| 63 | +- Set `OMP_NUM_THREADS=1` for ABACUS runtime, integration, and MPI tests unless |
| 64 | + a test explicitly requires another value. |
| 65 | +- Run MPI/runtime tests outside restricted sandboxes when process visibility, |
| 66 | + sockets, or MPI launch behavior matters. |
| 67 | +- Treat OpenMPI `opal_ifinit: socket() failed errno=1` warnings from sandboxed |
| 68 | + MPI-linked builds or runs as expected sandbox artifacts; rerun outside the |
| 69 | + sandbox before treating them as ABACUS failures. |
| 70 | +- Do not relax existing tests or references merely to make a failure pass. |
| 71 | + Update references only when the intended behavior changed and the PR explains |
| 72 | + why. |
| 73 | + |
| 74 | +## Review And Exception Flow |
| 75 | + |
| 76 | +- Mechanical blockers are enforced by hook and CI only for new files, changed |
| 77 | + files, or diff-added lines. Historical untouched code is not a default blocker. |
| 78 | +- Warnings from CI or AI review require reviewer attention but do not block by |
| 79 | + themselves. |
| 80 | +- Semantic questions such as module ownership, member-variable workflow state, |
| 81 | + test sufficiency, and exception approval require human review. |
| 82 | +- Exceptions must be recorded in the PR with reason, scope, risk, and a follow-up |
| 83 | + cleanup plan. |
| 84 | + |
| 85 | +## Local Commands |
| 86 | + |
| 87 | +```bash |
| 88 | +python3 tools/03_code_analysis/agent_governance_check.py --staged |
| 89 | +python3 tools/03_code_analysis/agent_governance_check.py --base upstream/develop --head HEAD --format text |
| 90 | +pre-commit run abacus-agent-governance --all-files |
| 91 | +``` |
| 92 | + |
| 93 | +The repository text files have been normalized to LF once. Day-to-day line |
| 94 | +ending enforcement should rely on staged/changed-file hooks and CI; rerun the |
| 95 | +full mixed-line-ending hook only for intentional repository-wide normalization. |
| 96 | + |
| 97 | +## PR Self-Check |
| 98 | + |
| 99 | +- Confirm the PR body states exact commands run, whether they passed or failed, |
| 100 | + and why any expected check could not be run. |
| 101 | +- Keep warning rationales concrete. For example, a header include warning can be |
| 102 | + acceptable when the header owns a value member that requires the complete type. |
| 103 | +- Keep historical-debt notes separate from new deterministic errors introduced |
| 104 | + by the PR. |
0 commit comments