Skip to content

Slim down agent rules: drop lint-enforced, stale and generic rules - #7884

Merged
denik merged 2 commits into
mainfrom
denik/slim-agent-rules
Nov 23, 2026
Merged

denik merged 2 commits into
mainfrom
denik/slim-agent-rules

Conversation

@denik

@denik denik commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Changes

Halve the agent rules: 66 KB → 33 KB of AGENTS.md + .agents/rules/. The rules that are always loaded or loaded on every Go edit shrink the most:

Context loaded Before After
Always (AGENTS.md) 12.2 KB 6.1 KB
Editing a .go file (+ style-guide-go, comments) 23.5 KB 9.7 KB
Editing a _test.go file (+ testing) 45.8 KB 17.5 KB
Editing acceptance outputs (+ testing, auto-generated-files) 38.5 KB 16.4 KB

Skills are unchanged: they load only when invoked.

What was removed, and why:

  • Already enforced by ./task lint (the agent gets the same message from the linter):
    • integer range, builtin min/max (modernize)
    • loop-variable capture (copyloopvar)
    • os.Getenv, sync.Once (forbidigo)
    • context.Background() (gorules)
    • t.Context() in tests (usetesting)
    • stdlib log (depguard)
    • %w wrapping (errorlint)
    • error-string punctuation (staticcheck ST1005)
    • copying config.Config (govet copylocks)
  • Wrong or stale:
    • errors.As was recommended, but forbidigo bans it (the tree has 0 errors.As calls vs 231 errors.AsType).
    • isResourceGone doesn't exist.
    • libs/structpath has moved to libs/structs/structpath.
    • "consult the Makefile": there is no Makefile.
    • The out.test.toml old-format migration rule is dead: 0 files are left in that format.
    • "Use Python 3.11" also applied to python/, which supports >=3.10.
    • The databricks_template_schema.json "reference" was an outdated copy of dbt-sql's schema. It described a description convention the real file no longer uses, and it had a typo. It is replaced by pointers to the real templates and to libs/jsonschema/extension.go.
    • template-versions.md hardcoded how many pins each template has. The counts were wrong; the grep in the same rule is what the agent should rely on.
  • Rules that produced wrong review feedback:
  • Generic guidance current models already follow:
    • return early
    • switch vs if/else
    • empty-struct context keys
    • table-driven tests
    • shared test constants
    • Go doc comment format
    • constructor parameter structs
    • "don't explain each test case in your responses"
    • debug prints (pr-checklist already covers them)
    • the GOOD/BAD preamble
  • Repetition:
    • Cloud = true runs locally too: this was explained 5 times and is now explained once in AGENTS.md and once in testing.md.
    • integration/ is deprecated: stated 4 times.
    • "Don't edit generated outputs": stated 4 times across testing.md and auto-generated-files.md.
    • The print_requests.py/jq guidance was 3 overlapping rules and is now 1.
    • The long GOOD/BAD examples were dropped where the rule sentence already says it.

Clarified:

Why

The rules were mostly mined from review history in #5078. That PR's follow-up promised a slim-down that never came (#4882), and token cost had already come up in review (#6584). Every byte of AGENTS.md and the Go/test rules is paid on most turns, and rules that are wrong or that the linter already enforces either crowd out the useful ones or become review noise. I checked the 98 comments from review-oss-bot and the human pushback since 2026: the rules that went wrong are the ones removed above. The acceptance-test rules that came from real agent failures (Cloud, EnvMatrix, TOML dotted keys, musterr/errcode, print_requests.py, testserver over [[Server]], GET-response projection) are kept, just shorter.

Tests

./task check-agents-setup and ./task checks pass. Every path, helper, task and identifier still mentioned was checked against the tree.

This pull request and its description were written by Isaac.

Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik marked this pull request as ready for review November 23, 2026 12:14
@denik
denik requested a review from a team as a code owner November 23, 2026 12:14

@review-oss-bot review-oss-bot 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.

Automated review at bf7874a. Each finding was verified against the code.

No blocking issues found. 1 non-blocking comment(s) below.

This PR halves the agent rules (~66 KB → ~33 KB) by removing lint-enforced, stale, wrong, and generic guidance while keeping the rules that came from real agent failures. The removals are well-motivated and the description is thorough. One small functional change — dropping the git fetch from the rebase recipe — appears unintentional and should be restored.

Comment thread AGENTS.md

