pi-session-router
v0.1.2
Published
Pi extension that uses an LLM to route new prompts into the most relevant existing session before continuing
Maintainers
Readme
pi-session-router
Pi extension that automatically decides whether a new prompt belongs in another existing session.
Behavior
- intercepts a newly submitted user prompt
- gathers recent project sessions
- asks an LLM to choose the most relevant existing session, if any
- switches to that session before continuing
- if no better session exists, keeps the current one
Commands
/session-router on
/session-router off
/session-router toggle
/session-router status
/session-router threshold 0.80
/session-router notices offNotes
- this is an opinionated workflow extension
- it uses an unsupported internal
AgentSessionhook to switch sessions invisibly during prompt interception - it can stay in the current session, switch to another local session, or start a new session when no good match exists
- it keeps a lightweight cache at
~/.pi/agent/session-router-cache.json - routing heuristics now use exact informative-token overlap instead of loose substring matching, which avoids false
CURRENTdecisions on unrelated prompts
Local test
pi -e ./pi-packages/pi-session-routerLogic tests
cd pi-packages/pi-session-router
node --test tests/router-logic.test.mjsInstall from local path
pi install ./pi-packages/pi-session-router