Skip to content

NO-JIRA: Refactor AGENTS.md to be minimal with references#587

Open
mdbooth wants to merge 1 commit into
openshift:mainfrom
openshift-cloud-team:fix-agent-instructions
Open

NO-JIRA: Refactor AGENTS.md to be minimal with references#587
mdbooth wants to merge 1 commit into
openshift:mainfrom
openshift-cloud-team:fix-agent-instructions

Conversation

@mdbooth

@mdbooth mdbooth commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Also folds the test-standards skill into a reference.

This change is a slight optimisation to context usage, as well as making the test-standards reference available to agents other than Claude.

Summary by CodeRabbit

  • Documentation
    • Reorganized internal developer documentation with consolidated reference guides for project structure, style conventions, build tasks, and testing practices.

Note: This release contains internal documentation updates with no changes to user-facing features or functionality.

Also folds the test-standards skill into a reference.

This change is a slight optimisation to context usage, as well as making
the test-standards reference available to agents other than Claude.
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 10, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@mdbooth: This pull request explicitly references no jira issue.

Details

In response to this:

Also folds the test-standards skill into a reference.

This change is a slight optimisation to context usage, as well as making the test-standards reference available to agents other than Claude.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci

openshift-ci Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign joelspeed for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Walkthrough

Documentation is reorganized to consolidate developer guidance. Four new reference documents are added under .agents/reference/ covering code structure, style conventions, build/test tasks, and testing practices. AGENTS.md is condensed to direct readers to these references, and review skill documents are updated to point to the new guidance locations.

Changes

Documentation Reorganization

