pi-hide-messages
Pi extension for hiding older TUI chat history while preserving full session context, with /hide-messages and /restore-messages controls.
Package details
Install pi-hide-messages from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-hide-messages- Package
pi-hide-messages- Version
0.1.3- Published
- Apr 25, 2026
- Downloads
- 348/mo · 155/wk
- Author
- masurii
- License
- MIT
- Types
- extension
- Size
- 52.7 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-hide-messages
Hide older Pi TUI chat messages without shrinking the underlying session context.
pi-hide-messages lets you keep long conversations readable by hiding older entries from the Pi terminal UI while preserving the session data needed to continue the conversation. It adds simple slash commands for manual control and can auto-hide older messages whenever a session starts or switches.
[!NOTE] Hidden messages are not deleted. They are only hidden from the Pi TUI display layer, so the underlying session data stays intact, the active model/agent still keeps the full conversation context, and
/restore-messagesbrings the hidden entries back into view.
Features
- Branch-aware history hiding for the active session path
- Manual commands for hiding or restoring visible chat history
- Auto-hide on session start/switch using a configurable visible-count threshold
- Preserved conversation continuity so recent assistant/tool/user context remains visible
- No context loss for the model or agent because hiding only changes what the TUI renders, not what the session stores
- Project-level overrides via
.pi/extensions/pi-hide-messages/config.json
Installation
Local extension folder
Place this folder in one of Pi's auto-discovery locations:
# Global default (when PI_CODING_AGENT_DIR is unset)
~/.pi/agent/extensions/pi-hide-messages
# Project-specific
.pi/extensions/pi-hide-messages
npm package
pi install npm:pi-hide-messages
Git repository
pi install git:github.com/MasuRii/pi-hide-messages
Usage
Commands
| Command | Description |
|---|---|
/hide-messages |
Hide older entries and keep the configured default visible count |
/hide-messages 20 |
Hide older entries and keep the latest 20 visible chat items |
/restore-messages |
Restore all entries hidden by this extension for the current session |
Behavior notes
defaultVisibleCountis used when/hide-messagesis called without arguments.autoHideOnSessionStartapplies the same visibility rule whenever Pi opens or switches sessions.- After
/restore-messages, auto-hide stays paused for the active branch until/hide-messagesis used again.
Configuration
Runtime configuration is loaded from:
# Global config default (respects PI_CODING_AGENT_DIR)
~/.pi/agent/extensions/pi-hide-messages/config.json
# Optional project override
.pi/extensions/pi-hide-messages/config.json
A starter template is included at config/config.example.json.
Project config overrides the global extension config when both are present.
Configuration options
| Option | Type | Default | Description |
|---|---|---|---|
debug |
boolean | false |
Reserved compatibility flag. Keep disabled unless a future release documents debug output. |
defaultVisibleCount |
number | 10 |
Positive integer count of visible chat items to keep when hiding older entries. |
autoHideOnSessionStart |
boolean | true |
Automatically apply the default visibility limit when a session starts or switches. |
Example
{
"debug": false,
"defaultVisibleCount": 10,
"autoHideOnSessionStart": true
}
How it works
- The extension updates older session entries with
hidden: truein the active session file. - It patches Pi's interactive session rendering so hidden entries are omitted from the visible TUI history.
- Session data remains restorable, which keeps the extension focused on UI readability rather than destructive cleanup.
- Hidden entries still remain part of the session record, so the model and agent keep their full context even when those messages are not currently rendered in the TUI.
Related Pi Extensions
- pi-tool-display — Compact tool rendering and diff visualization
- pi-startup-redraw-fix — Fix terminal redraw glitches on startup
- pi-image-tools — Image attachment and inline preview
- pi-smart-voice-notify — Multi-channel TTS and sound notifications