context-file-layout
Skill1 starsChanged 23 days agoMITView on GitHub
How to structure CLAUDE.md and the surrounding context files (global vs project, skills, RESUME_SESSION, auto-memory) so the always-loaded core stays short and rules actually get followed - the recommended layout, the portable-vs-local split, the anti-bloat rule, and a refactor playbook for an existing huge / absent / mis-split setup. Use when setting up or cleaning up a project's context files.
In this repository6 other files it gives its agents.
- agent-tiersSkill
- delegationSkill
- doc-lifecycleSkill
- gating-workflowSkill
- plan-waveSkill
- session-handoffSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 43
AUDIT: - read their global + project CLAUDE.md and any RESUME_SESSION.md / memory.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md + context layout - what goes where
The layout
| Surface | Holds | Loaded | Keep it |
Global ~/.claude/CLAUDE.md | portable defaults: about-you, machine/env, technique/workflow | every session, every project | short |
Project CLAUDE.md | local: what-it-is, architecture, build/run/test, conventions, gotchas, delegation surface, overrides | every turn and into every project sub-agent | SHORT - it's a per-turn tax |
Skills .claude/skills/<x>/SKILL.md | on-demand deep-dives, ONE subsystem each | only when the skill's description matches | as deep as needed |
RESUME_SESSION.md | transient top-of-context handoff: HEAD/version, deployed-vs-unverified, a ▶ NEXT pointer | re-injected at startup, /compact, resume and clear by the SessionStart hook (capped to fit the host's 10000-character hook limit, about 5-8 KB of handoff) | a pointer, not a 2nd doc |
| Auto-memory | durable cross-cutting facts (always-loaded index + per-fact files) | the index, always | concise; deep-dives → their own files |
Placement test
"True in a different repo?" → yes = global, no = project. A deep-dive on ONE subsystem → a skill, not the core. Transient working-state → RESUME_SESSION. A durable fact you'll want next session → memory. Precedence: global = defaults, project overrides.
The anti-bloat rule (why this matters) ⭐
The global and project CLAUDE.md are always-loaded - the project one loads on every turn AND into
every project sub-agent. Past a point a long core (a) wastes context + cost and (b) degrades
rule-following - the model skims a wall of text and misses the rules that count. Keep the core short;
push depth into on-demand skills. A 1000-line CLAUDE.md is a smell, not thoroughness.
Retired: the manual maturity tag
The dated confidence tag (*[YYYY-MM-DD]* 🌱|🌿|🌳|🌲) this section used to require is retired
(2026-09): a corpus check found 0 of 16 memory-carrying projects had ever applied it outside one
index header, so the manual annotation never happened in practice. See cards/MEMORY.md for what governs
memory content now. Age and re-verification are no longer hand-tagged; /agent-tiers-gc derives age from
file mtime and writes its own verified: YYYY-MM-DD frontmatter field when it re-checks a fact against the
repo (see commands/gc.md) - tool-written, not something a Lead is asked to remember to add.
Refactor an existing setup - audit → present → confirm → apply
For a project (or a new kit user) whose setup is huge / absent / mis-split:
- AUDIT - read their global + project
CLAUDE.mdand anyRESUME_SESSION.md/ memory. Classify each chunk: portable→global · local→project-core · deep-dive→a skill · transient→RESUME · durable-cross-cutting→memory · redundant→cut. - PRESENT - show the proposed moves (what splits to which skill, what's duplicated, what's missing) and the core's size before/after. Flag the biggest always-loaded offenders.
- CONFIRM - let them choose: apply all / pick some / hold. Never auto-mangle a CLAUDE.md.
- APPLY - scaffold the project
CLAUDE.mdfrom${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/agent-tiers}/templates/CLAUDE.project.example.mdif absent; move deep-dives to.claude/skills/<x>/SKILL.md(each pulled by itsdescription); slim the core to pointers; set upRESUME_SESSION.md(the kit's SessionStart hook injects it). ⚠️ Leave their PERSONAL global content alone - suggest structure, never overwrite their about-you / machine / preferences. The global is theirs; you only help them organise it.
Example
The recommended project shape ships at ${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/agent-tiers}/templates/CLAUDE.project.example.md
(short core + skill pointers). Use it as the target shape, not a verbatim drop-in.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

