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

# Contributing

> Contribute to the cognee project

We welcome contributions from the community! Your input helps make Cognee better for everyone.
This page outlines instructions and best practices for contributing to Cognee, ensuring your contributions are integrated into the project efficiently.

## How To Contribute

There are many ways in which you can contribute to this project include: submitting bug reports and feature requests via GitHub [issues](https://github.com/topoteretes/cognee/issues),
opening PRs with features, fixes, or tests, reviewing others’ PRs, and collaborating by commenting or answering questions in the [Discord community](https://discord.com/invite/m63hxKsp4p).

### Development Setup

Firstly, you will need to set up your local copy of the cognee code repository. Keep in mind that we have two different
repositories: our [core repo](https://github.com/topoteretes/cognee), which contains core cognee functionalities,
and our [community repo](https://github.com/topoteretes/cognee-community), which contains community-maintained add-ons and custom packages.

Once you have chosen the repo you are going to work on, you have to fork it, and clone it to your machine:

```bash theme={null}
git clone https://github.com/<your-github-username>/cognee.git
cd cognee
# OR
git clone https://github.com/<your-github-username>/cognee-community.git
cd cognee-community
```

After this, just create a branch for your work, and add your code there:

```bash theme={null}
git checkout -b feature/your-feature-name
```

### Development Guidelines

While working on new features and fixes, make sure to keep these guidelines in mind:

* **Code Style** - Make sure to follow the [PEP8](https://peps.python.org/pep-0008/) style guide, and also the style of the project codebase.
  Reuse as much of the code as possible, and follow the existing package and file hierarchy.
* **Tests** - Make sure to add tests for new features, and that the tests pass before opening a PR
* **Commits** - Write clear and concise commit messages, following the commit and PR title style below

#### Commit & PR Title Style

The same style applies to commit messages and PR titles. If you use a coding agent (e.g. Claude Code)
in the repository, it picks up these rules from
[`CLAUDE.md`](https://github.com/topoteretes/cognee/blob/main/CLAUDE.md) automatically.

**Subject line (required):**

* Use the format `(type): (short summary)`
* Write the summary as if it is giving an instruction — "Fix bug", not "Fixed bug"
* Keep it to 50 characters or less
* Capitalize the first character of the summary
* Do **not** end it with a period

**Body (optional):**

* Explain the motivation behind the change, what problem it solves, and any relevant background —
  the *what* and *why*, not the *how*; the code itself should make the "how" clear
* Separate the subject line from the body with a blank line. Generally, all commits should have separate
  subject and body.

#### Linting and Formatting

Before creating a Pull Request, you need to make sure that your code is linted and formatted correctly.
To do this, you first have to install [ruff](https://docs.astral.sh/ruff/) on your system.
Ruff is part of the project's dev dependencies, so you can install it with
[uv](https://docs.astral.sh/uv/) in the root of the core repo, or on its own through `pip`.

```bash theme={null}
uv sync
# OR
pip install ruff
```

Then run the linter and the formatter from the root of the project:

```bash theme={null}
ruff check .     # report lint errors
ruff format .    # rewrite files to the project format
```

If you only want to verify formatting without rewriting any files — which is what CI does — use the
`--check` variant instead:

```bash theme={null}
ruff format --check .
```

Both checks also run as [pre-commit](https://pre-commit.com) hooks (`ruff` and `ruff-format`) and again
directly in CI's Code Quality job. Install the hooks once so they run automatically on every commit:

```bash theme={null}
pre-commit install
```

The hooks are pinned to a specific ruff version in
[`.pre-commit-config.yaml`](https://github.com/topoteretes/cognee/blob/main/.pre-commit-config.yaml),
while the `ruff` dependency in `pyproject.toml` allows a range of versions. If a locally installed ruff
disagrees with CI, run the pinned version through the hooks instead:

```bash theme={null}
pre-commit run --all-files
```

Ruff's configuration lives in `pyproject.toml` under `[tool.ruff]` — most notably a line length of 100
and a list of excluded paths.

#### Submitting a Pull Request

After successfully linting and formatting your code, you can push your changes:

```bash theme={null}
git add .
git commit -s -m "feat: Add my new feature"
git push origin feature/your-feature-name
```

And now, create a Pull Request so your contribution can be reviewed, and eventually merged to the project repository:

* Go to the repository you made changes for (i.e. the core repo or the community repo)
* Click **Compare & Pull Request** and open a PR, being careful against **which branch**
  you open it (`dev` for core repo, `main` for community)
* Fill in the PR template with details about your changes

After opening the PR, the right reviewers will be notified automatically — Cognee uses a [CODEOWNERS](https://github.com/topoteretes/cognee/blob/main/.github/CODEOWNERS) file to request reviews based on the directories your PR touches. No manual ping required. We will make sure to review it, and eventually your contribution will be a part of the Cognee project!

#### Changelog Entries

If maintainers ask for a changelog entry, add it under the `Unreleased` section of `CHANGELOG.md`.

* Use `Added` for new capabilities
* Use `Changed` for behavior or documentation updates
* Use `Fixed` for bug fixes

Example entry:

```markdown theme={null}
## Unreleased

### Fixed
- Clarify the minimal Docker Compose setup for first-time contributors.
```

<CardGroup cols={3}>
  <Card title="Contributing Guide Details" href="https://github.com/topoteretes/cognee/blob/main/CONTRIBUTING.md" icon="book">
    More details about the contributing process.
  </Card>

  <Card title="Community Guidelines" href="https://github.com/topoteretes/cognee/blob/main/CODE_OF_CONDUCT.md" icon="book">
    Be respectful and follow our code of conduct. Help others learn and grow, and provide constructive feedback.
  </Card>

  <Card title="Join our Discord Community" href="https://discord.gg/m63hxKsp4p" icon="discord">
    Join the community for real-time discussions with us and other users!
  </Card>
</CardGroup>
