Skip to main content

Twitter Follow Discord Follow Documentation Status Stable Version License

🧙‍♂️ Mentat ⚡

It is by will alone I set my mind in motion

The Mentat Mantra

The Mentats of Dune combine human creativity with computer-like processing - and now you can too.


Mentat is the AI tool that assists you with any coding task, right from your command line.

Unlike Copilot, Mentat coordinates edits across multiple locations and files. And unlike ChatGPT, Mentat already has the context of your project - no copy and pasting required!

Want help understanding a new codebase? Need to add a new feature? Refactor existing code? Mentat can do it!

🍿 Example Videos (🔊 on!)

https://github.com/AbanteAI/mentat/assets/128252497/35b027a9-d639-452c-a53c-ef019a645719

See more videos on Twitter or YouTube:

⚙️ Setup

Installation and Setup Demonstration Video

Install

It is recommended you install this package in a virtualenv:

# Python 3.10 or higher is required
python3 -m venv .venv
source .venv/bin/activate

Note that you'll have to have activated the virtual environment to run mentat if you install it there.

There are then 3 install methods. The first two will just let you run it:

  • PyPI: python -m pip install mentat
  • Github: python -m pip install git+https://github.com/AbanteAI/mentat.git

The third option is useful if you'd also like to modify Mentat's code, as well as run it:

git clone https://github.com/AbanteAI/mentat.git
cd mentat

# install with pip in editable mode:
pip install -e .

Add your OpenAI API Key

There are a few options to provide Mentat with your OpenAI API key:

  1. Create a .env file with the line OPENAI_API_KEY=<your-api-key> in the directory you plan to run mentat in or in ~/.mentat/.env
  2. Run export OPENAI_API_KEY=<your key here> prior to running Mentat
  3. Place the previous command in your .bashrc or .zshrc to export your key on every terminal startup

If you want to use a models through Azure, Ollama or other services see this doc for details.

🚀 Usage

Run Mentat from within your project directory. Mentat uses git, so if your project doesn't already have git set up, run git init. Then you can run Mentat with:

mentat <paths to files or directories>

List the files you would like Mentat to read and edit as arguments. Mentat will add each of them to context, so be careful not to exceed the GPT-4 token context limit. To add multiple files at once, you can also provide directories as arguments. When a directory is provided, Mentat will add all the contained files, except for ones ignored in your .gitignore. In addition to files and directories, you can use glob patterns to add multiple files at once.

For more information on commands, configuration or using other models see the documentation.

MacOS Visual Artifacts

Mentat uses Textual. On MacOS, Textual may not render the TUI correctly; if you run into this problem, use the fix here.

👩‍💻 Roadmap and Contributing

We welcome contributions! To coordinate, make sure to join the Discord server: Discord Follow

The goal for Mentat is to become the best way to write code. Some big improvements coming up are:

  • seamlessly work with codebases much larger than LLM context limits, without requiring users to filter files manually
  • improved edit quality

If this is something you'd like to work on, jump right in! And if you want to join the team to work on this full time, message @bio_bootloader on twitter.

To find something specific to work on, take a look at open issues.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mentat-1.0.15.tar.gz (122.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mentat-1.0.15-py3-none-any.whl (165.7 kB view details)

Uploaded Python 3

File details

Details for the file mentat-1.0.15.tar.gz.

File metadata

  • Download URL: mentat-1.0.15.tar.gz
  • Upload date:
  • Size: 122.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.14

File hashes

Hashes for mentat-1.0.15.tar.gz
Algorithm Hash digest
SHA256 464c30c0fffff4a179f902d46fdd1c525a5d338b0c1b779c4688a1dd5dc3f3d2
MD5 82ddf97bfe7729291da8e636d6babdc2
BLAKE2b-256 6c2297f7df28ffe67037f1092dc953a28826c46de46f90c88211056902db0eb5

See more details on using hashes here.

File details

Details for the file mentat-1.0.15-py3-none-any.whl.

File metadata

  • Download URL: mentat-1.0.15-py3-none-any.whl
  • Upload date:
  • Size: 165.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.14

File hashes

Hashes for mentat-1.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 690b13600d4ab8d0f97d6f156e87c8dc6aca5ad9dcd8f7a4a3b2b146a3776dda
MD5 5707a1b95c99508ba62a669cc666ff01
BLAKE2b-256 73aac2bf76db83846dd2b1ad3dea7f0e2f3fef5c12bfd44c8f827d1ccefae3f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page