/meta:scope-instructions [file-or-folder]from meta
Sorts a repo's agent instructions into the homes that load them when they are needed. Weighs each section of a root CLAUDE.md or AGENTS.md, each folder README's must-know lines and each file another coding tool reads against root, a paths: rule, a nested CLAUDE.md or AGENTS.md, a skill, a hook, a README or nowhere, by the event that loads each home and whether that event comes before the mistake. Reads every instruction file itself, in its own context, so the scoping rule loads where the proposal is written. Measures the repo's own session transcripts per folder with a bundled script: who worked there, whether they opened its README first, which nested files and rules loaded, how often they compacted. Finds an AGENTS.md a CLAUDE.md silences and a fact two tools' files hold apart. Proposes every move in one table and edits only on approval. Where /init and /doctor refresh and trim a root file, this moves what does not belong there.
Ships in meta. 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; scripts run unread.
The question about a repo's agent guidance is rarely what to write and
usually where. Each home loads on its own trigger and misses in silence:
the guidance is on disk, correct, and never read. The built-ins answer
the other questions. In a trial on 2026-10-15, CLAUDE_CODE_NEW_INIT=1
/init and the claude-md-improver skill each cut derivable lines,
surfaced a README's rule and caught a stale command, and in three runs
neither moved a section out of a root CLAUDE.md into a nested file or
a paths: rule. This skill asks what they skip, of every section:
what event loads its home, and does that event come before the mistake
it guards against?
The homes and how each fails live in one place, the user-scope rule
agent-instructions-scoping.md, which this skill applies and does not
restate; where the user's config holds no such rule, as a plugin's
user's does not, this skill carries a copy of it,
references/agent-instructions-scoping.md.
It proposes; files change only on approval, and committing is
commit-changes's.
Past that rule or its copy, the live page: code.claude.com by the
claude-code-docs MCP server or
curl -s https://code.claude.com/docs/en/<page>.md, and another
tool's file by that tool's own markdown source, else WebFetch, saying
it read a summary. A live page that contradicts a line here wins: say
so, act on the page, and route the fix by capture-learning, bar a
dated measured line that names the page it overrules and the call that
measured it, which a page changed since its date sends back to re-measure.
An observed claim is cited or marked pending a doc check, and stands, marked
observed, only where no page covers it.
git rev-parse --show-toplevel
CLAUDE.md, AGENTS.md and
CLAUDE.local.md at any depth, .claude/CLAUDE.md, .claude/rules/,
and other tools' files. A CLAUDE.local.md is one person's: propose
for it, never move another person's lines out of it.~/.claude/, is a capture-learning
learning: name it in the proposal and leave it.CONTRIBUTING.md first.Glob for the set, then Read each file with the Read tool, in this context:
CLAUDE.md, CLAUDE.local.md and AGENTS.md at any depth, and
.claude/CLAUDE.md.claude/rules/**/*.mdGEMINI.md, .cursor/rules/, .windsurfrules, .clinerulesREADME.md, since a must-know line can hide in oneNever through a subagent, and never in a compound Bash command. Both
are how the trial's built-ins lost the rule. A subagent's Read loads a
nested file or rule into the subagent only, so /init, which hands its
exploring to one, wrote its proposal in a context that held none. A
loop, a pipe or a cat of several files loads nothing, which is how the
improver read. A single-file cat or head loads as a Read does since
2.1.293, but Read is the route that loads on every version.
Then check the rule is in context. The first Read of a CLAUDE.md,
AGENTS.md or rule loads agent-instructions-scoping.md by its glob:
its table headed "Guidance is…" should now be in context. If it is not,
Read it directly from the rules/ folder of the user's config
directory, CLAUDE_CONFIG_DIR or else ~/.claude, or cat that one
file if Read refuses a path outside the working directory. A
project-scope copy of the same name supersedes it; then that one is the
table. With neither, Read this skill's copy,
${CLAUDE_SKILL_DIR}/references/agent-instructions-scoping.md, and say
the proposal stands on that copy, since the user's config holds no
scoping rule of its own.
For each file, note its length and when it loads: root and every
ancestor at launch, a nested file at the session's first Read, Write or
Edit in its folder, a rule with paths: on a match and one without at
launch, an @path import at launch with its parent.
Find the silent files. Claude Code reads an AGENTS.md only when no
CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md sits in the working
directory or above it, so a root CLAUDE.md silences every AGENTS.md
in the repo, nested ones included. One that claudeMdExcludes skips does
not count. A silent file's unique lines are guidance no Claude session
has read.
Then read what already enforces guidance, which no instruction file
lists: .claude/settings.json and settings.local.json (permissions
and hooks), the git hooks (git config core.hooksPath, else
.git/hooks, and .pre-commit-config.yaml) and any CI job that fails a
guarded change. A line a guard already holds answers step 4's question
5 with evidence, for Claude (one client repo, 2026-10-26, where a deny
rule, a hook and a git hook moved three rows).
git shortlog -sne HEAD for who commits. One author means the user
alone: design for their tools, not for teammates.uv run --no-project "${CLAUDE_SKILL_DIR}/scripts/folder-sessions.py"
Run it from the repo, or from one of its worktrees. Per folder it prints
how many past sessions Read, Wrote or Edited there and how many edited;
whether each opened the folder's README first, later or
never, and how many of the first were named in a prompt; which
nested files and rules loaded on calls there; and how many of those
sessions compacted. --folder <path> narrows it, --depth, --min and
--limit shape it, --json is for parsing.
never beside many sessions is the evidence that the
folder's must-know lines belong in a rule or a nested file.loaded shows what already reaches the folder's work, so a move
there may be into a home that exists. A home that loads covers a
README only for the lines it holds: check the README's must-know lines
against it before calling the folder covered.compacted counts sessions that lost them for a while: after
/compact, root returns at once while nested files and paths: rules
return only at the next matching Read, Write or Edit.cleanupPeriodDays bounds (30 days by default), the versions seen, and
the loads it could pin to no folder, by what they followed.cat reads as never opened, and an
edit made through Bash is not seen. A folder with under five sessions
is an anecdote; say so.Every ## section of a root file gets one home, and so does each part
of any other file the rule's sizes flag: root past about 200 lines, a
nested file past about 60. Ask in order, and stop at the first yes:
paths: rule on that folder: a nested file where the folder's owners
keep their own conventions with the code, a rule where all
conventions are kept in one place (the large-codebases docs' split).
On Windows, prefer the paths: rule either way: a nested file misses
every Read, Write or Edit whose drive letter is cased unlike the
launch directory's, and a rule loads on both (the drive-letter bullet
of agent-instructions-scoping.md).
A section that also governs files outside the folder is split, each
line going where the files it governs are touched.paths: rule
globbed on that kind, **/*.sql, or a bare *.sql, which also
matches at any depth; /*.sql matches the repo root alone
(code.claude.com memory § "Path-specific rules", read 2026-11-17).permissions.deny rule./doctor's checkup cuts
the same.In the same pass:
AGENTS.md becomes the import form, @AGENTS.md at the top of
the CLAUDE.md, never a copy, which leaves two homes to drift.-h, guards a mistake only when a home that loads before the
mistake sends the agent there. Propose that pointer in the same row,
or leave the line where it loads; a pointer that fires only for a
guess misses the session that already knows the command.CLAUDE.md disagree, say on a line length the formatter config
settles, the config wins and the duplicates go.Makefile, package.json, the disk)
and flag what is missing. A full pass for staleness, contradiction and
prompting written for older models is /doctor prompt-audit's, from
2.1.283: name it rather than redo it.CLAUDE.md,
AGENTS.md and "keep" (a draft that moved such a line out, 2026-10-26).CLAUDE.md under a
root CLAUDE.md, AGENTS.md under a bare root AGENTS.md, and under
the import form a CLAUDE.md importing a sibling AGENTS.md where
other tools need it.<name>.<ItemType>/): untested
against Git sync. A markdown file at a workspace's sync root coexists..claude/, except .claude/rules/: .claude/CLAUDE.md is
the project file's second home, loaded at launch beside a root one.AGENTS.md in place of a root CLAUDE.md: the rule
lists five things it loses, each silently.claudeMdExcludes or instructionFiles change unasked.
instructionFiles is read only from user, managed and --settings
files, so a repo cannot set it for its readers. A committed exclude
travels into every worktree, and **/.claude/worktrees/** strips a
worktree session's own root CLAUDE.md (probed 2026-09-27, held on
2.1.293 on 2026-10-15).One table, a row for every section, moved or kept:
| Section | Now | Proposed home | Loads when | Evidence |
|---|
Under it: each new file's full text, root's line count before and
after, the silent files and what becomes of them, the stale lines
flagged, and what goes to capture-learning, to /doctor (trimming
derivable lines from a file that stays) or to /doctor prompt-audit
(stale and contradicting lines). Then stop.
The user approves rows, not the table: some may go and some stay.
Exactly the approved rows. A section moves; it is not copied. Its old text leaves in the same edit, or two homes start to drift.
Prove a new nested file or rule loads, in a session that did not
write it. This session wrote it, so it is in context already and
never arrives as a nested load here. The docs' own test is a fresh
session reading a file in that folder. Offer a cold probe, which costs
cents, and run it only on a yes. It drops this session's CLAUDE*
variables first, as this machine's loader probes do, so that it starts
as a session of its own rather than a child of this one. On Windows,
name the file by its absolute path, its drive letter in upper case.
Git Bash starts the probe on an upper-case drive, C:\ and not
c:\ (2026-10-15), and a nested file loads only on a path whose
drive letter is cased as the launch directory's (the rule), so a
c:\ path copied from elsewhere misses a file that is in place.
( for v in $(compgen -e | grep -E '^(CLAUDE|MCP_CONNECTION_NONBLOCKING)'); do unset "$v"; done
claude -p "Read <a file in that folder>, then reply done" -n "probe: scope-instructions" --model haiku --tools Read --strict-mcp-config )
uv run --no-project "${CLAUDE_SKILL_DIR}/scripts/folder-sessions.py" --probes --folder <that folder> --min 1
The new file listed under loaded is the proof. Its absence, with the
file in place and the path so spelled, means a glob or a name is
wrong.
Hand off to commit-changes. The repo's own checks run there.
capture-learning's.CLAUDE.md for a repo with none is
/init's; trimming a well-placed file of derivable lines is
/doctor's; staleness and contradiction are /doctor prompt-audit's;
how the loader behaves is capture-learning's.What SKILL.md sets; muted values are Claude Code's defaults
Use when asked where a piece of guidance should live, whether a repo or folder needs a nested CLAUDE.md or AGENTS.md, to split, slim or reorganize a CLAUDE.md, to move instructions into .claude/rules/, to audit instruction files across Claude and other tools, or why a folder's README or an AGENTS.md is never read. A learning about how Claude Code loads these files is capture-learning's, into its user-scope rule.
inheritxhighOther plugins' skills for the same job
npx claudepluginhub wardawgmalvicious/claude-plugins --plugin meta8 skills in this plugin
/audit-agent-setupAudits a repo's Claude Code setup on this machine and reports what to fix and what to add: hooks, permission rules, skills, subagents, plugins and MCP servers. Edits, writes and connects nothing. Runs the checks a generic recommender cannot: plugins declared off and the payload's reason for it, .mcp.json placeholders, literal header values and tracking, servers at the wrong scope, tenant pins that MCP servers ignore, and CLAUDE.md rules nothing enforces. Reuses the deployed agents and skills and microsoft-learn-mcp before proposing anything new, names scope-instructions, /doctor and /fewer-permission-prompts where one owns the question, and places each item in the repo, the repo the user's own config is authored in (through capture-learning from another repo) or nowhere. Typed only: audit-agent-setup [category]./draw-architectureDraws a repo's architecture as one Mermaid diagram in ARCHITECTURE.md, and keeps it true. The diagram is processes and boundaries: what crosses between a project's halves, such as a frontend and its backend, and what it starts or reaches outside itself, each edge labelled with what carries it, found by greps across both sides. Declines where a table serves: no crossing, fan-in or fan-out means no diagram. Renders each diagram with mermaid-cli by a bundled script and Reads the PNG before calling it done, since a diagram can parse and still draw too tall to read. Ends the file with the code the diagram is drawn from, and points the repo's CLAUDE.md or AGENTS.md at it, since nothing else loads it. Run again, it audits: rereads that code, lists where the file disagrees, and corrects it in place on a yes, never regenerating. Written for Claude Code first, a person second. Not for a flowchart of one procedure, a data model or a sequence diagram./find-sessionFinds a past Claude Code session by what was said in it — words from a prompt the user typed, a compaction summary or the session's name — across every repo on this machine, and gives the claude --resume command that reopens it. Runs the script bundled with the skill over the transcripts on disk, ranks one prompt holding every term above terms scattered through a long session, and reports how far back the transcripts reach, since an older session is gone. Naming the current session is /rename; running and background sessions are claude agents./init-user-instructionsAudits and rewrites ~/.claude/CLAUDE.md, Claude Code's user-scope instructions, from its source claude/CLAUDE.md in the repo the user's config is authored in, as init-account-instructions writes claude.ai's Account block; with no user-scope file yet, drafts a short first one, written on a yes. A bundled script checks the line count against the lint cap, ~/ pointers that resolve nowhere, skills named but not deployed at user scope, tools claimed on PATH or not installed, dated rules by age, counts that want a derivation command and drift from each deployed copy, then reads this machine's transcripts: corrections repeated across sessions, each rule's error text after its date, and whether the Account block loads, masked and reported as counts. Routes every line to the home that loads it, interviews, and proposes a table and a diff, adding a line only for a standing behavior the user states and only by displacing another. A repo's CLAUDE.md is scope-instructions'; one session's learning is capture-learning's./measure-session-costReports what a Claude Code session cost at API list prices, by phase, by model and by subagent, from its transcripts on disk, through a bundled script holding a dated price table. Prices each call's context, read from or written to the prompt cache, and its output; splits the session at each compaction and each idle gap over an hour; names every call that rewrote its context to the cache and why, whether the start, a compaction, an expired cache or a model switch; gives the context at the first call, before any work, and the tools called with the size of what they returned. Takes a session id or its start, the current session, or a repo's newest sessions, in every account's config directory. A model, speed or usage shape the table lacks is reported unpriced, never guessed. Reads only. Finding a session by what was said in it is find-session's. Typed only: measure-session-cost [id | --repo FOLDER --last N]./ship-pluginShips a Claude Code plugin so it installs and runs where its users are. A plugin gets no build step, so a .mcp.json pointing at a gitignored dist/ installs cleanly and its server never starts; chat, Cowork and Claude Code each load a different part of a plugin, and a top-level bin/ makes chat, Cowork and org sync refuse it; version means something different for a local-path marketplace, one added by source and one synced to a claude.ai organization; a synced marketplace is labelled with its repository's owner/repo and nothing renames it, and Delete source removes every plugin for every member. Ends with an install test in a throwaway CLAUDE_CONFIG_DIR (claude plugin validate, install --config, claude mcp list) and claude plugin eval for the plugin's own skills. Not for a mod, which plugin-authoring makes.