Skip to content

chore: trim agent rules under context limit, add review patterns#1322

Merged
mchmarny merged 1 commit into
mainfrom
chore/trim-agent-rules
Jun 11, 2026
Merged

chore: trim agent rules under context limit, add review patterns#1322
mchmarny merged 1 commit into
mainfrom
chore/trim-agent-rules

Conversation

@mchmarny

Copy link
Copy Markdown
Member

Summary

Trim .claude/CLAUDE.md (and its AGENTS.md mirror) back under the 40k-char context limit, and add three high-signal anti-pattern rows mined from recent PR review feedback.

Motivation / Context

.claude/CLAUDE.md had grown to ~40.1k chars, exceeding the context-window limit that Claude Code warns about. The growth was concentrated in redundancy: ~17 rows of the Anti-Patterns table simply restated rules already explained in full in the dedicated sections (Error Wrapping, Context Propagation, HTTP Client/Server, Logging, Constants, Kubernetes Patterns, Test Isolation). A review of the last ~40 merged PRs also surfaced recurring reviewer feedback not yet codified.

Fixes: N/A
Related: N/A

Type of Change

  • Documentation update
  • Build/CI/tooling

Component(s) Affected

  • Docs/examples (docs/, examples/)
  • Other: coding-agent rules (.claude/CLAUDE.md, AGENTS.md)

Implementation Notes

Testing

./tools/check-agents-sync   # AGENTS.md in sync with .claude/CLAUDE.md (line 5+)

No Go sources changed, so the coverage/lint Go gates do not apply. The relevant merge gate is check-agents-sync (part of make lint), verified locally.

Risk Assessment

  • Low — Documentation/tooling only, easy to revert, no runtime impact.

Rollout notes: N/A

Checklist

  • Tests pass locally (make test with -race) — N/A, no Go changes
  • Linter passes (check-agents-sync verified)
  • I did not skip/disable tests to make CI green
  • I added/updated tests for new functionality — N/A
  • I updated docs if user-facing behavior changed
  • Changes follow existing patterns in the codebase
  • Commits are cryptographically signed (git commit -S)

CLAUDE.md exceeded the 40k-char context limit. Dedupe the Anti-Patterns
table (remove ~17 rows that restated dedicated rule sections) and compress
the Documentation Style and test-coverage-gate prose. Add three new
anti-pattern rows mined from recent PR review feedback: fail-closed
negative/health checks, kyverno-json/chainsaw assertion traps, and
denylist-to-allowlist security gates.

AGENTS.md is regenerated as the line-5+ mirror.
@mchmarny mchmarny requested a review from a team as a code owner June 11, 2026 22:37
@mchmarny mchmarny added the theme/ci-dx CI pipelines, developer experience, and build tooling label Jun 11, 2026
@mchmarny mchmarny self-assigned this Jun 11, 2026
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This pull request refines agent guidance rules across two documentation files: .claude/CLAUDE.md and AGENTS.md. The changes tighten documentation style conventions for anchor/TOC auto-generation, bold-label promotion, slug hygiene, and anchor links. The anti-patterns table is expanded with stronger fail-closed, bounded-input/read, deterministic serialization, and security-gating guidance. The test coverage gate procedure is reworded with clearer baseline handling, blocking conditions for zero-coverage exports, coverage-decrease thresholds, and per-package delta reporting expectations. No exported entities are altered.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

size/S, area/docs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main changes: trimming agent rules to meet context limits and adding new review patterns from PR feedback.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, detailing the motivation, implementation approach, testing, and risk assessment for the documentation updates.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/trim-agent-rules

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 @.claude/CLAUDE.md:
- Around line 581-589: Update the sentence that currently reads "Block if `make
test-coverage` fails (enforces the project-wide 70% floor from `.settings.yaml`;
do not use per-package profiles for this check)." to use 75% instead of 70% so
it matches `.settings.yaml` and docs; i.e., change the documented project-wide
coverage floor in the "Test coverage gate" section to 75% (retain the rest of
the sentence and surrounding guidance).
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 6f71b092-0226-4f67-b335-d3b0a4672e0c

📥 Commits

Reviewing files that changed from the base of the PR and between e05a236 and aa422dc.

📒 Files selected for processing (2)
  • .claude/CLAUDE.md
  • AGENTS.md

Comment thread .claude/CLAUDE.md
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report ✅

Metric Value
Coverage 77.0%
Threshold 75%
Status Pass
Coverage Badge
![Coverage](https://img.shields.io/badge/coverage-77.0%25-green)

No Go source files changed in this PR.

@mchmarny mchmarny merged commit 3fadaf6 into main Jun 11, 2026
33 of 34 checks passed
@mchmarny mchmarny deleted the chore/trim-agent-rules branch June 11, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs size/M theme/ci-dx CI pipelines, developer experience, and build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants