/cog-second-brain:context-auditfrom cog-second-brain
Audits always-loaded context files (CLAUDE.md, AGENTS.md, etc.) for duplicate rules, stale lines, and token waste. Reports findings ranked by tokens saved, never modifying files.
Ships in cog-second-brain. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Every line in an always-loaded file costs tokens in every session, and a long file also dilutes the rules that matter. This skill measures that cost, reads the files, and reports what to cut, move or fix. It never changes the files it audits. The user decides what to apply.
Ideas credited to garrytan/gbrain (a report-only context audit skill) and garrytan/gstack (a published per-skill context bill). The text and checks here are original.
/context-auditscripts/context-bill.py --check fails01-daily/.date '+%Y-%m-%d %H:%M' with Bash for the real date. Use it in the report name and header.scripts/context-bill.py exists. If it does not, count characters with wc -c and divide by 4 for each file and skill, and say in the report that the bill script was missing.01-daily/ exists. Create nothing else.python3 scripts/context-bill.py --format json
Keep the JSON in working memory. It gives tokens for each instruction file, the skill catalog, and each skill body. Copy the headline numbers into the report: always-loaded total, the largest three always-loaded items, and the five largest skill bodies.
Read every instruction file the bill listed, in full: CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules, and .agents/rules/*.md when present. Read the description line of every skill (the bill output names the paths). Do not read skill bodies unless a finding needs one.
A rule is redundant when the same instruction appears in more than one place that one session loads.
cross-host mirror and rank it low. The same rule twice in one file, or in a file plus a skill description, costs tokens every session. Rank it high.A line is stale when it names something that no longer exists. Check mechanically, cheapest first.
test -e <path>. A path with a placeholder such as YYYY or <name> is a pattern, so skip it./example: run test -f .claude/skills/<name>/SKILL.md. Also accept a name defined under .claude/commands/ when that folder exists.test -e on the script path. For a CLI name, run command -v <name> and mark a miss unverifiable when the tool is optional.ls .claude/skills | wc -l.A section belongs in a skill or a reference file when it fits three tests:
Propose a target: a new skill with a description that says when to use it, or a file under an existing skill's references/ folder. In the always-loaded file, the section shrinks to one pointer line. Estimated saving: section tokens minus about 30 for the pointer.
Read each skill description. Flag it when it:
A flagged description gets a proposed rewrite: one sentence for what the skill does, one for when to use it. A missing trigger saves no tokens, so rank it by routing risk: place it below every finding with a token saving, ordered by skill body size.
Sort all findings by estimated tokens saved per session, highest first. For a finding in a skill body or a description of a rarely used skill, state the saving per trigger. Put findings with no token saving last.
Write one file: 01-daily/YYYY-MM-DD-context-audit.md. If it exists, add a numeric suffix. Do not overwrite an earlier report.
---
type: context-audit
date: YYYY-MM-DD
estimate: characters / 4
---
# Context audit YYYY-MM-DD
## Headline
One paragraph: always-loaded total in tokens, the largest items, the total estimated saving if every finding is applied.
## Bill
Always-loaded table (item, tokens) and the five largest skill bodies.
## Findings, ranked by tokens saved
| Rank | Kind | Where | Finding | Proposed action | Est. tokens saved |
Kinds: duplicate, stale, move-to-skill, no-trigger.
## Detail
One short block per finding: the quoted lines, the file and line range, the check that failed or the other location that repeats it, and the exact edit proposed.
## Waiting on you
Which findings to apply. Nothing was changed.
End the reply with the report path and the headline saving. State that no audited file changed.
A section stays always-loaded only if it changes behavior in most sessions. Test each section with one question: in the last ten sessions, how many would have gone differently without these lines? A rule that applies to a task type moves into the skill for that task. A rule that nothing enforces and nobody noticed missing is a candidate to delete. A safety rule keeps its place on its stated reason even when it rarely fires. When a section has a named owner and a test date, give it one more review cycle before cutting.
What SKILL.md sets; muted values are Claude Code's defaults
Claude Code refuses to install this plugin
.claude-plugin/plugin.json: skills: Invalid input, repository: Invalid input: expected string, received object
Checked against Claude Code 2.1.332's install rules. The listing below is what the repository ships; Claude Code cannot install it as published.
49 skills in this plugin
/auto-researchDeep strategic research engine — decomposes questions into parallel research threads, spawns multiple agents, and synthesizes into actionable strategic analysis/best-of-nSelector stage before a verification gate - generate N candidates in parallel, pick the best with a pivot tournament of pairwise judgements, then gate the winner. For high-variance, non-mutating deliverables only/blog-publishWrite and publish a post to your own static blog end to end: content checklist (embedded links, optional TL;DR), per-post ASCII art, an agent-readable markdown twin, deploy, and social distribution. Use when you say "write a blog post", "publish this to my blog", or "push this post to socials".
/braindumpQuick capture of raw thoughts with intelligent domain classification and competitive intelligence extraction/closed-loopRun one task through the V-model verification loop: CP-2 plan → CP-3 build → CP-3v component verify → CP-4 integration verify (full lane) → CP-5 acceptance. The worker never grades its own homework; evidence rows trace back to AC-n. Opt-in: invoke with /closed-loop or by asking for the closed loop, proper verification, or an evidence trail. Ordinary work does not run this.
/comprehensive-analysisDeep-dive 7-day analysis across all data sources for weekly reviews, board prep, and strategic planningOther plugins' skills for the same job