Tired of scrolling back to remember what you asked Claude to do? This pins your last prompt as a persistent line above the statusline, always visible, no matter how deep the rabbit hole goes.
Open five sessions, lose track of none!
- Claude Code CLI
bashjq—brew install jq(macOS) orapt install jq(Linux)
Optional: claude-hud — if installed, the statusline delegates to it after showing the prompt pin. Degrades gracefully without it.
Register the marketplace and install:
claude /plugin install claude-prompt-pin --marketplace github:unDemian/claude-prompt-pin
Then inside Claude Code, run:
/prompt-pin-setup
This configures the statusline. The prompt-saving hook is registered automatically by the plugin.
If you prefer not to use the plugin system:
bash install.sh
Then start a new Claude Code session.
- Copy
hooks/prompt-title.shto~/.claude/hooks/prompt-title.shandchmod +xit. - Copy
statusline.shto~/.claude/statusline.shandchmod +xit. - Add to
~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "bash ~/.claude/statusline.sh"
},
"hooks": {
"UserPromptSubmit": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/hooks/prompt-title.sh"
}
]
}
]
}
}Plugin: run claude /plugin uninstall claude-prompt-pin and remove the statusLine entry from ~/.claude/settings.json.
Manual: run bash uninstall.sh.
Edit statusline.sh (in the plugin cache or ~/.claude/ for manual installs):
- Change the icon: Replace
↳with any character or emoji. - Change colors: Modify the ANSI escape codes in the
printfline.\033[1;33m= bold yellow (arrow)\033[1m= bold white (prompt text)
- Change truncation length: Adjust
MAX=120to whatever character count you prefer.
- You submit a prompt → the
UserPromptSubmithook fires, saving it alongside the session transcript, then writing the terminal title escape to/dev/tty. - Claude Code refreshes its statusLine →
statusline.shreads the session's prompt file, prints the styled prompt line, then delegates to claude-hud (if present).
Each session's last prompt is stored as a sidecar file next to its transcript:
~/.claude/projects/<project>/<id>.last-prompt
Claude Code passes transcript_path in the JSON payload to both the hook and the statusline — the same stable per-session identifier used by claude-hud. The hook writes <transcript_path minus .jsonl>.last-prompt; the statusline reads it. A new session has no sidecar file yet, so it shows nothing until the first prompt is submitted.
uninstall.sh removes these files automatically. To remove them manually:
find ~/.claude/projects -name "*.last-prompt" -delete
The hook writes to /dev/tty directly to avoid injecting escape sequences into Claude's context. The plugin hook uses ${CLAUDE_PLUGIN_ROOT} for portable path resolution. The statusline auto-discovers the latest plugin version at runtime, so it survives plugin updates without needing to re-run /prompt-pin-setup.
