context-audit
What it does
This skill guides the AI agent in reviewing the always-loaded context files for an agent, such as CLAUDE.md and memory files. It is for people who want their agent to be faster and follow instructions more reliably.
When to use it
- βWhen your agent's instruction files have grown long and you want to trim them.
- βWhen you suspect two instruction files contradict each other.
- βWhen you want a ranked list of cuts with a risk level for each one.
Skill link
https://github.com/garrytan/gbrain/blob/master/plugin-variants/gbrain-coding/skills/context-audit/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βMy CLAUDE.md and memory file are getting long. Can you audit them and tell me what to trim first?β
5 new skills a week. 1 minute to read.
How it works
The agent lists every file loaded each turn, finds redundancy, contradictions and stale content, then produces a ranked action list with evidence.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
context-audit β Token Hygiene for the Always-Loaded Context Stack
Convention: see conventions/brain-first.md β before running a fresh audit, check the brain for prior audit reports (
gbrain recall "context audit report") so you can compute token DRIFT since the last run and avoid re-flagging findings the user already declined.Convention: see conventions/quality.md β every finding cites its file and evidence; no unsourced claims.
What this is
Every file that loads on every turn is a per-turn tax: tokens, latency, and β past a point β instruction-following quality. Always-loaded files accrete (append-only release notes, promoted memory blocks nobody re-reads, rules restated in three files that drift into contradiction). This skill audits the whole always-loaded stack at once and returns a ranked, evidence-cited action list sorted by token savings.
It is an auditor, not a surgeon. It measures, finds, ranks, and recommends. The user (or a skill the user explicitly invokes afterward) applies changes.
Scope: what counts as "always-loaded"
Enumerate what THIS harness actually loads every turn β do not assume a fixed list. Typical stack:
| File | Role | Fix belongs in |
|---|---|---|
project CLAUDE.md / AGENTS.md |
orientation, routing, invariants | the file itself (source-editable) |
user-global CLAUDE.md |
cross-project instructions | the file itself (source-editable) |
auto-memory MEMORY.md |
promoted memory blocks | the memory store (demote/expire) |
SOUL.md, USER.md, ACCESS_POLICY.md, HEARTBEAT.md, rendered AGENTS.md |
bootstrap-rendered identity files | the interview answer bank / templates β NEVER the rendered file |
| harness system-prompt fragments (identity/tools files) | per-harness | wherever that harness sources them |
Skills, reference docs, and anything loaded on demand are OUT of scope as audit subjects β but they are the DESTINATION for skill-extraction findings (content that only matters for one workflow should move out of the always-loaded stack into a skill).
Contract
This skill guarantees:
- Report-only. No audited file is edited, no page is written, nothing is auto-fixed β including π’ zero-risk findings. The output is a recommendation list the user applies deliberately.
- Rendered-file safety. Any recommendation touching a bootstrap-rendered
file is expressed as an answer-bank or template change
(
gbrain bootstrap interview --set KEY "..."thengbrain bootstrap render --only <FILE> --force), never as a direct edit. See skills/soul-audit/SKILL.md for the mechanics. - Estimated with a stated basis, never invented. Token figures come from
the deterministic pre-pass (
wc -cbytes/2.8 β Claude-family tokenizers run ~2.6-3.5 bytes/token on markdown dense with paths and code spans; 2.8 is the calibrated midpoint of measured always-loaded markdown, see #4988). The report prints the divisor so a reader can re-derive every number. If the host client reports an exact per-category context breakdown (e.g. Claude Code/context), that figure outranks the estimate β quote it and use it for the stack total. - Native judging. The draft report is quality-gated through
gbrain eval cross-modalβ no raw model API calls, no hardcoded model IDs. - Cost line. Default judging is ONE cheap model (the user's utility-tier
model, all three slots,
--cycles 1β a few cents). The full three-provider frontier panel runs only when the user explicitly asks for a "full" or "multi-model" audit (~3x+ the cost per cycle).
Procedure
1. Enumerate the stack (deterministic)
List the always-loaded files for this harness and measure each:
# bytes/2.8 (calibrated for Claude-family tokenizers on markdown, #4988); integer ceil: (n*10+27)/28
for f in CLAUDE.md AGENTS.md SOUL.md USER.md ACCESS_POLICY.md HEARTBEAT.md MEMORY.md; do
[ -f "$f" ] && echo "$f: $(wc -c < "$f") bytes (~$(( ( $(wc -c < "$f") * 10 + 27 ) / 28 )) tokens)"
done
Record the total. If a prior audit report exists in the brain, compute drift (net tokens grown/shrunk since last run, which files moved).
2. Read and analyze (the agent does this β no model calls yet)
Read every file in the stack in full. Evaluate against six dimensions:
- Token efficiency β tokens spent per unit of behavioral value
- Redundancy β the same rule/
FAQ
Does it change my files?
No. The skill is an auditor that measures and recommends, and you or a chosen skill apply the changes.
Why does it matter?
The skill explains that every always-loaded file costs tokens on every turn and can hurt instruction following.
Does it check past reports?
Yes. It can check the brain for earlier audit reports to measure drift since the last run.
Details
Original description by the author
Token-hygiene audit of the always-loaded context stack β CLAUDE.md, AGENTS.md, auto-memory MEMORY.md, and the bootstrap-rendered identity files (SOUL.md, USER.md, ACCESS_POLICY.md, HEARTBEAT.md) or their harness equivalents. Finds redundancy, contradictions, stale content, compression candidates, and skill-extraction candidates; produces a ranked action list sorted by token savings with a risk class per finding. REPORT-ONLY: this skill never edits any audited file. Recommendations for bootstrap-rendered files target the interview answer bank / templates, never the rendered output. Judging rout
repo: garrytan/gbrain
Popularity
- GitHub stars
- 31k
- Ranking position
- #9252
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
gbrain
31kLets your agent search a shared company knowledge brain for facts about people, projects and decisions, and save durable notes to it.
brain-ingest-gate
31kChecks new content against an existing knowledge brain before it is added, to avoid duplicates and resolve named entities first.
brain-link-discipline
31kMakes sure your agent includes a working link to each brain page it reports, in the same message, so you can open it right away.
brain-ops
31kGives your agent the core routine for a knowledge brain: check existing context first, save explicit notes with their source, and link related pages.
Similar skills
writing-skills
311kTeaches your agent to write new skills and test each one first, checking that the skill actually changes how the agent behaves.
writing-for-agents
310kExplains how to write clear instructions for AI agents, including skills, AGENTS.md, and CLAUDE.md files, so the agent behaves predictably.
bengali-nlp
280kHas your agent process Bengali text. It helps understand and work with the language, normalizing text and handling its unique characteristics.