Lumen: The Local Code Reviewer That Lives in Your Terminal

How a Rust-powered TUI bridges the gap between raw diffs and meaningful history using local-first AI.

• View on GitHub • More from jnsahaj

A lighthouse projecting a structured grid of code blocks onto a clean canvas in the sky, illuminating a dark, tangled shore of vines and thorns.
Bringing clarity to the chaotic pre-commit environment.

The missing code review tool in the era of AI coding agents.

Sahaj Jain, Author/Maintainer · jnsahaj/lumen

Key Takeaways

The Cognitive Tax of the Empty Prompt

The "Inner Loop" of development has a massive blind spot: the gap between finishing a line of code and typing git commit. We usually fill this gap with a messy git diff that scrolls off the screen, followed by a brain-draining session of summarizing our own work into a "Conventional Commit" message.

Lumen is interesting because it treats the terminal not just as a text output, but as a high-fidelity code review environment. By combining a Rust-powered side-by-side diff engine with local-first AI, it turns the solitary act of committing into a structured, assisted "self-review."

Sahaj Jain, Author/Maintainer of Lumen

Re-Engineering the Terminal Diff

A deep dive into the Rust diff engine reveals how Lumen transforms standard git diff output into a readable side-by-side view. The compute_word_diff function uses a "meaningful content" ratio (MIN_UNCHANGED_RATIO = 0.20).

If two lines are too different, it suppresses word-level highlighting to avoid visual noise. This shows a high degree of polish in the UI logic. The compute_side_by_side algorithm pairs consecutive deletions and insertions.

How a standard unified diff is transformed into a readable side-by-side comparison.

Intelligence Without the Cloud

Lumen handles AI through a provider-agnostic trait system, supporting OpenAI, Claude, Groq, and Ollama. Uniquely, it offers a "no API key" mode using Phind by default, lowering the barrier to entry.

The operate command translates natural language intent into executable shell commands, incorporating safety checks to prevent destructive Git mistakes.

A human hand hovering over an execute button, while a mechanical owl uses a magnifying glass to inspect a hallucinated command string, revealing a hidden trapdoor.
The operate command acts as a safety net against destructive generated commands.

The pipeline detailing how natural language is safely translated into Git commands.

Beyond the Git Monoculture

Analysis of the jj.rs implementation reveals how Lumen abstracts Version Control to support Jujutsu. This "VCS-agnosticism" is a bet on the future of developer tools.

The detect_git_syntax function intercepts Git idioms and suggests the jj equivalent, easing the transition for users.

A stone bridge connecting two architectural styles, representing Git and Jujutsu, with the Lumen logo as the keystone.
Abstracting version control systems to support both legacy and modern workflows.
FeatureDeltaAicommitsLumen
Primary FocusVisibility (Aesthetics)Single-purpose AIInteractive TUI + AI + Multi-VCS
LanguageRustTypeScriptRust
AI IntegrationNoneYesYes (Multiple Providers + Local)