# hachikuji: yet another shell completion popup

> Fig became Amazon Q, Amazon Q became Kiro CLI, and the popup under my prompt disappeared along the way. inshellisense filled the gap at 43 MB per terminal. So I wrote a plan, picked a language I had never tried before, and built my own.

- Published: 2026-11-27
- Canonical HTML: https://glpecile.xyz/blog/hachikuji

For years, I had a small popup under my prompt. A friend introduced me to Fig, and it stuck.

Type `git ch`, and a list opened under the cursor: `checkout`, `cherry-pick`, `cherry`, each with a one-line description. Type `git checkout `, and it listed my branches. Press Tab, and the word was there. It felt like an IDE had quietly moved into the terminal.

Then the tool that drew it changed names. Twice. A year after the second name, the popup was gone.

This is the story of how I got it back. It involves one acquisition, one rebrand, one Node process per terminal, a plan written for an agent, and my first Rust project. It ends with [`hachikuji`](https://github.com/glpecile/hachikuji): an IDE-style completion popup for zsh that uses about 2 MB per shell.

<DemoVideo src={demo} label="Typing git, cd, make and docker commands in zsh. A popup under the line lists subcommands, branches, folders, make targets and options. Up and Down move the selection, Tab inserts it.">
	hachikuji in Catppuccin Mocha: subcommands, branches, folders, make targets and options. Recorded with <a class="site-link" href="https://github.com/charmbracelet/vhs">VHS</a>.
</DemoVideo>

## Fig was the good part

[Fig](https://github.com/withfig) was a Mac app that added IDE-style autocomplete to the terminal. You typed, and a popup offered subcommands, options, file paths and branches, with descriptions.

The app was the visible part. The valuable part was a repository.

Every command Fig knew about came from a _completion spec_: a TypeScript file that describes a CLI. Which subcommands `git` has. Which options take an argument. That `git checkout` wants a branch, and how to list branches. Those specs lived in [withfig/autocomplete](https://github.com/withfig/autocomplete), under the MIT license, and the community wrote them by the hundreds. `docker`, `kubectl`, `npm`, `ssh`, `make`, `brew`, `ffmpeg`. If you used it, someone had probably written its spec.

Keep that repository in mind. It is the one piece of this story that never went away.

## Then it became Amazon Q

In August 2023, [AWS acquired Fig](https://www.geekwire.com/2023/amazon-web-services-acquires-fig-a-yc-grad-that-boosts-the-command-line-for-devs/). For a while nothing changed. Then the features moved into [Amazon Q Developer](https://aws.amazon.com/q/developer/). The Fig service shut down on 1 September 2024, and the migration path was the Amazon Q Developer CLI: the `q` command.

It still worked. The popup was still there. It now came with an AWS login and a chat feature, but the part I used did not change.

There was also a good sign: the Amazon Q Developer CLI was [open source](https://github.com/aws/amazon-q-developer-cli). If AWS ever lost interest, the code would still be there.

## Then it became Kiro CLI

In November 2025, the Amazon Q Developer CLI became [Kiro CLI](https://kiro.dev/docs/upgrade-guides/migrating-from-q/), and the source closed. The old repository now says it will only get critical security fixes, and that the CLI continues as Kiro CLI, a closed-source product.

The popup lasted one more year. On 3 November 2026, [Kiro CLI 3.0](https://kiro.dev/changelog/cli/3-0/) became the default. It is a chat agent, and its changelog says it plainly: inline shell autocomplete is retired, with "no standalone replacement". The Homebrew casks `kiro-cli` and `amazon-q` both install it now.

I understand why. The attention is on agents, not on a popup that tells you `git rebase` takes `--onto`. But the feature I installed Fig for, years earlier, was no longer in any of them.

Three names, one acquisition, and the thing I actually used was the part that got cut.

## inshellisense, and half a gigabyte of popup

The obvious replacement was [inshellisense](https://github.com/microsoft/inshellisense), from Microsoft. Open source, MIT, and built on the same Fig specs. Same popup, same commands, no account.

It worked. It also cost more than I expected, in three ways.

**Memory.** inshellisense is a Node app. My first count was about 95 MB per terminal: a Node launcher of about 31 MB and a native binary of about 64 MB. I keep around 12 terminals open, so that is roughly 1.1 GB of RAM to draw a popup. Measured more carefully with `footprint`, which counts private memory instead of shared pages, it is 43 MB per terminal. Still about twenty times what a popup should need.

**A wrapper.** inshellisense runs your shell inside its own pseudo-terminal. So the terminal's foreground process is not zsh, it is the wrapper. Apps that read the folder of the foreground process, like [Herdr](https://herdr.dev), saw the wrapper and always showed the folder it started in. `cd` anywhere, and the tab still showed the start folder.

**Colors.** Its theme did not follow the system light and dark mode. My terminal switches between [Catppuccin](https://catppuccin.com) Latte and Mocha with the system. The popup did not.

Each problem had a workaround in my dotfiles. Each workaround was a few more lines that existed only to fix a tool that was supposed to save me time. And every new shell took about 140 ms to show a prompt, against 18 ms without it.

<Diagram
	caption="Six years, three products, one popup. The MIT specs are in every step."
	code={`timeline
    2020 : Fig publishes its specs (MIT)
    2023 : AWS acquires Fig : Microsoft ships inshellisense
    2024 : Fig shuts down : The popup moves to Amazon Q
    2025 : Amazon Q CLI becomes Kiro CLI : Its source closes
    2026 : Kiro CLI 3 retires the popup`}
/>

At some point, the honest question was: what does a completion popup actually need?

## The plan

I did not start with code. I started with [`plan.md`](https://github.com/glpecile/hachikuji/blob/main/plan.md).

It is a build prompt. It is written for an agent ("You are building `hachikuji`... Read this whole file before you write code"), and most of it is constraints, not features. The constraints came straight from the three problems above:

1. **No pty wrapper.** zsh stays the foreground process. All drawing goes through [ZLE](https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html), the zsh line editor. The plan says it plainly: "If a design needs a wrapper, it is wrong."
2. **No Node, no JS runtime, no Python at runtime.** One native binary.
3. **Less than 4 MB of private memory per shell.** Measured with `footprint` or `vmmap`, not RSS.
4. **p99 below 16 ms** for static specs, from key press to updated popup. One frame.
5. **Less than 10 ms added to zsh startup.** The helper starts on the first key, not in `.zshrc`.
6. **Fail silent.** If the helper crashes or hangs, the shell works as normal. zsh never blocks on it.
7. **No network** and no telemetry. The one exception, added later, is `hachikuji update`: you run it, and it calls the system `curl`.
8. **zsh only**, macOS first, Linux must build.
9. **Colors follow the terminal.** Only the 16 ANSI palette colors and reverse video. Never RGB, never the 256-color cube, because terminals do not change those when the theme changes.

<DemoVideo src={latte} label="The same zsh demo in the light Catppuccin Latte theme. The popup under git checkout lists branches and tags on a light background, with the selected row in reverse video.">
	The same popup in Catppuccin Latte. No theme config: the terminal's palette does the work.
</DemoVideo>

## Why Rust

The helper is one small process next to every shell, and it lives as long as the shell does. So the language had to fit two of the constraints, one native binary with no runtime (2) and less than 4 MB of private memory (3), and it had to start fast, because it starts on the first key you type. We looked at four.

1. **[Elixir](https://elixir-lang.org)** runs on the BEAM, the Erlang VM. Each shell would start its own VM, and that is the runtime constraint 2 rules out. The BEAM is built for many processes in one long-lived node. This job is one tiny process per shell.
2. **[Go](https://go.dev)** ships a garbage collector and a runtime in every binary. That overhead comes out of the same 4 MB budget before the helper does any work.
3. **[Zig](https://ziglang.org)** meets the budgets. But it is not at 1.0 yet, each release breaks the language and the standard library, and it has fewer libraries for TOML, Unicode width and fuzzing. The summer of 2026 made it a harder bet. The Zig project does not accept LLM-written contributions, and [Bun](https://bun.sh), the best-known program written in Zig, ported itself to Rust with Claude agents in 11 days. Andrew Kelley, Zig's creator, [answered with a long post](https://andrewkelley.me/post/my-thoughts-bun-rust-rewrite.html) that went after the rewrite and Bun's creator, Jarred Sumner, by name ([The Register has the summary](https://www.theregister.com/devops/2026/07/14/zig-creator-calls-buns-claude-rust-rewrite-unreviewed-slop/5270743)). hachikuji was going to be written by an agent too. I did not want to start it in a language whose project had just made that a fight.
4. **[Rust](https://www.rust-lang.org)** has no garbage collector and no runtime. It has a mature crate for each part: [`memmap2`](https://docs.rs/memmap2) for the index, [`unicode-width`](https://docs.rs/unicode-width) to cut rows to the terminal width, [`toml`](https://docs.rs/toml) for config, and `cargo-fuzz` for the tokenizer. `cargo build --target` gives one self-contained binary per platform.

The helper ended at 2.19 MB and a 700 KB binary, well inside the budget.

I respect Rust from the outside, through what people build with it. [GPUI](https://www.gpui.rs), the GPU-accelerated UI framework that the [Zed](https://zed.dev) editor is built on, is a good example. That track record made Rust an easy pick, even though I would not be the one writing it.

I wrote the plan and the agent wrote the Rust. I did not read a line of it. What am I, some kind of vibe coder? Yes. But one with a test suite and a memory budget: I checked every result against the plan. Does `footprint` say 2.19 MB? Does `cd` update the folder in Herdr? Does Ctrl-C at the prompt leave the helper alive?

The constraints did the reviewing. Each one is a number or a yes/no check, and most of them are a script in the repo: memory, latency, startup, the foreground process, a hung helper and the colors. A design that broke one of those failed a test, whatever language it was in.

## How it works

The whole thing is two pieces: about 350 lines of zsh ([`shell/hachikuji.zsh`](https://github.com/glpecile/hachikuji/blob/main/shell/hachikuji.zsh)), and one Rust helper per shell ([`src/`](https://github.com/glpecile/hachikuji/tree/main/src)).

<Diagram
	caption="zsh draws; the helper decides what to draw. The spec index is one mmap file that all shells share."
	code={`flowchart LR
    subgraph shell ["zsh (hachikuji.zsh)"]
        H["line-pre-redraw hook"]
        F["zle -F handler"]
        P["POSTDISPLAY +<br/>region_highlight"]
        F --> P
    end

    subgraph helper ["hachikuji serve (Rust)"]
        T["tokenizer"] --> S["spec walk"] --> R["rank"] --> D["render"]
        G["generators<br/>200 ms timeout, cache"]
    end

    I[("specs.idx<br/>mmap, shared")]

    H -- "request (FIFO)" --> T
    D -- "response (FIFO)" --> F
    G -- "async update" --> F
    S --> I`}

/>

- **The zsh side** hooks `line-pre-redraw`, not `self-insert`, so it plays well with [zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions), [zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting) and [starship](https://starship.rs), which wrap widgets. It sends a request only when the buffer or the cursor changed. Otherwise the redraw from a response would send a new request, forever.
- **Transport** is two FIFOs in a private folder. zsh opens both read-write, so no open blocks. Writes are non-blocking. At most one request is in flight, and zsh keeps only the newest pending one. Each request has a sequence number, and older responses are dropped.
- **The helper** tokenizes the line (quotes, pipes, `&&`, `$( )`, subshells), walks the spec, ranks prefix matches, falls back to fuzzy matches only when nothing starts with what you typed, and sends back rows that are ready to print, already cut to the terminal width.
- **Generators** list branches, files, package scripts and make targets. They run async with a 200 ms timeout, so a slow `git` never blocks typing. When one finishes, the popup updates through `zle -F`.
- **Fail silent** is real: if a request gets no response in 1 s, zsh kills the helper, shows no popup, and restarts it at most once a minute.

## The specs, again

Remember the Fig repository? This is where it comes back.

hachikuji uses [withfig/autocomplete](https://github.com/withfig/autocomplete) at one pinned commit. The specs are TypeScript, but the helper can't run JavaScript, by design. So a build step ([`tools/extract.ts`](https://github.com/glpecile/hachikuji/blob/main/tools/extract.ts), in [Bun](https://bun.sh)) reads each spec **without running it**. The TypeScript parser gives the syntax tree, and a small evaluator keeps only literal values: objects, arrays, strings, constants and spreads. Functions are never called.

Then `hachikuji compile` writes one binary index: a string table plus fixed-size node records, read in place with `mmap`. 1,455 specs fit in 14.7 MB. Because it's a read-only `mmap` file, the OS shares its pages between all shells. Twelve terminals don't load it twelve times.

Some specs use JavaScript for parts of their data, like a generator that lists git branches. Those parts are dropped and logged in [`specs/lost.txt`](https://github.com/glpecile/hachikuji/blob/main/specs/lost.txt): 262 specs lose something, so it can be ported later. A few, like `cargo`, are not static at all and give no popup. The most common ones are already ported to Rust built-ins: git branches, remotes, tags and changed files, `package.json` scripts, Makefile targets, ssh hosts and [zoxide](https://github.com/ajeetdsouza/zoxide) folders.

The specs ship with their original MIT notice, in [`specs/FIG-LICENSE`](https://github.com/glpecile/hachikuji/blob/main/specs/FIG-LICENSE), next to the index.

## The numbers

Apple M5, the full Fig index, the same `.zshrc` in a real pty. Only the plugin changes. The scripts and the full table are in the [README](https://github.com/glpecile/hachikuji#numbers).

<BenchBars
	highlight="hachikuji"
	caption="Lower is better. inshellisense's install is 120 MB plus Node (149 MB)."
	metrics={[
		{ label: "Memory per terminal", unit: "MB", rows: [["hachikuji", 2.2], ["inshellisense", 43]] },
		{ label: "Time to the first prompt", unit: "ms", rows: [["zsh alone", 18], ["hachikuji", 19], ["inshellisense", 141]] },
		{ label: "Key press to updated screen, p99", unit: "ms", rows: [["zsh alone", 5.1], ["hachikuji", 12.8], ["inshellisense", 44.2]] },
		{ label: "Installed size", unit: "MB", rows: [["hachikuji", 15], ["inshellisense", 269]] },
	]}
/>

Inside the helper, a request takes 0.14 ms at p99. The binary is about 700 KB. Twelve terminals use about 26 MB together, less than one terminal of inshellisense.

And the three workarounds in my dotfiles are deleted. Herdr shows the right folder, because zsh is the foreground process again. The popup follows Latte and Mocha, because it only knows palette colors. There's nothing to work around.

The plan was written on 3 November 2026, the same day Kiro CLI 3.0 shipped without a popup. [Version 1.0.0](https://github.com/glpecile/hachikuji/releases/tag/v1.0.0) shipped three days later, on 6 November 2026. [Version 1.1](https://github.com/glpecile/hachikuji/releases/tag/v1.1.0) added [nushell](https://www.nushell.sh), because the same friend who showed me Fig asked for it. There, hachikuji supplies the items and nushell's own menu shows them.

<DemoVideo src={nu} label="In nushell, Tab after git ch, make and docker run --r opens nushell's menu next to the line. It lists subcommands, branches, make targets and options, with the description of the selected item in a box beside it.">
	In nushell, the same specs feed nushell's own completion menu.
</DemoVideo>

## A short detour into Homebrew

I wanted `brew install hachikuji` to work. It mostly does, and the details taught me more about [Homebrew](https://brew.sh) than years of using it.

**homebrew-core will not take it yet.** Its [acceptance policy](https://docs.brew.sh/Package-Acceptance-Policy) asks for at least 75 stars (or 30 forks, or 30 watchers), more if the owner submits it, and a repository at least 30 days old. homebrew-core also builds every formula from source on its own CI. A repository from 3 November 2026, owned by one person, does not qualify yet, and that's a fair rule.

**A tap is just a Git repository.** [glpecile/homebrew-tap](https://github.com/glpecile/homebrew-tap) holds one file, `Formula/hachikuji.rb`. The `homebrew-` prefix lets you write `glpecile/tap` for short. The formula downloads the prebuilt archive for your Mac's CPU, checks its SHA-256, and installs the binary and the index. No Rust or Bun needed on your machine.

**Homebrew 7 doesn't trust taps by default.** This one surprised me. `brew tap glpecile/tap` followed by `brew install hachikuji` fails with "Refusing to load formula glpecile/tap/hachikuji from untrusted tap". The one-command form trusts that formula as it installs:

```sh
brew install glpecile/tap/hachikuji
```

So that's the only command the docs give.

**Symlinks keep the `.zshrc` line stable.** The binary finds its zsh file through the `bin` and `share` symlinks in `$(brew --prefix)`, not through the versioned folder in `Cellar/`. So the line you add to `.zshrc` still works after `brew upgrade`.

**Don't update what Homebrew owns.** `hachikuji update` replaces a script install in place. But if the binary's real path contains `Cellar`, it prints `brew upgrade hachikuji` and stops. Files that change outside Homebrew break `brew upgrade` and `brew uninstall` later.

The cost of a tap is one manual step per release ([`docs/RELEASING.md`](https://github.com/glpecile/hachikuji/blob/main/docs/RELEASING.md)): copy the generated formula into the tap repository and push. When the project meets the policy, it can move to homebrew-core.

## Open source is what kept this moving

Look at the chain again.

Fig the company is gone. Fig the app is gone. Amazon Q Developer CLI became Kiro CLI, closed its source, and dropped the popup. If the story had ended inside those products, it would have ended there.

But the specs were MIT. So Microsoft could build inshellisense on them. And because inshellisense was open source too, I could read exactly why it used 43 MB and why it needed a wrapper, and write a plan whose first constraint is "no wrapper". And because both were open, hachikuji didn't have to describe 1,455 CLIs from scratch. It had to describe one popup.

None of this is a new idea. It's just rare to watch it happen in one small tool, in the span of a few years: a company stops, a product changes direction, and the work survives because someone put a license on it.

So hachikuji is [MIT](https://github.com/glpecile/hachikuji/blob/main/LICENSE) too. The [plan](https://github.com/glpecile/hachikuji/blob/main/plan.md) is in the repo. There's a [migration guide](https://github.com/glpecile/hachikuji/blob/main/docs/MIGRATION.md) from Kiro CLI, Amazon Q, Fig and inshellisense, written so that a coding agent can do the move for you, with a backup and a check at each step. If someone takes this further, or takes only the index format, or only the plan, that's the point.

The name comes from [Monogatari](https://anilist.co/anime/5081/Bakemonogatari): [Mayoi Hachikuji](https://anilist.co/character/22052), the girl with the lost snail. The snail is the mascot. It felt right for a tool that exists because my completion popup kept getting lost between rebrands.

It found its way back. It just had to stop belonging to a product first.