One-command session renamer toggle for Pi coding agent.
Problem it solves:
- Pi sessions accumulate fast
- default names drift (“Chat 173”) and searching becomes pain
- you want good enough names, but you also want an easy undo
pi-retune is a safe toggle:
/retune→ rename (repo-scoped by default)/retune again→ restore (only if the name is still what retune set)
If this improves your workflow, star the repo.
Install with Pi, not npm:
pi install npm:pi-retuneThen:
/reload
/retune
- rename sessions for this repo:
/retune - undo safely:
/retune again - preview only:
/retune --dry - edit/approve the plan:
/retune --review
/retune/retune again/retune --help
Common options:
--reviewedit/approve the plan before applying--drypreview only (no writes)--scope repo|cwd|all--limit 200--since 30d(or2026-01-01)--template "#{moduleOrRepo} - {primaryTask|truncate:28}"--no-modelnever call a model--allinclude already-named sessions (overwrite)
Placeholders:
{moduleOrRepo}{moduleName}{primaryTask}{repo}{branch}{ticket}{taskType}{created}{modified}{messages}{id8}
Modifiers:
|lower |upper |title |kebab |snake |sanitize |caveman |truncate:N |default:TEXT
Escape braces:
{{→{and}}→}
Merged global → project:
~/.pi/agent/retune.json<repo>/.pi/retune.json
Legacy names still supported:
~/.pi/agent/pi-retune.json<repo>/.pi/pi-retune.json
- config:
~/.pi/agent/retune.json - config (project):
<repo>/.pi/retune.json
- No sessions matched repo scope
- try:
/retune --scope all
- try:
- You renamed a session manually, and restore didn’t happen
- safety rule: restore only runs if the session name is still what retune set
Local dev install:
pi install -l <path-to-pi-retune>Release checklist:
- update
CHANGELOG.md - bump version:
npm version patch npm publish
MIT