chore: split CLAUDE.md by domain for lazy context loading#26034
chore: split CLAUDE.md by domain for lazy context loading#26034ryan-crabbe-berri wants to merge 1 commit intomainfrom
Conversation
Move domain-specific rules from the root CLAUDE.md into nested CLAUDE.md files so Claude Code only loads them when working in the relevant subdirectory (per the documented hierarchical memory behavior). Root keeps universal rules (commands, architecture, style, testing). No rule wording changed. Also adds empty stubs for proxy sub-domains (auth, guardrails, hooks, spend_tracking, pass_through_endpoints) so future rules land in the right place.
Greptile SummaryThis PR splits the monolithic root Confidence Score: 5/5Safe to merge — documentation-only change with no code or test modifications. All changes are pure documentation relocation. The only finding is a P2 duplicate of the Database Migrations section across root and proxy CLAUDE.md, which does not affect runtime behavior. No files require special attention.
|
| Filename | Overview |
|---|---|
| CLAUDE.md | Root file trimmed to universal rules + nested-file index; Database Migrations block duplicated verbatim in litellm/proxy/CLAUDE.md |
| litellm/proxy/CLAUDE.md | New file with proxy DB access rules, N+1/batch/pagination guidance, schema-sync troubleshooting, and duplicated Database Migrations section |
| ui/litellm-dashboard/CLAUDE.md | New file with antd migration guidance, browser storage safety (sessionStorage), MCP OAuth UI-side rules; content correctly split from root |
| litellm/proxy/management_endpoints/CLAUDE.md | New file with MCP credential storage and OAuth backend rules relocated from root; correctly scoped to management endpoints |
| litellm/caching/CLAUDE.md | New file with HTTP client cache safety rule (no close() on eviction); correctly relocated from root |
| .circleci/CLAUDE.md | New file with CI supply-chain safety rules (checksum verification, pinned versions); correctly scoped to CI directory |
| litellm/proxy/auth/CLAUDE.md | Stub file for future auth-specific rules |
| litellm/proxy/guardrails/CLAUDE.md | Stub file for future guardrails-specific rules |
| litellm/proxy/hooks/CLAUDE.md | Stub file for future proxy hooks rules |
| litellm/proxy/spend_tracking/CLAUDE.md | Stub file for future spend tracking rules |
| litellm/proxy/pass_through_endpoints/CLAUDE.md | Stub file for future pass-through endpoint rules |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
ROOT["CLAUDE.md (root)\nUniversal: commands, arch, style, testing, setup, enterprise"]
ROOT --> UI["ui/litellm-dashboard/CLAUDE.md\nantd, browser storage, UI↔backend, MCP OAuth UI"]
ROOT --> PROXY["litellm/proxy/CLAUDE.md\nDB access, migrations, schema sync"]
ROOT --> CACHING["litellm/caching/CLAUDE.md\nHTTP client cache safety"]
ROOT --> CI[".circleci/CLAUDE.md\nCI supply-chain safety"]
PROXY --> MGMT["management_endpoints/CLAUDE.md\nMCP credential storage, MCP OAuth backend"]
PROXY --> AUTH["auth/CLAUDE.md\n(stub)"]
PROXY --> GUARD["guardrails/CLAUDE.md\n(stub)"]
PROXY --> HOOKS["hooks/CLAUDE.md\n(stub)"]
PROXY --> SPEND["spend_tracking/CLAUDE.md\n(stub)"]
PROXY --> PASS["pass_through_endpoints/CLAUDE.md\n(stub)"]
Comments Outside Diff (1)
-
CLAUDE.md, line 134-138 (link)Duplicated Database Migrations section
The "Database Migrations" block (lines 134–138 of the root
CLAUDE.md) is identical to the one added inlitellm/proxy/CLAUDE.md. Keeping both in sync doubles the maintenance burden; the two can silently drift apart over time. Since the proxy-level file is the natural home for this guidance, consider removing or reducing the root copy to a one-liner pointer (e.g. "Seelitellm/proxy/CLAUDE.mdfor Prisma migration details").
Reviews (1): Last reviewed commit: "chore: split CLAUDE.md by domain for laz..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
CLAUDE.mdinto nestedCLAUDE.mdfiles so Claude Code only loads domain-specific rules when working in the relevant subdirectory. Root keeps universal rules (commands, architecture, style, testing, setup wizard, enterprise).auth/,guardrails/,hooks/,spend_tracking/,pass_through_endpoints/) so future rules land in the right place.Why
Per Claude Code memory docs:
CLAUDE.mdfiles in ancestor directories load at launch, but subdirectory files load lazily when Claude reads files inside them. Splitting by domain keeps the initial context lean and scopes guidance to where it applies.File map
CLAUDE.md(root)ui/litellm-dashboard/CLAUDE.mdlitellm/proxy/CLAUDE.mdlitellm/proxy/management_endpoints/CLAUDE.mdlitellm/caching/CLAUDE.md.circleci/CLAUDE.mdlitellm/proxy/{auth,guardrails,hooks,spend_tracking,pass_through_endpoints}/CLAUDE.mdTest plan
CLAUDE.mdstill renders correctly on GitHub