How to Install the Graph Module in activeloopai/hivemind

The graph component is a built-in part of the Hivemind package—there is no separate package to install. When you install the Hivemind npm module, the graph command and its runtime are automatically included.

The graph module in the activeloopai/hivemind repository provides code intelligence capabilities for analyzing and visualizing codebase structures. Unlike distributed tools that require separate installations, this module ships as an integrated component of the main Hivemind package. This guide walks you through installing the package and activating the graph functionality for your projects.

Install the Hivemind Package

Since the graph module is bundled with the core library, you only need to install the @deeplake/hivemind package. The graph dependencies, including the Graph VFS, are listed as optional dependencies in the repository’s package.json and are pulled automatically during installation.

npm install @deeplake/hivemind

Verify the Graph Command

After installation, the package’s bin field points to bundle/cli.js, making the hivemind executable available in your path. You can verify that the graph sub-command is registered by checking the help output.

npx hivemind graph --help

This command confirms that the CLI entry point in src/commands/graph.ts is properly loaded and ready to accept graph-specific instructions.

Initialize a Graph for Your Repository

To enable Hivemind to maintain a live code-graph for a specific project, run the initialization command from your project’s root directory.

hivemind graph init

This creates a hidden directory at ~/.deeplake/memory/graph/... where snapshots are stored, as implemented in src/graph/snapshot.ts. The initialization sets up the graphsRoot and repoDir paths necessary for the module to track your codebase’s evolution.

Working with the Graph Module

Once initialized, you can interact with the codebase graph through several CLI commands that leverage the snapshot storage and session management logic.

Query Symbols

Search for specific functions or classes that agents have touched using the query command. This functionality relies on the graph snapshot data stored in your local repository directory.

hivemind graph query "AuthService"

Render Visualizations

Generate static visual representations of your codebase structure. The src/graph/session-context.ts file handles the session state that enables these rendering operations.

hivemind graph render --output graph.png

This outputs a PNG or HTML file showing the current graph state, as documented in the README.md "Codebase graph" section.

Key Implementation Files

Understanding the source structure helps when debugging or extending the graph functionality:

  • src/commands/graph.ts: The CLI entry point that registers the graph sub-command and handles argument parsing for all graph operations.
  • src/graph/snapshot.ts: Manages storage paths and persistence logic for graph snapshots, including the graphsRoot and repoDir variables that determine where data lives on disk.
  • src/graph/session-context.ts: Generates the shell prompt line that advertises graph endpoints during active sessions, enabling real-time code intelligence.

Summary

  • The graph module requires no separate installation—it is bundled with the @deeplake/hivemind package.
  • Install the package via npm install @deeplake/hivemind to access the graph CLI and its optional dependencies.
  • Initialize project-specific graphs using hivemind graph init, which stores data in ~/.deeplake/memory/graph/.
  • Query symbols with hivemind graph query and render visualizations with hivemind graph render.
  • Core logic resides in src/commands/graph.ts and src/graph/snapshot.ts.

Frequently Asked Questions

Is the graph module a separate package from Hivemind?

No. According to the activeloopai/hivemind source code, the graph component is a built-in part of the Hivemind package. When you install @deeplake/hivemind, the graph command and its runtime dependencies are automatically included as optional dependencies in package.json.

Where does Hivemind store graph snapshots?

Graph snapshots are stored in a hidden directory under ~/.deeplake/memory/graph/.... The src/graph/snapshot.ts file handles these storage paths, specifically managing the graphsRoot and repoDir variables to organize snapshots by repository.

How do I verify the graph module is installed correctly?

Run npx hivemind graph --help. If the command returns usage information for the graph sub-command, the module is properly registered. This verifies that the CLI entry point in src/commands/graph.ts is accessible and that the package’s bin field in package.json is correctly configured.

Can I use the graph module without running hivemind graph init?

While you can access the hivemind graph CLI commands immediately after installation, running hivemind graph init is required to create the local storage structure for a specific repository. Without initialization, commands like query and render may not have persistent snapshot data to work with, as the src/graph/snapshot.ts logic depends on the initialized directory structure.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →