Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

histsync

Automatically adds commands that Claude Code runs on your behalf to your shell history.

The problem

When Claude Code executes bash commands, they run in a subprocess and never reach your shell history. This means you can't search or reuse them later.

How it works

Installs a Claude Code hook that fires after every Bash tool call, reads the command from stdin, and writes it to your history backend in the correct format.

Supported backends

Detected automatically in priority order:

Backend Detection
atuin atuin on PATH
mcfly mcfly on PATH
fish $SHELL contains fish
zsh $SHELL contains zsh
bash fallback

Tools that read from native history files (fzf, hstr, etc.) are covered through the zsh/bash backends.

Requirements

Node.js must be on your PATH. The hook is a short Node script that parses the tool payload and appends to your history file.

brew install node        # macOS
apt install nodejs       # Debian/Ubuntu

Heads up: Older versions of this plugin assumed Node was bundled with Claude Code itself. That was true for early npm-distributed Claude Code, but not for the current native-binary install (~/.local/share/claude/versions/…). If Node is missing, the plugin will print a clear error on the first Bash tool call instead of failing silently.

Install

/plugin marketplace add ayakutt/claude-code-plugins
/plugin install histsync@claude-plugins-ayakutt

Note on history reloading

After an entry is written, your current terminal session won't see it until you open a new tab or run fc -R to reload history manually. If you have setopt SHARE_HISTORY in your .zshrc, new entries are picked up automatically.

Uninstall

/plugin uninstall histsync@claude-plugins-ayakutt

Adding a new backend

Add a writeMyBackend() function to hooks/history-sync.js and a detection check in detectAndWrite():

function writeMyBackend(cmd) {
  const res = spawnSync('mybackend', ['add', '--', cmd]);
  return res.status === 0;
}

Then in detectAndWrite(), before the shell-native fallback:

if (onPath('mybackend') && writeMyBackend(cmd)) return;

PRs welcome.