npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hanxu131/pi-autotitle

v0.1.0

Published

Generate a session title from the current conversation using the current model, with smart trimming for long conversations.

Readme

@hanxu131/pi-autotitle

A pi extension that generates a session title from the current conversation. The /title command summarizes the conversation with the current session model, applies smart trimming for long conversations (anchor the first user message + keep a recent window), then shows a preview with confirm / regenerate / edit / cancel before setting the session display name.

Install

pi install npm:@hanxu131/[email protected]

Then run /reload to activate. The command registers as /title.

For local development:

pi -e ./extensions/autotitle.ts

Usage

| Command | Behavior | | --- | --- | | /title | Extract conversation → trim if needed → generate title with the current model → preview dialog → set session name | | /title <custom name> | Skip the model entirely and set the session name directly |

Interactive keys (TUI)

| Key | Action | | --- | --- | | Enter | Accept the generated title and set it as the session name | | R | Regenerate (unlimited retries, result updates in place) | | E | Edit the title (prefilled with the current result; clearing the input and submitting regenerates) | | Esc | Cancel — the existing session name is left unchanged |

Non-TUI modes (print / json / rpc) set the title directly without a dialog. Setting confirm: false in the config skips the dialog in TUI mode too.

Configuration

Config is read on every command invocation (hot-reload friendly). All keys are optional; missing keys fall back to defaults.

| File | Scope | | --- | --- | | ~/.pi/agent/autotitle.json | Global (all projects) | | .pi/autotitle.json | Project-local, overrides global (only read when the project is trusted) |

Reference

| Key | Default | Description | | --- | --- | --- | | maxLength | 60 | Maximum title length in characters (prompt constraint, not a hard truncation) | | prefix.enabled | true | Allow a [Type] prefix when the conversation type is clear | | prefix.types | ["Bug", "Feature", "Question", "Refactor", "Docs"] | Candidate types for the prefix | | language | "follow" | "follow" uses the conversation's dominant language; "zh" / "en" force a language | | trim.threshold | 15000 | Estimated-token threshold that triggers trimming | | trim.window | 8000 | Most-recent tokens kept after trimming | | trim.anchorChars | 500 | Truncation length for the first user message (the topic anchor) | | confirm | true | Show the preview dialog; false sets the title directly |

Example:

{
  "maxLength": 80,
  "prefix": {
    "enabled": true,
    "types": ["Bug", "Feature", "Question", "Refactor", "Docs"]
  },
  "language": "follow",
  "trim": {
    "threshold": 15000,
    "window": 8000,
    "anchorChars": 500
  },
  "confirm": true
}

How trimming works

When the extracted conversation (user + assistant text only) exceeds trim.threshold estimated tokens, only a reduced excerpt is sent to the model:

  1. The first user message is kept as the topic anchor, truncated to trim.anchorChars characters.
  2. The most recent messages are kept up to trim.window tokens.
  3. An omitted-messages note is inserted between the anchor and the recent window.

Edge cases

  • Empty session or no extractable text → warning notification, no model call.
  • No model selected (ctx.model undefined) → error notification, no model call.
  • Model call failure / empty or garbled result → error shown in the dialog (retry or cancel); the existing session name is preserved in both TUI and non-TUI modes.
  • Running /title when the session already has a custom name → normal flow, the preview lets you back out.

License

MIT