Automatically adds commands that Claude Code runs on your behalf to your shell history.
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.
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.
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.
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/UbuntuHeads 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.
/plugin marketplace add ayakutt/claude-code-plugins
/plugin install histsync@claude-plugins-ayakuttAfter 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.
/plugin uninstall histsync@claude-plugins-ayakuttAdd 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.