{"_id":"@byteowlz/pi-auto-rename","_rev":"8-ac6ce0f685942553472deab24ed41eca","name":"@byteowlz/pi-auto-rename","dist-tags":{"latest":"1.0.7"},"versions":{"1.0.0":{"name":"@byteowlz/pi-auto-rename","version":"1.0.0","keywords":["pi-package","pi-extension","pi-coding-agent"],"license":"MIT","_id":"@byteowlz/pi-auto-rename@1.0.0","maintainers":[{"name":"tommyfalkowski","email":"tommy@byteowlz.com"}],"homepage":"https://github.com/byteowlz/pi-agent-extensions#readme","bugs":{"url":"https://github.com/byteowlz/pi-agent-extensions/issues"},"pi":{"extensions":["./index.ts"]},"dist":{"shasum":"5f148d37ba71e939306d5c77099277cd2ec0943b","tarball":"https://registry.npmjs.org/@byteowlz/pi-auto-rename/-/pi-auto-rename-1.0.0.tgz","fileCount":6,"integrity":"sha512-+PxAzYkoAj0iPXCNCkb5YxTfonvnkX8tSd6HJYYF+S83rfecA8CoDaZz3PPsCV0grg8J9/+C5ZbtSHImQHDQFA==","signatures":[{"sig":"MEUCIQDYmdgzNtj0i+XELBJCIdFEGoIU0ZEOFE/81CzyOYKhUgIgLNcSZ+7GzN3K97cipol6K5yPBECm7UbCESHrwc7ZKm8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66364},"type":"module","gitHead":"a35af63b4e4e1258135b1383f976c38de1c0ff04","_npmUser":{"name":"tommyfalkowski","email":"tommy@byteowlz.com"},"repository":{"url":"git+https://github.com/byteowlz/pi-agent-extensions.git","type":"git","directory":"auto-rename"},"_npmVersion":"11.9.0","description":"Auto-Rename Extension for pi","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"peerDependencies":{"@mariozechner/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-auto-rename_1.0.0_1774014727475_0.08844558797195945","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@byteowlz/pi-auto-rename","version":"1.0.1","keywords":["pi-package","pi-extension","pi-coding-agent"],"license":"MIT","_id":"@byteowlz/pi-auto-rename@1.0.1","maintainers":[{"name":"tommyfalkowski","email":"tommy@byteowlz.com"}],"homepage":"https://github.com/byteowlz/pi-agent-extensions/tree/main/pi-auto-rename","bugs":{"url":"https://github.com/byteowlz/pi-agent-extensions/issues"},"pi":{"extensions":["./index.ts"]},"dist":{"shasum":"0a3e9ec390159e754f029b905c81838cc5137798","tarball":"https://registry.npmjs.org/@byteowlz/pi-auto-rename/-/pi-auto-rename-1.0.1.tgz","fileCount":6,"integrity":"sha512-Ey5fOpwcGstRfNJSvQ3fdKMtXVNSp4zYKjRcOfWYbGwP7WE/TzIOobkVP4fxkCcRGVOETRvMXJAmynEOeldWwA==","signatures":[{"sig":"MEUCIQCFSaNcIDENhMVhN7l9QsCBNU56ELbU4unDifl6uo2fgwIgVKeLKOnSvNeUSJnrHEYxrAiGj71taOeFEgaL6DGVliM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66732},"type":"module","gitHead":"3339fad857c501f1ddeb187b106a3a186b29b715","_npmUser":{"name":"tommyfalkowski","email":"tommy@byteowlz.com"},"repository":{"url":"git+https://github.com/byteowlz/pi-agent-extensions.git","type":"git","directory":"pi-auto-rename"},"_npmVersion":"11.9.0","description":"Auto-Rename Extension for pi","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"devDependencies":{"@mariozechner/pi-ai":"*","@mariozechner/pi-tui":"*","@mariozechner/pi-agent-core":"*","@mariozechner/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-auto-rename_1.0.1_1774015748908_0.08684492927169751","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@byteowlz/pi-auto-rename","version":"1.0.2","keywords":["pi-package","pi-extension","pi-coding-agent"],"license":"MIT","_id":"@byteowlz/pi-auto-rename@1.0.2","maintainers":[{"name":"tommyfalkowski","email":"tommy@byteowlz.com"}],"homepage":"https://github.com/byteowlz/pi-agent-extensions/tree/main/pi-auto-rename","bugs":{"url":"https://github.com/byteowlz/pi-agent-extensions/issues"},"pi":{"extensions":["./index.ts"]},"dist":{"shasum":"7034514f3a7d92a666a05cdc408d084528018a98","tarball":"https://registry.npmjs.org/@byteowlz/pi-auto-rename/-/pi-auto-rename-1.0.2.tgz","fileCount":6,"integrity":"sha512-SfKqg+A5tGTg4MIcanYRH0xuqCvUZnROrWI/yMAV0I5D1sgL9lLWFtnBsIhqG9rZI63y8VK8DiY8xi9CKsTx8w==","signatures":[{"sig":"MEQCICJhlK4du8qfJnYlro/Bxe4cVVJyRJlhlLRYqWXj5KRjAiAsX+gNPVeW3MeaKt9u+04ozBnNi6QgdXSGObQReNpzyw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":67805},"type":"module","gitHead":"931a28f676a59439b9941a413d20a47b4319b69b","_npmUser":{"name":"tommyfalkowski","email":"tommy@byteowlz.com"},"repository":{"url":"git+https://github.com/byteowlz/pi-agent-extensions.git","type":"git","directory":"pi-auto-rename"},"_npmVersion":"11.9.0","description":"Auto-Rename Extension for pi","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"devDependencies":{"@mariozechner/pi-ai":"*","@mariozechner/pi-tui":"*","@mariozechner/pi-agent-core":"*","@mariozechner/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-auto-rename_1.0.2_1774016357403_0.828307949926304","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@byteowlz/pi-auto-rename","version":"1.0.3","keywords":["pi-package","pi-extension","pi-coding-agent"],"license":"MIT","_id":"@byteowlz/pi-auto-rename@1.0.3","maintainers":[{"name":"tommyfalkowski","email":"tommy@byteowlz.com"}],"homepage":"https://github.com/byteowlz/pi-agent-extensions/tree/main/pi-auto-rename","bugs":{"url":"https://github.com/byteowlz/pi-agent-extensions/issues"},"pi":{"extensions":["./index.ts"]},"dist":{"shasum":"7fca3b174654ff8c231bcbe3d94b18e3818707eb","tarball":"https://registry.npmjs.org/@byteowlz/pi-auto-rename/-/pi-auto-rename-1.0.3.tgz","fileCount":6,"integrity":"sha512-71fdkMS6Y2fZRzVM6ef8tAyNCYtPZG+2gyvWPNvYXt6jwiFPqh8CyBEABbnprTMatSn8ibxY0c7ApyevHOmzmw==","signatures":[{"sig":"MEQCIHwIylxm2pzmGOI8gJeICN8kDIU+RQN0Gwe9LXw0COkcAiAhbKsXI64FiVlBonVDbt/1JKjoJmgzW9WnqevOcmS8mQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":68173},"type":"module","gitHead":"e14632ae42ead5b13eff75e479052d9493626eb4","_npmUser":{"name":"tommyfalkowski","email":"tommy@byteowlz.com"},"repository":{"url":"git+https://github.com/byteowlz/pi-agent-extensions.git","type":"git","directory":"pi-auto-rename"},"_npmVersion":"11.9.0","description":"Auto-Rename Extension for pi","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"devDependencies":{"@mariozechner/pi-ai":"*","@mariozechner/pi-tui":"*","@mariozechner/pi-agent-core":"*","@mariozechner/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-auto-rename_1.0.3_1774016896596_0.01973444440768679","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@byteowlz/pi-auto-rename","version":"1.0.4","keywords":["pi-package","pi-extension","pi-coding-agent"],"license":"MIT","_id":"@byteowlz/pi-auto-rename@1.0.4","maintainers":[{"name":"tommyfalkowski","email":"tommy@byteowlz.com"}],"homepage":"https://github.com/byteowlz/pi-agent-extensions/tree/main/pi-auto-rename","bugs":{"url":"https://github.com/byteowlz/pi-agent-extensions/issues"},"pi":{"extensions":["./index.ts"]},"dist":{"shasum":"649d52216c4dd0f4792d309fe79e064c41771ba4","tarball":"https://registry.npmjs.org/@byteowlz/pi-auto-rename/-/pi-auto-rename-1.0.4.tgz","fileCount":6,"integrity":"sha512-3rfLujJtkz7ka+bLBNd4LwroEG7OGVTKK4xS5b+MF+4XtAqPsuG3rZ00iGDkr7s3t3kAKv8RiZv/4K63vzBfUw==","signatures":[{"sig":"MEUCIQCo7ZZBTHWe4nSA+KmphqqAMUW8YN9+yNeSYvzyXPfwPAIgRDu5XU3WPtvpIHfO+LsODF3C8k9K9ksbumAc2A9ap2M=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":68703},"type":"module","gitHead":"db7d33cfd1359566a8ecc3312163b609e71e169e","_npmUser":{"name":"tommyfalkowski","email":"tommy@byteowlz.com"},"repository":{"url":"git+https://github.com/byteowlz/pi-agent-extensions.git","type":"git","directory":"pi-auto-rename"},"_npmVersion":"11.9.0","description":"Auto-Rename Extension for pi","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"devDependencies":{"@mariozechner/pi-ai":"*","@mariozechner/pi-tui":"*","@mariozechner/pi-agent-core":"*","@mariozechner/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-auto-rename_1.0.4_1774018265891_0.7176159381964904","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@byteowlz/pi-auto-rename","version":"1.0.5","keywords":["pi-package","pi-extension","pi-coding-agent"],"license":"MIT","_id":"@byteowlz/pi-auto-rename@1.0.5","maintainers":[{"name":"tommyfalkowski","email":"tommy@byteowlz.com"}],"homepage":"https://github.com/byteowlz/pi-agent-extensions/tree/main/pi-auto-rename","bugs":{"url":"https://github.com/byteowlz/pi-agent-extensions/issues"},"pi":{"extensions":["./index.ts"]},"dist":{"shasum":"86d6c0dd3fd6102d63a76642a154752946f8e89c","tarball":"https://registry.npmjs.org/@byteowlz/pi-auto-rename/-/pi-auto-rename-1.0.5.tgz","fileCount":6,"integrity":"sha512-NHPBG6oTCV1uj02/5Q3kd6yMImPp4ZfnmB2R89BSmB/f7FGLQqq3uWhFlZRioG5x39yZgpinZRcHNaxqAyE//w==","signatures":[{"sig":"MEYCIQCyvYoK6pTvRJI5JFb0lKJjGB+Xw5P5+lsVUPDzyDG/GAIhANaWsR5mDLEFtv5tAPOXnwJoeqxCSG/L6uyxxYMXb+49","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":69427},"type":"module","gitHead":"dd5a46bf02e6231e28f31c173fa91fc3067d5601","_npmUser":{"name":"tommyfalkowski","email":"tommy@byteowlz.com"},"repository":{"url":"git+https://github.com/byteowlz/pi-agent-extensions.git","type":"git","directory":"pi-auto-rename"},"_npmVersion":"11.9.0","description":"Auto-Rename Extension for pi","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"devDependencies":{"@mariozechner/pi-ai":"*","@mariozechner/pi-tui":"*","@mariozechner/pi-agent-core":"*","@mariozechner/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-auto-rename_1.0.5_1774018517523_0.03633276181580092","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@byteowlz/pi-auto-rename","version":"1.0.6","keywords":["pi-package","pi-extension","pi-coding-agent"],"license":"MIT","_id":"@byteowlz/pi-auto-rename@1.0.6","maintainers":[{"name":"tommyfalkowski","email":"tommy@byteowlz.com"}],"homepage":"https://github.com/byteowlz/pi-agent-extensions/tree/main/pi-auto-rename","bugs":{"url":"https://github.com/byteowlz/pi-agent-extensions/issues"},"pi":{"extensions":["./index.ts"]},"dist":{"shasum":"8c067690e788426a6c918b978d816faa43971bc8","tarball":"https://registry.npmjs.org/@byteowlz/pi-auto-rename/-/pi-auto-rename-1.0.6.tgz","fileCount":6,"integrity":"sha512-dtAmIWCzcVKozr7HFWEeZSGRSp8QM72NVSy6Jm8T8ncb3qPBIUhmuh7iIOskNbThHqItrQ3qpcnJ9mP65KtGPg==","signatures":[{"sig":"MEUCIEtHF0GoDfWrd1prB6ZiINGSgX3K++FS0VSrwUgFkhKcAiEAnBWQcTpnJaupTXrQd4sn8MJLMEzPVpdQhJfjTP+JdnA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":70999},"type":"module","gitHead":"f965aaeb86cc2832072cb0d8f3c197e3cd6985ab","_npmUser":{"name":"tommyfalkowski","email":"tommy@byteowlz.com"},"repository":{"url":"git+https://github.com/byteowlz/pi-agent-extensions.git","type":"git","directory":"pi-auto-rename"},"_npmVersion":"11.9.0","description":"Auto-Rename Extension for pi","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"devDependencies":{"@mariozechner/pi-ai":"*","@mariozechner/pi-tui":"*","@mariozechner/pi-agent-core":"*","@mariozechner/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-auto-rename_1.0.6_1774041824639_0.7188103809165065","host":"s3://npm-registry-packages-npm-production"}},"1.0.7":{"name":"@byteowlz/pi-auto-rename","version":"1.0.7","description":"Auto-Rename Extension for pi","type":"module","keywords":["pi-package","pi-extension","pi-coding-agent"],"pi":{"extensions":["./index.ts"]},"homepage":"https://github.com/byteowlz/pi-agent-extensions/tree/main/pi-auto-rename","bugs":{"url":"https://github.com/byteowlz/pi-agent-extensions/issues"},"repository":{"type":"git","url":"git+https://github.com/byteowlz/pi-agent-extensions.git","directory":"pi-auto-rename"},"devDependencies":{"@mariozechner/pi-agent-core":"*","@mariozechner/pi-ai":"*","@mariozechner/pi-coding-agent":"*","@mariozechner/pi-tui":"*"},"license":"MIT","gitHead":"8d03510547e79c48309e73d8f665d52ffc53fb73","_id":"@byteowlz/pi-auto-rename@1.0.7","_nodeVersion":"25.4.0","_npmVersion":"11.7.0","dist":{"integrity":"sha512-EE6OSDVmo1tNavrPKCL6LSESxw643oN3D5F+887yT/WlJSg3x2zEI+0VzFMiBwWBXSoEj3rhBlFFdHN75wKPEg==","shasum":"c10c431f239f6978c2f729ddc9d01585b754cf29","tarball":"https://registry.npmjs.org/@byteowlz/pi-auto-rename/-/pi-auto-rename-1.0.7.tgz","fileCount":6,"unpackedSize":72408,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGemHEhCJ85VYqfN8FmBrrFJPGtCvg2OtTtTCa17BZ/VAiEA0GknGmTjCVEBb1vxDwVcih0l2ruXY1wTXafMt/bpplM="}]},"_npmUser":{"name":"tommyfalkowski","email":"tommy@byteowlz.com"},"directories":{},"maintainers":[{"name":"tommyfalkowski","email":"tommy@byteowlz.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-auto-rename_1.0.7_1775638871152_0.37337569053856146"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-20T13:52:07.383Z","modified":"2026-04-08T09:01:11.477Z","1.0.0":"2026-03-20T13:52:07.627Z","1.0.1":"2026-03-20T14:09:09.059Z","1.0.2":"2026-03-20T14:19:17.572Z","1.0.3":"2026-03-20T14:28:16.759Z","1.0.4":"2026-03-20T14:51:06.047Z","1.0.5":"2026-03-20T14:55:17.687Z","1.0.6":"2026-03-20T21:23:44.805Z","1.0.7":"2026-04-08T09:01:11.319Z"},"bugs":{"url":"https://github.com/byteowlz/pi-agent-extensions/issues"},"license":"MIT","homepage":"https://github.com/byteowlz/pi-agent-extensions/tree/main/pi-auto-rename","keywords":["pi-package","pi-extension","pi-coding-agent"],"repository":{"type":"git","url":"git+https://github.com/byteowlz/pi-agent-extensions.git","directory":"pi-auto-rename"},"description":"Auto-Rename Extension for pi","maintainers":[{"name":"tommyfalkowski","email":"tommy@byteowlz.com"}],"readme":"# Auto-Rename Extension for pi\n\nAutomatically generates descriptive session names based on the first user query, making it easier to find and resume sessions later.\n\n## Features\n\n- **Automatic naming**: Generates a session name as soon as the first prompt is sent\n- **Configurable model**: Use any model accessible via pi (Anthropic, OpenAI, Google, etc.)\n- **Model selection strategy**: Choose whether auto mode prefers current model or cheapest model\n- **Fallback model**: Specify an alternative model if the primary fails\n- **Deterministic fallback**: Generate names without LLM if all models fail\n- **Custom prompts**: Customize the prompt used for name generation\n- **Static or dynamic prefixes**: Use a fixed string or a shell command for the prefix\n- **Readable-id suffix**: Append a deterministic `[adjective-noun-noun]` id\n- **Prefix-only mode**: Skip LLM entirely and use just the prefix (e.g., workspace name)\n- **Manual override**: Rename sessions manually via `/auto-rename <name>`\n- **Regenerate names**: Force regeneration with `/auto-rename regen`\n- **Connectivity test**: Test model availability with `/auto-rename test`\n\n## Installation\n\nCopy or symlink the `auto-rename` directory to your pi extensions folder:\n\n```bash\n# Global installation\ncp -r auto-rename ~/.pi/agent/extensions/\n\n# Or project-local\ncp -r auto-rename .pi/extensions/\n```\n\nThen reload pi or restart it.\n\n## Configuration\n\nCreate `auto-rename.json` in one of these locations (searched in order):\n\n1. `./auto-rename.json` (current working directory)\n2. `./.pi/auto-rename.json` (project-local)\n3. `~/.pi/agent/auto-rename.json` (global)\n\n### Default Configuration\n\n```json\n{\n  \"$schema\": \"./auto-rename.schema.json\",\n  \"model\": null,\n  \"fallbackModel\": null,\n  \"fallbackDeterministic\": \"readable-id\",\n  \"modelSelection\": \"current\",\n  \"prompt\": \"Generate a short, descriptive title...\",\n  \"prefix\": \"\",\n  \"prefixCommand\": null,\n  \"prefixOnly\": false,\n  \"readableIdSuffix\": false,\n  \"readableIdEnv\": \"PI_SESSION_READABLE_ID\",\n  \"enabled\": true,\n  \"debug\": false\n}\n```\n\n### Configuration Options\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `model` | object/null | `null` | Primary model to use (`{ provider, id }`). If null, auto selection is used. |\n| `fallbackModel` | object/null | `null` | Fallback model if primary fails. If null, skip explicit fallback. |\n| `fallbackDeterministic` | string | `\"readable-id\"` | Fallback if all LLMs fail: `\"readable-id\"` (adjective-noun-noun from session ID), `\"truncate\"` (first 50 chars), `\"words\"` (first 6 words), `\"none\"` |\n| `modelSelection` | string | `\"current\"` | Auto strategy when `model`/`fallbackModel` are null: `\"current\"` (current model then cheapest) or `\"cheapest\"` (cheapest then current). |\n| `prompt` | string | (see above) | Prompt template. Use `{{query}}` as placeholder |\n| `prefix` | string | `\"\"` | Static prefix before generated names |\n| `prefixCommand` | string/null | `null` | Shell command to generate dynamic prefix (5s timeout) |\n| `prefixOnly` | boolean | `false` | Skip LLM, use only prefix as full name |\n| `readableIdSuffix` | boolean | `false` | Append `[readable-id]` to generated names |\n| `readableIdEnv` | string/null | `\"PI_SESSION_READABLE_ID\"` | Environment variable that can provide a readable-id suffix override |\n| `maxQueryLength` | integer | `2000` | Max characters of user query sent to LLM prompt. Longer queries have their middle cut out, preserving beginning and end. |\n| `maxNameLength` | integer | `80` | Max characters for the generated name (before prefix/suffix). LLM responses exceeding this are truncated. |\n| `enabled` | boolean | `true` | Enable/disable auto-rename |\n| `debug` | boolean | `false` | Show debug notifications |\n| `wordlistPath` | string/null | `null` | Override path to `word_lists.toml` (relative to session cwd) |\n| `wordlist` | object | `null` | Inline wordlist override (`{ adjectives: [], nouns: [] }`) |\n\n### Example Configurations\n\n**Using OpenAI with Google fallback:**\n```json\n{\n  \"model\": { \"provider\": \"openai\", \"id\": \"gpt-4o-mini\" },\n  \"fallbackModel\": { \"provider\": \"google\", \"id\": \"gemini-2.0-flash\" }\n}\n```\n\n**Local Ollama with cloud fallback:**\n```json\n{\n  \"model\": { \"provider\": \"ollama\", \"id\": \"llama3.2\" },\n  \"fallbackModel\": { \"provider\": \"anthropic\", \"id\": \"claude-3-5-haiku-20241022\" },\n  \"fallbackDeterministic\": \"words\"\n}\n```\n\n**No LLM fallback, deterministic only on failure:**\n```json\n{\n  \"model\": { \"provider\": \"anthropic\", \"id\": \"claude-3-5-haiku-20241022\" },\n  \"fallbackModel\": null,\n  \"fallbackDeterministic\": \"readable-id\"\n}\n```\n\n**Dynamic prefix from git repo name:**\n```json\n{\n  \"prefixCommand\": \"basename $(git rev-parse --show-toplevel 2>/dev/null || pwd)\"\n}\n```\nResult: `my-project: Fix Authentication Bug`\n\n**Workspace prefix + readable-id suffix:**\n```json\n{\n  \"prefixCommand\": \"basename $(git rev-parse --show-toplevel 2>/dev/null || pwd)\",\n  \"readableIdSuffix\": true\n}\n```\nResult: `my-project: Fix Authentication Bug [brisk-sunflower-river]`\n\n**Readable-id override from frontend:**\n```json\n{\n  \"readableIdSuffix\": true,\n  \"readableIdEnv\": \"PI_SESSION_READABLE_ID\"\n}\n```\nResult: `my-project: Fix Authentication Bug [frontend-temp-id]`\n\n**Workspace name only (no LLM):**\n```json\n{\n  \"prefixCommand\": \"basename $(git rev-parse --show-toplevel 2>/dev/null || pwd)\",\n  \"prefixOnly\": true\n}\n```\n\n**Custom wordlist path for readable IDs:**\n```json\n{\n  \"fallbackDeterministic\": \"readable-id\",\n  \"wordlistPath\": \"./word_lists.toml\"\n}\n```\nResult: `my-project`\n\n**Git branch as prefix:**\n```json\n{\n  \"prefixCommand\": \"git branch --show-current 2>/dev/null || echo 'main'\"\n}\n```\nResult: `feature/auth: Add OAuth Support`\n\n**Custom prompt for code-focused sessions:**\n```json\n{\n  \"prompt\": \"Generate a 3-5 word title for a coding session. Focus on the programming language, framework, or task. Based on:\\n\\n{{query}}\\n\\nReply with ONLY the title.\",\n  \"prefix\": \"code: \"\n}\n```\n\n## Commands\n\n| Command | Description |\n|---------|-------------|\n| `/auto-rename` | Show current session name |\n| `/auto-rename <name>` | Manually set session name |\n| `/auto-rename regen` | Force regenerate name from first query |\n| `/auto-rename config` | Show current configuration |\n| `/auto-rename init` | Create default config in current directory |\n| `/auto-rename test` | Test model connectivity |\n\n## How It Works\n\n1. On `session_start`, the extension checks if the session already has a name\n2. After the first `before_agent_start` event (first prompt send), it:\n   - Resolves the prefix (runs `prefixCommand` if set, otherwise uses static `prefix`)\n   - If `prefixOnly` is true: uses just the prefix as the session name\n   - Otherwise: extracts the first user message and tries to generate a name:\n     1. Try primary model\n     2. If primary fails, try fallback model\n     3. If both fail, use deterministic fallback (`readable-id`, `truncate`, `words`, or `none`)\n   - Combines prefix + generated name and sets via `pi.setSessionName()`\n3. The name appears in the session selector (`/resume`) instead of the first message\n\n### Input and Output Guards\n\nThe extension protects against excessively long inputs and outputs:\n\n- **Query truncation** (`maxQueryLength`, default 2000): When the user's first message is very long (e.g., pasting a large code block or document), the middle section is cut out and replaced with a `[...truncated...]` marker. The beginning (60%) and end (40%) of the query are preserved at word boundaries, keeping both the initial context and the trailing question/details. This prevents excessive token usage and keeps costs low.\n\n- **Name length enforcement** (`maxNameLength`, default 80): If the LLM returns a name longer than `maxNameLength` characters, it is truncated at a word boundary with an ellipsis. This ensures session names stay readable in the session selector UI.\n\nBoth limits can be tuned in the config. Enable `debug: true` to see notifications when truncation occurs.\n\n### Error Handling\n\nThe extension provides detailed error messages for common issues:\n\n- **Provider not found**: Shows available providers\n- **Model not found**: Indicates the model ID is invalid\n- **No API key**: Reminds you to set the environment variable\n- **Authentication failed (401/403)**: API key is invalid or expired\n- **Rate limited (429)**: Too many requests, uses fallback\n- **Timeout**: Network issues, uses fallback\n\nEnable `debug: true` to see all error details.\n\n### Fallback Chain\n\n```\nConfigured model → Configured fallback → Auto strategy → Deterministic function → (no name)\n      ↓                  ↓                 ↓                    ↓\n   Success?           Success?     current/cheapest         \"truncate\" / \"words\"\n      ↓                  ↓                 ↓                    ↓\n    Done!              Done!             Done!             Done! (or skip if \"none\")\n```\n\nAuto strategy is controlled by `modelSelection`:\n- `\"current\"`: current model, then cheapest\n- `\"cheapest\"`: cheapest, then current\n\n## Session File Format\n\nThe extension writes to the standard pi session format using `pi.setSessionName()`, which appends a `session_info` entry to the JSONL session file:\n\n```json\n{\"type\":\"session_info\",\"id\":\"...\",\"parentId\":\"...\",\"timestamp\":\"...\",\"name\":\"Your Generated Name\"}\n```\n\nThis is the canonical field for session names in pi-agent session files.\n\n## Requirements\n\n- pi-coding-agent (pi)\n- An API key for at least one configured model provider (or use `prefixOnly`)\n- Node.js 18+\n\n## Tips\n\n- Use a fast, cheap model (like `claude-3-5-haiku` or `gpt-4o-mini`) for quick naming\n- Set up a fallback model from a different provider for reliability\n- Use `fallbackDeterministic: \"readable-id\"` for canonical session IDs\n- Keep the prefix short to avoid truncation in the session selector\n- Enable `debug: true` temporarily to troubleshoot issues\n- Use `/auto-rename test` to verify model connectivity before relying on it\n- The extension skips renaming if the session already has a name\n\n## Files\n\n- `index.ts` - Extension source code\n- `auto-rename.schema.json` - JSON Schema (Draft-07) for configuration validation\n- `auto-rename.example.json` - Example configuration file\n- `README.md` - This documentation\n\n## License\n\nMIT\n","readmeFilename":"README.md"}