Documentation
Using Monty

Using Monty

Monty has two major skills:

  1. Chatting with or without a document
  2. Chatting with search versus selected files and symbols

When chatting in document mode or with your code, Monty can chat with selected files and symbols or with search.

Chatting with Search vs Selected Files and Symbols

ChatButtons.png

When initiating a chat, you have two options:

  • The Chat with search button will ignore any manually designed context and will perform a search based on the context from the document or chat history.
  • The Chat button will not perform a search and will immediately start chatting with the AI based on your selected files and symbols.

Chat with Search

Chat with search enables Monty to locate large amounts of code relevant to your needs.

What is search doing?

  1. Builds Search Queries - Monty builds multiple queries based on your chat history to find code similar to what you are searching for.
  2. Searches Your Code with Those Queries - Monty searches an index built locally on your machine.
  3. Populates the Context with Those Results - Instead of using a selected files and symbols you built, Monty utilizes these search results when responding.

Chat with Selected Files and Symbols

Right-clicking on a symbol opens up the context management menu.

LargerContextMenu.png

Monty provides six options here to understand your code thoroughly.

  1. Definition or Selection
    • Monty adds the full definition of a class, function, or method if you have just clicked on a specific symbol. If you have selected code, Monty will add the selection.
  2. File
    • Monty adds the whole file to the context.
  3. Callers
    • Monty adds the functions or methods that call this symbol.
  4. Callees
    • Monty adds the functions or methods this symbol calls. If you were working with a function, this would include all the functions called inside that function.
  def func1():
    """
    If you add my callees, func 2 will be added to context.
    This function will also be pulled in as the definition of the current symbol
    """
    func2()

  def func2():
    """
    If you add my callers, then func1 will be added to context.
    This function will also be pulled in as the definition of the current symbol
    """
    print("Monty is sick")
  1. Neighborhood
    • Monty adds both the callers and callees of the symbol.
  2. 2-hop Neighborhood
    • Monty adds all of the neighbors and their neighbors. Be careful, this can get large quickly!

See Advanced Usage for how to define what gets excluded from the context automatically.

Tips for Chat Success

  • Use Names from the Relevant Code: Monty uses fuzzy matching against keywords and employs AI to generate more keywords. The more relevant keywords you provide, the better the search results will be.
  • Ask for Details about the Relevant Code First: Experience shows that asking for an explanation of the relevant code before requesting a complicated solution yields better results. This is because the search queries Monty can generate are better and breaking down the different tasks you want Monty to do enhances its performance.

Building Documents

If you need specific technical documents like engineering specifications, GitHub/Jira Tickets, or if you want to explain a section of the codebase to a co-worker, Monty is the tool for you.

To get started, you'll need to add a document to a chat by right-clicking on it.

AddTemplate.png

Monty attaches a doc to the chat. This doc will disappear when you switch chats as it exists only for this chat.

You can hover over a markdown header and can update a specific section of the doc. This action takes the comments directly under the markdown header and adds them to the chat.

This functionality works in any markdown doc, not only when you are chatting with docs attached to a chat. This allows for prompt chain customization with or without document mode.

Tips for Document Success

  • Use Templates! See the Templates page for example starting documents.
  • Start with Existing Text: Paste existing issues, tickets, and specifications into the appropriate sections of your markdown document so that Monty has more to work with.
  • Provide as Much Information as You Can: Monty’s ability to find relevant code is based on the concepts and names in the markdown document and instructions. The more information Monty has, the better it performs.
  • Write the Headings of the Document You Want to Create: Monty excels at filling in details if you give it a good outline.
  • Use File, Function, Class, Variable Names, etc. in Your Instructions and Document: This helps Monty find the right code. Don't worry if you don't know the exact spelling or capitalization.
  • Use Declarative Language in Your Instructions: For example, “rewrite the documentation for class foo”, or “expand the requirements section”, “add more detail about the test plan.”
  • Be as Explicit as Possible: For example, “add a section on the assumptions implicit in the use case” rather than “say more.”
  • Review Monty's Reasoning in the Chat Window: This will help you understand how Monty is thinking and help you give better instructions in the future.
  • Note that Monty Works Off the Document and Your Latest Instruction, Not Chat History: The context that gets built up from interacting with Monty is the markdown document.
  • Remember that You Can Edit the Markdown Too: Monty will do its best; however, if you know what you want to say, type it out.

Getting Help

If you need help, you can email us at [email protected].

Found a bug? Report it on our community Discord (opens in a new tab).

Follow us @AiMaintainer (opens in a new tab) on X.