← Catalog

pi-retitle

Session titles for pi. Titles an unnamed session after its first exchange, regenerates the title with /retitle, and lets you pick a cheap title model.

Package

Install

Install with PiG

pig install npm:pi-retitle

Install with Pi

pi install npm:pi-retitle
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.1.1 (README.md). PiG does not review it.

pi-retitle

pi-retitle names your pi sessions. An unnamed session gets a short title after its first completed exchange. /retitle writes a new title from the whole conversation. A model you choose in settings.json writes the titles, so a cheap model can do it instead of your session model.

pi-retitle asks the title model to write in the language you use, so Korean messages get a Korean title.

Install

Install from npm:

pi install npm:pi-retitle

Install from a local checkout:

pi install /path/to/pi-retitle

A local install loads the files in place. pi supplies @earendil-works/pi-ai and @earendil-works/pi-coding-agent to the extension, so the checkout needs no npm install to run.

Add --local to any of these commands to write the package to the project's .pi/settings.json instead of ~/.pi/agent/settings.json.

Replace @pi-archimedes/session-name

Both extensions title new sessions, so keep only one. Remove the old one and install pi-retitle:

pi remove npm:@pi-archimedes/session-name
pi install npm:pi-retitle

The old extension read its model from the "archimedes.sessionName" key in ~/.pi/agent/settings.json. pi-retitle does not read that key. If you set a model there, move it to retitle.model and delete the old key.

Choose the title model

Set retitle.model in ~/.pi/agent/settings.json, or in .pi/settings.json for one project:

{
	"retitle": {
		"model": "anthropic/claude-haiku-5-5"
	}
}

Write the model as provider/id. pi keeps settings in memory and rereads settings.json on /reload, so run /reload or restart pi after you edit it.

If you leave retitle.model out, the session's current model writes titles.

Regenerate the title

Run /retitle in a session. pi-retitle sends the conversation on the current branch to the title model and replaces the session name, including a name you set with /name. When it finishes, pi shows the new title and the model that wrote it:

Session title: 세션 쿠키 만료 처리 개선 (anthropic/claude-haiku-5-5)

To set a title by hand, use pi's built-in /name <title>. /retitle takes no arguments.

Reference

Automatic titles

pi-retitle titles a session automatically when all of these hold after an agent run finishes:

  • The run was not aborted with Escape.
  • The session has no name. A name from /name, --name, or an earlier title stops automatic titling for good.
  • pi runs with a UI, in interactive or RPC mode. Runs with -p or --mode json exit before a title could arrive.
  • The session is saved to a file. A --no-session session gets no automatic title.
  • The branch has at least one assistant reply with text.
  • No other title request from pi-retitle is running.

pi-retitle sends the request in the background, so you can type your next prompt while it runs.

If an automatic title fails, pi shows one warning that names the cause and suggests /retitle. pi-retitle tries again after your next exchange, without another warning. The warning can appear again after pi restarts, after /reload, or after you switch sessions.

/retitle

  • It replaces the current name, whether pi-retitle or you set it.
  • It also runs in a --no-session session.
  • If the conversation has no user or assistant text yet, it reports Nothing to title yet. and sends nothing.
  • On failure it shows the cause as an error and leaves the name unchanged.

Which name wins

pi-retitle writes a title only if the session name is still what it was when the request started. So:

  • If you run /name while a title is generating, your name stays and the generated title is discarded.
  • If you run /retitle again while one is generating, the first request is cancelled and the second one's title is used.
  • An automatic title never replaces a name, even one set while the request ran.

retitle.model

ValueResult
absentThe session's current model writes titles.
"provider/id"That model writes titles. pi-retitle splits at the first /, so the id may contain /.
malformed, unknown, or without credentialspi-retitle sends no request and reports the problem. It never falls back to the session model.

In a trusted project, .pi/settings.json overrides ~/.pi/agent/settings.json, as for every pi setting.

What the title model receives

  • The user and assistant text of every message on the current branch, including messages that compaction summarized. Tool calls, tool results, thinking, and images are left out.
  • A /skill:<name> message as /skill:<name> plus the text you typed after it, not the skill file's contents.
  • Each message cut to 1,000 characters. If the conversation is longer than 24,000 characters, the first and last messages are kept and the middle is left out.

pi-retitle asks for 2 to 6 words, requests no reasoning when the model allows that, and gives up after 30 seconds. Titles are at most 80 characters.

Develop

Install the dev dependencies, then run the type check and the tests:

npm install
npm run typecheck
npm test

npm publish runs both checks first.

To check the extension in a real pi session, run python3 scripts/live-check.py. It starts pi in RPC mode with an isolated agent directory and makes real model calls.

License

MIT