# How to Export the Egonex AI Knowledge Graph for External Tools

> Easily export the Egonex AI knowledge graph for external tools via the dashboard, local HTTP endpoint, or disk file. Integrate Egonex AI data seamlessly and unlock new possibilities.

- Repository: [Egonex/Understand-Anything](https://github.com/Egonex-AI/Understand-Anything)
- Tags: how-to-guide
- Published: 2026-06-20

---

**The Egonex AI knowledge graph can be exported via the dashboard's download button, fetched from the local HTTP endpoint at `http://localhost:5173/knowledge-graph.json`, or copied directly from the [`.understand-anything/knowledge-graph.json`](https://github.com/Egonex-AI/Understand-Anything/blob/main/.understand-anything/knowledge-graph.json) file on disk.**

After running a codebase scan with Understand-Anything, the resulting knowledge graph is stored as a JSON file in your project directory. This structured data contains nodes and edges representing your code's architecture, making it valuable for external analysis, visualization, and reporting tools.

## Where the Knowledge Graph is Stored

After running the `/understand` command or a `--full` scan, the graph is written to [`.project-root/.understand-anything/knowledge-graph.json`](https://github.com/Egonex-AI/Understand-Anything/blob/main/.project-root/.understand-anything/knowledge-graph.json). The core persistence layer defines this location using the constant `GRAPH_FILE = "knowledge-graph.json"` in [`understand-anything-plugin/packages/core/src/persistence/index.ts`](https://github.com/Egonex-AI/Understand-Anything/blob/main/understand-anything-plugin/packages/core/src/persistence/index.ts) at line 8.

## Three Methods to Export the Graph

### Dashboard UI Download

The `ExportMenu` component provides a one-click export feature. Located in [`understand-anything-plugin/packages/dashboard/src/components/ExportMenu.tsx`](https://github.com/Egonex-AI/Understand-Anything/blob/main/understand-anything-plugin/packages/dashboard/src/components/ExportMenu.tsx) at line 207, this component creates a `Blob` from the in-memory graph using `JSON.stringify(filteredGraph, null, 2)` and triggers a download of `<project-name>-export.json`.

To use this method:

1. Start the dashboard dev server
2. Click the export icon (gear/download button) in the top-right toolbar
3. Select "Export JSON"

### HTTP Endpoint Access

When running the development server, the graph is served at `http://localhost:5173/knowledge-graph.json` (or the URL defined by `VITE_GRAPH_URL`). The middleware implementation in [`understand-anything-plugin/packages/dashboard/vite.config.ts`](https://github.com/Egonex-AI/Understand-Anything/blob/main/understand-anything-plugin/packages/dashboard/vite.config.ts) at line 130 handles these requests.

For token-gated projects, append the authentication token:

```bash
curl -s "http://localhost:5173/knowledge-graph.json?token=$(cat .understand-anything/token.txt)" -o knowledge-graph.json

```

### Direct File Copy

Since the graph is a plain JSON file on disk, you can access it directly without running the server:

```bash
cp .understand-anything/knowledge-graph.json /path/to/export/location/

```

This method is useful for automated scripts and CI/CD pipelines that need to process the graph after a scan completes.

## Querying and Processing the Exported Data

The exported JSON follows a consistent schema with `nodes` and `edges` arrays. You can query it using `jq` or load it programmatically:

```bash

# List all source files

jq -r '.nodes[]?.filePath' knowledge-graph.json | sort -u

# Count edges from a specific file

jq '[.edges[] | select(.source == "file:src/app.ts")] | length' knowledge-graph.json

```

For TypeScript projects, import the schema from `@understand-anything/core/schema` to ensure type safety when processing the graph:

```typescript
import graph from "./knowledge-graph.json";

console.log(`Nodes: ${graph.nodes.length}, Edges: ${graph.edges.length}`);

```

## Summary

- The knowledge graph is automatically saved to [`.understand-anything/knowledge-graph.json`](https://github.com/Egonex-AI/Understand-Anything/blob/main/.understand-anything/knowledge-graph.json) after scanning
- **Dashboard UI**: Use the `ExportMenu` component in [`ExportMenu.tsx`](https://github.com/Egonex-AI/Understand-Anything/blob/main/ExportMenu.tsx) to download filtered JSON directly from the browser
- **HTTP endpoint**: Fetch from `http://localhost:5173/knowledge-graph.json` with optional token authentication via the middleware in [`vite.config.ts`](https://github.com/Egonex-AI/Understand-Anything/blob/main/vite.config.ts)
- **Direct access**: Copy the JSON file directly from the persistence layer defined in [`persistence/index.ts`](https://github.com/Egonex-AI/Understand-Anything/blob/main/persistence/index.ts)
- The graph structure includes `nodes` and `edges` arrays suitable for analysis with `jq` or programmatic processing

## Frequently Asked Questions

### Can I export the knowledge graph without running the dashboard server?

Yes. The graph is stored as a plain JSON file at [`.understand-anything/knowledge-graph.json`](https://github.com/Egonex-AI/Understand-Anything/blob/main/.understand-anything/knowledge-graph.json) immediately after the scan completes. You can copy or move this file using standard filesystem commands without starting the development server, as implemented in the core persistence layer.

### Does the HTTP endpoint require authentication?

Authentication depends on your project configuration. If token-gating is enabled, you must include the token as a query parameter when fetching from `http://localhost:5173/knowledge-graph.json`. The token is stored in [`.understand-anything/token.txt`](https://github.com/Egonex-AI/Understand-Anything/blob/main/.understand-anything/token.txt) and can be referenced directly in your curl commands according to the middleware logic in [`vite.config.ts`](https://github.com/Egonex-AI/Understand-Anything/blob/main/vite.config.ts).

### What is the schema of the exported JSON?

The exported knowledge graph follows a standardized schema defined in the core package at `@understand-anything/core/schema`. It contains top-level `nodes` and `edges` arrays, where nodes represent code entities (like files and functions) and edges represent relationships between them.

### Can I filter the graph before exporting?

Yes. When using the dashboard UI export method, the `ExportMenu` component in [`ExportMenu.tsx`](https://github.com/Egonex-AI/Understand-Anything/blob/main/ExportMenu.tsx) applies filters to the in-memory graph before serialization via `JSON.stringify()`. You can modify the filtering logic to include only specific node types or relationships based on your external tool's requirements.