agent-optimizer

Audits AGENTS.md, CLAUDE.md, and context/ directories for token waste and orphaned files.

6|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/northguild/gmt --skill agent-optimizer-northguild
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: agent-optimizer
Source: https://github.com/northguild/gmt/tree/main/.agents/skills/agent-optimizer
Command: npx skills add https://github.com/northguild/gmt --skill agent-optimizer-northguild

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pyyaml, pytest, and includes scripts (resource) and references (resource) components.

What problem does it solve? Agent entry files like AGENTS.md and CLAUDE.md tend to bloat over time, accumulating oversized sections, broken links, and orphaned context files that consume maintenance effort without ever being loaded. This Skill audits those files and the context/ directory they reference, producing a report of token waste and progressive-disclosure violations. ## Core Features & Use Cases - Entry file auditing: Measures AGENTS.md and CLAUDE.md against a 4000-character budget and flags any ## section over 600 characters as an extraction candidate for context/. - Orphan and broken-link detection: Identifies context/*.md files not linked from any entry file, and entry-file links pointing at nonexistent files. - Near-duplicate detection: Compares context files pairwise with a similarity ratio of 0.80 to flag merge candidates. - Use Case: After months of editing AGENTS.md, run the audit to discover that a 70,000-character roadmap.md is orphaned and that two standards files are near-duplicates, then apply the suggested fixes. ## Quick Start Ask the agent to audit this repository's AGENTS.md and context directory for token waste and orphaned files.

Frequently Asked Questions about agent-optimizer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit AGENTS.md for token waste?▼

Run the optimize.py script against the repository root containing AGENTS.md and context/. It reports character counts against a 4000-character budget, oversized sections over 600 characters, and broken links, all as a JSON report without modifying any files.

How to find orphaned context files not linked from AGENTS.md?▼

The audit parses every Markdown link in AGENTS.md and CLAUDE.md, then compares the linked set against all files under context/. Any context/*.md file not linked from an entry file is reported as an orphan, which is the highest-priority finding.

Does the agent context audit modify my files?▼

No, the skill is advisory only and never edits files. It reads entry files and context files, prints a JSON report with warnings and suggestions, and exits with code 0 on a successful scan. A human applies the suggested fixes.

What size limits should AGENTS.md and context files stay under?▼

The default budgets are 4000 characters for entry files like AGENTS.md and 15000 characters for individual context/*.md files. Sections in entry files over 600 characters are flagged as extraction candidates. These thresholds are documented in references/rules.md.

Can the audit detect duplicate context documentation?▼

Yes, it compares every pair of context files using a SequenceMatcher similarity ratio. Pairs scoring 0.80 or higher are reported as near-duplicates, which are candidates to merge since duplicated content wastes context budget and risks drift.