> For the complete documentation index, see [llms.txt](https://pharaoh.so/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pharaoh.so/docs/use-pharaoh/security.md). Agents can also search and read this documentation through its [MCP server](https://pharaoh.so/docs/~gitbook/mcp).

# Security and data

What Pharaoh stores: no source code, only structural metadata and short excerpts. Read-only access to your code, and deletion 30 days after uninstall.

Pharaoh maps repository structure so your agent can query it. Mapping requires temporary access to source files; the persistent graph contains extracted metadata.

## Repository permissions

The GitHub App reads the repositories you authorize. It can publish GitHub check results, but cannot push commits, edit source files, create branches or open pull requests. GitHub displays the requested permissions before installation. You can review or change repository access in [GitHub's installed-app settings](https://github.com/settings/installations).

## Processing and storage

A mapping or pull-request check clones code into a temporary directory, parses it and deletes the directory when the job finishes, including when the job fails. Startup cleanup removes abandoned job directories after a process interruption.

The graph stores metadata such as:

* Function, class and constant names; file paths and module boundaries.
* Import, dependency and call relationships; complexity scores and line ranges.
* Function-body hashes and file modification dates and change counts.
* HTTP routes, cron schedules, database table names, event names and environment variable names.
* Function signatures, up to 200 characters of each doc comment or docstring, and top-level constant values of up to 128 characters.

Function signatures, doc comments and constant values are encrypted with account-derived keys before storage. Names, paths, routes, modules, dependencies and complexity scores are not. Source-file bodies, function bodies, environment variable values, and commit messages, authors and diffs are not stored in the graph.

Structural metadata and extracted excerpts can still be sensitive. The [open-source parser](https://github.com/Pharaoh-so/pharaoh-parser) shows what is extracted. Authorized MCP tool calls return graph information to the agent you connect.

Pharaoh also keeps a 90-day log of tool calls, including the arguments your agent sends, and the name and version of each connected client.

## Access control

Each person authenticates their client with GitHub. Access follows the authorized personal account, organization membership or repository collaborator permissions. Tool calls check repository access against account records in PostgreSQL, and graph queries are scoped to the requested repository.

Removing GitHub access can require cached authorization to expire before an existing session observes the change; revocation is not guaranteed to be instantaneous. Per-account rate limits help control excessive MCP tool usage.

## Encryption and infrastructure

GitHub credentials and the sensitive graph properties listed above are encrypted at rest with AES-256-GCM. Pharaoh derives separate keys for credentials and graph properties using HKDF, the account ID and a server-managed master key. A GitHub credential stored before its account exists uses a shared sign-up key until its session is next used or refreshed with the account in place. Encryption complements access checks; it does not make the remaining metadata non-sensitive.

Pharaoh uses Render for application hosting and PostgreSQL operational data, Neo4j Aura for the graph, GitHub for authentication and repository access, Stripe for billing and Resend for email. Stripe handles payment details; Pharaoh does not store card numbers. See the [privacy policy](https://pharaoh.so/docs/use-pharaoh/terms-and-privacy.md#privacy) for every provider and what each receives.

## Removal

Uninstalling the GitHub App revokes its GitHub access and starts a 30-day retention period for the account's graph and operational data. Reinstalling before deletion can restore the account and its maps. After deletion, reconnecting requires mapping again.

Removing a repository from the App deletes its graph. A trial or subscription ending deletes no graph: the last map keeps answering. See the [privacy policy](https://pharaoh.so/docs/use-pharaoh/terms-and-privacy.md#privacy) for retention, deletion requests and contact information.

## Design intelligence

When an administrator enrolls a repository, Pharaoh keeps the root `VISION.md` (up to 64 KiB), proposed and approved rules, and the reasons people give for decisions. These records use a repository-specific encryption key. Revoking enrollment removes the key and its records. Before an edit, component and token discovery runs on the local checkout. Opt-in maintenance derives rule suggestions and file-and-line evidence from the temporary default-branch checkout Pharaoh already maps. Enabling maintenance sends only the repository binding and the opt-in setting.

Pharaoh checks current GitHub collaborator access before showing design evidence. A contributor can grant their CLI permission to submit drafts. Publishing a rule change requires a repository and installation administrator to review it and confirm with an enrolled hardware security key.

Private design CI receives a short-lived signed projection of the approved rules for the specific repository, workflow run and checkout. The artifact includes the target paths and constraints required for lint. Vision prose, reasons and review history stay in Pharaoh. A neutral GitHub check can link to an authenticated review.