```sh
GIT_EDITOR=true GIT_SEQUENCE_EDITOR=true VISUAL=true GIT_PAGER=cat git fetch origin main &&
GIT_EDITOR=true GIT_SEQUENCE_EDITOR=true VISUAL=true GIT_PAGER=cat git rebase origin/main

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nice to have] The base recipe chained git fetch origin main && before the rebase (base line 54). Without the fetch, the agent rebases on whatever origin/main it last fetched locally, which can be arbitrarily stale. The PR description doesn't list this as an intentional removal. Re-add the fetch line before the rebase command.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Restored in b11be8d, thanks — the drop was unintentional.

Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 8f27fc4 Nov 23, 2026
22 checks passed
@denik
denik deleted the denik/slim-agent-rules branch November 23, 2026 12:47
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

❌ Integration test report

Commit: 8f27fc4

Run: 45177665045

Env ❌​FAIL 🔄​flaky 💚​RECOVERED ✅​pass 🙈​skip Time
🔄​ aws linux-2core-8gb 4 25 1617 1423 97:23
🔄​ aws-windows-latest-4core-16gb 2 27 1533 1451 106:24
💚​ azure linux-2core-8gb 27 1599 1431 104:54
🔄​ azure-windows-latest-4core-16gb 3 24 1515 1459 110:07
❌​ gcp linux-2core-8gb 1 3 26 1603 1429 118:06
💚​ gcp-windows-latest-4core-16gb 27 1522 1457 115:30
34 interesting tests: 24 RECOVERED, 9 flaky, 1 FAIL
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
🔄​ TestAccept 💚​R 💚​R 💚​R 🔄​f 🔄​f 💚​R
🔄​ TestAccept/bundle/config-remote-sync/multiple_resources ✅​p 🙈​s ✅​p 🙈​s 🔄​f 🙈​s
❌​ TestAccept/bundle/config-remote-sync/multiple_resources/DMS= ✅​p ✅​p ❌​F
🔄​ TestAccept/bundle/config-remote-sync/multiple_resources/DMS=true ✅​p ✅​p 🔄​f
💚​ TestAccept/bundle/deployment/bind/alert 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/deployment/bind/alert/DMS= 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/deployment/bind/alert/DMS=true 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🔄​ TestAccept/bundle/destroy/jobs-and-pipeline/DMS= ✅​p 🔄​f ✅​p ✅​p ✅​p ✅​p
🔄​ TestAccept/bundle/destroy/jobs-and-pipeline/DMS=true ✅​p 🔄​f ✅​p ✅​p ✅​p ✅​p
💚​ TestAccept/bundle/generate/alert 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/generate/alert/DMS= 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/generate/alert/DMS=true 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🔄​ TestAccept/bundle/invariant/delete_idempotent 🔄​f ✅​p ✅​p ✅​p ✅​p ✅​p
🔄​ TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=volume.yml.tmpl/READPLAN=1 🔄​f ✅​p ✅​p ✅​p ✅​p ✅​p
💚​ TestAccept/bundle/resources/alerts/basic 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/alerts/basic/DMS= 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/alerts/basic/DMS=true 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/alerts/with_file 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/alerts/with_file/DMS= 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/alerts/with_file/DMS=true 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started-omitted 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS= 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=true 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started-toggle 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS= 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS=true 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started/DMS= 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started/DMS=true 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/postgres_synced_tables/basic 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/postgres_synced_tables/basic/DMS= 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🔄​ TestAccept/bundle/resources/postgres_synced_tables/recreate 🔄​f 💚​R 💚​R 🔄​f 💚​R 💚​R
🔄​ TestAccept/bundle/resources/postgres_synced_tables/recreate/DMS= 🔄​f 💚​R 💚​R 🔄​f 💚​R 💚​R
💚​ TestAccept/bundle/resources/postgres_synced_tables/recreate/DMS=true 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 50 slowest tests (at least 2 minutes):
duration env testname
12:48 azure linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
12:08 gcp linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
12:03 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
11:48 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
10:18 azure linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=true
10:02 aws-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
9:58 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
9:49 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
9:47 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=
9:37 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
9:33 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=true
9:30 aws-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
9:24 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
9:07 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
9:04 gcp linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=
9:04 azure linux-2core-8gb TestAccept/bundle/resources/clusters/resize-terminated-fallback/DMS=true
8:59 azure linux-2core-8gb TestAccept/bundle/resources/clusters/deploy/update-after-create/DMS=
8:37 azure linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
8:30 gcp linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
8:19 aws linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
8:19 azure linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
8:04 gcp linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
7:52 azure linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=
7:49 gcp linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
7:30 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/deploy/local_ssd_count/DMS=true
7:26 gcp linux-2core-8gb TestAccept/bundle/resources/clusters/deploy/local_ssd_count/DMS=
7:23 azure-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/deploy/simple/DMS=
7:08 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
7:04 azure linux-2core-8gb TestAccept/bundle/config-remote-sync/multiple_resources/DMS=true
7:02 aws linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
6:57 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/deploy/local_ssd_count/DMS=
6:38 gcp linux-2core-8gb TestAccept/bundle/resources/clusters/deploy/local_ssd_count/DMS=true
6:13 aws linux-2core-8gb TestAccept/bundle/config-remote-sync/multiple_resources/DMS=true
6:10 gcp linux-2core-8gb TestAccept/bundle/config-remote-sync/multiple_resources/DMS=true
6:09 aws linux-2core-8gb TestAccept/bundle/config-remote-sync/multiple_resources/DMS=
6:01 azure-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
5:59 aws-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
5:57 gcp-windows-latest-4core-16gb TestAccept
5:49 aws-windows-latest-4core-16gb TestAccept/bundle/deploy/spark-jar-task/DMS=true
5:48 gcp linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=true
5:44 aws-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
5:31 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/resize-terminated-fallback/DMS=true
5:24 aws linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=true
5:19 aws-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=
5:15 azure-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
5:12 azure linux-2core-8gb TestAccept/bundle/config-remote-sync/multiple_resources/DMS=
4:59 aws linux-2core-8gb TestAccept/pipelines/run/refresh-flags
4:49 gcp linux-2core-8gb TestAccept/bundle/deploy/spark-jar-task/DMS=
4:49 azure linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
4:47 gcp linux-2core-8gb TestAccept/bundle/deploy/spark-jar-task/DMS=true

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.

5 participants