AI and agents · Prompt

Audit how your project loads context

A prompt so your agent reviews your documentation and how it gets into its window, and proposes changes without touching a single file. It works in Claude Code, in Codex CLI and in any agent with read access to the repo.

The rule of this document: this phase is diagnosis and proposal only. The prompt explicitly forbids modifying, moving, deleting or creating files, making commits and running hooks or startup scripts. It ends by waiting for your approval. And an instruction isn't a permissions layer: give it to a session with read permissions, not to one with production access.
5 phases
Read only
0 files modified
It ends waiting for your OK
The full prompt, ready to copy
Audit this project's documentation and how it loads context. This phase is diagnosis and proposal only: don't modify, move, delete or create files. Don't make commits or run hooks, startup scripts or repository commands to investigate them. Use only read tools and non-destructive searches allowed in this session. Don't access production, paid services, secrets, client data or other projects.

GOAL
Separate two decisions: where the information lives and when it needs to enter the agent's context. Don't assume that more files means better organization, or that every document should be read at startup.

1. INVENTORY AND LOADING PATHS
Start by inventorying names, headings, sizes and references without dumping the whole repository into the context. Examine the applicable instruction files (for example, CLAUDE.md and AGENTS.md), hook configuration, imports, rules, Skill descriptions and the memories that are accessible and authorized for this project. Follow their references selectively.
Distinguish: content injected automatically; instructions that ask for a later read; loading conditioned by scope or activation; and available documents that are only read when consulted. Don't classify a file by its name. Don't read a normal link as an automatic import, and don't ignore imports like @path in CLAUDE.md.
Respect the shared instruction source the project already uses. If AGENTS.md is the canonical source and CLAUDE.md imports it, don't propose keeping two copies of the content. Check how it's loaded in this configuration: an import like @AGENTS.md, a reference in prose and native client support aren't the same mechanism.
Don't read external personal or global folders without authorization. If you can't review an applicable source, report it as a coverage limit.

2. COMPOSITION AND AUTHORITY
For each relevant document, identify its function: instructions, planning, spec, execution plan, current state, progress history, decision, reference or persistent learning. One function can be spread out and one file can hold several. Assess whether the sections need to be maintained or loaded separately; don't demand one file per concept.
Look for existing sources first before proposing new ones. Identify facts maintained by hand in several documents, contradictions and broken references. Propose which one will be the authoritative source and which documents should link to it. A local copy and its remote version in Git aren't two independent sources just because of that. Don't confuse an old date with incorrect content: verify against code, decisions or authorized sources; if that's not possible, mark it unverified.

3. STRUCTURE PROPOSAL
Propose what to keep, merge, update, extract, create or link. First identify the different functions/sections of the large document and compare them with sources that already exist. If the information already has a suitable destination, reconcile what's unique, current and useful there, and propose links from the origin. If there's no destination and it really needs its own document, propose creating it. Don't assume a new file for every fragment, and don't overwrite differences without working out what they mean. Keep all useful unique information and respect the user's decisions. Don't propose deleting documents just because you can't find references to them. Keep the existing specs, plans and sources that already do their job. Current state and history may need different queries: don't turn a growing log into required reading for everyone.
Include a table: origin/section | function | existing or new destination | proposed operation | evidence | risk.

4. LOADING PROPOSAL
Define a minimal initial context with the essential instructions and useful pointers. Don't remove security requirements or permission limits.
For each remaining source, state which task or condition justifies consulting it and how the agent will find it. Describe the real mechanisms of the client in use. Don't invent a universal three-level taxonomy, and don't assume an index gets loaded just because it exists.
Propose the map inside the main instruction file when it fits clearly; use a separate index only if it adds value, and explain how it's discovered. Pointers should state purpose, path and when to consult. The main map doesn't have to list every file: it can point to thematic indexes read on demand. Don't create an unnecessary hierarchy of indexes, and don't manually duplicate the Skills catalog or the memory index if the client already provides them. Link to existing sources and keep their scope. Don't automatically equate a spec with a plan, and don't force separating progress or the decision log from a plan that already keeps them properly. Don't turn on-demand documents into imports that preload them all.
Include two contrasting example tasks: for each one, state which documents would need to be consulted and which wouldn't by default, taking dependencies between areas into account.

