Skip to content

t1281: Deduplicate shared rules across context chain (pass 1)#2039

Merged
marcusquinn merged 5 commits intomainfrom
feature/t1281
Feb 21, 2026
Merged

t1281: Deduplicate shared rules across context chain (pass 1)#2039
marcusquinn merged 5 commits intomainfrom
feature/t1281

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 21, 2026

Summary

  • Deduplicate shared rules across the always-loaded context chain (build.txt + repo AGENTS.md + .agents/AGENTS.md + build-plus.md)
  • Establishes build.txt as single source of truth for universal rules; downstream files now use one-line pointers
  • Saves ~4,275 bytes (~1,068 tokens) per session with zero knowledge loss

Changes by deduplication target

Target Before After Savings
(a) Pre-edit check 24 lines in AGENTS.md + 3 in build-plus Pointer + unique subagent restrictions ~14 lines
(b) Completion self-check 10 lines in .agents/AGENTS.md + 8 in repo AGENTS.md Pointers to build.txt ~16 lines
(c) File discovery 13-line table in .agents/AGENTS.md One-line pointer ~12 lines
(d) Security rules 11 lines in .agents/AGENTS.md + 5 in repo AGENTS.md Pointers + unique config templates line ~12 lines
(e) Working directories 15-line tree in .agents/AGENTS.md Pointer + agent tiers list ~9 lines
(f) Quality standards Scattered across AGENTS.md files Pointers to build.txt ~4 lines
(g) Dev lifecycle 16 lines in repo AGENTS.md Pointer to .agents/AGENTS.md ~14 lines
Bot reviewer feedback 3 lines in .agents/AGENTS.md Pointer to build.txt ~2 lines
Compaction survival 2 lines in .agents/AGENTS.md Pointer to build.txt ~1 line

File size results

File Before After Target Status
build.txt 12,647 12,647 ≤13,000 PASS
AGENTS.md 5,299 4,043 n/a -1,256
.agents/AGENTS.md 39,129 36,080 ≤36,000 ~80 over
build-plus.md 16,207 16,237 ≤15,500 ~737 over
Total 73,282 69,007 -4,275 bytes

Verification

  • Inheritance chain traced for all 9 deduplicated rules — all accessible via build.txt (loaded first)
  • No knowledge deleted — unique content preserved in place, duplicates replaced with pointers
  • markdownlint: 0 errors across all 3 modified files

Ref #2036

Summary by CodeRabbit

  • Chores
    • Updated internal agent and build process documentation with consolidated references to external guidelines and prompts for streamlined developer workflow.

Keep build.txt as authoritative source. Replace .agents/AGENTS.md verbose
pre-edit section (24 lines) with pointer + unique subagent restrictions only.
Replace build-plus.md references with one-liners pointing to build.txt.
build.txt "Completion and quality discipline" section is authoritative (20 lines).
Remove duplicate 10-line block from .agents/AGENTS.md and 8-line block from repo
AGENTS.md, replacing with one-line pointers.
…ng dirs (t1281)

(c) File discovery: replace 13-line table in .agents/AGENTS.md with pointer.
(d) Security: keep only unique config templates line, replace rest with pointer.
(e) Working directories: keep only agent tiers detail, replace tree with pointer.
(f-partial) Critical Rules: replace 10-line block with single pointer line.
…epo AGENTS.md (t1281)

(f) Quality standards: replace inline list in repo AGENTS.md with pointer to build.txt.
(g) Development lifecycle: replace 16-line block in repo AGENTS.md with pointer to
.agents/AGENTS.md (which has the more complete version).
(d-repo) Security: replace 5-line block with pointer, keep unique contributor rule.
…ule (t1281)

Replace bot reviewer feedback paragraph with pointer to build.txt AI Suggestion
Verification section. Replace compaction survival rule with pointer. Saves ~370
additional bytes.
@gemini-code-assist
Copy link

Summary of Changes

Hello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors how shared operational rules are managed across various agent configuration files. By centralizing common guidelines in prompts/build.txt and replacing redundant content with concise pointers, the change significantly reduces the overall token count required for agent sessions. This improves efficiency and maintainability by establishing a single, authoritative source for critical instructions, while preserving unique file-specific restrictions.

Highlights

  • Deduplication of Shared Rules: Shared rules across the always-loaded context chain (build.txt, repo AGENTS.md, .agents/AGENTS.md, build-plus.md) have been deduplicated.
  • Single Source of Truth: The build.txt file is now established as the single source of truth for universal rules, with downstream files using one-line pointers to it.
  • Token and Byte Savings: This change saves approximately 4,275 bytes (~1,068 tokens) per session without any loss of knowledge.
  • Specific Deduplication Targets: Rules for pre-edit checks, completion self-checks, file discovery, security, working directories, quality standards, dev lifecycle, bot reviewer feedback, and compaction survival have been updated to use pointers.
