Mentat is an open-source, terminal-native AI coding assistant designed to coordinate multi-file changes by ingesting repository context directly from the command line. Built for developers who favor keyboard-driven and headless workflows, it operates with a developer-in-the-loop approach where generated code diffs are reviewed and approved before application. In practical usage, Mentat reads repository structures, dependencies, and file contents to build contextual awareness for code generation, refactoring, and code review tasks. It interfaces directly with local files and allows developers to inspect proposed atomic diffs, review conversation history, and commit or discard changes straight through Git integration. Mentat supports pluggable LLM backends, including OpenAI, Anthropic Claude, and custom or local endpoints such as Ollama, vLLM, and LM Studio using OpenAI-compatible APIs. Mentat differentiates itself through its multi-file atomic editing capabilities coupled with strict developer-in-the-loop review semantics. Rather than focusing on single-line completions like traditional IDE plugins, Mentat executes cross-file refactors and architectural edits across mixed-language projects while keeping code changes bound to the local filesystem without mandatory cloud dependencies. The core CLI tool is open-source and free, relying on user-provided API keys or self-hosted local infrastructure. Paid tiers starting at $15/month are available for teams requiring priority support and managed cloud inference.
Full-Codebase Context Analysis — Reads project directory structures and file dependencies to ground code edits across the repository. - Multi-File Atomic Editing — Generates and coordinates precise edits across multiple files with diff review and rollback support. - Pluggable LLM Backends — Connects to OpenAI, Anthropic Claude, or local inference engines like Ollama, vLLM, and LM Studio via OpenAI-compatible endpoints. - Developer-in-the-Loop Workflow — Requires explicit user approval for diffs before modifying local filesystem files. - Native Git Integration — Enables direct reviewing, committing, or discarding of generated code changes within the CLI interface. - Developer API & Automation — Exposes a programmatic API to integrate Mentat capabilities into custom scripts and CI/CD pipelines.
Use cases
Use Case: Cross-File Codebase Refactoring A developer needs to rename an internal interface or update an API pattern across multiple interdependent modules. Mentat analyzes the repository context, traces usages across files, and proposes atomic diffs that the developer can review and apply in a single command.
Use Case: Offline and Private Development with Local LLMs Engineers working under strict data privacy constraints can configure Mentat to route inference through a local Ollama or vLLM server. This allows repository-wide code generation, analysis, and refactoring without sending source code to third-party cloud providers.
Use Case: Automated PR and Code Quality Reviews Teams can integrate Mentat via its CLI and Developer API into internal automation scripts to analyze incoming pull requests. Mentat parses the codebase context to provide structured reviews, flag architectural mismatches, and suggest concrete fixes.
Who it is for
Mentat is built for backend engineers, platform engineers, and CLI-focused developers who need multi-file codebase reasoning and strict human-in-the-loop diff approvals. It is particularly well-suited for developers wanting flexibility to use local LLMs (like Ollama or vLLM) or their own API keys. It is less suitable for junior developers or those who prefer graphical, in-editor inline code completion over a terminal-based workflow.
Install guide
Installation Mentat requires Python 3.10 or higher. Install it via pip: bash pip install mentat
First Run Configure your preferred LLM provider API key as an environment variable before launching the CLI: bash # For OpenAI models export OPENAI_API_KEY="your-openai-api-key" # Or for Anthropic Claude models export ANTHROPIC_API_KEY="your-anthropic-api-key" # Or point to a local OpenAI-compatible endpoint (e.g., Ollama or vLLM) export OPENAI_API_BASE="http://localhost:11434/v1" Navigate to your project repository and launch Mentat, passing any specific target files or allowing it to read the repository context: bash cd /path/to/your/project mentat
Example Session Run Mentat on specific project files to refactor an existing utility and update corresponding tests: bash mentat src/auth.py tests/test_auth.py Inside the Mentat prompt, enter your instruction: text >>> Refactor auth.py to use argon2 hashing instead of bcrypt, and update test_auth.py to reflect the changes. Mentat will analyze both files, generate the proposed diffs, and prompt for confirmation before applying the modifications to disk.
Qwen Code — Qwen Code is an open-source terminal-based AI coding assistant maintained by the Qwen team (Alibaba Cloud / QwenLM). Built on…
Nanocoder — Nanocoder is an open-source terminal-based AI coding assistant developed by the Nano-Collective community. Designed for software developers who prefer working…
coro-code — coro-code is an open-source, terminal-based AI coding assistant developed in Rust by Blushyes. Built around a compiled native architecture, it…
Groq Code CLI — Groq Code CLI is an open-source command-line coding assistant developed by the build-with-groq team. It integrates directly with Groq's high-speed…
ob-1 — ob-1 is an open-source terminal-based AI coding agent created by Overbrilliant. Designed for developer workflows in the shell, it orchestrates…
VTCode — VTCode is an open-source terminal-based AI coding agent built in Rust by Vinh Nguyen (vinhnx). Engineered as a high-performance CLI…