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

@alexleekt/pi-heading

v0.2.0

Published

Know where you are at a glance. One-line session heading widget for the Pi agent.

Readme

@alexleekt/pi-heading

npm License: MIT

Know where you are at a glance.

A one-line session heading for the Pi coding agent. It summarizes the current goal while Pi works, then replaces it with a short achievement when the run finishes.

What it looks like

Clean up the old chezmoi checkout

After completion:

Removed stale dotfiles and migrated the setup to yadm

The extension uses Pi's native working-message row. There are no borders, custom panels, duplicate transcript cards, or competing animation timers.

Features

| Feature | What it does | |---------|--------------| | Auto-summarized heading | Generates a concise goal after every user message | | Achievement summary | Shows what the agent completed after the final turn | | Stable topic | Keeps a 2–4 word topic label from jittering between related turns | | Branch-aware state | Restores the correct heading after session resume and /tree navigation | | Native lifecycle integration | Finalizes on Pi's agent_settled event, after retries, compaction, and queued follow-ups | | Cancellation-aware calls | Passes Pi's active AbortSignal to heading model requests | | Custom prompts and model | Supports editable prompts and a separate low-cost summarization model | | Extension API | Exposes current state through the heading tool and heading:state event |

Requirements

  • Pi coding agent 0.80.4 or newer

Installation

pi install @alexleekt/pi-heading

For local development:

ln -s ~/git/pi-extensions/packages/pi-heading ~/.pi/agent/extensions/pi-heading

Run /reload after changing extension code. Pi loads TypeScript through jiti, so clearing jiti's cache may be necessary when retargeting symlinks.

Usage

The heading updates automatically. No command is required.

/heading

Set the current goal manually:

/heading
Session heading: Migrating from Docker to Kubernetes

/heading-model

Choose a model for topic, goal, and achievement summaries. Reset the override to use the active session model.

/heading-debug

/heading-debug on
/heading-debug off
/heading-debug clear
/heading-debug

Debug mode writes structured prompts, user input, responses, and errors to a private log under Pi's agent directory. The file is restricted to the current user, but it can contain sensitive conversation content; enable it only while diagnosing a problem and clear it afterward.

Agent tool

The extension registers a heading tool:

  • action: "get" returns topic, goal, and latest achievement.
  • action: "skill" returns the heading behavior guide.

The tool's prompt metadata asks the agent to check the current session goal before changing direction.

Event bus integration

Other extensions can subscribe without importing pi-heading:

pi.events.on("heading:state", (payload) => {
    const { topic, goal, achievement, mode } = payload as {
        topic: string;
        goal: string;
        achievement?: string;
        mode: "goal" | "working" | "achievement" | "idle";
    };
});

See PI-INTEGRATION.md for the payload contract.

Custom prompts

Packaged defaults live in prompts/. To override them, create matching files under:

~/.pi/agent/extensions/pi-heading/prompts/
├── topic.md
├── goal.md
└── achievement.md

If PI_CODING_AGENT_DIR is set, pi-heading follows Pi's configured agent directory instead of hardcoding ~/.pi/agent.

Each prompt supports YAML frontmatter with max_words:

---
max_words: 4
---
Summarize the user's message as a concise topic label.

Message: {message}

Placeholders:

  • {message} — input being summarized
  • {goal} — current goal, available to the achievement prompt
  • {max_words} — parsed frontmatter limit

Lifecycle

sequenceDiagram
    participant User
    participant Pi
    participant Heading as pi-heading
    participant Model as Summary model

    Pi->>Heading: session_start / session_tree
    Heading->>Heading: replay latest branch heading

    User->>Pi: submit prompt
    Pi->>Heading: before_agent_start
    Heading->>Pi: setWorkingMessage(prompt placeholder)
    Heading-->>Model: topic + goal (non-blocking, abort-aware)
    Pi->>Heading: agent_start / turn_start
    Heading->>Pi: setWorkingMessage(goal)

    alt Intermediate tool turn
        Pi->>Heading: turn_end with toolResults
        Heading->>Heading: keep goal; skip achievement call
    else Final text turn
        Pi->>Heading: turn_end without toolResults
        Heading-->>Model: achievement (non-blocking, abort-aware)
        Heading->>Pi: setWorkingMessage(achievement)
    end

    Pi->>Heading: agent_settled
    Heading->>Pi: keep latest goal or achievement

agent_settled is intentionally used instead of agent_end: Pi can retry, compact and retry, or process queued follow-ups after a low-level agent run ends.

Prompt evaluation

bun tools/prompt-eval.ts topic
bun tools/prompt-eval.ts goal
bun tools/prompt-eval.ts topic-goal firepass test-cases-comprehensive.json

The optimizer mutates prompt files in place, so back them up first:

bun tools/prompt-eval.ts optimize topic prompts/topic.md \
  "Concise 1-4 word noun phrases, no articles" \
  90 firepass test-cases-comprehensive.json

Development

npm run typecheck
npm test
npm run pack-smoke

pack-smoke packs the npm artifact, verifies all transitive runtime files are present, installs it into a temporary project with declared peers, and imports the TypeScript entrypoint through Pi's jiti loader.

License

MIT