Layer / File(s) Summary
New reference documentation suite
.agents/reference/code-structure.md, .agents/reference/style-guide.md, .agents/reference/tasks.md, .agents/reference/testing.md
Four new reference documents are added: code-structure.md enumerates binaries and controllers; style-guide.md defines coding conventions and acronym usage; tasks.md documents Makefile targets and test execution patterns; testing.md covers test level selection, Ginkgo/Gomega patterns, Komega assertions, and debuggability rules.
Consolidate AGENTS.md and update review skills
AGENTS.md, .claude/skills/deep-review/SKILL.md
AGENTS.md is shortened to remove duplicated guidance and point to the new .agents/reference/ documents; .claude/skills/deep-review/SKILL.md is updated to reference AGENTS.md and .agents/reference/style-guide.md for conventions and .agents/reference/testing.md for test guidance, replacing prior references to CLAUDE.md and .claude/skills/test-standards/SKILL.md (deleted file).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately summarizes the main change: refactoring AGENTS.md to be more minimal while adding references to dedicated documentation files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PR contains only documentation changes with no actual Go test files modified. Documentation examples demonstrate proper test naming practices with static, deterministic strings.
Test Structure And Quality ✅ Passed PR contains only documentation changes (Markdown files) with no Ginkgo test code. The custom check is inapplicable to documentation-only changes.
Microshift Test Compatibility ✅ Passed This PR contains only documentation changes (markdown files). No new Ginkgo e2e tests are being added, so MicroShift compatibility check is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR adds only documentation files; no new Ginkgo e2e tests (It/Describe/Context/When) are being added to the codebase. Custom check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR contains only documentation changes (.md files). No deployment manifests, operator code, or controllers are added/modified, so topology-aware scheduling check is not applicable.
Ote Binary Stdout Contract ✅ Passed PR contains only documentation changes (.md files); no Go code modifications exist that could violate the OTE stdout contract.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR contains only documentation changes (.agents/reference/*.md, AGENTS.md, etc.) with no new Ginkgo e2e tests added. Check is not applicable.
No-Weak-Crypto ✅ Passed PR contains only Markdown documentation changes. No cryptographic code, weak algorithms (MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB), or secret comparisons detected.
Container-Privileges ✅ Passed PR contains only documentation changes (.md files); no container manifests, Dockerfiles, or K8s configurations present. The container-privileges check does not apply.
No-Sensitive-Data-In-Logs ✅ Passed PR contains only documentation changes with no Go source code modifications. No logging statements with sensitive data (passwords, tokens, API keys, PII, etc.) were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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/reference/code-structure.md:
- Around line 36-37: Update the two bullet lines under the controllers section
to hyphenate compound modifiers: change the descriptions for "Machine Sync
Controller" and "MachineSet Sync Controller" so they read "machine-related
resources" and "machineset-related objects" respectively, ensuring the modifiers
are hyphenated while leaving the controller names unchanged.
🪄 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: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0acf2451-a54d-4ae2-894f-7a338be80742

📥 Commits

Reviewing files that changed from the base of the PR and between 05c113e and 6859df3.

📒 Files selected for processing (7)
  • .agents/reference/code-structure.md
  • .agents/reference/style-guide.md
  • .agents/reference/tasks.md
  • .agents/reference/testing.md
  • .claude/skills/deep-review/SKILL.md
  • .claude/skills/test-standards/SKILL.md
  • AGENTS.md
💤 Files with no reviewable changes (1)
  • .claude/skills/test-standards/SKILL.md

Comment on lines +36 to +37
- **Machine Sync Controller** (`pkg/controllers/machinesync/`) - Synchronizes individual machine related resources between APIs
- **MachineSet Sync Controller** (`pkg/controllers/machinesetsync/`) - Synchronizes machineset related objects between APIs

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Hyphenate compound modifiers.

Lines 36 and 37 use "machine related" and "machineset related" as compound modifiers before nouns. According to English style conventions, these should be hyphenated: "machine-related resources" and "machineset-related objects".

📝 Proposed fix
-- **Machine Sync Controller** (`pkg/controllers/machinesync/`) - Synchronizes individual machine related resources between APIs
+- **Machine Sync Controller** (`pkg/controllers/machinesync/`) - Synchronizes individual machine-related resources between APIs
-- **MachineSet Sync Controller** (`pkg/controllers/machinesetsync/`) - Synchronizes machineset related objects between APIs
+- **MachineSet Sync Controller** (`pkg/controllers/machinesetsync/`) - Synchronizes machineset-related objects between APIs
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- **Machine Sync Controller** (`pkg/controllers/machinesync/`) - Synchronizes individual machine related resources between APIs
- **MachineSet Sync Controller** (`pkg/controllers/machinesetsync/`) - Synchronizes machineset related objects between APIs
- **Machine Sync Controller** (`pkg/controllers/machinesync/`) - Synchronizes individual machine-related resources between APIs
- **MachineSet Sync Controller** (`pkg/controllers/machinesetsync/`) - Synchronizes machineset-related objects between APIs
🧰 Tools
🪛 LanguageTool

[grammar] ~36-~36: Use a hyphen to join words.
Context: ...ync/`) - Synchronizes individual machine related resources between APIs - **Machi...

(QB_NEW_EN_HYPHEN)


[grammar] ~37-~37: Use a hyphen to join words.
Context: ...hinesetsync/`) - Synchronizes machineset related objects between APIs ### Shared...

(QB_NEW_EN_HYPHEN)

🤖 Prompt for 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.

In @.agents/reference/code-structure.md around lines 36 - 37, Update the two
bullet lines under the controllers section to hyphenate compound modifiers:
change the descriptions for "Machine Sync Controller" and "MachineSet Sync
Controller" so they read "machine-related resources" and "machineset-related
objects" respectively, ensuring the modifiers are hyphenated while leaving the
controller names unchanged.

@openshift-ci

openshift-ci Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@mdbooth: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@theobarberbany

theobarberbany commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

this is posted by claude, reviewed by me 🎉

I've reviewed this and the instinct is right — the old AGENTS.md was 184 lines, already over the recommended ≤150 line guideline. ETH Zurich research found that bloated context files hurt agent performance (20%+ increased inference costs with no accuracy benefit). A lean root file is the right shape.

I have a few concerns with the approach though. I've left inline comments on the specific areas.

@@ -0,0 +1,56 @@
# Code Structure

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.

`.agents/` is not a standard directory — consider hierarchical `AGENTS.md` files instead

The established convention for agent instructions is hierarchical `AGENTS.md` files placed in subdirectories. Agents auto-read the nearest `AGENTS.md` in the directory tree — the closest one takes precedence, and each subdirectory can ship tailored instructions. The OpenAI repo has 88 of them. This is supported natively by Claude Code, Codex, Cursor, Copilot, Jules, and others, and is now governed by the Agentic AI Foundation under the Linux Foundation.

There is a community proposal for a `.agent` directory (singular, different structure), but it's at the discussion stage and not adopted by any tool. The `.agents/reference/` directory used here doesn't match the standard, doesn't match the proposal, and won't be auto-discovered by any agent tooling.

These files will only be read if an agent actively decides to follow the links in the root AGENTS.md — which is not guaranteed, especially for quick fixes or tasks where the agent doesn't think to check conventions.

Suggestion: Place this content in `AGENTS.md` files in relevant subdirectories instead (e.g., `pkg/AGENTS.md`, `e2e/AGENTS.md`). This gets the same "thin root, detailed when needed" outcome while using the standard mechanism that tools already auto-discover.

@@ -1,121 +0,0 @@
---

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.

Removing this skill loses the auto-trigger on `_test.go` files

This skill had an auto-trigger: it fired automatically when agents worked on `_test.go` files, injecting testing conventions into context at exactly the right time. Moving the content to `.agents/reference/testing.md` and deleting the skill removes that trigger.

Now an agent writing or modifying tests will only see the testing guidance if it independently decides to read the reference file — which isn't guaranteed, especially for quick test fixes.

The `deep-review` skill was updated to point at the new location, so reviews are covered. But unguided work (writing new tests, fixing test failures) loses the automatic context injection.

Suggestion: Either keep this skill (pointing at the new reference file location), or ensure the testing guidance ends up in a subdirectory `AGENTS.md` that tools auto-discover.

Comment thread AGENTS.md
## Project Overview

The Cluster CAPI Operator manages the installation and lifecycle of Cluster API components on OpenShift clusters. It serves as a bridge between OpenShift's Machine API (MAPI) and the upstream Cluster API (CAPI), providing forward compatibility and migration capabilities.

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.

These links won't be reliably followed by agents

The root AGENTS.md is auto-loaded into context by Claude Code, Codex, Cursor, Copilot, and others. But these linked files are regular markdown files — an agent has to actively decide to read them. That decision depends on the agent judging that the reference is relevant to the current task, which won't happen consistently.

For example: with the old inline AGENTS.md, "never use `time.Sleep()`, use `Eventually`" was always in context during test work. Now it's behind a link the agent may or may not follow. "Always applied" vs "usually applied" is where regressions show up.

The standard approach here is subdirectory `AGENTS.md` files (see comment on `.agents/reference/`), which tools auto-discover without the agent needing to make a judgment call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants