Prompt History Bar
Adds a right-side column to the Claude Code status line: the most recent prompts entered in the current project, newest at the bottom, each with an age. The left side keeps the usual project, model, effort, and context information.
Data comes from <config>/history.jsonl, which Claude Code writes locally. The
script makes no network requests and registers no hooks.
Install
The plugin is installed under Claude Code's plugin directory, or as a personal
skill under ~/.claude/skills/prompt-history-bar/. In both cases, run the
installer from the skill directory:
# Personal skill
python3 ~/.claude/skills/prompt-history-bar/scripts/install.py
# Plugin (the variable is expanded in skill content)
python3 ${CLAUDE_PLUGIN_ROOT}/skills/prompt-history-bar/scripts/install.py
install.py is the installer. install.sh and uninstall.sh are thin wrappers
that call it, kept for compatibility; some install channels drop shell scripts,
so prefer the .py paths when both exist.
The installer copies the runtime to <config>/statusline/prompt-history-bar/
and adds or replaces the statusLine key in <config>/settings.json.
Ask the user before running it. This edits their global settings. Show them
the exact command first, preferably with --dry-run:
python3 .../install.py --dry-run --lang en
Then run it after they agree.
Options:
| Option | Effect |
|---|---|
| --lang en\|zh | Age labels in English (default) or Chinese |
| --paste | Show the first line of pasted content instead of [paste] |
| --session | Show only the current session's prompts instead of the whole directory |
| --refresh N | Also re-run the status line every N seconds (whole number, minimum 1), so the bar and its age labels update while Claude is busy or idle |
| --force | Replace a different existing statusLine command (backup kept) |
| --dry-run | Print the change; write nothing |
| --uninstall | Remove the statusLine entry |
| --purge | With --uninstall, also delete the runtime copy |
Without --force, the installer refuses to overwrite an existing statusLine
that points somewhere else. Every write is backed up as
settings.json.bak.YYYYMMDD-HHMMSS and validated before it replaces the file.
Re-running the installer with different flags builds a different statusLine
command, which the helper treats as a conflict and refuses without --force.
To refresh the runtime files only, repeat the flags from the original install
(for example --lang zh --paste). To change them deliberately, pass the new
flags together with --force; the settings file is backed up first.
After installing, start a new Claude Code session or reload settings. The status line is skipped until the workspace trust prompt is accepted.
Configuration
Set these in the environment that launches Claude Code (for example
~/.zshrc):
| Variable | Meaning |
|---|---|
| CLAUDE_HISTORY_LANG | en (default) or zh |
| CLAUDE_HISTORY_PASTE | 1 to show the first line of pasted content |
| CLAUDE_HISTORY_SCOPE | session to list only the running session's prompts (default: whole directory) |
| CLAUDE_HISTORY_WIDTH | Force a terminal width in cells |
| CLAUDE_HISTORY_STYLE | ANSI style for the history cells |
| DEBUG | 1 to log width decisions under the state directory |
The status line input JSON does not include terminal dimensions. Width comes
from tmux when TMUX_PANE is set, then from COLUMNS (which Claude Code sets
for status line commands), then /dev/tty, then the last successful value,
then 120. tmux gives the most reliable width; set CLAUDE_HISTORY_WIDTH when
running elsewhere.
Troubleshooting
- Nothing appears. Accept the workspace trust prompt. Check
disableAllHooks: truein settings (it disables the status line too), and check that managed settings are not overridingstatusLine. - Only the left column appears. The current project has no entries in
history.jsonl, or the file is missing. Visiting a project creates entries. - The right column is misaligned. Width detection failed. Set
CLAUDE_HISTORY_WIDTH, or run Claude Code inside tmux. - Prompts from a parent directory appear. That is intentional inside a git
repository: if the exact directory has no entries, parents are tried up to the
git root (four levels at most). Without a
.gitabove it, only the exact directory is matched. - Pasted text shows
[paste]. Enable the preview withCLAUDE_HISTORY_PASTE=1. An input that is only a paste is still listed (as[paste], or its first line with the preview on), and a paste whose first line is a shell prompt stays[paste]even with the preview on. - Uninstall. Run
python3 ~/.claude/statusline/prompt-history-bar/install.py --uninstall [--purge], orinstall.py --uninstall --purgefrom the skill directory. Theuninstall.shwrapper in either directory does the same thing.
Privacy
The script reads only local files:
<config>/history.jsonl— the prompt history it displays.<config>/paste-cache/<hash>.txt— only whenCLAUDE_HISTORY_PASTE=1.- Git branch via
git -C <project> rev-parsefor the left column.
Nothing is uploaded. The history column displays prompt text on screen, so be careful when screen-sharing or recording.
How it works
statusline.py reads Claude Code's JSON from stdin, builds up to four left rows,
and calls history_bar.render_statusline. The history reader scans
history.jsonl backwards in 64 KiB blocks and stops as soon as it has enough
entries for the current project, so its cost does not grow with the file size.
It accepts both the logical project path and its realpath, tries parents up to
the git root (four levels at most; none when there is no .git), and ignores bash-mode inputs (!...), UI commands (/effort,
/model, ...), exit words, and inputs that are only image
placeholders (an input that is only a paste stays, shown as [paste] or its
first line; [Image #N] is dropped from entries that also have text, along
with the separators and invisible characters left at the front, such as the ,
in [Image #1] ,说明).
An input that immediately repeats the previous one in the same project (for
example a resend after a dropped connection) shows once, at its newest time;
the same text with different pasted content stays separate.
A transcript stored inline, without a [Pasted text ...] placeholder, keeps
its command; a leading host, bracket, PowerShell, or glyph prompt is stripped
before display. A bare $/% line is left alone so ordinary text keeps its
subject.
With the paste preview on, a paste is shown by its first line. When that line
looks like a shell prompt ([user@host dir]$ ..., user@host ~ % ...,
(base) user@host:~$ ..., PS C:\> ..., or a Starship module line such as
~/proj on main ❯ ...), it says nothing about intent, so the cell shows
[paste] next to any typed text instead. Bare # and > are not prompt
signals, so script comments and quoted lines still preview.
With enough entries the history uses two columns, aligned to the terminal
edge; with fewer it is a single column that starts right after the left rows
and takes the remaining width. A long prompt wraps onto spare rows of its column (newest first)
and is cut with … only when the rows run out. If the pane is too narrow it
falls back to one column, then to the left column alone rather than
overflowing.
Development
Run the dependency-free checks with a throwaway HOME:
bash tests/run-tests.sh
The tests cover rendering, language labels, paste privacy, install, reinstall, force replacement, uninstall, and syntax.

Scan to join WeChat group