pi-task-title

Generate Pi task titles, loading animations, and notifications.

Packages

Package details

extension

Install pi-task-title from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-task-title
Package
pi-task-title
Version
0.1.3
Published
Sep 17, 2026
Downloads
286/mo · 42/wk
Author
koma-chan
License
MIT
Types
extension
Size
25.5 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

Pi Task Title

中文 | English

中文

为 Pi 的终端标签生成简短任务标题,在任务运行期间显示加载动画,并可在任务完全结束后发送桌面通知。

功能

  • 在后台使用当前会话模型,根据首条原始用户任务生成同语言标题;会话空闲后将标题保存为 Pi 会话名称,不阻塞主任务
  • Pi 工作期间在终端标题中显示 Braille 加载动画
  • 等待重试、自动压缩和排队任务全部结束后恢复静态标题
  • 按最终状态发送已完成、已中止、输出截断或执行失败的通知,并显示易读耗时
  • 支持 Ghostty、iTerm2、WezTerm、Kitty 和 WSL Windows Terminal 通知
  • 使用 /notify 选择所有任务通知、仅通知耗时达到 10 秒的任务,或关闭通知
  • 首次加载已有未命名会话时,使用会话中真正的第一条用户消息
  • 摘要失败、返回空内容或没有可用模型时,退回到首条任务的本地短标题,不阻断主任务
  • 在 reload、切换会话或退出时取消旧标题请求,避免旧结果影响后续会话并减少无效模型工作

安装

从 npm 安装:

pi install npm:pi-task-title

或从 GitHub 安装:

pi install git:github.com/Koma-Chen/pi-task-title

已安装 npm 或 GitHub 版本时,可更新全部扩展:

pi update --extensions

安装或更新后重启 Pi,或在 Pi 中执行 /reload

使用说明

插件只在交互式 TUI 模式中显示终端标题、加载动画和桌面通知。有可用模型时,每个未命名会话最多在后台额外调用当前模型一次生成标题;该请求不会阻塞主任务,并会禁用 prompt cache。

模型摘要返回前,终端标题会临时使用首条任务经清理和截短后的文本;摘要成功后会自动替换该临时标题。首条任务只取前 6000 个字符,避免超长输入增加额外成本。

标题请求的 reasoning 和输出上限如下:

请求类型 Reasoning 输出上限
Pi 标记为支持 reasoning 的 OpenAI Responses 或 Azure OpenAI Responses 模型 low 512 tokens
Pi 标记为支持 reasoning 的其他已适配 API 关闭或降至最低 64 tokens
未标记为支持 reasoning 的模型,或未适配的 API 不覆盖模型默认值 64 tokens

用户通过 /name 修改会话名称后,终端标题也会同步更新。

执行 /notify 可选择:

  • 开启:所有任务都通知(默认)
  • 开启:仅通知耗时达到 10 秒的任务
  • 关闭通知

选择会保存到 Pi 全局配置目录下的 pi-task-title.json,重启后仍然生效。如果 /notify 与其他扩展重名,可以使用完整命令 /task-title-notify

在 tmux 中使用基于 OSC 的终端通知需要开启 passthrough:

set -g allow-passthrough on

English

Generate concise task titles for Pi terminal tabs, show a loading animation while a task is running, and optionally send a desktop notification after the task fully settles.

Features

  • Uses the active session model to generate a title in the task's language from the first raw user task, then saves it as the Pi session name once the session is idle without blocking the main task
  • Shows a Braille loading animation in the terminal title while Pi is working
  • Restores the static title only after retries, automatic compaction, and queued tasks have settled
  • Reports the final state as completed, aborted, truncated, or failed, with a readable elapsed time
  • Supports notifications in Ghostty, iTerm2, WezTerm, Kitty, and Windows Terminal under WSL
  • Provides /notify to notify for every task, only tasks that take at least 10 seconds, or not at all
  • Uses the actual first user message when first loaded into an existing unnamed session
  • Falls back to a local shortened title when summarization fails, returns no text, or no model is available, without blocking the main task
  • Cancels stale title requests on reload, session switch, or shutdown so old results cannot affect later sessions and unnecessary model work is reduced

Installation

Install from npm:

pi install npm:pi-task-title

Or install from GitHub:

pi install git:github.com/Koma-Chen/pi-task-title

To update an installed npm or GitHub version together with other extensions:

pi update --extensions

Restart Pi after installation or update, or run /reload inside Pi.

Usage

The extension only shows terminal titles, loading animations, and desktop notifications in interactive TUI mode. When a model is available, each unnamed session makes at most one additional background call to the active model to generate its title; this request does not block the main task and disables prompt caching.

Until the model summary returns, the terminal title temporarily uses a cleaned and shortened form of the first task. A successful summary automatically replaces that temporary title. Only the first 6,000 characters of the initial task are sent to avoid extra cost for very large prompts.

Title requests use the following reasoning and output limits:

Request type Reasoning Output limit
OpenAI Responses or Azure OpenAI Responses models that Pi marks as reasoning-capable low 512 tokens
Other adapted APIs that Pi marks as reasoning-capable Disabled or minimized 64 tokens
Models not marked as reasoning-capable, or unrecognized APIs Model default is preserved 64 tokens

Renaming the session with /name also updates the terminal title.

Run /notify to choose:

  • Notify for every task (default)
  • Notify only for tasks that take at least 10 seconds
  • Disable notifications

The selection is saved as pi-task-title.json in Pi's global configuration directory and survives restarts. If /notify conflicts with another extension, use /task-title-notify.

OSC-based notifications inside tmux require passthrough:

set -g allow-passthrough on

Development

npm run check
npm pack --dry-run

License

MIT