@jangmanj/pi-router
Session-level 3-axis model router with local two-stage pivot detection and calibration pipeline for Pi.
Package details
Install @jangmanj/pi-router from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@jangmanj/pi-router- Package
@jangmanj/pi-router- Version
1.0.0- Published
- Oct 28, 2026
- Downloads
- 284/mo · 284/wk
- Author
- jangmanj
- License
- MIT
- Types
- extension
- Size
- 254.8 KB
- Dependencies
- 0 dependencies · 3 peers
Pi manifest JSON
{
"extensions": [
"./router/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@jangmanj/pi-router
Session-level 3-axis model router (router/auto) with local two-stage pivot detection and a content-addressed SQLite calibration/retrieval pipeline for Pi.
router/— Pi virtual model (router/auto,session@v2):- Initial selection: Paired concurrent 3-axis decider review (
depth,width,urgencyviabaseten/mammoth-1:freeandperplexity/pplx-decider-v1.2on OpenRouter, withtypesafe/jev-1.14andinception/mercury-decideas automatic fallbacks), reconciled conservatively (maxondepth/width,minonurgency), matched against configurableprofilesinrouter/config.json(quick,local_work,wide_work,diagnosis_scoping,diagnosis_exec,deep_focus,deep_system). - Continuation & two-stage pivot cascade (
router/src/pivot.ts): Stage 1 combines deterministic telemetry trouble thresholds with local bi-encoder cosine similarity (Qwen3-Embedding-0.6Bon127.0.0.1:8081) againstgoal_anchor+ optional<cwd>/.anchor/router-stub.md. Ambiguous semantic drift or soft instability wakes Stage 2 (Qwen3-Reranker-0.6Bon127.0.0.1:8082). Only confirmed pivots re-run the paired 3-axis decider pass. - Optional
tag:routing: If<cwd>/.anchor/router-stub.mdspecifies an optionaltag: <openrouter_task_type>, the router prefers the first available model for(tag, tier)fromrouter/tag-mappings.json(synced daily fromauto-router-probe).
- Initial selection: Paired concurrent 3-axis decider review (
pipeline/— Stable-ID routing record store (~/.local/share/route-pipeline/pipeline.db), background embedding queue (hash-ngram,bm25,qwen3-embedding-0.6bacrossrequest-text,project-summary, andcontextualrecipes), retrieval (consult), and outcome calibration (calibrate).pipeline_guide.md— Full operational guide, configuration surfaces, and systemd units.
Install
pi install npm:@jangmanj/pi-router
Select in Pi:
/model router/auto # in pi
pi --model router/auto:high # from the shell
Development
npm run check # type checker and tests (router + pipeline)
npm run smoke:pack # pack, install the tarball, and load router/auto in Pi
Release
npm version patch # or minor / major
git push --follow-tags # triggers .github/workflows/publish.yml (OIDC trusted publishing + provenance)
License
MIT. See LICENSE.