context-audit
Inventory every file an agent loads from a repository checkout, with size, trigger, and depth mode, then list what to clean up. Use when the user asks to audit the context in a repository, measure instruction or skill load, or find bloated CLAUDE.md, AGENTS.md, rules, or skills.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 7
- Forks
- 1
01 前言 Front Matter
- name
- context-audit
- description
- Inventory every file an agent loads from a repository checkout, with size, trigger, and depth mode, then list what to clean up. Use when the user asks to audit the context in a repository, measure instruction or skill load, or find bloated CLAUDE.md, AGENTS.md, rules, or skills.
02 资源文件 13
- 参考文档references/depth-modes.md3.0 KB
- 脚本scripts/context_audit_constants/__init__.py59 B
- 脚本scripts/context_audit_constants/config/__init__.py43 B
- 脚本scripts/context_audit_constants/config/constants.py6.0 KB
- 脚本scripts/context_audit_constants/config/test_constants.py1020 B
- 脚本scripts/context_audit.py3.5 KB
- 脚本scripts/context_inventory.py14.6 KB
- 脚本scripts/context_report.py5.6 KB
- 脚本scripts/context_sources.py7.1 KB
- 脚本scripts/test_context_audit.py7.8 KB
- 脚本scripts/test_context_inventory.py4.0 KB
- 脚本scripts/test_context_report.py3.6 KB
- 脚本scripts/test_context_sources.py3.8 KB
03 SKILL.md 正文
Context audit
Use this skill when the user says "audit the context in <repository>" or asks what an agent loads from a checkout.
Run
python "${CLAUDE_SKILL_DIR}/scripts/context_audit.py" <repository-root> --rows <scratch>/rows.jsonl
Add these options when they apply:
| Option | When |
|---|---|
--rules-dir <path> |
The repository ships a folder that installs as the user rules folder. |
--skills-dir <path> |
The repository ships a folder that installs as the user skills folder. |
--session-start-text <file> |
A SessionStart hook prints text. Save that text to a file first. Repeat for each hook. |
Paths for --rules-dir and --skills-dir are relative to the repository root. The script runs no hook command.
Read the output
The report opens with the startup load in lines and estimated tokens, then a table by trigger. The cleanup list follows in three sections.
- Carries depth over cap. An entry file holds depth that belongs in a reference. Move that depth into a linked file and leave a pointer.
- Empty instruction stubs. An instruction file or rule with no content. Delete it unless a tool needs the file to exist.
- Long skills to split. A skill body over 200 lines. Keep the steps every run uses in
SKILL.mdand move the rest intoreferences/.
Content used on every invocation stays in the entry file. Moving it behind a link adds a read to every run.
Hand the user the cleanup list with paths, line counts, and caps. The rows file holds every row for follow-up questions.
references/depth-modes.md has the triggers, the depth modes, the caps table, and the row fields.
Layout
| File | Purpose |
|---|---|
scripts/context_audit.py |
Command line entry point. Prints the report and writes the rows file. |
scripts/context_inventory.py |
Walks the checkout and records one row per loaded file. |
scripts/context_sources.py |
Reads files, parses frontmatter, follows links and imports, and measures rows. |
scripts/context_report.py |
Formats the summary, the trigger table, and the cleanup list. |
scripts/context_audit_constants/config/constants.py |
Caps, patterns, labels, and report templates. |
04 同仓库更多 Skills
update
Fast-forwards a local repository's main branch to a remote's main after confirming the repo path and source remote through AskUserQuestion. Use when the user says '/update', 'update main', 'fast-forward main', 'sync main from origin', 'pull latest main into <path>', or 'bring main up to date'.
source-command-sr-loop
Converging cleanup loop: repeat /simplify until clean, then repeat /code-review --fix until clean
skill-builder
Skill lifecycle: classify, scaffold, write via the skill-writer-agent, self-audit, compose sub-skills, polish description triggers, enforce deterministic scripts. Triggers: build a skill, new skill workflow, improve this skill, optimize skill description, skill development lifecycle, skill modularity, skill composition, description trigger catalog, deterministic skill scripts.
session-tidy
Audit, clean, and consolidate session logs in the Obsidian vault. Fixes format drift, resolves orphaned next-steps, updates stale statuses, and generates project rollup summaries. Use when session logs feel cluttered or before starting a new project milestone. Triggers on '/session-tidy', 'tidy sessions', 'clean up session logs', 'session audit'.
session-log
Logs a session report as an HTML page, tracks vault context, extracts decisions, and outputs a /rename command. Use for /session-log, 'journal this session', 'log this work', 'session report', 'summarize/log/record this session', 'save session', 'capture session', or 'document what we did'.
run-claude-dev-env
Build, install, run, and test the claude-dev-env installer. Use when asked to run claude-dev-env, install the Claude Code config into ~/.claude, drive the installer, smoke-test it against a sandbox, or run its test suite.