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-sticky-usermessage

v3.1.0

Published

Sticky header showing your last user message above the editor in Pi coding agent

Readme

pi-sticky-usermessage

Sticky header that shows your last user message above the editor in Pi coding agent. Features persistence, smart formatting, and sensitive data filtering.

What it does

After you send a prompt, a persistent bar above the input editor shows your message with rich metadata. Perfect for keeping context visible during long tool-execution sequences.

▎ 14:32 · ● new </>
  Fix the auth middleware to handle expired tokens properly
  and add a retry with exponential backoff to the client

Features

✨ Core

  • Persistent Configuration: Settings saved across sessions
  • Smart Truncation: Word-boundary aware, respects max lines
  • Syntax Awareness: Highlights file paths, URLs, functions, errors
  • Overflow Indicator: Shows … +N more lines when message exceeds display

🎨 Customization

  • Timestamp Display: Show when the message was sent
  • Message Type Indicators: ● new, → follow-up, ✎ edit
  • Code Block Detection: Shows </> marker when code is present
  • Custom Prefix Symbol: Change the to any character
  • Theme-Aware Colors: Uses your active Pi theme colors

🔒 Privacy & Security

  • Sensitive Data Filtering: Automatically redacts emails, API keys, passwords, IPs
  • Custom Patterns: Add your own regex patterns for redaction
  • Toggle Filtering: Enable/disable per your needs

Install

pi install pi-sticky-usermessage

Or test locally:

pi -e ./src/index.ts

Usage

The header is on by default after installation.

Commands

| Command | Effect | |---------|--------| | /sticky | Show current status (ON / OFF) | | /sticky on | Enable the sticky header | | /sticky off | Disable and clear the header | | /sticky show | Show detailed configuration | | /sticky reset | Reset to default settings | | /sticky config <key>=<value> ... | Update configuration | | /sticky-lines <number> | Set max lines (1-20) | | /sticky-width <number> | Set max width (20-200) |

Configuration Examples

# Change multiple settings at once
/sticky config maxLines=5 showTimestamp=false smartTruncation=true

# Customize colors
/sticky config timestampColor=yellow metadataColor=cyan

# Change prefix symbol
/sticky config prefixSymbol="→"

# Disable sensitive data filtering
/sticky config filterSensitive=false

Configuration Options

| Key | Default | Description | |-----|---------|-------------| | enabled | true | Start enabled | | maxLines | 3 | Maximum message lines to display (1-20) | | maxWidth | 120 | Characters per line before ellipsis (20-200) | | showTimestamp | true | Show message timestamp | | showMessageType | true | Show message type indicator | | smartTruncation | true | Apply smart syntax highlighting | | codeBlockIndicator | true | Show </> for code blocks | | prefixSymbol | "▎" | Prefix character for header | | truncateAtWordBoundary | true | Truncate at word boundaries | | filterSensitive | true | Filter sensitive data | | customPatterns | undefined | Custom regex patterns for redaction | | timestampColor | "dim" | Theme color for timestamps | | metadataColor | "muted" | Theme color for metadata |

Sensitive Data Filtering

The extension automatically detects and redacts:

  • Email addresses: [email protected][email]
  • IP addresses: 192.168.1.1[ip]
  • Phone numbers: (555) 123-4567[phone]
  • API keys: sk-abc123...[key]
  • Bearer tokens: Bearer xyzBearer [token]
  • Passwords: password: secret123password [redacted]
  • API keys: api_key: abc123api_key [redacted]
  • Secrets: secret: xyzsecret [redacted]

Custom Patterns

Add custom regex patterns via the API or by modifying the config in code:

config.customPatterns = [
  "\\b[A-Z]{2}-\\d{4}\\b",  // Ticket numbers like AB-1234
  "\\b\\d{4}-\\d{4}-\\d{4}-\\d{4}\\b",  // Credit card format
];

Syntax Highlighting

When smartTruncation is enabled, the extension highlights:

  • File paths: src/components/Button.tsx (accent color)
  • URLs: https://example.com (cyan color)
  • Function calls: fetchData() (yellow color)
  • Errors/warnings: Error: failed (error color)

Theme Colors

The extension uses these Pi theme color names:

| Color | Usage | |-------|-------| | accent | Code block markers, file paths | | muted | Metadata, message type | | dim | Timestamps, overflow indicator | | cyan | URLs | | yellow | Function calls | | error | Error/warning patterns |

Technical Details

Persistence

Configuration and last message metadata are persisted using pi.appendEntry():

pi.appendEntry("sticky-config", {
  config: { ... },
  lastMetadata: { ... }
});

State is automatically restored on session_start.

Event Capture

Messages are captured from the before_agent_start event, which fires for every prompt that reaches the agent.

Troubleshooting

Widget not showing

  • Check if enabled: /sticky
  • Verify UI is available (not in print mode)
  • Check for errors in Pi logs

Settings not persisting

  • Ensure session is saved (Pi auto-saves)
  • Check file permissions for Pi data directory
  • Try /sticky reset then reconfigure

Sensitive data not filtered

  • Verify filterSensitive: true via /sticky show
  • Check if custom patterns are needed
  • Test with known patterns (email, API key)

Text not truncating correctly

  • Check maxWidth setting via /sticky show
  • Verify truncateAtWordBoundary is set as desired
  • Try adjusting maxLines for better fit

License

MIT