> 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/tools-reference/audit.md).

# Audit Tools

Sweep the entire codebase for drift, duplication, dead code, and regression risk. All Audit tools are **Pro** — free tier receives a preview with partial results to demonstrate value.

## get\_vision\_gaps

**Question it answers:** "What's specified but not built? What's built but not specified?"

Finds specs without matching code AND complex code without matching specs. Useful for keeping PRDs and implementation in sync.

**When to use:** During sprint planning, to find unimplemented specs. During cleanup, to find undocumented code.

**Parameters:**

* `repo` (required): Repository name
* `module` (optional): Filter to a specific module

## get\_cross\_repo\_audit

**Question it answers:** "Are shared dependencies drifting between repos?"

Compares two repositories for code duplication, structural overlap, diverged shared modules, and shared environment variables.

**When to use:** When maintaining multiple repos that share code. When evaluating whether to consolidate.

**Parameters:**

* `repo` (required): First repository name
* `target_repo` (required): Second repository name to compare against

## get\_consolidation\_opportunities

**Question it answers:** "Where is duplicate or overlapping logic?"

Finds duplicate code (by function body hash), parallel consumers of the same data, competing DB access patterns, and functions with identical signatures in different modules.

**When to use:** Before a refactor pass. When reducing codebase surface area. When investigating why the same bug appears in multiple places.

**Parameters:**

* `repo` (required): Repository name
* `module` (optional): Filter to a specific module

## get\_unused\_code

**Question it answers:** "What code is never called and safe to delete?"

Finds functions unreachable from any production entry point. Uses dual verification: graph reachability AND text-reference backup. Returns three tiers:

* **Dead:** Graph-unreachable AND no text references. Safe to delete.
* **Likely Dead:** Graph-unreachable BUT found as text in other files. May be string-dispatched.
* **Alive:** Graph-reachable. Not reported.

**When to use:** During cleanup passes. After a refactor. When reducing bundle size.

**Parameters:**

* `repo` (required): Repository name
* `module` (optional): Filter to a specific module

## get\_test\_coverage

**Question it answers:** "Which modules and functions lack tests?"

Per-module coverage summary showing which files have tests, which high-complexity functions lack them, and overall coverage distribution.

**When to use:** When deciding where to add tests. During code review, to verify new code has test coverage.

**Parameters:**

* `repo` (required): Repository name
* `module` (optional): Filter to a specific module

## get\_regression\_risk

**Question it answers:** "How risky is this change to production?"

Scores functions by likelihood of breaking production based on: cyclomatic complexity, call-graph exposure (number of callers), recent churn (change frequency), and caller count across modules.

**When to use:** Before deploying changes. During PR review, to assess risk. When prioritizing what to test.

**Parameters:**

* `repo` (required): Repository name
* `module` (optional): Filter to a specific module
* `function` (optional): Specific function to score


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pharaoh.so/docs/tools-reference/audit.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
