AI-powered semantic session naming for Pi.
Automatically name sessions after the first dialogue, periodically re-name as the conversation evolves, and regenerate on demand with /autoname.
pi install npm:pi-autoname
| Scenario | Behavior |
|---|---|
| First dialogue settles | Automatically generates a semantic session name |
| Conversation continues | Silently considers a rename every 10 minutes (configurable) |
| Session topic drifts | Updates only when the current name no longer fits |
Run /autoname |
Manually regenerate from recent context |
| AI naming fails | Falls back to smart text extraction |
pi install npm:pi-autonameWorks out of the box. No configuration needed — uses your current session's model by default.
Config file is auto-generated on first use at ~/.pi/agent/pi-autoname.json:
{
"enabled": true,
"model": "",
"fallbackModels": [],
"cooldownMinutes": 10,
"debug": false,
"respectManualName": false
}| Field | Type | Default | Description |
|---|---|---|---|
enabled |
boolean | true |
Set to false to disable AI naming |
model |
string | (session model) | Primary model (provider/modelId). Empty = use session model |
fallbackModels |
string[] | [] |
Additional models to try if primary fails |
cooldownMinutes |
number | 10 |
Minutes between periodic re-names |
debug |
boolean | false |
Enable debug logging |
respectManualName |
boolean | false |
When false (default), a /name change gets one cooldown window before automatic naming resumes. Set to true to keep a user-issued /name until /autoname is explicitly run. |
{
"enabled": true,
"model": "minimax-cn/MiniMax-M2.7",
"fallbackModels": [
"xiaomi-token-plan-cn/mimo-v2-omni"
],
"cooldownMinutes": 10
}This tries models in order: MiniMax-M2.7 → mimo-v2-omni → session model.
first complete dialogue
↓
Pi reaches agent_settled
↓
AI generates a semantic session name in the background
↓
setSessionName(name)
agent_settled event (all retry/follow-up work complete)
↓
cooldown passed? (10 min default)
↓
AI checks recent context against the current name
↓
topic changed? → silently update
name still fits? → keep it
primary model (from config)
↓ failed within the shared 30-second budget?
fallback models (from config)
↓ failed?
session model (automatic)
↓ failed?
smart text extraction (no AI)
/autonameRegenerates the session name from recent conversation context. Useful when you want to force an immediate rename.
Pi's native command still works:
/name My custom titleWith the default respectManualName: false, pi-autoname gives /name a full cooldownMinutes grace period, then may resume automatic naming if the topic changes. It observes the name change immediately through Pi's session metadata event.
- For a one-shot rename that pi-autoname may later take over again: use
/name. - To force a re-name from the current conversation right now: use
/autoname. - To keep a
/nameindefinitely: setrespectManualName: true. Running/autonameremains an explicit override.
Periodic naming compares recent context with the current title. The model is asked to return the existing title unchanged when it still fits, so the extension avoids needless title churn and session metadata writes.
pi-autoname sends a short, recent conversation excerpt to the selected naming model. Before sending, it redacts common secret patterns such as API keys, bearer tokens, AWS access keys, private keys, and *_TOKEN / *_SECRET / *_PASSWORD environment assignments. If the AI call fails and the user text contained a detected secret, the local fallback name is skipped to avoid turning secrets into session names.
Names use the dominant natural language in user messages: the first user message for initial naming, and recent user messages for periodic or manual naming. Assistant responses, paths, URLs, and code snippets do not determine the language. When no natural-language user text is available, pi-autoname optionally uses the active pi-di18n /lang locale; pi-di18n is never required.
- pi-compaction-i18n — localized compaction summaries
The repository has no development dependency. With Node.js 22.6 or later (Node.js 22.22.3 is the tested baseline), run the built-in TypeScript test runner directly:
npm testPi provides the two declared peer dependencies at extension runtime.
MIT
