psychic is a accelerated document browser alongside ML-powered ranking
Most days I’m in the terminal cd’ing into directories and beginning records in my editor. In any stated week it’s mostly the identical records and dirs since I’m operating on the identical projects. I was annoyed I had to recall anywhere records live, and tired of tab-completing the identical few paths. My device should already cognize which document I desire to open!
So I made psychic, a accelerated terminal-based document browser. It tracks the directories you go to and remembers which records you open. It trains a lightweight ML example on your data and ranks results using that model. It prioritizes interactivity and speed complete all else: results update as you category and the UI renders in under 16ms.
Everything concerning how it plant flows from a key scheme decision: it have to be accelerated adequate to update inside one example following a keypress. I’d fairly do 10 accelerated searches in the area of a brace seconds, than 1 astute hunt that takes many seconds to complete.
I use psychic all period I’m on my computer. It’s rotate into the chief way I move about the filesystem. Some numbers: Since I started using it in October 2025,
- I’ve opened it 1450 times. On average, I typed 1.6 characters before I had what I wanted.
- 29% of the period I typed nothing! psychic knew what I wanted, top result. All I did was open and hit enter.
- Median period from beginning psychic to getting anywhere I wanted to go was 2 seconds. 41% of searches happened inside 1s, 69% inside 3s.
- 80% of the time, I picked the top result. 96% of picks were in the top 3.
- The paths I selected were concerning 50 characters away, on average. So I’m typing 3% of that to get there.
(These are from the built-in psychic stats command, which you can run on your own history!)
It’s on homebrew: beer instal kshitijl/tap/psychic.
On the remaining are hunt results. On the correct is a preview of the document or directory currently selected. You category a query in the base and the results are filtered and ranked, changing alongside all letter. If you hit Enter on a file, it opens your terminal publishing company in the identical opening and waits in the background. If it’s a directory, it restarts the hunt from inner there. It remembers all document and dir you open, and a casing integration records all dir you cd into from exterior psychic. All of those are included in all search.
It’s akin fzf and zoxide had a baby, affirmative a small ML example that learns your patterns and favorites. It’s doing ad optimization on your own data, to assistance you navigate your device faster.
- psychic is a accelerated document browser alongside ML-powered ranking
- How it works
- Some key scheme decisions
- How to be psychic
- Computer go fast
How it works
All your searches and clicks get written to a sqlite db on your computer. psychic trains a LightGBM example on that data. The example learns to foretell which records you’ll open, according to your hunt query. psychic uses the example to position hunt results. After all keypress, psychic reruns the example and reranks all results.
For additional details, see the README in the repo.
Some key scheme decisions
The example I use is LightGBM, an implementation of gradient-boosted trees. It’s small and accelerated and trains in seconds. It can study rules that depend on threshold values. For example, it can study a regulation akin “Files complete 1 MB are lone opened if they’ve been modified in the final 24 hours”, akin log files. LightGBM additionally has the outstanding LambdaRank objective, which is specialized for exactly this benevolent of ranking task.
The latency prosperity ruled out any example that’s not local: a network call could effortlessly be complete 10 ms or worse. It additionally ruled out LLMs or any benevolent of transformer model. Linear and logistic regression were too uncomplicated and performed much worse than LightGBM.
The example is re-trained from scratch all period you open psychic. This method it continually reflects your current use patterns. Training happens in the backdrop and writes the example to disk whenever it’s done. We don’t toggle to using the new example during you’re looking at results, since it’s jarring whenever apps do that. Instead, we delay for whenever you’re not looking at the screen, akin whenever you’re beginning a document in an publishing company or whenever you click on a directory. Then we toggle to the new model. I’m arrogant of this careful small dance.
When a person has fair started using psychic, there aren’t adequate clicks to train on. We use a uncomplicated example that rewards latest clicks, latest modification period and a fuzzy equivalent between the query and filename. The final mark is a valued sum of the uncomplicated example and ML model. With few clicks, the uncomplicated example dominates. As additional clicks accumulate, the ML model’s mark gets higher weight, until it’s basically 1.
How to be psychic
I use a carefully chosen set of features to try to foretell which document you’ll open. Some features are simple: how lately you final clicked it inside psychic, its modification time, whether the filename starts alongside the query, a fuzzy content equivalent mark between the query and the filename. Here’s a debug pane that shows the features and several achievement stats:

This debug pane was extremely helpful in the commencement for figuring out weird results or slowness. These days psychic is beautiful stable but I motionless akin beginning it sometimes.
One characteristic is “number of latest clicks on records that are in the identical directory as this one”. This characteristic helps the example boost records that are in currently energetic projects.
The characteristic “clicks for this query” helps the example affiliate particular queries alongside particular files, without having to exactly recall filenames and query texts. This way, during the example doesn’t immediately see filenames, it can motionless recall associations.

Every training run writes a pdf alongside several stats. Here we see a training curve and the acquire of all feature.
An episode is defined as everything that happens from beginning psychic (or from the final click) to clicking on an item. So a sole event has a bunch of queries, including hitting backspace and trying new queries. The characteristic “engagements in event alongside query” counts the figure of times you clicked on a document at any item in an event that had the current query. So if you continually category “es” and end up clicking on “bayesian-estimate.md”, afterward the example can see that association. Next period you category “es”, the example volition put that document at the top of the list.

Here are SHAP values and a dot chart. These assistance me comprehend how much a characteristic affects the model’s output, and to construe why a example behaves the way it does. For example, the dot diagram shows that the example prefers lately modified files, and dislikes most big files.
Computer go fast
I observe perf closely and spent a lot of attempt on a fine benchmarking setup, affirmative perf logging. Every commit has achievement benchmarks. If you use psychic and get bad performance, that’s a bug! Let me cognize and I’ll fix it.
My tech choices were driven by performance. Probably the most crucial choices were Rust and LightGBM.
Syscalls are costly but of way this entire program is syscalls. I tried to minimize syscalls. No filesystem syscalls in the chief render loop; I carefully made certain that we ask for document metadata at the period we stroll the filesystem and afterward transport that about everyplace else.