Agent skill

Context Audit

by undefined-ui in undefined-ui/second-brain-os

Audit an agent's context layout against the four places: system prompt, tools, history, tail.

MITAuto-check passedAI & LLM Engineering

Install Context Audit

skills CLI
$ npx skills add undefined-ui/second-brain-os --skill context-audit -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install undefined-ui/second-brain-os context-audit --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/undefined-ui/second-brain-os.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/agents-course/skills/context-audit .claude/skills/context-audit && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
context-audit
GitHub stars
999
Token cost
~810 tokens
SKILL.md length
370 words
Files
1
Skills in repo
23
Repo updated
First seen
Licence
MIT

At a glance

Audit an agent's context layout against the four places: system prompt, tools, history, tail.

  • Works in 6 steps: Find the context sources. Locate what… → Measure the five numbers. Approximate… → Hunt cache killers. Flag every dynamic… → …
  • The user asks to audit
  • SKILL.md covers Core rule, Workflow and Output format
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Context Audit is an agent skill from undefined-ui/second-brain-os. Audit an agent's context layout against the four places: system prompt, tools, history, tail. Use when the user asks to audit, review or fix their agent's context, prompt caching, token spend per turn, or CLAUDE.md / AGENTS.md layout. Read-only: reports findings and a fix list, changes nothing. Do NOT use for writing evals (evals-bootstrap) or for loop design (goal-test).

Its SKILL.md is about 810 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering Agent instruction files, LLM evaluation and Prompt engineering. The repository describes itself as: An AI second brain that maintains itself. Full guide, starter vault, agent skills and scripts for a self-organizing knowledge base in Claude Code and Obsidian. The licence is MIT.

When your agent uses it

  • The user asks to audit
  • Fix their agents context
  • Token spend per turn
  • CLAUDE.md / AGENTS.md layout

Example prompts

  • “/context-audit”

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Find the context sources. Locate what actually reaches the model
  2. Measure the five numbers. Approximate token counts for: system prompt,
  3. Hunt cache killers. Flag every dynamic value in the system prompt —
  4. Hunt window bloat. Find the largest single item in the history. A
  5. Check the tail. Locate the current goal. If it appears only in the
  6. Check guides. If CLAUDE.md / AGENTS.md exists: it should be a few

What it can do on your machine

Read from SKILL.md and the folder at commit d6861cc. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • undefined-ui.github.io

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Context Audit loads about 810 tokens when it runs. Until then it costs about 97 tokens; SKILL.md has 370 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~97
When it runs · the whole SKILL.md, loaded when a task matches
~810

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from undefined-ui/second-brain-os at commit d6861cc, republished under its MIT licence (© undefined-ui). 370 words, ~810 tokens.

