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

pi-compaction-i18n

v0.4.2

Published

Locale-aware compaction and branch summarization for pi

Downloads

956

Readme

pi-compaction-i18n

Make pi's compaction and branch summaries speak your language.

pi-compaction-i18n is a Pi extension that overrides the default English-only /compact and /tree branch summaries with fully localized output in 11 languages — auto-detected from your system locale.

✨ What it does

| Feature | Default pi | With this extension | |---|---|---| | /compact summary headings | ## Goal, ## Progress… (English) | ## 目标, ## 进展… (your language) | | /tree branch summary | English only | Localized | | Language detection | N/A | Auto from PI_LOCALE > LC_ALL > LANG | | Supported languages | English only | 11 languages |

🌍 Supported languages

| Locale | Language | Headings example | |---|---|---| | zh-CN, zh_* | 简体中文 (Simplified Chinese) | ## 目标 / ## 进展 / ## 下一步 | | zh-TW, zh-HK, zh-MO | 繁體中文 (Traditional Chinese) | ## 目標 / ## 進展 / ## 下一步 | | ja-* | 日本語 (Japanese) | ## 目標 / ## 進捗 / ## 次のステップ | | ko-* | 한국어 (Korean) | ## 목표 / ## 진행 상황 / ## 다음 단계 | | de-* | Deutsch (German) | ## Ziel / ## Fortschritt / ## Nächste Schritte | | fr-* | Français (French) | ## Objectif / ## Progression / ## Étapes suivantes | | es-* | Español (Spanish) | ## Objetivo / ## Progreso / ## Próximos pasos | | pt-* | Português (Portuguese) | ## Objetivo / ## Progresso / ## Próximos passos | | ru-* | Русский (Russian) | ## Цель / ## Прогресс / ## Следующие шаги | | ar-* | العربية (Arabic) | ## الهدف / ## التقدم / ## الخطوات التالية | | other | English | ## Goal / ## Progress / ## Next Steps |

📦 Install

pi install npm:pi-compaction-i18n

Works out of the box. No configuration needed — uses your current session's model by default.

⚙️ Configuration

Config file is auto-generated on first use at ~/.pi/agent/pi-compaction-i18n.json:

{
  "locale": "auto",
  "model": ""
}

| Field | Type | Default | Description | |---|---|---|---| | locale | string | "auto" | Force a locale (e.g. "zh-CN"). Set to "auto" for auto-detection from environment | | model | string | (session model) | Override the LLM model for summaries (provider/modelId). Empty = use current session's active model |

Note: Compaction summaries benefit from strong models (they need deep context understanding). The default behavior of using your session model is recommended in most cases. Only override if you have a specific reason.

🚀 Usage

Check status

After installing, open any Pi session and run:

/compaction-i18n-status

Example output on a Chinese system:

pi-compaction-i18n: enabled
Detected locale: zh-CN
Summary language: zh-Hans
Instruction: Write the entire summary in Simplified Chinese (简体中文). All headings and body content must be in Simplified Chinese.

Trigger localized summaries

  • Compaction: Type /compact or let auto-compaction trigger naturally
  • Branch summary: Use /tree to navigate between branches with summarization enabled

Both will now produce fully localized markdown summaries.

🔧 How it works

  1. Locale detection: Reads PI_LOCALELC_ALLLANG environment variables (e.g., zh_CN.UTF-8zh-CN). Can be overridden via config.
  2. Language mapping: Maps locale code to one of 11 supported languages
  3. Template generation: Builds a compaction/branch-summary prompt with localized section headings and a language instruction prepended
  4. Event interception: Registers handlers for session_before_compact and session_before_tree events via Pi's extension API
  5. LLM call: Uses complete() from @earendil-works/pi-ai to generate the summary with the localized prompt. Uses session's active model by default, or a configured override.

Event precedence

For session_before_compact and session_before_tree events, the last handler that returns a non-null result wins. If you have multiple extensions that override compaction, ensure only one is active at a time.

🧪 Development

# Clone & test
git clone https://github.com/ssdiwu/pi-compaction-i18n.git
cd pi-compaction-i18n
npm install
npm test

# Install locally into pi for testing
pi install .

🔗 Related

  • pi-autoname — AI-powered session naming (sibling project)

📄 License

MIT © ssdiwu