Repository navigation
Add AGENTS.md for AI coding agents - #3559
Conversation
Documents the conventions and constraints that contributors absorb by osmosis but that an AI agent has no way to discover: - Most changes cannot be verified by running them: six UNIX variants, two native implementations, and hardware that may not exist locally. - The JNA/FFM twin rule, and the preference for hoisting shared logic into oshi-common rather than writing it in both implementations. - Per-module language levels (oshi-common and oshi-core are Java 8). - APIs banned by forbidden-apis, notably Integer.parseInt and friends in favor of ParseUtil. - Tests run under junit-platform-maven-plugin, not surefire, so there is no "Tests run:" output to check; Mockito is deliberately absent. - Assert invariants rather than values: CI runs on VMs with no battery, sensors, or discrete GPU. - Stale oshi-common resolved from ~/.m2 as a common self-inflicted build failure. - Concurrency annotations and Memoizer as near-universal conventions, and the platform-dependent tradeoff between native calls, file reads, and ExecutingCommand. AGENTS.md is the emerging cross-tool standard, read by Claude Code, GitHub Copilot, Cursor, and others, so a single file serves all of them. Removes it from .gitignore, where it sat alongside the still- ignored local CLAUDE.md. No CHANGELOG entry: no user-visible behavior changes.
📝 WalkthroughWalkthroughAdded ChangesRepository Guidance
Estimated code review effort: 1 (Trivial) | ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3559 +/- ##
============================================
- Coverage 79.31% 79.29% -0.03%
Complexity 4022 4022
============================================
Files 706 706
Lines 24264 24264
Branches 4057 4057
============================================
- Hits 19246 19239 -7
- Misses 2825 2833 +8
+ Partials 2193 2192 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@AGENTS.md`:
- Around line 1-5: Add the repository-standard current-year copyright and SPDX
license header at the beginning of AGENTS.md, before the existing “# AGENTS.md”
title, following the required format documented by the repository instructions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 999ba3fa-8fe1-49c5-b20a-f71a15294c5b
📒 Files selected for processing (2)
.gitignoreAGENTS.md
💤 Files with no reviewable changes (1)
- .gitignore
📜 Review details
⏰ Context from checks skipped due to timeout. (7)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: Test JDK 26, ubuntu-latest
- GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: Analyze (java)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{java,md}
📄 CodeRabbit inference engine (AGENTS.md)
When platform-specific code cannot be run, copy the nearest working sibling implementation, verify native structures and constants against the target platform's real headers, and document what was untested.
Files:
AGENTS.md
**/*
📄 CodeRabbit inference engine (AGENTS.md)
**/*: Do not commit generated output,target/, or IDE files.
Do not add dependencies without discussion or manually bump dependency versions; Renovate manages version updates.
Commit messages must describe what changed and why, and must not add sign-off orCo-Authored-Bytrailers unless requested.
Files:
AGENTS.md
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: oshi/oshi
Timestamp: 2026-08-01T01:48:50.856Z
Learning: Only build and test the platform and hardware available locally; use a JDK 25+ toolchain to ensure FFM code is compiled.
Learnt from: CR
Repo: oshi/oshi
Timestamp: 2026-08-01T01:48:50.856Z
Learning: When `oshi-common` changes, rebuild from the repository root; use `-am` with `-pl` and run `install -DskipTests` before out-of-reactor execution.
Learnt from: CR
Repo: oshi/oshi
Timestamp: 2026-08-01T01:48:50.856Z
Learning: Before opening a PR, run `spotless:apply`, `checkstyle:check`, `install`, `forbiddenapis:check`, and `javadoc:javadoc` in that order for touched modules.
🪛 LanguageTool
AGENTS.md
[style] ~23-~23: This phrase is redundant (‘I’ stands for ‘interfaces’). Use simply “APIs”.
Context: ...ts | |---|---| | oshi-common | Public API interfaces, abstract bases, POJOs, shared parsing/...
(ACRONYM_TAUTOLOGY)
[grammar] ~156-~156: Use a hyphen to join words.
Context: ...Concurrency annotations. Roughly two thirds of the classes in this project ca...
(QB_NEW_EN_HYPHEN)
[style] ~162-~162: You can shorten this phrase to improve clarity and avoid wordiness.
Context: ... calls are expensive, and callers poll. Values that are constant (CPU model, serial number) or expensive...
(NNS_THAT_ARE_JJ)
🔇 Additional comments (1)
AGENTS.md (1)
7-145: LGTM!Also applies to: 150-247
Closes #3557.
Adds an
AGENTS.mdat the repository root, and removes it from.gitignorewhere it had been sitting next to the (still ignored) localCLAUDE.md.AGENTS.mdis the emerging cross-tool convention — Claude Code, GitHub Copilot, Cursor, and others read it — so one committed file serves all of them rather than a per-tool file each.What it covers
The aim is not to restate
README.mdorCONTRIBUTING.md, but to write down what a human contributor picks up by osmosis and an agent has no way to discover:oshi-commonso the two cannot diverge in the first place.oshi-commonandoshi-coreare Java 8; models reach forvarandList.ofreflexively.Integer.parseIntand friends in favor ofParseUtil, which is surprising enough to cost a full build cycle to discover.junit-platform-maven-plugin, not surefire, so there is noTests run:line to grep for, and Mockito is deliberately absent — with the parse-seam pattern named as the alternative.oshi-commonresolved from~/.m2, described by symptom, since it is the most common self-inflicted build failure.Memoizer, which appear in roughly two thirds and a tenth of main source files respectively, and the platform-dependent tradeoff between native calls, file reads, andExecutingCommand(/procand/syson Linux are kernel interfaces, not disk).Existing docs are linked with a note on when each is relevant, rather than duplicated into a new
specs/tree.No CHANGELOG entry: no user-visible behavior changes.
Follow-up
A "common tasks" section walking through adding a field to a HAL component (interface, platform implementations across both twins, tests) and fixing a single-platform parsing bug would be the natural next addition, and would help human contributors as much as agents. Left for a separate PR so this one can be reviewed on its own.
Summary by CodeRabbit