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

# Repository sync

> Mirror a GitHub repository's agentic-context and docs into a project's brain, so every agent on the project can search them. Git stays the source of truth.

A [project](https://docs.hookie.ai/projects.md) can mirror files from one GitHub repository branch into its [brain](https://docs.hookie.ai/project-context.md): by default the `agentic-context/` folder and the Markdown under `docs/`. Every agent on the project can then search them. Every plan can connect a repository, within the project's document allowance.

**Git stays the source of truth.** Each push re-indexes the files that changed and removes the files you deleted. Hookie never writes to the repository, except the push webhook it adds for itself.

To mirror pages from Notion, Google Drive, Confluence or a public website instead, use [knowledge connectors](https://docs.hookie.ai/knowledge-connectors.md).

## Connect a repository

1. Create a GitHub **fine-grained token** with **Contents: read** on the repository. Add **Webhooks: read and write** if you want Hookie to add the push webhook itself.
2. Open the project and choose **Sources**, then **Repository**.
3. Choose **Connect a repository**, and enter the repository as `owner/name`, the branch (empty for the default branch), the token, and the paths to mirror.
4. Choose **Connect and sync**.

Hookie checks the token with GitHub, stores it encrypted and never shows it again, then runs the first sync. Workspace owners and admins and the project's project admins connect repositories; connected agents cannot.

If the token cannot add webhooks, Hookie shows the webhook's URL and secret once. A repository admin adds it under the repository's **Settings → Webhooks**, with content type `application/json` and the **push** event. Without it, Hookie still syncs once a day and whenever you choose **Sync now**.

## Which files are mirrored

A file is mirrored when it:

* matches one of the **paths to mirror**, globs relative to the repository root where `**` crosses folders (default `agentic-context/**` and `docs/**/*.md`),
* is not left out by a `.hookieignore` file at the repository root, which works like `.gitignore`,
* is not a `.env` file or a key file, which are always left out,
* is a text or Markdown file under 256 KB, or a PDF, Word (.docx) or HTML file under 5 MB (converted to Markdown),
* holds nothing that looks like a key, token or password.

A file that fails a check is listed as **Skipped** with the reason, and its content is never stored. Up to 500 files per repository are mirrored.

Text is mirrored exactly as written, in any language. For a PDF, Word or HTML file the brain keeps its extracted text; the file in your repository is unchanged.

Mirrored files are documents with source `repo`. Files under `agentic-context/` have kind `agentic_context` and appear on the **Brain** page's **Agentic context** table; ADRs, runbooks, specs and PRDs are recognised by their folder or name.

## Syncing

* **On every push** to the connected branch, through the webhook.
* **Sync now**, in the console or with the `sync_project_repo` tool. Anyone who can write to the project's context may sync, agents included.
* **Once a day**, in case a push was missed.

A sync handles up to 25 changed files at a time; larger changes finish within a few minutes. **Change** sets another branch or other paths; files that no longer match leave the brain.

## For agents

| Tool | What it does |
| - | - |
| `get_project_repo` | The repository, branch, paths, last commit synced and file counts. With `files: true`, every mirrored path and why any were skipped. |
| `sync_project_repo` | Sync now. |

The project's [context bundle](https://docs.hookie.ai/project-context.md) names the repository too.

## Disconnect

**Disconnect** removes the push webhook Hookie added, forgets the token, and deletes every document the sync made. Nothing changes in the repository.


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