@claaslange/pi-directory-models
pi extension that selects a model from the nearest ancestor .pi/settings.json
Package details
Install @claaslange/pi-directory-models from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@claaslange/pi-directory-models- Package
@claaslange/pi-directory-models- Version
0.1.0- Published
- Mar 23, 2026
- Downloads
- 16/mo · 3/wk
- Author
- claas_lange
- License
- MIT
- Types
- extension
- Size
- 10.5 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./extensions"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-directory-models
pi-directory-models is a pi extension that selects a model from the nearest ancestor .pi/settings.json.
It is meant for setups where different directory trees should automatically use different models or thinking levels.
What it does
On session start, the extension walks up from the current working directory until it reaches your home directory or the filesystem root.
As soon as it finds an ancestor .pi/settings.json with one of these settings, it applies them:
defaultProviderdefaultModeldefaultThinkingLevel
Missing values fall back to your global ~/.pi/agent/settings.json.
Example
Project root:
{
"defaultProvider": "github-copilot",
"defaultModel": "gpt-5",
"defaultThinkingLevel": "medium"
}
Put that in:
/path/to/company-project/.pi/settings.json
Then every pi session started anywhere inside that project tree will switch to that model automatically.
Requirements
- pi /
@mariozechner/pi-coding-agent>= 0.62.0 - extension peer deps:
@mariozechner/pi-coding-agentand@mariozechner/pi-agent-core>= 0.62.0
This extension does not use the APIs affected by the 0.62.0 breaking changes around renderCall/renderResult or sourceInfo provenance.
Install
npm
pi install npm:@claaslange/pi-directory-models
Local path
pi install /absolute/path/to/pi-directory-models
Git
pi install git:github.com/claaslange/pi-directory-models
Package layout
extensions/index.ts– extension entry pointpackage.json– pi package manifest
Development
npm install
npm run check
Useful scripts:
npm run typechecknpm run lintnpm run lint:fixnpm run formatnpm run check
Publishing (maintainers)
This repo is set up to publish to npm via GitHub Actions on tags that match vX.Y.Z.
To publish:
- Update
package.jsonversion. - Push the commit.
- Push a matching tag, for example
git tag v0.1.0 && git push origin v0.1.0. - Configure npm Trusted Publishing for
claaslange/pi-directory-modelsand the publish workflow.
The published package name is @claaslange/pi-directory-models.
Notes
- The nearest matching
.pi/settings.jsonwins. - If
defaultModelis set withoutdefaultProvider, the extension tries to resolve the model by ID from available models. - If that model ID is ambiguous across providers, the extension shows a warning and asks you to set
defaultProvidertoo.