Skip to content

docs(agents): [#2691] reduce the AGENTS.md token footprint - #2704

Merged
josecelano merged 19 commits into
torrust:developfrom
josecelano-bot:2691-reduce-agents-md-token-footprint
Nov 4, 2026
Merged

josecelano merged 19 commits into
torrust:developfrom
josecelano-bot:2691-reduce-agents-md-token-footprint

Conversation

@josecelano-bot

@josecelano-bot josecelano-bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implements #2691: research good practices for AGENTS.md and apply them to the root AGENTS.md to cut its token footprint. The specification was merged earlier in #2692.

Measure Baseline Now
Claude Code /context tokens 12.4k 4.8k (-61%)
Lines 523 229
Bytes 35,910 13,027

The target was about 5k tokens or fewer. Only global rules stay in the root file; the rest moved to the skill, doc or nested AGENTS.md closest to where it is used, or was removed with a recorded reason.

What changed

  • docs/packages.md is now the canonical package catalog; packages/AGENTS.md links to it. AGENTS.md keeps a pointer and the cargo metadata command.
  • The open-pull-request skill gained the commit-history, rewrite and PR-title rules (it previously pointed back at AGENTS.md). The run-linters skill gets a corrected ignore note (ignorePaths in cspell.json). The setup-dev-environment skill gains an optional VS Code agent-skills section.
  • Build, config, container and Git Workflow detail in AGENTS.md is condensed to short rules plus pointers.
  • Cross-references to the removed content were updated (deny.toml, EPIC Overhaul: Packages #1669, spec Adopt a calendar-based MSRV policy #2183).
  • Four statements in the old file were already wrong (non-existent test target, .cspell.gitignore, four of five cargo aliases, tests/ contents) and were dropped, not carried over.

How "no rule lost" was checked

  • rule-inventory.md lists all 99 rules and facts of the baseline file, each with a final location or a recorded reason for removal; all are asserted.
  • Two fresh-session checks (V2, V3) confirmed an agent still states the commit, signing and branch rules and finds the moved package and port content.
  • An independent review found no lost rules and some stale references, which were fixed and re-reviewed (agent-review-reports.md).

Decisions and non-goals

No ADR, no CLAUDE.md adapter, and no regrowth guard for now (D7, D9; may be revisited). The short, very common branch, commit and pre-commit rules deliberately stay inline (D8). Details are in section-disposition.md and implementation-retrospective.md in the issue folder.

Validation

./contrib/dev-tools/git/hooks/pre-commit.sh passes for every commit, linter all exits 0, and the pre-push hook passed. CI has not run yet.

Closes #2691

🤖 Generated with Claude Code

josecelano-bot and others added 7 commits October 30, 2026 16:37
…best-practices research

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…or the AGENTS.md dispositions

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ainer usage instead of duplicating them

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@josecelano josecelano self-assigned this Nov 3, 2026
@josecelano
josecelano requested a review from da2ce7 November 3, 2026 17:40
josecelano-bot and others added 12 commits November 3, 2026 18:01
…ead of duplicating their content

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…en-pull-request skill

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…g in setup-dev-environment

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… waive the regrowth guard

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… check and the final rule inventory walk-through

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… review the acceptance criteria

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…s findings

Fix the stale references to the removed AGENTS.md content (EPIC torrust#1669, issue
torrust#2183, deny.toml), the T6 status, the R030 reason and the run-linters version.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@josecelano-bot
josecelano-bot marked this pull request as ready for review November 4, 2026 11:42
@josecelano-bot
josecelano-bot requested a review from a team as a code owner November 4, 2026 11:42
@josecelano

Copy link
Copy Markdown
Member

ACK 6b63c72

@josecelano
josecelano merged commit d4987d5 into torrust:develop Nov 4, 2026
22 checks passed
josecelano added a commit that referenced this pull request Nov 4, 2026
…ssues/closed

5746b35 chore(issues): archive closed issue #2691 spec to docs/issues/closed (josecelano-bot)

Pull request description:

  Archives the spec for issue #2691 (closed on GitHub by #2704) from `docs/issues/open/` to `docs/issues/closed/`, following the `cleanup-completed-issues` skill.

  - Verified issue #2691 is `CLOSED` on GitHub
  - Updated frontmatter (`status: done`, `spec-path`, `related-artifacts`, `last-updated-utc`) and the workflow checkboxes, and added a progress-log entry
  - Searched the repository for the old folder name: no live references outside the folder itself; historical prose that names the `open/` path is unchanged
  - Pre-commit hooks and `linter all` passed

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

ACKs for top commit:
  josecelano:
    ACK 5746b35

Tree-SHA512: 789b96bddacf44484830550329d10163c69bd2544d8d14567655013a212b0bafba29625db8e32eb7cfdca62dd270ca249c75a934b92399875151696726315175
@da2ce7

da2ce7 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Post-merge note: this pull request requested a review from this account and was closed without one at its final head. A post-merge review will not be done: It changed only documentation (the root and package agent guides, skill instructions, the package catalog and issue records) and one comment line in deny.toml, with no executable code, build or CI effect.

This branch was previously deployed

1 inactive deployment
coverage — 6b63c723 Deployed Nov 4, 2026 by josecelano-bot via Generate Coverage Report #2902
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.

Research AGENTS.md best practices and reduce its token footprint

3 participants