Mk context audit
Skill ngocsangyem/MeowKit/packages/mewkit/src/migrate/modules/cursor/root/.cursor/skills/mk-context-audit
Production ready. AI Agent Workflow System for Claude Code
npx -y skills add ngocsangyem/MeowKit --skill mk-context-auditAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 15 stars15 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Read-only audit of the project's agent-tree structural overhead vs the context window. NOT for cost tracking (budget skill); NOT for read/compact decisions (mk:context-engineering).
SKILL.md
4.9 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it
the context-audit skill — Context Window Structural Audit
Read-only audit of the project's agent-tree (.cursor/ + .cursor/skills/) structural overhead. Surfaces what is loaded into
every host-runtime session and how much of the context window it consumes,
then recommends the highest-leverage trims.
Complementary lens: mewkit inventory --substrate shows the same artifact set
grouped by the responsibility each serves (covered / partial / missing), so a trim
can be checked against responsibility coverage before removing an artifact. The
per-phase read budget that bounds what an audit-driven session should load lives in
rules/context-budget-rules.md.
When to Use
Three concrete triggers:
- Pre-add capacity check — before adding a new agent, skill, or rule file, confirm the project is below the 25% structural-overhead threshold.
- Post-degradation diagnostic — when sessions feel slow, off-topic, or over-compacted, audit to see if structural overhead has grown past 10%.
- Periodic health audit — quarterly or on model upgrades, confirm
the always-on bundle still pays its keep (paired with the dead-weight audit
in
harness-rules.mdRule 7).
Context vs Cost (Boundary)
| Concern | Mechanism | Unit |
|---|---|---|
| Monetary cost | the budget skill + ../autobuild/scripts/budget-tracker.sh | USD |
| Window utilization (this skill) | the context-audit skill + scripts/inventory-context.sh | tokens / % |
The three concerns are deliberately separate. This skill measures only what is statically loaded into every session — the always-on bundle. Conversation history, tool output, and active edits live elsewhere.
Workflow
The slash command runs the pipeline:
SCAN_ROOT="${1:-$PWD}"
bash .cursor/skills/context-audit/scripts/inventory-context.sh "$SCAN_ROOT" \
| bash .cursor/skills/context-audit/scripts/estimate-tokens.sh \
| bash .cursor/skills/context-audit/scripts/format-audit-report.sh
Output is markdown, printed to terminal. The skill does NOT write any files.
Steps:
- Inventory —
inventory-context.shwalks the agent tree and emits raw byte/line counts per category (AGENTS.md chain, agents, skills, rules, MCP) as JSON. - Estimate —
estimate-tokens.shenriches the inventory withestimated_tokens(chars/4 heuristic, mirrorsbudget-tracker.cjs) and computestotalsincludingstructural_overhead_pctagainst a 200K window. - Format —
format-audit-report.shemits a 5-section markdown report: header, summary table, top consumers, recommendations, footer. - Banner — the formatter selects a banner based on
structural_overhead_pct:< 10%→ Healthy10–25%→ Watch≥ 25%→ Action recommended
Output Format
# Context Audit — <scan_root>
*Scanned at <timestamp> · model window 200K tokens · banner: <Healthy|Watch|Action>*
## Summary
| Category | Components | Bytes | Tokens | % of Window |
| ... | ... | ... | ... | ... |
## Top Consumers
1. <component> ~<tokens> (<path>)
... (top 10)
## Recommendations
1. <priority finding> — saves ~<tokens>
... (sorted by token impact, descending)
## How to Act
- Cost: see `the budget skill`
- Runtime trim: see `mk:lazy-agent-loader`
The 10% / 25% thresholds are the canonical source of truth for token-overhead
banners — see references/token-cost-model.md. They are NOT linked to
MEOWKIT_BUDGET_* env vars (those are USD amounts, not token percentages).
Integration Points
- Reuses, does not duplicate:
packages/mewkit/src/token-estimator/index.tsis the canonical chars/4 source. Shell scripts inline the same heuristic with a citation comment, avoiding a Node bridge that would requiredist/. - Reads, does not write:
.meowkit/telemetry/cost-log.json, the project's agent-tree,.mcp.json. No file writes anywhere. - No env vars introduced. Window size is hard-coded 200K; override deferred until a real 1M-context use case appears.
- Discovery: via
keywords:frontmatter and a cross-reference fromthe budget skill. There is no separate routing rule.
Gotchas
(none yet — grow from observed failures)
Related Rules
- Skill authoring conventions — discovery + Gotchas section requirements
AGENTS.md(Data & injection boundary) Rule 11 — Skill Rule of Two; this skill scores 2 of 3 (untrusted SCAN_ROOT input + filename inventory may surface sensitive paths) so paths are canonicalized viarealpathand never executed.
What ships with it: 6 files
17.4 KB alongside SKILL.md, 3 of them executable
references/
- .gitkeep0 B
- token-cost-model.md4.2 KB
scripts/
- estimate-tokens.shruns2.4 KB
- format-audit-report.shruns5.4 KB
- .gitkeep0 B
- inventory-context.shruns5.3 KB
Gives 0 of the 12 instructions most context ai engineering skills give in ~1.1k tokens
Counted across 1,193 of the 1,976 authors here whose files we hold, read 2026-08-07
- Dispatch a fresh implementer subagent per taskin 48 of 1193, across 19 files
- Dispatch a final code reviewer after all tasksin 33 of 1193, across 8 files
- Provide full task text to the subagentin 30 of 1193, across 9 files
- Review spec compliance before code qualityin 27 of 1193, across 10 files
- Make the hook script executablein 26 of 1193, across 8 files
- Re-snapshot after navigation or DOM changesin 25 of 1193, across 19 files
- Read files before editing themin 22 of 1193, across 11 files
- Answer subagent questions before proceedingin 22 of 1193, across 7 files
- Mark task complete in TodoWrite after approvalin 22 of 1193, across 6 files
- Merge hook into existing settingsin 21 of 1193, across 3 files
- Ask if installation is global or projectin 20 of 1193, across 2 files
- Copy the hook script to target locationin 20 of 1193, across 2 files
Said here and by no other author read
- run the audit pipeline
- inventory the agent tree
- estimate tokens for artifacts
- select banner based on overhead percentage
- display recommendations sorted by token impact
- canonicalize scan root paths
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.