Mentat CLI Cheatsheet - Terminal Multi-file AI Coding Agent Full Reference
Mentat is a terminal-native AI coding agent whose core verb is producing a multi-file diff: give it files and a task, it proposes a unified patch, you review and apply. It respects .gitignore, supports auto-context retrieval and MCP tools. This sheet covers context control, models, and interactive commands so you can refactor at scale from the terminal.
Install and Start 4
pip install mentat-aimentatmentat --helpexport OPENAI_API_KEY=sk-xxxxContext Control 7
mentat src/main.py tests/mentat "scripts/**/*.py"mentat src/ --exclude tests/legacy/mentat --auto-contextmentat -a --auto-tokens 8000mentat --model claude-3-5-sonnetmentat --mcp-server "npx @modelcontextprotocol/server-postgres"Interaction and Scripting 9
/include/exclude/model gpt-4o:save:loadmentat --run "add docstrings"git initmentat --versionmentat src/ --exclude "**/*.test.ts"Tips
- Mentat produces a unified diff you review before applying, closer to pair programming than chat tools.
- --auto-context uses RAG to find relevant snippets, sparing manual file picking in large repos.
- It respects .gitignore and only touches files you pass in, a good safety default.
FAQ
How is Mentat different from Aider?
Both are terminal multi-file coding agents; Mentat centers on a unified diff plus review, while Aider emphasizes git-style /add and a chat loop. Pick by feel.
Must it use a cloud model online?
OpenAI by default, also Anthropic or local models via LiteLLM; keys come from env vars or .env.
Official References
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
Maintained by LaoHand
Publicly updated on Sep 10, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us