Download SKILL.mdSave it as .claude/skills/context-audit/SKILL.md (or your agent's skills folder).
name
context-audit
description
Audit an agent's context layout against the four places: system prompt, tools, history, tail. Use when the user asks to audit, review or fix their agent's context, prompt caching, token spend per turn, or CLAUDE.md / AGENTS.md layout. Read-only: reports findings and a fix list, changes nothing. Do NOT use for writing evals (evals-bootstrap) or for loop design (goal-test).

Audit the context window

Theory: How models read context and The four places. Every piece of context belongs in exactly one of four places — a byte-stable system prompt, a frozen tool set, a compacting history, and a short live tail — and most agent problems trace back to something sitting in the wrong one.

Core rule

Report and rank; never edit. The output is an audit, and the user decides what to apply. If they ask you to apply fixes afterwards, that is a normal edit session, not this skill.

Workflow

  1. Find the context sources. Locate what actually reaches the model: system prompt (or CLAUDE.md / AGENTS.md for a Claude Code setup), tool definitions, and — if the project logs requests — one full mid-conversation payload. If nothing is logged, say so and audit the static files; ask for one captured request only if the user can produce it cheaply.
  2. Measure the five numbers. Approximate token counts for: system prompt, tool definitions, message history, retrieved content, current query. A rough count (chars / 4) is fine; write all five down.
  3. Hunt cache killers. Flag every dynamic value in the system prompt — timestamps, user names, injected memories, "current task" lines. Each one is a guaranteed cache miss on every call. Check whether the tool list can change mid-run; a changing list invalidates the whole prefix.
  4. Hunt window bloat. Find the largest single item in the history. A verbatim tool result over ~2,000 tokens should have been a file path plus a one-line receipt. Count tools: past twenty (or ~10K tokens of definitions), recommend deferred tools + tool search.
  5. Check the tail. Locate the current goal. If it appears only in the opening message, it lives in the weak middle of the window — recommend restating it in the tail every three to five steps.
  6. Check guides. If CLAUDE.md / AGENTS.md exists: it should be a few lines of constraints the code cannot show, not four pages of narrative. Flag anything the repo already records (structure, history).
Show full SKILL.md (37 more words)Show less

Output format

Context audit — <project>
system prompt   <n> tok   <clean | N dynamic values: ...>
tools           <n> tok   <n> tools  <frozen | mutates mid-run>
history         <n> tok   largest item: <what, n tok>
tail            <present | goal only in opening message>

Top fixes, in order of saved tokens per turn:
1. ...
2. ...

Each fix names the file and line where possible, states what moves to which of the four places, and estimates the saving. Close with the one-line rule: stable prefix, frozen tools, compact history, live tail.

© undefined-ui, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/agents-course/skills/context-audit of undefined-ui/second-brain-os.

Open the folder on GitHubat commit d6861cc

Compare with similar skills

Context Audit next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Context Audit compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Context Audit this skillundefined-ui/second-brain-os999—~810Automated safety check: PassMIT
Agents Best PracticesDenisSergeevitch/agents-best-practices2.4k—~7.4kAutomated safety check: PassMIT
Prompt EngineerJeffallan/claude-skills12k1 repos~1.5kAutomated safety check: PassMIT
Asd Ste100 SkillTwiTech-LAB/devchain101—~1.2kAutomated safety check: PassMIT
Add Benchmarkai-twinkle/Eval117—~1.8kAutomated safety check: PassMIT
Writing Claude Directivesed3dai/ed3d-plugins250—~2.4kAutomated safety check: PassNone

Similar skills

  • Agents Best Practices

    DenisSergeevitch/agents-best-practices

    A skill your agent uses when designing, generating an MVP blueprint for, auditing, troubleshooting, refactoring, or explaining an agentic harness for any domain.

    2.4k GitHub stars~7.4k tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check passed
  • Prompt Engineer

    Jeffallan/claude-skills

    Designs, tests and refines LLM prompts: zero-shot, few-shot and chain-of-thought patterns, system prompts, structured output schemas and evaluation test suites.

    12k GitHub starsUsed in 1 repo~1.5k tokens
    AI & LLM EngineeringAuto-check passed
  • Asd Ste100 Skill

    TwiTech-LAB/devchain

    Write or rewrite English with ASD-STE100 Simplified Technical English rules: one meaning per word, active voice, simple tenses, one instruction per sentence.

    101 GitHub stars~1.2k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Add Benchmark

    ai-twinkle/Eval

    為 Twinkle Eval 新增一個評測 benchmark(IFEval、BFCL、RAGAS、Text2SQL、Vision MCQ 之類)。涵蓋 CLAUDE.md §6 的完整強制流程:先建 Milestone 與 6 個 Issue、準備 example dataset、實作 Extractor + Scorer 並註冊 PRESETS、與參考框架做分數與速度對比、撰寫…

    117 GitHub stars~1.8k tokensUpdated 22 days ago
    AI & LLM EngineeringAuto-check passed
  • Writing Claude Directives

    ed3dai/ed3d-plugins

    A skill your agent uses when writing instructions that guide Claude behavior - skills, CLAUDE.md files, agent prompts, system prompts.

    250 GitHub stars~2.4k tokensUpdated 1 mo ago
    AI & LLM EngineeringAuto-check passed
  • Create Simple Prompt

    pnp/copilot-prompts

    This skill should be used when the user asks to "create a new prompt sample", "add a new prompt sample", "scaffold a new prompt sample", "create a prompt contribution", "add a prompt", or needs to…

    891 GitHub stars~2.6k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed

More from undefined-ui/second-brain-os

All 23 skills in this repo
  • Evals Bootstrap

    undefined-ui/second-brain-os

    Scaffold a first eval suite for an agent: mine real failures into cases, write behavioural checks over traces, and generate the runner.

    999 GitHub stars~793 tokensUpdated 8 days ago
    Auto-check passed
  • Gate Check

    undefined-ui/second-brain-os

    Find the decisions in a pipeline that do not need the expensive model and propose the gate for each: a rule, a classic classifier, or a small model, with fail-closed routing.

    999 GitHub stars~861 tokensUpdated 8 days ago
    Auto-check passed
  • Goal Test

    undefined-ui/second-brain-os

    Turn a vague task into a testable definition of done and generate an executable goal-test script for it, optionally with a bounded retry loop around a headless agent.

    999 GitHub stars~761 tokensUpdated 8 days ago
    Auto-check passed
  • Harness Audit

    undefined-ui/second-brain-os

    Audit an agent's harness against the four rings: containment, guides, sensors, permissions.

    999 GitHub stars~862 tokensUpdated 8 days ago
    Auto-check passed
  • Second Brain Chat Import

    undefined-ui/second-brain-os

    Triage an exported chat history into what to ingest, what to archive and what to delete, with a privacy pass first.

    999 GitHub stars~527 tokensUpdated 8 days ago
    Auto-check passed
  • Second Brain Graph

    undefined-ui/second-brain-os

    Analyse the vault's link graph and report on its shape: orphan rate, average degree, components, hubs, bridges and clusters, with what each number means for retrieval.

    999 GitHub stars~533 tokensUpdated 8 days ago
    Auto-check passed

Questions about Context Audit

What does Context Audit do?

Audit an agent's context layout against the four places: system prompt, tools, history, tail. Context Audit is an agent skill from undefined-ui/second-brain-os. Audit an agent's context layout against the four places: system prompt, tools, history, tail.

When should I use Context Audit?

Context Audit fits situations like: the user asks to audit; fix their agents context; token spend per turn; CLAUDE.md / AGENTS.md layout.

How do I install Context Audit in Claude Code?

Run `npx skills add undefined-ui/second-brain-os --skill context-audit -a claude-code`. Or copy the skill folder (plugins/agents-course/skills/context-audit in undefined-ui/second-brain-os) into .claude/skills/context-audit in your project. Claude Code loads it when a task matches its description.

How do I install Context Audit in Codex?

Run `npx skills add undefined-ui/second-brain-os --skill context-audit -a codex`. Or copy the skill folder (plugins/agents-course/skills/context-audit in undefined-ui/second-brain-os) into .agents/skills/context-audit in your project. Codex loads it when a task matches its description.

Can I use Context Audit in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add undefined-ui/second-brain-os --skill context-audit -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/context-audit, .gemini/skills/context-audit, .github/skills/context-audit and .opencode/skills/context-audit in your project.

What does Context Audit need to run?

SKILL.md names no scripts, command-line tools or credentials: Context Audit is instructions for the agent only.

Does Context Audit access the network?

SKILL.md names 1 domain. As links in the text: undefined-ui.github.io. This is read from the text; nothing was executed.

Is Context Audit safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Context Audit use?

Context Audit is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Context Audit use?

About 810 tokens (SKILL.md is roughly 3.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Context Audit?

Skills that share tags, products or a category with Context Audit: Agents Best Practices (DenisSergeevitch/agents-best-practices, 2.4k stars), Prompt Engineer (Jeffallan/claude-skills, 12k stars), Asd Ste100 Skill (TwiTech-LAB/devchain, 101 stars) and Add Benchmark (ai-twinkle/Eval, 117 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Context Audit?

undefined-ui (a GitHub user) maintains it in undefined-ui/second-brain-os, which has 999 GitHub stars. The repository holds 23 skills in this directory. The repository was last updated on September 29, 2026.

Source: undefined-ui/second-brain-os on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.