@claaslange/pi-directory-models
v0.1.0
Published
pi extension that selects a model from the nearest ancestor .pi/settings.json
Maintainers
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.jsonThen 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-modelsLocal path
pi install /absolute/path/to/pi-directory-modelsGit
pi install git:github.com/claaslange/pi-directory-modelsPackage layout
extensions/index.ts– extension entry pointpackage.json– pi package manifest
Development
npm install
npm run checkUseful 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.
