---
title: Ignore files and folders in Knowledge Stack
description: Learn how to use .mstyignore to exclude files and folders from your knowledge stack
---

The `.mstyignore` file is a powerful tool allows you to specify which files and folders should be ignored when composing your knowledge stack. By using `.mstyignore`, you can streamline your knowledge base, exclude unnecessary files, and maintain a cleaner, more focused stack.

### Understanding .mstyignore Syntax

Good news for those familiar with Git: `.mstyignore` uses the same syntax as `.gitignore`. This means if you're already comfortable with `.gitignore`, you'll find `.mstyignore` intuitive and easy to use. For those new to this syntax, don't worry – it's straightforward and easy to learn.

### How to Create and Use a .mstyignore File

1. Create a new file named "`.mstyignore`" in the root directory of your knowledge stack folders or Obsidian vaults.
2. Open the file in a text editor.
3. Add patterns for files and folders you want to ignore, one per line.
4. Save the file.

### Syntax Rules and Pattern Examples

Here are some common patterns and what they do:
1. Ignore specific files:
   example.txt

2. Ignore all files with a certain extension:
   *.log

3. Ignore all files in a specific folder:
   folder_name/

4. Ignore a specific folder and all its contents:
   folder_name/**

5. Ignore files or folders that match a pattern:
   **/temp_*

6. Negate a pattern (include a file that would otherwise be ignored):
   !important.txt

Practical Examples

Here's an example of what your `.mstyignore` file might look like:

```
# Ignore all .log files
*.log

# Ignore the entire 'temp' folder
temp/

# Ignore all .tmp files in any directory
**/*.tmp

# Ignore all files in the 'drafts' folder
drafts/

# But don't ignore important drafts
!drafts/important_draft.md

# Ignore all files starting with 'temp_'
temp_*

# Ignore all files ending with '_old'
*_old
```

### Best Practices

1. Keep your `.mstyignore` file in the root directory of your knowledge stack.
2. Use comments (lines starting with #) to explain complex patterns.
3. Be specific to avoid accidentally ignoring important files.
4. Regularly review and update your `.mstyignore` file as your knowledge stack evolves.

By effectively using `.mstyignore`, you can maintain a clean, relevant, and efficient knowledge stack in Misty AI. This allows you to focus on the information that matters most, improving the overall quality and usefulness of your AI assistant.
