You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From a PR review patterns audit across 7 MongoDB Agent Skills, token efficiency / content placement was the most frequent pattern (14 instances across 5 PRs). SKILL.md is always loaded into context, so every token there has a high cost.
Proposed check
Add an info-level check that reports SKILL.md token count with a section-level breakdown, and a warning when the total exceeds a configurable threshold.
Behavior
Info output: For every skill-validator check run, report:
Total SKILL.md estimated token count
Per-section breakdown (split by ## headings)
Largest section highlighted
Warning threshold: Flag when SKILL.md exceeds a configurable token budget (suggested default: 3,000 tokens). The threshold should be configurable via CLI flag (e.g., --skill-md-token-budget 3000).
Use a simple whitespace-based heuristic (words × 1.3) or a tiktoken-compatible tokenizer. Exact count is less important than consistent, directional guidance.
Context
From a PR review patterns audit across 7 MongoDB Agent Skills, token efficiency / content placement was the most frequent pattern (14 instances across 5 PRs). SKILL.md is always loaded into context, so every token there has a high cost.
Proposed check
Add an info-level check that reports SKILL.md token count with a section-level breakdown, and a warning when the total exceeds a configurable threshold.
Behavior
Info output: For every
skill-validator checkrun, report:##headings)Warning threshold: Flag when SKILL.md exceeds a configurable token budget (suggested default: 3,000 tokens). The threshold should be configurable via CLI flag (e.g.,
--skill-md-token-budget 3000).Message:
SKILL.md: ~{N} tokens ({sections} sections). Largest section: "{name}" (~{M} tokens).SKILL.md exceeds token budget ({N} tokens > {budget} threshold). Consider moving conditionally-needed content to reference files.Token estimation
Use a simple whitespace-based heuristic (words × 1.3) or a tiktoken-compatible tokenizer. Exact count is less important than consistent, directional guidance.
Relationship to existing work
Examples from PR reviews
createoperationsRelated
Complements #30 (title + description token count). Part of a series of checks derived from PR review pattern analysis.