> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# From Directory • AI Agent SDK

> from_directory: Auto-detect and load .praisonignore from directory.

# from\_directory

Method

> This is a method of the [**IgnoreMatcher**](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/IgnoreMatcher.md) class in the [**indexing**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/indexing.md) module.

Auto-detect and load .praisonignore from directory.

Also checks for .gitignore as fallback.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def from_directory(directory: str) -> 'IgnoreMatcher'
```

## Parameters

**directory** `str` *required*

Directory to search

### Returns

**Returns** `'IgnoreMatcher'`

IgnoreMatcher with loaded patterns

## Uses

* `exists`
* `splitlines`
* `f.read`
* `cls`

## Used By

* [`Knowledge.index`](../functions/Knowledge-index)

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/knowledge/indexing.py#L286)
>
> `praisonaiagents/knowledge/indexing.py` at line 286


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.