OmniscioSettings examplesA monorepo
Claude Code settings.json example for a monorepo
Every monorepo settings question comes down to one thing: which directory the session started in. Both files are below in full, with every key explained, the layout they assume, the worktree session that needs the second copy, and the rule that makes the whole scheme look broken the first time you test it from the wrong folder.
Checked against Anthropic’s Claude Code 2.1.332. By the Omniscio team. Updated .
Who these files are for
A repository of packages that are worked on separately: packages/api, packages/web, a shared library, and a root that ties them together. Sessions start inside one package. They sometimes need the package next door, and repeating a full checkout in every worktree costs too much time and disk.
The long version, including CLAUDE.md layering, code intelligence and per-directory skills, is the Claude Code in a monorepo guide. This page is the two files that carry the settings half of it.
First decide where sessions start
Claude Code reads the shared project file from the directory the session starts in, and it does not look in parent directories. That rule decides the layout. A file at packages/api/.claude/settings.json is read by a session working in packages/api/, whether it started there or moved there with /cd, and by no session working anywhere else. No shared project setting is inherited upwards or downwards.
Anthropic’s advice for a large tree is to start where the work is, so that sibling packages’ CLAUDE.md files stay out of the context window. If you instead start every session at the repository root, you need one root file and no per-package files. Copy file one there and delete its additionalDirectories key: ../shared would resolve to a folder outside the repository, and a session started at the root can already read every package beneath it.
File one: the package file
Save this as packages/api/.claude/settings.json and commit it. Replace api and shared everywhere they appear, twice in sparsePaths and once in additionalDirectories, and keep the leading ../ there: that is what makes it point at a sibling rather than a child.
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"worktree": {
"sparsePaths": [
".claude",
"packages/api",
"packages/shared"
],
"symlinkDirectories": [
"node_modules"
]
},
"permissions": {
"additionalDirectories": [
"../shared"
],
"deny": [
"Read(./**/dist/**/*)",
"Read(./**/build/**/*)",
"Read(./**/*.generated.*)",
"Read(./**/vendor/**/*)"
]
}
}| Key | What it does here |
|---|---|
worktree.sparsePaths | Checks out only the directories listed, plus root-level files, into each worktree Claude Code creates. Paths are relative to the repository root, so they work whichever directory the session started in. .claude is the load-bearing entry: it puts the repository root’s .claude/settings.json inside every worktree, which is what makes file two load there |
worktree.symlinkDirectories | Symlinks the root node_modules from the main checkout into each worktree instead of duplicating it. It assumes a hoisted root node_modules; if your workspace keeps one per package, list each package’s as well |
permissions.additionalDirectories | Grants file access to ../shared, which is outside the working directory because the session starts inside packages/api; in a committed file it waits for workspace trust |
permissions.deny | Blocks reads of build output, generated files and vendored code that is checked in. Each directory pattern ends in /**/* rather than /** |
The /**/* ending is deliberate. A pattern ending in /** covers the directory itself, so ls dist and cd build are refused along with the reads. The longer form blocks the files and leaves the directory usable: Claude can still see that dist/ exists, and cannot open anything inside it.
Deny rules cover Claude’s file tools, shell commands Claude Code recognizes when a blocked path is passed as an argument (cat, head, grep), and redirection targets. They do not cover a command that reads files without naming them, such as grep -r pattern ., or a subprocess that opens the file itself.
File two: the root file, for worktree sessions
Save this as .claude/settings.json at the repository root. It carries only the deny rules, because it has one job: a worktree created from a package session starts at the worktree root, so the package file is not loaded there and its rules would otherwise vanish. The deny list is duplicated in these two files on purpose: when you add or change a rule, edit both, or worktree sessions will not have it.
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"deny": [
"Read(./**/dist/**/*)",
"Read(./**/build/**/*)",
"Read(./**/*.generated.*)",
"Read(./**/vendor/**/*)"
]
}
}The resulting layout is what Anthropic’s own monorepo example reaches: a root file for worktree sessions, a self-contained file in each package you start sessions in, and per-directory CLAUDE.md files, so a session in packages/api/ loads the root CLAUDE.md and the package’s own, and never a sibling’s.
| Path | Read by |
|---|---|
.claude/settings.json | A session started at the repository root, and a worktree session, which starts at the worktree root |
packages/api/.claude/settings.json | A session started in packages/api/ |
.claude/settings.local.json | You, in every session inside the repository, wherever it starts, except on Windows and the other cases where Claude Code does not keep the local file at the repository root; in a worktree it is read from the main checkout’s root |
One thing to know before you rely on a relative path: rules that begin with /, and relative sandbox paths, anchor at the session’s working directory, not the repository root. A rule that has to hold from every subdirectory needs to start with //, which means the repository root, and it belongs in the committed files if the rest of the team needs it too.
One more key, if you start at the root
Starting at the root loads every package’s CLAUDE.md. When that is too much, claudeMdExcludes skips the files you do not want. Its patterns match against absolute file paths, which is why the example keeps a leading **/: it stands in for everything up to the checkout, so the entry works on any machine.
{
"claudeMdExcludes": [
"**/packages/web/**"
]
}The list is static, so it is a decision about today. Starting the session in the package instead keeps working when tomorrow’s work is somewhere else: the file that loads is always the one for the package you are in.
How to confirm it took effect
- Start the session in the package, then run
/statusand read theSetting sourcesline. An entry for the project’s settings file means that file was read. The line names the files Claude Code loaded and does not say which file supplied a key, so check the working directory yourself: the shared project file is read from the directory the session starts in. - Run
/permissionsto see the resolved rules. Thedenyentries from this file should appear there, and nothing from the package next door. - Ask for a file under
dist/and one under../shared. The first is refused. The second is granted once you have accepted the workspace trust dialog for the folder: a committed file’sadditionalDirectoriesentries wait for trust, while itsdenyrules apply either way. - If a rule is missing, check where the session started before you check the file. A package file copied into the wrong folder is not read at all, and nothing reports a file that was never opened.
The common mistake: one root file for everything
The mistake is writing one excellent settings file at the repository root and assuming every session gets it. It does not, and the failure is quiet: the team sees the deny rules working from the root and silently not applying inside a package, which reads as a permissions bug rather than a layout one.
- A sibling package is not reachable by default from inside a package, because the working directory stops at the package.
additionalDirectoriesor--add-diris the grant, and only the latter also loads that directory’s skills. - A worktree session drops the package file, because it starts at the worktree root. That is why the second file exists.
- A rule written with a relative path follows the working directory, so the same file used from two starting directories can mean two different things.
Writing rules like these by hand is where mistakes hide, because a rule that never loads looks exactly like a rule that works. The permissions builder writes and checks them, and the settings.json precedence page covers which file wins when two of them apply.
Common questions
Does Claude Code read a settings.json in a parent folder?
No. Project settings are not inherited from parent directories. Claude Code reads the shared .claude/settings.json from the directory the session starts in, so a session started in packages/api/ does not read the repository root’s file. That is why a monorepo gives each area it starts sessions in a settings file of its own.
Why do my deny rules stop applying inside a worktree?
A worktree session starts at the worktree root, not in the package folder, so the package’s .claude/settings.json does not load and its rules do not apply. Put a copy of the deny rules in the repository root’s .claude/settings.json so worktree sessions pick them up.
Should I add the other packages to additionalDirectories?
Only the siblings a session started elsewhere has to reach. A session started at the repository root can already read every package under it. additionalDirectories grants file access to directories outside the working directory, and it grants file access only: it loads none of the directory’s CLAUDE.md, skills or rules.
Where to go next
- The other four example pages: a team project, a solo power-user setup, an enterprise policy, and Bedrock or Vertex.
- Claude Code in a monorepo: CLAUDE.md by directory, code intelligence, and skills per package.
- Claude Code across multiple folders:
--add-dirand what an added directory brings with it. - Team settings: what a clone gets, and why allow rules wait for trust.
Run the sessions side by side, each with its own settings
Omniscio runs one session per package side by side, each with its own working directory, so the file a session reads is the file for the package in front of you. The features page covers what it adds, and you can download it for Windows, macOS or Linux.