How to Set Up Egonex AI to Auto-Update After Every Git Commit

Copy the provided hook from understand-anything-plugin/hooks/auto-update-prompt.md to .git/hooks/post-commit, make it executable, and configure it to run pnpm commands that rebuild the core packages and regenerate the knowledge graph after each commit.

The Understand-Anything repository from Egonex-AI is a pnpm workspaces monorepo that requires rebuilding its TypeScript core and WASM-based tree-sitter parser to keep the analysis dashboard current. To eliminate manual steps, the repository provides a ready-made Git hook that triggers the build pipeline automatically after every git commit. This creates a "live-analysis" experience where the dashboard reflects code changes instantly without manual refreshes.

Prerequisites

Before configuring the auto-update hook, ensure your environment meets the following requirements:

  • Node.js 22 or higher installed
  • pnpm installed globally (npm i -g pnpm)
  • Repository cloned and dependencies installed (pnpm install)

The monorepo structure places the core engine in packages/core and the dashboard UI in packages/dashboard, with build outputs written to the .understand-anything/ directory.

Installing the Auto-Update Hook

The repository includes a pre-written hook at understand-anything-plugin/hooks/auto-update-prompt.md. Install it by copying it to your local Git hooks directory and setting execution permissions.


# From the repository root

cp ./understand-anything-plugin/hooks/auto-update-prompt.md .git/hooks/post-commit
chmod +x .git/hooks/post-commit

This single-step installation wires the post-commit event to the build pipeline, ensuring every commit triggers the analysis refresh.

Configuring the Build Pipeline

The hook executes the same commands documented in README.md and CLAUDE.md. It reinstalls dependencies, rebuilds filtered workspace packages, and regenerates the knowledge graph that powers the dashboard.

#!/usr/bin/env bash

# Auto-update the Understand-Anything analysis after each commit

# Re-install any new dependencies added since last commit

pnpm install

# Rebuild the core package including Tree-Sitter WASM

pnpm --filter @understand-anything/core build

# Rebuild the dashboard package (optional if running UI)

pnpm --filter @understand-anything/dashboard build

# Regenerate the knowledge graph for the current codebase

node ./scripts/generate-large-graph.mjs

# Optional: Restart the dev server if running locally

# pkill -f "pnpm dev:dashboard" && pnpm dev:dashboard &

The pnpm --filter @understand-anything/core build command compiles the TypeScript sources and WASM parser, while node ./scripts/generate-large-graph.mjs outputs the updated .understand-anything/knowledge-graph.json that the dashboard consumes.

Verifying the Auto-Update Workflow

Test the configuration by making a commit and observing the hook execution:


# Make a small change to trigger analysis

echo "// test change" >> src/example.ts
git add src/example.ts
git commit -m "Test auto-update hook"

# Watch for build output in the terminal

# Then launch or refresh the dashboard

pnpm dev:dashboard

After the commit completes and the build finishes, the dashboard automatically reloads the graph from .understand-anything/knowledge-graph.json, displaying the new source file in the knowledge graph without requiring a manual page refresh.

Key Files and Architecture

Understanding these specific files helps troubleshoot and customize the auto-update behavior:

Summary

  • Git hooks in understand-anything-plugin/hooks/ provide the post-commit script template for automatic updates.
  • pnpm workspace filters (--filter @understand-anything/core) rebuild only the necessary packages efficiently.
  • Knowledge graph regeneration via scripts/generate-large-graph.mjs ensures the dashboard reflects the latest code structure.
  • The dashboard dev server watches .understand-anything/knowledge-graph.json and updates the UI automatically when the hook regenerates the file.

Frequently Asked Questions

Where is the post-commit hook template located in the Egonex AI repository?

The template is stored at understand-anything-plugin/hooks/auto-update-prompt.md in the Understand-Anything monorepo. Copy this file to .git/hooks/post-commit in your local clone and make it executable to activate the auto-update behavior.

What Node.js version is required to run the auto-update build pipeline?

The build pipeline requires Node.js 22 or higher, as specified in the repository documentation. This version ensures compatibility with the pnpm workspaces and the WASM-based Tree-Sitter parser compilation executed during the post-commit hook.

How does the dashboard know when to refresh after the hook runs?

The dashboard development server monitors the .understand-anything/knowledge-graph.json file for changes. When the post-commit hook executes node ./scripts/generate-large-graph.mjs, it overwrites this JSON file, triggering an automatic hot-reload in the browser to display the updated analysis.

Can I customize the build commands in the auto-update hook?

Yes, you can edit the .git/hooks/post-commit script after copying it from the template. Common customizations include adding pnpm --filter @understand-anything/dashboard build for UI rebuilds, or uncommenting the dev server restart lines if you need to recycle the dashboard process after large dependency changes.

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 →