How it works

loxx is one program of about 80 MB, written in Go, with no other dependencies. Most of that size is the search model and the built in command list.

Saving commands

The block the installer adds to your shell settings loads a small hook. After every command, the hook starts loxx record in the background with the command, its folder, exit code, start and end time. Your prompt doesn't wait for it: the measured cost is about 1 to 4 ms per command.

zsh has the hooks this needs built in. bash doesn't, so loxx includes bash-preexec (MIT). If you close a terminal while a command is still running, the command is saved as the shell exits, with its exit code unknown.

Storage

Commands go into one SQLite database with a full text index. Each distinct command is stored once, with every run of it (when, where, exit code, duration) recorded separately. That's how the list can show “14×” and filter by folder or failures.

Search by meaning

loxx has all-MiniLM-L6-v2 built in, a small language model (Apache 2.0 license) that turns text into 384 numbers capturing its meaning. Commands with a similar purpose get similar numbers, so “compress a folder” lands near tar -czvf.

The model runs inside loxx itself, written in plain Go, with no GPU, no Python and no internet. New commands are processed in the background at low priority, a few moments after you run them.

Combining the two searches

Each search runs a keyword search and a meaning search, then merges the two ranked lists (reciprocal rank fusion). Keyword matches appear instantly as you type; matches by meaning follow after a short pause. If meanings aren't ready yet, keyword search still works.

The weights were tuned and measured on a real shell history, with questions like “undo the last commit, keep the changes” and fragments like port-forw.

Suggested commands

loxx also carries about 29,000 example commands from tldr pages (by the tldr pages team and contributors, CC BY 4.0), with their meanings worked out ahead of time. loxx shows placeholders like {{path/to/file}} as plain words and drops memory hints like “e[x]tract” from the descriptions. A search compares your words with each example's tool, description and page summary, and keeps only programs found on your PATH.

Your own commands that contain the words you typed come first. After them, your commands and suggestions take turns, at most five suggestions per search. Filters other than “all” show your history only.

Speed

WhatMeasured
Added to each commandabout 1 to 4 ms
Search list appearsabout 30 ms
Keyword results, 100,000 commandsunder 50 ms
Meaning results, 10,000 commandsabout 0.2 s

Open source

loxx is open source under the MIT license. The code, the reasons behind each design choice, and how the model was picked are all on GitHub.