omp packages

@agnishc/edb-auto-name-session0.21.5

Pi extension: replace Pi's first-message session label with a generated title

agnishc Published 4 days ago MIT ~133 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

@agnishc/edb-auto-name-session

A Pi CLI extension that replaces Pi's default first-message session label with a short generated title.

By default, Pi already shows the first user message in the session picker when no explicit session name exists. This extension watches the first real user prompt in a new unnamed session, sends that prompt to a naming model, and then stores a cleaner display name with pi.setSessionName().

Install

pi install npm:@agnishc/edb-auto-name-session

Commands

/autoname-sessions opens an interactive panel:

Auto-name sessions
────────────────────────────────────────────────────────────
❯ Automatic naming                                 enabled
  Model                                opencode/big-pickle
  Name this session now
  Close

  ↑↓ move · space/enter toggle · esc close
  • Automatic naming — space or enter toggles it, and the change is saved immediately.
  • Model — opens a fuzzy-searchable list of every model with working credentials, plus Session model (default) to follow whatever model the session uses. The current choice is marked ●.
  • Name this session now — closes the panel and names the current session.

Subcommands still exist for scripting: /autoname-sessions on, off, now, reset, status.

Use case

Without this extension:

  • Pi falls back to the raw first user message as the session label

With this extension:

  • Pi keeps the same session flow
  • after the first user message, the fallback label is replaced with a concise generated title

Example:

  • First prompt: The next extension to build is auto-name-session. This will use the opencode big pickle model.
  • Generated session name: Build Auto Name Session

Behavior

  • Runs once per fresh unnamed session
  • Waits until the first user message is actually recorded
  • Generates a concise title with the configured model
  • Shows an interactive notification while auto-naming runs, then confirms the final title with the model used, its token count, and the duration (Session named: Foo Bar · opencode/big-pickle · 812 tok · 1.3s)
  • Leaves nothing on screen afterwards: no footer chip, no status entry. The same details are appended to ~/.pi/agent/logs/edb-auto-name-session.log
  • Adds nothing to the agent context — no system-prompt injection, no messages, no tools. The title and its stats never reach the model, so nothing invalidates the prompt cache.
  • Calls pi.setSessionName() only if the session is still unnamed
  • Leaves already named, resumed, or forked sessions alone

Settings

Stored in $PI_CODING_AGENT_DIR/edb-auto-name-session.json (default ~/.pi/agent/edb-auto-name-session.json). The file is owned by this extension, so /autoname can write it without racing Pi's own settings.json.

{
  "enabled": true,
  "model": { "provider": "opencode", "id": "big-pickle" }, // null = follow the session model
  "fallbackToSessionModel": true,                            // use the session model if the chosen one is unavailable
  "maxChars": 60,
  "announce": true                                            // TUI notifications
}

Model resolution order: the configured model, then (when fallbackToSessionModel is on) the session model. If neither resolves, nothing is generated and the reason is written to ~/.pi/agent/logs/edb-auto-name-session.log.

Requirements

The default model is opencode/big-pickle. Any model with working credentials works — set it with /autoname model, or set "model": null to name sessions with whatever model the session is using.

For the default, configure OpenCode access with either:

export OPENCODE_API_KEY=...

or /login in Pi if you store provider credentials there.

License

MIT © Agnish Chakraborty