Skip to content

Add AGENTS.md for AI coding agents - #3559

Merged
dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:agents-md
Aug 1, 2026
Merged

dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:agents-md

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Aug 1, 2026 •

Copy link
Copy Markdown
Member

Closes #3557.

Adds an AGENTS.md at the repository root, and removes it from .gitignore where it had been sitting next to the (still ignored) local CLAUDE.md.

AGENTS.md is 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.md or CONTRIBUTING.md, but to write down what a human contributor picks up by osmosis and an agent has no way to discover:

  • Most changes here cannot be verified by running them. Six UNIX variants, two native implementations, and hardware that may not exist on the machine you are on. An agent's default assumption that a green local build means a correct change is wrong in this repository more often than in most.
  • The JNA/FFM twin rule — a behavior change to one implementation without the other is almost always a bug — and, better, the preference for hoisting shared logic into oshi-common so the two cannot diverge in the first place.
  • Per-module language levels. oshi-common and oshi-core are Java 8; models reach for var and List.of reflexively.
  • APIs banned by forbidden-apis, particularly Integer.parseInt and friends in favor of ParseUtil, which is surprising enough to cost a full build cycle to discover.
  • Tests run under junit-platform-maven-plugin, not surefire, so there is no Tests run: line to grep for, and Mockito is deliberately absent — with the parse-seam pattern named as the alternative.
  • Assert invariants, not values. CI runs on VMs with no battery, sensors, or discrete GPU, which is where most flaky tests here come from.
  • Stale oshi-common resolved from ~/.m2, described by symptom, since it is the most common self-inflicted build failure.
  • Concurrency annotations and 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, and ExecutingCommand (/proc and /sys on 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

  • Documentation
    • Added comprehensive repository guidance covering project structure, development workflows, testing, coding standards, platform considerations, and contribution practices.
    • Improved discoverability of this guidance by ensuring it is included in version control.

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.
@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Added AGENTS.md with repository guidance for AI coding agents. Removed its entry from .gitignore so the file is tracked.

Changes

Repository Guidance

Layer / File(s) Summary
Track and document agent guidance
.gitignore, AGENTS.md
AGENTS.md now documents repository structure, workflows, coding rules, platform conventions, testing guidance, and pull-request policies. .gitignore no longer excludes the file.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

A rabbit reviewed the guide with care,
Then cleared its name from ignore’s lair.
Commands and rules now neatly stay,
For agents hopping through the day.
“Track this file!” the rabbit cheered,
While tidy paths appeared.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the primary change: adding AGENTS.md for AI coding agents.
Linked Issues check ✅ Passed The PR addresses issue #3557 by adding committed repository guidance for AI agents and making AGENTS.md trackable.
Out of Scope Changes check ✅ Passed The changes are limited to adding AGENTS.md and removing it from .gitignore, which matches the stated objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.29%. Comparing base (06a7d74) to head (84f73b2).
⚠️ Report is 1 commits behind head on master.

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     
Flag Coverage Δ
linux 36.74% <ø> (ø)
macos 37.68% <ø> (-0.05%) ⬇️
windows 44.62% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 464e8bd and 84f73b2.

📒 Files selected for processing (2)
  • .gitignore
  • AGENTS.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 or Co-Authored-By trailers 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

Comment thread AGENTS.md Resolved
@dbwiddis
dbwiddis merged commit a1c9bb0 into oshi:master Aug 1, 2026
16 checks passed
@dbwiddis
dbwiddis deleted the agents-md branch August 1, 2026 01:54
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.

Improve repository's friendliness to AI Agents

1 participant