Skip to content

docs: improve AGENTS.md for agent/sandbox environments#21997

Open
mazze93 wants to merge 4 commits intoHomebrew:mainfrom
mazze93:stable
Open

docs: improve AGENTS.md for agent/sandbox environments#21997
mazze93 wants to merge 4 commits intoHomebrew:mainfrom
mazze93:stable

Conversation

@mazze93
Copy link
Copy Markdown

@mazze93 mazze93 commented Apr 12, 2026

Adds sandbox setup instructions and improves existing content for AI agents working in this repository.

Changes

  • Add ### Sandbox Setup section explaining how to configure a writable HOMEBREW_CACHE in sandboxed environments (e.g. OpenAI Codex) to avoid permission errors when running the test suite
  • Fix ambiguous intro sentence ("before prompting for input" → "before prompting the user")
  • Fix double space in --online --changed command example
  • Expand ## Repository Structure with missing entries: cmd/, dev-cmd/, test/, sorbet/

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests (excluding integration tests) for your changes? — not applicable (docs-only change)
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally? — not applicable (no Ruby/Bash changes)

  • AI was used to generate or assist with generating this PR. Claude Sonnet 4.6 drafted and applied the changes; content was manually reviewed for accuracy against the actual repo structure.

mazze93 and others added 3 commits April 11, 2026 20:51
Documents how to configure a writable cache directory in sandboxed environments (e.g. OpenAI Codex) to avoid permission errors when running the test suite.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix ambiguous intro sentence ("before prompting for input")
- Fix double space in `--online --changed` example
- Add missing repo structure entries: cmd/, dev-cmd/, test/, sorbet/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ls after gem changes unless stubs are regenerated. The --update vs --update-all distinction prevents agents from unnecessarily rebuilding everything on a DSL-only change.

Sandbox setup (lines 28–34) — Rewritten as explicit numbered steps. The original buried the HOMEBREW_CACHE path structure in prose; the corrected tmp/cache/ (not tmp/cache/api/) export path also fixes a subtle bug in the original where the exported var pointed one level too deep.

Completions/manpages trigger (lines 48, 59) — Changed "don't edit directly" to also say when to regenerate. Without this, an agent adding a flag to a command would correctly update the Ruby but silently skip the generated files.

HOMEBREW_BREW_FILE clarification (line 71) — Added a concrete usage example (safe_system HOMEBREW_BREW_FILE, "install", name) and made explicit that ./bin/brew is for the terminal only. The old wording was ambiguous enough that an agent might apply the rule in the wrong direction.

Commit conventions (line 73) — Grounded in observed history (livecheck:, sorbet:, tests:, docs:). Includes the automated tooling carve-out so agents don't try to reformat dependency bumps.
Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Please reduce the scope of this, most of this is random rewording.

Comment thread AGENTS.md
# Agent Instructions for Homebrew/brew

Most importantly, run `./bin/brew lgtm` to verify any file edits before prompting for input to run all style checks and tests.
Most importantly, run `./bin/brew lgtm` to verify any file edits before prompting the user, to run all style checks and tests.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't change random words like this.

Comment thread AGENTS.md

1. Copy the API cache: `cp -r "$(./bin/brew --cache)/api/" tmp/cache/api/`
2. Export the writable path: `export HOMEBREW_CACHE="$(pwd)/tmp/cache/"`
3. Then run `./bin/brew tests` as normal.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should already be handled by brew tests. Can you please verify and submit a PR to do that if not?

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.

2 participants