# How to Configure File Filters in DeepWiki to Exclude Specific Directories and Files

> Learn how to configure file filters in DeepWiki to easily exclude specific directories and files from your repository analysis using repo.json for precise control.

- Repository: [ASYNCFUNC/deepwiki-open](https://github.com/asyncfuncai/deepwiki-open)
- Tags: how-to-guide
- Published: 2026-02-16

---

**DeepWiki uses a two-layer filter system that combines built-in defaults with user-defined rules in [`repo.json`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/repo.json) to exclude specific directories and files from repository analysis.**

DeepWiki analyzes code repositories to generate documentation, but you often need to exclude build artifacts, dependencies, or sensitive files from processing. Learning how to configure file filters in DeepWiki allows you to precisely control which paths get indexed through the `file_filters` configuration and the programmatic API in [`api/data_pipeline.py`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/data_pipeline.py).

## Understanding DeepWiki's Two-Layer Filter System

DeepWiki determines which files are processed through a hierarchical filtering mechanism defined in [`api/config.py`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/config.py) and [`api/data_pipeline.py`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/data_pipeline.py). The system merges three levels of configuration: hard-coded defaults, repository-specific JSON settings, and runtime function arguments.

### Built-in Default Exclusions

The foundation of DeepWiki's filtering resides in [`api/config.py`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/config.py) (lines 288-326), which defines `DEFAULT_EXCLUDED_DIRS` and `DEFAULT_EXCLUDED_FILES`. These constants contain exhaustive patterns for virtual environments (`.venv/`, `venv/`), version control folders (`.git/`), compiled artifacts (`*.pyc`, `node_modules/`), and common build directories. These defaults ensure that DeepWiki never processes ephemeral or third-party code unless explicitly instructed.

### User-Supplied Configuration Overrides

The second layer reads from [`api/config/repo.json`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/config/repo.json), specifically the `file_filters` section. When DeepWiki initializes, it merges the `excluded_dirs` and `excluded_files` arrays from this JSON into the global `configs` dictionary. This merge is additive by default: your custom patterns extend the built-in defaults rather than replacing them, unless you implement inclusion mode (detailed below).

## How to Configure File Filters in DeepWiki via repo.json

To permanently exclude specific paths from all future analysis runs, edit the `file_filters` object in [`api/config/repo.json`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/config/repo.json). This JSON structure supports two arrays: `excluded_dirs` for directory paths and `excluded_files` for filename patterns.

```json
// api/config/repo.json
{
  "file_filters": {
    "excluded_dirs": [
      "./.venv/",
      "./node_modules/",
      "./custom_exclude_dir/",
      "./src/legacy/"
    ],
    "excluded_files": [
      "secret_config.yml",
      "*.bak",
      "temp_*",
      "*.log"
    ]
  },
  "repository": {
    "max_size_mb": 50000
  }
}

```

When DeepWiki loads the configuration via `load_repo_config()` in [`api/config.py`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/config.py), these entries merge with `DEFAULT_EXCLUDED_DIRS` and `DEFAULT_EXCLUDED_FILES`. The crawler in [`api/data_pipeline.py`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/data_pipeline.py) then references this combined set during the repository crawl.

## Programmatic Filter Configuration with read_all_documents

For temporary exclusions or dynamic filtering logic, use the `read_all_documents` function in [`api/data_pipeline.py`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/data_pipeline.py) (lines 151-231). This function accepts override parameters that merge on top of the default and JSON-configured sets, allowing fine-tuned control without modifying persistent configuration files.

### Temporary Exclusions for Single Runs

Pass `excluded_dirs` and `excluded_files` as arguments to `read_all_documents` to exclude paths for a single execution. These parameters accept lists of string patterns.

```python
from api.data_pipeline import read_all_documents

# Exclude a temporary folder and debug logs only for this execution

docs = read_all_documents(
    path="/path/to/repo",
    excluded_dirs=["./temp_folder/", "./cache/"],
    excluded_files=["debug.log", "*.tmp"]
)

```

The function builds the final exclusion set at lines 205-231 by first loading the defaults from [`api/config.py`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/config.py), then updating with repository configuration, and finally applying these runtime arguments.

### Using Inclusion Mode to Whitelist Specific Paths

DeepWiki supports an **inclusion mode** that reverses the filtering logic. When you provide `included_dirs` or `included_files` arguments to `read_all_documents`, the function sets `use_inclusion_mode = True` and processes only explicitly listed paths.

```python
docs = read_all_documents(
    path="/path/to/repo",
    included_dirs=["./src/", "./docs/"],
    included_files=["README.md", "CHANGELOG.md"]
)

```

In this mode, the `should_process_file` inner function (lines 35-102 in [`api/data_pipeline.py`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/data_pipeline.py)) ignores the exclusion lists and instead verifies that each file resides within the included directories or matches the included file patterns. This effectively overrides the default behavior, allowing you to index only critical documentation and source files while ignoring everything else.

### Combining Exclusion and Inclusion Strategies

You can combine both approaches to create complex filtering rules. When inclusion mode is active, DeepWiki first checks if a file matches the inclusion criteria, then applies any additional exclusions on top of that whitelist.

```python
docs = read_all_documents(
    path="/path/to/repo",
    included_dirs=["./src/", "./docs/"],
    excluded_dirs=["./src/legacy/"],  # Exclude a sub-directory inside the whitelisted area

    excluded_files=["*.test.js"]
)

```

The function builds the final filter sets at lines 205-231: it starts with defaults, merges repository configuration, applies inclusion lists (switching modes if present), and finally layers on runtime exclusion arguments.

## Core Files and Functions Behind DeepWiki Filtering

Understanding the source architecture helps you debug filter behavior and extend the system. DeepWiki's filtering logic spans three primary locations:

| File | Purpose |
|------|---------|
| **[`api/config.py`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/config.py)** | Defines `DEFAULT_EXCLUDED_DIRS` and `DEFAULT_EXCLUDED_FILES` (lines 288-326) and loads all JSON configurations via `load_repo_config()`. |
| **[`api/config/repo.json`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/config/repo.json)** | User-editable JSON containing the `file_filters` object with `excluded_dirs` and `excluded_files` arrays. |
| **[`api/data_pipeline.py`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/data_pipeline.py)** | Implements `read_all_documents` (lines 151-231) and the inner `should_process_file` logic (lines 35-102) that applies exclusion or inclusion rules during repository crawling. |

## Summary

- DeepWiki combines **built-in defaults** from [`api/config.py`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/config.py) with **user-defined filters** in [`api/config/repo.json`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/config/repo.json) to determine which files to analyze.
- Configure permanent exclusions by editing the `file_filters` object in [`repo.json`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/repo.json), adding patterns to `excluded_dirs` and `excluded_files`.
- Use the `read_all_documents` function in [`api/data_pipeline.py`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/data_pipeline.py) with `excluded_dirs` and `excluded_files` arguments for temporary, single-run filter adjustments.
- Enable **inclusion mode** by passing `included_dirs` or `included_files` to `read_all_documents` to whitelist only specific paths, overriding the default exclusion behavior.
- Runtime arguments merge hierarchically: defaults → [`repo.json`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/repo.json) → inclusion mode (if specified) → runtime exclusions.

## Frequently Asked Questions

### What is the default list of excluded directories in DeepWiki?

DeepWiki's default exclusions are defined in [`api/config.py`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/config.py) within `DEFAULT_EXCLUDED_DIRS` and `DEFAULT_EXCLUDED_FILES` (lines 288-326). These constants automatically exclude virtual environments (`.venv/`, `venv/`, `env/`), version control folders (`.git/`, `.svn/`), dependency directories (`node_modules/`, `vendor/`), and compiled artifacts (`*.pyc`, `__pycache__/`, `*.class`). These patterns ensure that ephemeral or third-party code does not clutter the analysis.

### Can I override DeepWiki's default exclusions instead of extending them?

By default, DeepWiki merges your custom filters from [`repo.json`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/repo.json) with the built-in defaults, effectively extending the exclusion list. However, you can effectively override the defaults by using **inclusion mode** in the `read_all_documents` function. When you provide `included_dirs` or `included_files` arguments, DeepWiki switches to inclusion mode and processes only the explicitly listed paths, ignoring all defaults and other repository files. This allows you to define a completely custom scope for analysis.

### How do I exclude files temporarily without modifying repo.json?

For temporary exclusions that apply only to a single execution, use the `excluded_dirs` and `excluded_files` parameters of the `read_all_documents` function in [`api/data_pipeline.py`](https://github.com/AsyncFuncAI/deepwiki-open/blob/main/api/data_pipeline.py). Pass Python lists containing directory paths or filename patterns as strings. These runtime arguments merge on top of the default and JSON-configured sets, allowing you to fine-tune filtering for specific runs without persisting changes to the repository configuration file.

### What is the difference between exclusion mode and inclusion mode in DeepWiki?

**Exclusion mode** is DeepWiki's default behavior, where the system processes all files except those matching patterns in `DEFAULT_EXCLUDED_DIRS`, `DEFAULT_EXCLUDED_FILES`, or your custom `file_filters`. When you pass `included_dirs` or `included_files` to `read_all_documents`, the system switches to **inclusion mode**, processing only files that reside within the specified directories or match the specified file patterns. In inclusion mode, the exclusion lists are ignored unless you also provide runtime exclusion arguments, which are applied after the inclusion check.