5. MEASUREMENT AND VALIDATION
Separate observed facts, behavior inferred from configuration and estimates. Cite file and line or session evidence for each finding.
Report bytes and lines only if you've measured them. If you don't have an appropriate counter for the model in use, don't present tokens as an exact measurement. A file's size doesn't prove it was read in full. A read instruction doesn't prove it was executed either. Don't promise savings in quota, money, latency or quality improvement without a comparison.
If there are /context (or /context all) results in Claude Code, use them as a snapshot of current occupancy, not as sufficient proof of the whole loading chain. In Codex CLI, /status shows the session's context usage; don't present it as a breakdown identical to /context. Use real traces to determine the reads.
Propose a before/after comparison with fresh sessions, the same task, model and configuration, also reviewing the read trace. Don't run that test without authorization.
Propose checks for links, content preservation and representative tasks, without imposing a log change for every commit or claiming that a link lint proves semantic freshness.

DELIVERABLE
- A prioritized diagnosis with evidence and coverage limits.
- A table of proposed operations, without applying anything.
- A concrete example of the entry point with instructions and map.
- The proposed initial context and consultation paths for the two tasks.
- A before/after acceptance test that validates both occupancy and that no necessary information is left out.
End by waiting for approval. Don't run the migration.

USAGE NOTE
This read-only request doesn't replace tool permissions. Use an appropriate environment and read permissions. Don't give access to production or secrets to run this audit.

01

Inventory and loading paths

Phase

Which documents exist and, above all, HOW they get into the context.

⌄

Use it when

You get the feeling the agent starts up loaded and you don't know with what.

What it does

A document that's available and a document that gets injected on its own aren't the same thing. The prompt forces it to separate four things: what comes in automatically, what an instruction says to read later, what depends on an activation and what's only read if someone consults it.

What it DOESN'T do: It doesn't classify a file by its name, and it doesn't confuse a normal markdown link with an import that preloads.
02

Composition and authority

Phase

What function each document serves and which one wins when two contradict each other.

⌄

Use it when

The same fact lives by hand in several places and you no longer know which one is right.

What it does

One file can hold instructions, a spec, a plan, state and history all at once, and each of those changes at a different pace. Before proposing anything, the prompt looks for destinations that already exist.

What it DOESN'T do: A local copy and its remote version aren't two sources. And an old date doesn't mean incorrect content: if it can't be verified, it gets marked unverified.
03

Structure proposal

Phase

What to keep, what to merge, what to extract and what to create. With a table and its evidence.

⌄

Use it when

You want to reorganize without losing anything and without ending up with forty new files.

What it does

The output is a table of origin, function, destination, operation, evidence and risk. First it reconciles wherever there's already a place; creating a new document is the last option, not the first.

What it DOESN'T do: It doesn't propose deleting a document just because it can't find references to it.
04

Loading proposal

Phase

What comes in by default and what gets consulted, with the condition that justifies it.

⌄

Use it when

It's the part that really changes the cost: where something lives and when it gets loaded are two different decisions.

What it does

It defines a minimal initial context (essential instructions plus pointers) and, for each remaining source, which task justifies consulting it and how the agent will find it. It includes two contrasting example tasks.

What it DOESN'T do: It doesn't invent a universal three-level taxonomy, and it doesn't turn on-demand documents into imports that preload them all.
05

Measurement and validation

Phase

What's measured, what's inferred and what's an estimate. With file and line.

⌄

Use it when

It's what separates an audit from a well-organized opinion.

What it does

It separates observed facts, behavior inferred from the configuration and estimates, and asks for file and line or session evidence for every finding. It proposes a before/after test with the same task, model and configuration.

What it DOESN'T do: A file's size doesn't prove it was read in full, and a read instruction doesn't prove it was carried out either. Without the model's counter, tokens aren't presented as an exact measurement.
Before you believe the result: ask it for the coverage. If it couldn't read a source that applies, it has to say so as a limit, not keep quiet about it. An audit that doesn't say what it didn't look at looks too much like one that looked at everything.

Interactive version by @itsmarbuilds