pi-local-session-dir
Pi extension: /local_ses_dir sets a project's session directory in .pi/settings.json
Package details
Install pi-local-session-dir from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-local-session-dir- Package
pi-local-session-dir- Version
1.0.0- Published
- Oct 29, 2026
- Downloads
- 296/mo · 296/wk
- Author
- boois
- License
- MIT
- Types
- extension
- Size
- 9 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./extensions/local-ses-dir.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-local-session-dir
A pi extension that adds a /local_ses_dir command for setting the session directory of the current project.
It writes sessionDir into the project-level .pi/settings.json and keeps every other field untouched.
Install
pi install npm:pi-local-session-dir
Try it for a single run without saving it to your settings:
pi -e npm:pi-local-session-dir
Usage
/local_ses_dir # use the default directory: .pi/sessions
/local_ses_dir my/sessions # use the relative directory my/sessions
- Only paths relative to the current working directory are accepted; absolute paths are rejected with an error.
\is normalized to/, and a leading./, repeated/, and trailing/are cleaned up.- Arguments are completed from the subdirectories of the directory you are typing in.
- If
.pi/settings.jsonalready exists but is not valid JSON, the command refuses to write so your settings are not destroyed.
sessionDir is read once at pi startup, so restart pi (or start a new pi process) after running the command.
Result
Running /local_ses_dir my/sessions produces:
{
"sessionDir": "my/sessions"
}
Existing keys in .pi/settings.json (for example extensions or packages) are preserved.
Development
This repository is also the working copy of the extension. npm pack --dry-run shows the published tarball contents, and .pi/settings.json loads the extension from extensions/local-ses-dir.ts via extensions: ["../extensions/local-ses-dir.ts"].
License
MIT