omp packages

pi-dent-sticky-model0.1.1

A pi extension that keeps the previous session's model and thinking level across /new

GitHub Actions Published 1 day ago MIT ~0 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-dent-sticky-model

A pi extension that keeps the previous session's model and thinking level across /new: instead of falling back to the startup default, the new session reuses what the previous session last switched to. defaultProvider/defaultModel are never written. pi-dent bundles it through its pi.extensions; it also runs standalone in pi.

Published to npm as pi-dent-sticky-model and listed in the Pi package gallery.

Why

pi.setModel() and pi.setThinkingLevel() record their change in the session's history, and a new session starts from the configured defaults. An agent that switches models mid-task — a fast model for the drill, a stronger one for the review — loses that choice on every /new, /clear followed by more work, or a compaction-heavy session. This extension reads what the previous session last chose and re-applies it to the new one.

How it works

  • Trigger: acts only on a session start with reason new that carries a previous session file. startup, reload, resume and fork are untouched, as is a /new from an unpersisted session (no file, nothing to restore).
  • Reading: the previous session's JSONL transcript is scanned for the last model_change entry (provider, modelId) and the last thinking_level_change entry (thinkingLevel), each independent of the other. Malformed lines and entries without well-formed fields are skipped; an unreadable file restores nothing and says nothing.
  • Applying: the model is looked up in the session's model registry and set first; the thinking level is set after it, so the host clamps the level to that model's capabilities. A level without a model entry still applies, to the session's default model.
  • Messages: when setModel reports missing authentication, the extension notifies No auth for <provider>/<modelId> with severity error. An unknown model is skipped silently.
  • Settings: never written — defaultProvider and defaultModel keep their values, so the startup default still applies wherever no previous session exists.

The exact rules are in specs/sticky-model.md.

Using it

pi-dent bundles it. Standalone:

pi install npm:pi-dent-sticky-model

Requires Node 26 or later. No settings: install and it works.

Development

pnpm check        # the done-set: typecheck, lint, fmt:check, test
pnpm test:e2e     # end-to-end via pi RPC; needs the pi CLI and provider auth

Every push to main runs the publish workflow: pnpm check, then npm is published via OIDC trusted publishing; when package.json's version is already on npm, the patch version is bumped and the bump is committed back to main.

License

MIT