Allow worktree-path in project config + support config inheritance from parent directories
Use case
I have a project with multiple independent git repos under a shared parent directory:
my-project/ ← parent repo (orchestration, process management)
├── .config/wt.toml ← would like this to apply to child repos
├── my-api/ ← git repo
│ ├── .bare/
│ ├── main/
│ ├── development/
│ └── feature-branch/
├── my-frontend/ ← git repo
│ ├── .bare/
│ ├── main/
│ ├── development/
│ └── feature-branch/
└── Procfile.dev
Both repos share the same worktree layout, hooks, and aliases. Our tooling (process manager, symlinks, Procfile) depends on worktrees being created inside each repo directory rather than as siblings. Today there's no good way to share this configuration with teammates:
worktree-pathis user-config only, so each developer has to configure it manually in~/.config/worktrunk/config.toml. If a new dev doesn't set it up, the default sibling layout breaks our tooling.- Hooks and aliases can go in
.config/wt.toml, but I'd have to duplicate that file into each child repo and keep them in sync.
Current workaround
I can symlink .config/wt.toml from each child repo to a shared file in the parent, but this still requires per-repo setup and doesn't solve worktree-path since that's excluded from project config entirely.
Proposal
Two changes would solve this:
-
Allow
worktree-pathin project config (.config/wt.toml) as a team default. User config would still take precedence, so developers who prefer a different layout can override it. This way new team members get the right layout automatically without manual setup. -
Walk up parent directories when resolving
.config/wt.toml(stopping at filesystem root or home directory). This way multi-repo projects can define shared config once in the parent rather than duplicating or symlinking per repo. A child repo's ownwt.tomlwould override the inherited parent config — similar to how.editorconfigresolution works.
Precedence: user config → child .config/wt.toml → inherited parent .config/wt.toml → worktrunk defaults
Thanks for the detailed write-up and the clear use case! I searched the codebase and confirmed that neither feature exists today:
-
worktree-pathin project config — This is intentionally user-config-only (src/config/user/sections.rs). If placed in.config/wt.toml, it would be flagged as an unknown key. The worktree path computation insrc/commands/worktree/resolve.rsonly consultsUserConfig. -
Parent directory walking for
.config/wt.toml— Project config is loaded from exactly one location:<repo_root>/.config/wt.toml(src/config/project.rs). There is no ancestor directory traversal.
The closest related issue is #980 (multi-repo workflows), which covers cross-repo operations from a different angle — repo selection and global switching rather than shared config. Not a duplicate, but in the same problem space.
I'll leave it for a maintainer to evaluate and prioritize.
thanks for writing out the issue!
this seems quite a niche case, and I would encourage trying to put these all the same repo, even though I realize that's not always possible
the worktree-path in project settings would cause a large change for anyone depending on whether they had set the default value which is not great
the path walking isn't so bad per se, but introduces a modest complication, and I'm not really sure to what end: even in the motivating case, how do we know the paths will organized this way?
I will leave open in case others have overlapping needs or ideas
hope that's reasonable
Thanks for the response!
Re: worktree-path in project config — apologies if I'm misunderstanding, I'm not intimately familiar with the codebase, but since it would be None by default, it would only take effect if a project explicitly sets it in .config/wt.toml. No change for anyone otherwise. And worktrunk already has the [projects."..."] per-project override in user config, so a developer who prefers a different layout can always override it. The precedence would be:
user per-project override > project .config/wt.toml > user global > default
So the project sets a convention, but the developer always has the final say.
Re: path walking — this is a well-established pattern across CLI tools: ripgrep (.rgignore), fd (.fdignore), .gitignore, .editorconfig, ESLint, Prettier, mise (.mise.toml). Beyond multi-repo setups, it would let organizations put shared hooks in a top-level directory that apply to all repos underneath.
Re: worktree-path in project config — apologies if I'm misunderstanding, I'm not intimately familiar with the codebase, but since it would be None by default, it would only take effect if a project explicitly sets it in .config/wt.toml. No change for anyone otherwise. And worktrunk already has the [projects."..."] per-project override in user config, so a developer who prefers a different layout can always override it. The precedence would be:
user per-project override > project .config/wt.toml > user global > default
So the project sets a convention, but the developer always has the final say.
yes! but then there is a sudden change in behavior between a) having the literal default in a config, and b) falling back to the default
Re: path walking — this is a well-established pattern across CLI tools: ripgrep (.rgignore), fd (.fdignore), .gitignore, .editorconfig, ESLint, Prettier, mise (.mise.toml). Beyond multi-repo setups, it would let organizations put shared hooks in a top-level directory that apply to all repos underneath.
do the repo-related ones continue walking out of the repo?
another thing to check out is the system config file; to the extent you have control of users' systems...
Re worktree-path: fair concern. What if user config always takes precedence over project config? So the precedence would be:
user per-project > user global > project .config/wt.toml > default
Project config would only be a recommended default — it applies to developers who haven't set their own preference. Anyone who has worktree-path in their user config (whether the literal default or something custom) is unaffected.
Re walking out of the repo: yes — .editorconfig, ripgrep (.rgignore), fd (.fdignore), and mise (.mise.toml) all walk past the repo boundary. .gitignore is the notable exception (stays within the repo). .editorconfig uses root = true to let users control where the walk stops, which could work here too.
Project config would only be a recommended default — it applies to developers who haven't set their own preference. Anyone who has worktree-path in their user config (whether the literal default or something custom) is unaffected.
my sense is that this is will produce too much confusing behavior relative to the benefit. I'm happy to leave this open to see if there's broader demand for it.
Re walking out of the repo: yes —
.editorconfig, ripgrep (.rgignore), fd (.fdignore), and mise (.mise.toml) all walk past the repo boundary..gitignoreis the notable exception (stays within the repo)..editorconfigusesroot = trueto let users control where the walk stops, which could work here too.
👍
@worktrunk-bot please could you do a survey of files that are used to configure repos; find patterns on which will walk out of the repo vs require being at the root?
Here's a survey of how developer tools resolve config files, organized by behavior pattern.
Pattern 1: Walk up + merge across levels (hierarchical)
These walk up parent directories and merge/layer configs. Closer configs override farther ones.
| Tool | Config file | Stops at | Root marker |
|---|---|---|---|
| EditorConfig | .editorconfig |
FS root or root = true |
root = true |
| ripgrep | .rgignore, .ignore |
FS root | None (--no-ignore-parent to disable) |
| mise | .mise.toml |
FS root or MISE_CEILING_PATHS |
MISE_CEILING_PATHS env var |
| Biome | biome.json |
Home dir fallback | "root" field |
ESLint (legacy .eslintrc) |
.eslintrc.* |
FS root or root: true |
root: true |
Pattern 2: Walk up, first match wins (no merge)
Walk up but stop at the first config found.
| Tool | Config file | Stops at | Root marker |
|---|---|---|---|
| Prettier | .prettierrc |
FS root | None |
| rustfmt | rustfmt.toml |
Home dir / ~/.config/rustfmt/ |
None |
| direnv | .envrc |
FS root | None |
| nvm | .nvmrc |
FS root | None |
| pyenv | .python-version |
FS root | None |
| rbenv | .ruby-version |
FS root | None |
| asdf | .tool-versions |
Home dir | None |
Version managers universally walk to FS root (or $HOME) — they need exactly one answer and "closest match wins" naturally scopes it.
Pattern 3: Walk up to find a project root marker, then read config there
These walk up to find a known root marker, then scope all config to that root. They don't look in arbitrary parent directories.
| Tool | Root marker | Config at root | Walks past repo? |
|---|---|---|---|
git (.gitignore) |
.git/ |
.gitignore per-directory |
No — stops at .git/ |
| Cargo | Cargo.toml with [workspace] |
Cargo.toml |
Technically yes (has open bugs about accidental parent pickup) |
| Gradle | settings.gradle |
gradle.properties |
No |
| Bazel | WORKSPACE / MODULE.bazel |
.bazelrc |
No — errors if no root found |
| npm | package.json / node_modules/ |
.npmrc at project root only |
No |
| pre-commit | .git/ |
.pre-commit-config.yaml |
No |
Pattern 4: Fixed location only (no walk)
| Tool | Config file | Where it looks |
|---|---|---|
| Clippy | clippy.toml |
CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR / CWD |
| Docker | .dockerignore |
Build context root |
| Terraform | .terraformrc |
Home dir only |
Pattern 5: ESLint flat config (intentional simplification)
ESLint's new flat config (eslint.config.js) walks up only to find one config file — it deliberately removed the old hierarchical merge behavior, citing confusion and performance issues.
Summary: what predicts walking vs. not?
Walk past the repo boundary:
- Ignore/style files (EditorConfig, ripgrep
.rgignore, Prettier) — these are about developer preferences and naturally cascade - Version managers (
.nvmrc,.python-version,.tool-versions) — environment concerns span multiple projects - Environment tools (mise, direnv) — same rationale
Stay within the repo:
- Build tools (Bazel, Gradle, Cargo workspaces) — config outside the project root would be surprising and dangerous
- Git hooks and git-native config (
.gitignore,.pre-commit-config.yaml) — scoped to the repository by design - Package managers (npm
.npmrc) — project-scoped
The dividing line seems to be: does the config describe the project itself (build, dependencies, hooks) or the developer environment (formatting, tool versions, ignore patterns)? Project-intrinsic config stays at the root; environment/preference config walks up.
For worktrunk, .config/wt.toml mixes both: hooks and aliases feel project-intrinsic, while worktree-path is more of an environment/layout preference. That hybrid nature is probably what makes this decision tricky — the precedents point in different directions depending on which settings you focus on.
Worth noting that several tools that do walk past the repo boundary consider it a misfeature or have open bugs about it (Prettier #8303, Cargo #9922), suggesting the ecosystem is trending toward not walking past project boundaries for project-level config.
Well, ok, thanks for the consideration.
Let me lay out the issue I'm having from first principles and maybe you can see the problem I'm trying to solve and/or suggest an alternative solution:
Currently, there seems no way for a project to express "this is how worktrees should be laid out." Every developer has to manually configure the project's worktree-path in their own user config (if the project deviates from the default, of course).
It's similar to if .nvmrc didn't exist and every developer had to set their Node version per-project in their global nvm config — it works, but the project can't communicate its own convention.
Currently, there seems no way for a project to express "this is how worktrees should be laid out."
I think this is basically correct — the user is sovereign over this, the project cannot reach here
I know that's not ideal for your use case. But it does seem like relying on an exact layout of repos is not that well supported beyond just worktrunk, and something like a monorepo or submodules might be more standard? or a script that people run and it sets their configs etc, if they're your team?
will close but if others have thoughts, feel free to add them here. thank you for the thoughtful discussion @madhermit