# Where Is the Global Graphify Graph Stored? File Paths and Implementation Guide

> Discover where the global Graphify graph is stored. Learn about the JSON file path ~/.graphify/global-graph.json and its associated manifest file for repository metadata.

- Repository: [Graphify Labs/graphify](https://github.com/Graphify-Labs/graphify)
- Tags: how-to-guide
- Published: 2026-07-16

---

**The global Graphify graph is stored as a JSON file at `~/.graphify/global-graph.json` in the user's home directory, alongside a manifest file that tracks repository metadata and checksums.**

Graphify maintains a single global knowledge graph that aggregates code relationships from all repositories you add via the `graphify global` commands. Understanding exactly where the global Graphify graph is stored is essential for backup strategies, debugging persistence issues, and programmatic access. According to the Graphify-Labs/graphify source code, the storage layer uses a dedicated directory in the user's home folder to isolate global state from any project-specific working directories.

## Global Graphify Graph Storage Location

The storage location is determined dynamically using Python's `pathlib` module to ensure cross-platform compatibility across Linux, macOS, and Windows environments.

### The `.graphify` Directory Structure

In [`graphify/global_graph.py`](https://github.com/Graphify-Labs/graphify/blob/main/graphify/global_graph.py), lines 10-13 define three critical constants that establish the storage layout:

- **`_GLOBAL_DIR`**: `Path.home() / ".graphify"` — The root directory for all global state data
- **`_GLOBAL_GRAPH`**: `_GLOBAL_DIR / "global-graph.json"` — The serialized NetworkX graph containing aggregated repository data
- **`_GLOBAL_MANIFEST`**: `_GLOBAL_DIR / "global-manifest.json"` — Tracks which repository tags are present and stores the checksum of each source graph

The application creates this directory automatically when first initialized, so no manual setup is required. This isolation ensures that repository-specific operations never interfere with the global aggregated state.

## How Graphify Persists and Loads the Global Graph

The persistence mechanism uses JSON serialization to convert the in-memory NetworkX graph to disk storage, enabling fast loading and human-readable debugging when necessary.

### Loading Operations

Lines 48-60 in [`graphify/global_graph.py`](https://github.com/Graphify-Labs/graphify/blob/main/graphify/global_graph.py) implement `_load_global_graph()`, which handles reading the persisted state:

- Checks for the existence of [`global-graph.json`](https://github.com/Graphify-Labs/graphify/blob/main/global-graph.json) in the `~/.graphify` directory
- Deserializes the JSON content back into a NetworkX graph object using node-link data format
- Returns an empty graph if the file does not exist, handling first-run scenarios gracefully

Before loading, [`graphify/security.py`](https://github.com/Graphify-Labs/graphify/blob/main/graphify/security.py) validates the file size to prevent excessive memory consumption from corrupted or oversized files.

### Saving Operations

Lines 62-68 define `_save_global_graph(G)`, which persists the current graph state:

- Accepts a NetworkX graph `G` as a parameter
- Serializes the graph structure to JSON format
- Writes the output atomically to [`global-graph.json`](https://github.com/Graphify-Labs/graphify/blob/main/global-graph.json)

The manifest follows an identical pattern through `_load_manifest()` and `_save_manifest(manifest)`, ensuring repository metadata remains synchronized with the graph data.

## Programmatically Accessing the Storage Location

You can interact with the global graph storage directly using Graphify's Python API. The following examples demonstrate how to locate the file and manage repository entries:

```python
from pathlib import Path
from graphify.global_graph import global_path, global_add, global_remove, global_list

# Locate the file that stores the global graph

graph_file: Path = global_path()
print(f"Global graph is stored at: {graph_file}")

# Add a repository graph to the global graph

repo_tag = "my-repo"
source = Path("my-repo/graph.json")
result = global_add(source, repo_tag)
print("Add result:", result)

# List the repositories currently tracked in the global graph

print("Tracked repos:", global_list())

# Remove a repository from the global graph

removed = global_remove(repo_tag)
print(f"Removed {removed} nodes belonging to '{repo_tag}'")

```

These operations directly modify the files in `~/.graphify`, with `global_path()` returning the exact `Path` object pointing to [`global-graph.json`](https://github.com/Graphify-Labs/graphify/blob/main/global-graph.json).

## Summary

- The global Graphify graph is stored at `~/.graphify/global-graph.json` in the user's home directory
- A companion manifest file at `~/.graphify/global-manifest.json` tracks repository tags and checksums
- Storage paths are defined in [`graphify/global_graph.py`](https://github.com/Graphify-Labs/graphify/blob/main/graphify/global_graph.py) using `Path.home()` for cross-platform compatibility
- The `_load_global_graph()` and `_save_global_graph(G)` functions handle JSON serialization of the NetworkX graph
- File size validation occurs in [`graphify/security.py`](https://github.com/Graphify-Labs/graphify/blob/main/graphify/security.py) before loading to prevent resource exhaustion
- Programmatic access is available through `global_path()`, `global_add()`, `global_remove()`, and `global_list()`

## Frequently Asked Questions

### What format is the global Graphify graph stored in?

The global graph is stored as a JSON file using NetworkX's node-link data format. This serialization converts the graph structure into a JSON-compatible dictionary before writing to [`global-graph.json`](https://github.com/Graphify-Labs/graphify/blob/main/global-graph.json), enabling human readability and portability across different Python environments while maintaining the complete node and edge relationships.

### Can I move the global Graphify graph to a different location?

The storage location is hardcoded to `~/.graphify` in the current version of Graphify-Labs/graphify. While you cannot configure the path through environment variables or configuration files, you can create symbolic links from `~/.graphify` to another directory if you need to relocate the storage for disk space management or backup purposes.

### How does Graphify handle concurrent access to the global graph?

The source code in [`graphify/global_graph.py`](https://github.com/Graphify-Labs/graphify/blob/main/graphify/global_graph.py) handles file I/O through standard read/write operations without explicit file locking mechanisms. For production use with multiple concurrent writers, you should implement external locking or use the API functions which ensure atomic replacement during save operations to minimize corruption risks.

### What happens if the [`global-graph.json`](https://github.com/Graphify-Labs/graphify/blob/main/global-graph.json) file becomes corrupted?

If JSON deserialization fails in `_load_global_graph()`, the function typically returns an empty graph or raises a descriptive exception depending on the error handling context. The size-cap validation in [`graphify/security.py`](https://github.com/Graphify-Labs/graphify/blob/main/graphify/security.py) provides an additional safeguard against loading corrupted oversized files, preventing excessive memory consumption from malformed data.