A new open-source tool called Deja replaces zsh-autosuggestions with a smarter approach to inline shell predictions. Instead of only matching commands that start with what you've typed, Deja uses fuzzy matching, directory awareness, and command sequence prediction to suggest what you actually want to run, all rendered as ghost text after every keystroke with sub-millisecond latency.

The project, by Giammarco Ferranti, is written in Go and uses a daemon architecture: one background process serves all terminal windows. Data stays in a local SQLite database with nothing leaving the machine. There's no account, no sync server, and no TUI. The suggestion appears as zsh's POSTDISPLAY widget, the same mechanism zsh-autosuggestions uses, so it looks identical in your terminal.

Four signals, one composite score

Deja combines four scoring signals into a single ranking. Fuzzy matching checks for in-order subsequences of typed characters, with bonuses for consecutive characters, word boundaries, and prefix hits. Frecency blends frequency and recency with a one-week exponential decay. Directory affinity scores commands you've run from the current working directory higher. Sequence prediction knows that you typically run make test after make build.

The scoring formula weights these signals: 1.0 for fuzzy, 0.4 for frecency, 0.3 for directory affinity, and 0.5 for sequence. When the typed text matches the start of commands in your history, Deja anchors to those and doesn't suggest unrelated commands. Typing "cd" suggests a "cd ..." you've actually run, not an unrelated command that happens to contain those letters.

Three fuzzy presets control how strictly the matcher works. The "tight" preset requires typed letters to be near-adjacent (up to one character gap), "smart" keeps them close (up to four characters), and "loose" allows up to eight characters between. You cycle through them on the fly with Shift+arrow keys, and the ghost suggestion repaints immediately under the new mode.

Daemon architecture, under a millisecond per keystroke

The daemon loads all state into memory at startup, using a sync.RWMutex so reads never block each other. Writes, when you run a command, take microseconds. The socket communication between the zsh widget and the daemon returns suggestions in under a millisecond. If the daemon is unavailable, the query falls back to a direct SQLite read automatically, ranking in two passes: first on fuzzy, frecency, and sequence signals, then over the top 50 candidates with directory affinities.

The init script caching is particularly careful. The "deja init zsh" command writes the integration to ~/.local/share/deja/init.zsh and prints a source line for it. Sourcing the file directly skips the 25 to 36 millisecond cost of spawning the binary on every shell open. Deja also compares the installed binary's stat identity against the one baked into the cached script (0.083 milliseconds, no subprocess) and regenerates in the background if they differ. The current shell keeps working with the old script; the next shell picks up the new one.

Privacy by design, respecting zsh history rules

Deja honors zsh's own history rules. A leading space with hist_ignore_space set keeps a command out of deja's database, not just out of ~/.zsh_history. The HISTORY_IGNORE pattern works the same way. Commands ignored this way break the prediction chain: a skipped command is dropped as the "previous command" for sequence prediction, so it can't resurface indirectly.

One deliberate difference from zsh: Deja drops space-prefixed commands even if hist_ignore_space isn't set, because the daemon can't see the shell's setopt state and errs toward forgetting. Those commands stay in your zsh history; they're just not learned by deja.

All data lives in ~/.local/share/deja/ with directory permissions at 0700 and database files at 0600. Other local accounts can't read your history. The database is plaintext SQLite, not encrypted, so anyone who can already act as you or as root can read it. The project documents this tradeoff in its security section.

Key bindings and customization

The default bindings use right arrow to accept the full suggestion, Ctrl+right arrow for the next word only, Tab to cycle through ranked alternatives without leaving the line, and Ctrl+X to suppress suggestions for the current session. Every binding is remappable by exporting environment variables before the integration loads in ~/.zshrc. The highlight style is also configurable through zsh's region_highlight grammar, compatible with the ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE format from zsh-autosuggestions.

Deja is available through Homebrew and a curl installer, with plugin support for Oh My Zsh and zinit. The project has 724 stars on GitHub, is MIT licensed, and includes automated releases through release-please with conventional commits. The scorer in internal/scorer/ is the most iteration-heavy part of the codebase, and the project welcomes contributions there.