Repository navigation
Migrate skills to .agents and trim GEMINI.md - #3295
Merged
Merged
Conversation
CydeWeys
enabled auto-merge
November 24, 2026 21:00
CydeWeys
force-pushed
the
trim-gemini-md-and-fix-skills
branch
2 times, most recently
from
November 26, 2026 00:20
2022ed7 to
60b7d0f
Compare
gbrodman
approved these changes
Dec 2, 2026
gbrodman
left a comment
Collaborator
There was a problem hiding this comment.
@gbrodman partially reviewed 8 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on jicelhay).
CydeWeys
force-pushed
the
trim-gemini-md-and-fix-skills
branch
from
December 4, 2026 17:02
60b7d0f to
3cfb4d9
Compare
gbrodman
approved these changes
Dec 4, 2026
gbrodman
left a comment
Collaborator
There was a problem hiding this comment.
@gbrodman partially reviewed 3 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on jicelhay).
AI coding agents and reviewers working across fork-based workflows currently hit four recurring sources of friction: repository skills sit in a legacy directory that standard Git workspaces do not auto-discover, local diff and formatting checks overwrite remote tracking refs or diff against stale fork bases, redundant checklists and contradictory rules bloat always-on context toward per-file truncation limits, and commit messages often bury why a change matters beneath low-level file mechanics. Consolidating and trimming the repository engineering guide, relocating skills to the standard discovery directory, making fork-point detection strictly read-only, and requiring plain-English motivation at the top of every commit eliminate these failure modes. As a result, agents discover repository skills automatically without mutating developer Git remotes, always-on instructions stay comfortably below truncation caps, and reviewers can grasp the purpose and value of every pull request on first read. 1. **`GEMINI.md` (`20,649 B` -> `18,118 B`, down from `28,125 B` pre-google#3284):** - Keeps the guide comfortably below the `24,000 B` per-file truncation cap while preserving all invariants added in google#3284, google#3301, and google#3312 (including `Sync & Rebase onto upstream/master`). - Updates `Commit Message Style` so commit and PR bodies open with 2–4 plain-English sentences stating why the change is being made, what problem, waste, or risk exists today, and what concrete outcome improves—before naming classes, flags, or implementation mechanics ("what"/"how"). - Replaces the rigid push ban with a default push gate (halt at local commit unless overridden by a user-level rule or an explicit directive to open/update a PR; use `--force-with-lease` on amended branches; never chain remote transfers with `git commit`). - Resolves internal contradictions: recommends a fixed static `Instant.parse(...)` constant in `reTransact` test helpers (instead of `clock.now()`) and statically imported `formatInstant(...)` from `DateTimeUtils`. - Preserves both Reviewable footer formats (the HTML-comment Reviewable block and `This change is https://reviewable.io/reviews/...`), deduplicates the pre-commit `pr-polisher` checklist into a concise pointer to `.agents/skills/pr-polisher/SKILL.md`, and keeps a single concise `Continuous Improvement` bullet under `Common Pitfalls & Efficiency`. 2. **Migrate repo skills from `.gemini/skills/` to `.agents/skills/`:** - Moves `pr-polisher` (including `check_diff_test.py` from google#3311) and `java-ast-refactoring` into `.agents/skills/` so agents automatically discover them in Git workspaces, updating all path references (including `SCRIPT_PATH` in `check_diff.py`). - Removes duplicated `Continuous Improvement` sections from both `SKILL.md` files (previously instructing agents to commit skill edits inside unrelated PRs), keeping the single concise `Continuous Improvement` bullet in `GEMINI.md`, and fixes YAML 1.2 frontmatter quoting in `.agents/skills/pr-polisher/SKILL.md` (removing internal VCS wording). 3. **Read-only merge-base & `pr-polisher` fixes:** - Removes the `git update-ref` mutation of `refs/remotes/origin/master` from `.agents/skills/pr-polisher/scripts/check_diff.py` and replaces hardcoded `HEAD^` diffs (including `check_protostuff_cached_entities()`) with a read-only `get_diff_base()` helper selecting the fresher merge-base across `upstream/master` and `origin/master` (gracefully catching `CalledProcessError` on shallow or unrelated remote refs and falling back to `refs/heads/master`, covered in `check_diff_test.py`). - Updates `java-format/google-java-format-git-diff.sh` (`findForkPoint()`) to pick the fresher merge-base across fully qualified `refs/remotes/upstream/master` and `refs/remotes/origin/master` read-only (falling back cleanly on shallow/unrelated refs via `|| true` and propagating errors via `forkPoint=$(findForkPoint) || exit 1`). - Fixes the self-contradictory `DateTimeUtils.formatInstant(...)` message in `check_diff.py` to recommend statically importing `formatInstant(...)`, and aligns the `Instant.now()` message with `GEMINI.md`. Verification: - `python3 .agents/skills/pr-polisher/scripts/check_diff_test.py -v`: `11/11` passed. - `python3 .agents/skills/pr-polisher/scripts/check_diff.py`: `0` errors, `0` warnings (`spotlessCheck` and `javaIncrementalFormatCheck` passed). - `./gradlew --no-daemon runPresubmits`: `BUILD SUCCESSFUL`. - Verified strict YAML frontmatter parsing on all `.agents/skills/*/SKILL.md` files, `bash -n java-format/google-java-format-git-diff.sh`, and zero remaining `.gemini/skills` references across the repository. BUG=http://b/588443833 Signed-off-by: Ben McIlwain <mcilwain@google.com>
CydeWeys
force-pushed
the
trim-gemini-md-and-fix-skills
branch
from
December 5, 2026 00:26
3cfb4d9 to
7912b45
Compare
CydeWeys
added a commit
to CydeWeys/nomulus
that referenced
this pull request
Dec 5, 2026
After migrating repository skills to `.agents/skills/` (google#3295), adding scoped `AGENTS.md` guides (google#3311), and adding the on-demand `pr-review` skill (google#3313), a full audit of all agent instructions and skill scripts uncovered remaining duplication, always-on context bloat, mis-routed/stale rules, and four concrete guardrail bugs: `check_diff.py` silently missed Valkey Protostuff fields on `@MappedSuperclass` parents and inline-annotated fields, `core/AGENTS.md` scoped the Netty `retainedDuplicate()` rule away from `proxy/` (its primary caller), `run_rewrite.sh` silently exited `0` on Gradle failure without cleanup traps, and `check_diff_test.py` never ran in presubmits or CI. Centralizing review rules into `pr-review`, moving `core/`-only rules out of root `GEMINI.md`, correcting stale Gradle/Spotless instructions, and fixing the guardrail scripts close these blind spots while cutting always-on `GEMINI.md` by 22%. Specifically, this change: - **Centralizes PR review rules in `.agents/skills/pr-review/SKILL.md`:** - `GEMINI.md` (`18,118 B` -> `14,071 B`): replaces duplicated `Processing PR Feedback` and `PR Description Sync` bullets with a 1-line pointer to `.agents/skills/pr-review/SKILL.md`. - `.agents/skills/pr-polisher/SKILL.md`: removes Step 9 (paginated PR review comment fetch), renumbers Step 10 -> 9, and adds `pr-review` negative routing to frontmatter `description`. - `console-webapp/AGENTS.md`: removes `## Review Calibration`, moving `Shared State` and `Build & Screenshots` into `pr-review` while keeping `Nested @if` as an Angular template authoring rule. - `core/AGENTS.md`: trims the review-only parenthetical from `JPQL Timestamp Ordering`. - `.agents/skills/pr-review/SKILL.md`: adds `### Nomulus Review Calibration` under `Conducting PR Reviews`. - **Re-scopes always-on rules and fixes stale build/formatting docs:** - Moves `Netty Retry Buffers` (`ByteBufHolder.retainedDuplicate()`) out of `core/AGENTS.md` into `GEMINI.md`'s Netty lifecycle bullet so `proxy/`, `networking/`, `prober/`, and `core/` all load it; removes the verbatim duplicated `console-webapp` sentence from `GEMINI.md`. - Moves `core/`-only idioms (CLI/Beam/`TestRegistryToolComponent`, model layering, `@GetterDelegate` sets, partial JSON updates, JAXB optional attributes, allocation tokens, Console actions, CSV output, time-projected entities, Valkey Protostuff compatibility, and async pipeline boundaries) from `GEMINI.md` into `core/AGENTS.md`, fixes exact `monthly_logs.sql` / `monthly_logs_test.sql` paths, and condenses `2-PR Schema Split` in `GEMINI.md`. - Corrects `spotlessApply` (`*.gradle` only) vs. `javaIncrementalFormatApply` (Java formatting & import order) and `checkstyleMain`/`checkstyleTest`, and replaces backend compile commands that triggered Docker `:core:buildToolImage` or `console-webapp` `npmInstallDeps` across `GEMINI.md`, `pr-polisher`, and `java-ast-refactoring`. - **Hardens guardrail scripts and wires unit tests into presubmits:** - `.agents/skills/pr-polisher/scripts/check_diff.py` (+ `SKILL.md` & `check_diff_test.py`): adds the 4 missing Protostuff `@MappedSuperclass` parents (`UpdateAutoTimestampEntity`, `GracePeriodBase`, `DomainDsDataBase`, `BaseTransferObject`), strips leading inline `@Annotation(...)` tokens instead of skipping annotated field lines, skips Java comment lines in anti-pattern checks (while still catching `/* package */`), fixes `fqn_pattern` capturing so full FQNs print, scopes `check_commit_message()` `[OK]` to local errors, and expands internal-leak checks to cover `//depot/configs` and `cl/<digits>` (`15/15` unit tests). - `config/presubmits.py`: adds `verify_agent_scripts()` so `check_diff_test.py` runs automatically on `./gradlew runPresubmits` and CI. - `.agents/skills/java-ast-refactoring/scripts/run_rewrite.sh`: adds `set -euo pipefail`, an `EXIT` cleanup trap for temporary files, and portable top-level `^name:` YAML extraction via `awk`. Verification: - `python3 .agents/skills/pr-polisher/scripts/check_diff_test.py -v`: `15/15` passed. - `python3 .agents/skills/pr-polisher/scripts/check_diff.py`: `0` errors, `0` warnings (`spotlessCheck` and `javaIncrementalFormatCheck` passed). - `./gradlew --no-daemon runPresubmits`: `BUILD SUCCESSFUL` (includes running `check_diff_test.py` via `verify_agent_scripts()`). - Strict `PyYAML` parse OK on all `.agents/skills/*/SKILL.md` files, `bash -n` on `run_rewrite.sh`, and `0` lines > 80 chars in `core/AGENTS.md` and `console-webapp/AGENTS.md`. BUG=http://b/593117423 Signed-off-by: Ben McIlwain <mcilwain@google.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI coding agents and reviewers working across fork-based workflows currently hit
four recurring sources of friction: repository skills sit in a legacy directory
that standard Git workspaces do not auto-discover, local diff and formatting
checks overwrite remote tracking refs or diff against stale fork bases,
redundant checklists and contradictory rules bloat always-on context toward
per-file truncation limits, and commit messages often bury why a change matters
beneath low-level file mechanics. Consolidating and trimming the repository
engineering guide, relocating skills to the standard discovery directory, making
fork-point detection strictly read-only, and requiring plain-English motivation
at the top of every commit eliminate these failure modes. As a result, agents
discover repository skills automatically without mutating developer Git remotes,
always-on instructions stay comfortably below truncation caps, and reviewers can
grasp the purpose and value of every pull request on first read.
Summary of Changes
GEMINI.md(20,649 B->18,118 B, down from28,125 Bpre-Harden Gemini skills and tighten GEMINI.md #3284):24,000 Bper-file truncation capwhile preserving all invariants added in Harden Gemini skills and tighten GEMINI.md #3284, Add explicit state-machine rules and checks #3301, and Enforce upstream/master rebase in PR polisher #3312 (including
Sync & Rebase onto upstream/master).Commit Message Styleso commit and PR bodies open with 2–4plain-English sentences stating why the change is being made, what
problem, waste, or risk exists today, and what concrete outcome
improves—before naming classes, flags, or implementation mechanics
("what"/"how").
unless overridden by a user-level rule or an explicit directive to
open/update a PR; use
--force-with-leaseon amended branches; neverchain remote transfers with
git commit).Instant.parse(...)constant inreTransacttest helpers (instead ofclock.now()) and statically importedformatInstant(...)fromDateTimeUtils.block and
This change is https://reviewable.io/reviews/...), deduplicatesthe pre-commit
pr-polisherchecklist into a concise pointer to.agents/skills/pr-polisher/SKILL.md, and keeps a single conciseContinuous Improvementbullet underCommon Pitfalls & Efficiency..gemini/skills/to.agents/skills/:pr-polisher(includingcheck_diff_test.pyfrom Add scoped AGENTS.md rules and static guardrails #3311) andjava-ast-refactoringinto.agents/skills/so agents automaticallydiscover them in Git workspaces, updating all path references (including
SCRIPT_PATHincheck_diff.py).Continuous Improvementsections from bothSKILL.mdfiles (previously instructing agents to commit skill edits inside
unrelated PRs), keeping the single concise
Continuous Improvementbulletin
GEMINI.md, and fixes YAML 1.2 frontmatter quoting in.agents/skills/pr-polisher/SKILL.md(removing internal VCS wording).pr-polisherfixes:git update-refmutation ofrefs/remotes/origin/masterfrom.agents/skills/pr-polisher/scripts/check_diff.pyand replaces hardcodedHEAD^diffs (includingcheck_protostuff_cached_entities()) with aread-only
get_diff_base()helper selecting the fresher merge-base acrossupstream/masterandorigin/master(gracefully catchingCalledProcessErroron shallow or unrelated remote refs and falling backto
refs/heads/master, covered incheck_diff_test.py).java-format/google-java-format-git-diff.sh(findForkPoint())to pick the fresher merge-base across fully qualified
refs/remotes/upstream/masterandrefs/remotes/origin/masterread-only(falling back cleanly on shallow/unrelated refs via
|| trueandpropagating errors via
forkPoint=$(findForkPoint) || exit 1).DateTimeUtils.formatInstant(...)message incheck_diff.pyto recommend statically importingformatInstant(...),and aligns the
Instant.now()message withGEMINI.md.Verification
python3 .agents/skills/pr-polisher/scripts/check_diff_test.py -v:11/11passed.
python3 .agents/skills/pr-polisher/scripts/check_diff.py:0errors,0warnings (
spotlessCheckandjavaIncrementalFormatCheckpassed)../gradlew --no-daemon runPresubmits:BUILD SUCCESSFUL..agents/skills/*/SKILL.mdfiles,
bash -n java-format/google-java-format-git-diff.sh, and zeroremaining
.gemini/skillsreferences across the repository.BUG=http://b/588443833
This change is