Changelog
  • .agents/AGENTS.md
    • Replaced detailed 'MANDATORY: Pre-Edit Git Check' rules with a pointer to prompts/build.txt.
    • Replaced detailed 'Completion self-check' rules with a pointer to prompts/build.txt.
    • Replaced detailed 'MANDATORY: File Discovery' rules with a pointer to prompts/build.txt.
    • Replaced detailed 'Critical Rules' with a pointer to prompts/build.txt.
    • Replaced detailed 'Compaction survival rule' with a pointer to prompts/build.txt.
    • Replaced detailed 'Bot Reviewer Feedback' with a pointer to prompts/build.txt.
    • Replaced detailed 'Security' rules with a pointer to prompts/build.txt and clarified agent file locations in 'Working Directories'.
  • .agents/build-plus.md
    • Updated 'Execution Mode' pre-edit check instruction to reference prompts/build.txt.
    • Updated planning completion pre-edit check instruction to reference prompts/build.txt.
  • AGENTS.md
    • Replaced detailed 'Quality Standards' with a pointer to prompts/build.txt.
    • Replaced detailed 'Development Lifecycle' and 'Completion self-check' with pointers to .agents/AGENTS.md and prompts/build.txt.
    • Replaced detailed 'Security' rules with a pointer to prompts/build.txt.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 21, 2026

Walkthrough

This PR consolidates agent documentation by replacing detailed, explicit operational rules with concise references to centralized prompt documentation (prompts/build.txt), reducing inline guidance verbosity across .agents/AGENTS.md, .agents/build-plus.md, and AGENTS.md files.

Changes

Cohort / File(s) Summary
Agent Documentation Consolidation
.agents/AGENTS.md, .agents/build-plus.md, AGENTS.md
Replaced explicit pre-edit checks, lifecycle steps, quality standards, security rules, and file-discovery procedures with references to external prompts/build.txt. Updated pre-edit check instructions to use platform-agnostic command names. Net reduction of ~75 lines of redundant detail across files.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

📋 Rules once sprawled across pages wide,
Now neatly tucked in prompts, side by side—
Less is more when truth's centralized,
DevOps discipline, crystallized! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and specifically describes the primary objective: deduplicating shared rules across the context chain. It is concise, clear, and accurately summarizes the main refactoring change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/t1281

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions
Copy link

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 34 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Sat Feb 21 00:25:34 UTC 2026: Code review monitoring started
Sat Feb 21 00:25:35 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 34

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 34
  • VULNERABILITIES: 0

Generated on: Sat Feb 21 00:25:37 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request effectively deduplicates shared rules across the context chain, leading to significant token savings (~1,068 tokens per session). This is a great optimization for LLM-based workflows. The unique content in each file has been preserved while common rules are now centralized in prompts/build.txt. My main feedback is regarding the loss of markdown formatting (backticks) for file paths and script names in the newly added pointer lines, which affects readability and consistency with the existing documentation style.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.agents/build-plus.md (1)

103-103: pre-edit-check.sh should use its full path for consistency.

Every other script reference in this file uses an absolute path (e.g., ~/.aidevops/agents/scripts/memory-helper.sh, ~/.aidevops/agents/scripts/planning-commit-helper.sh). The bare pre-edit-check.sh silently assumes ~/.aidevops/agents/scripts/ is on $PATH, which isn't documented anywhere and diverges from the established pattern in .agents/AGENTS.md's Quick Reference (~/.aidevops/agents/scripts/[service]-helper.sh).

♻️ Suggested consistent form
-1. Pre-edit check: run `pre-edit-check.sh` before any edit (see `prompts/build.txt`)
+1. Pre-edit check: run `~/.aidevops/agents/scripts/pre-edit-check.sh` before any edit (see `prompts/build.txt`)

Apply the same fix at Line 315.

Also applies to: 315-315

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/build-plus.md at line 103, Replace the bare script reference
pre-edit-check.sh with the full path used elsewhere
(~/.aidevops/agents/scripts/pre-edit-check.sh) to match the established pattern;
update both occurrences (the one shown and the other at the same spot referenced
around line 315) so all script references in .agents/build-plus.md consistently
use the absolute ~/.aidevops/agents/scripts/ path.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.agents/build-plus.md:
- Line 103: Replace the bare script reference pre-edit-check.sh with the full
path used elsewhere (~/.aidevops/agents/scripts/pre-edit-check.sh) to match the
established pattern; update both occurrences (the one shown and the other at the
same spot referenced around line 315) so all script references in
.agents/build-plus.md consistently use the absolute ~/.aidevops/agents/scripts/
path.

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.

1 participant