# How to Enable Auto-Update on Every Commit with --auto-update in Understand Anything

> Learn to enable auto-update on every commit in Understand Anything using the --auto-update flag. Streamline your workflow effortlessly. Explore the Egonex-AI/Understand-Anything repository now.

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

---

How to Enable Auto-Update on Every Commit with --auto-update in Understand Anything

**Run `understand --auto-update` to enable automatic knowledge-graph updates on every Git commit, which writes `{"autoUpdate": true}` to [`.understand-anything/config.json`](https://github.com/Egonex-AI/Understand-Anything/blob/main/.understand-anything/config.json) and installs a post-commit hook that incrementally patches the graph without manual intervention.**

Understand Anything is an open-source tool by Egonex-AI that maintains a structural knowledge graph of your repository. When you enable the `--auto-update` flag, it configures a post-commit hook that keeps this graph synchronized with your code changes automatically, eliminating the need for manual rebuilds after every commit.

## How --auto-update Works

The auto-update mechanism operates through three coordinated components defined in the source code that detect commits and incrementally update the knowledge graph.

### Configuration File Creation

When you execute the command with the `--auto-update` flag, the skill defined in [`understand-anything-plugin/skills/understand/SKILL.md`](https://github.com/Egonex-AI/Understand-Anything/blob/main/understand-anything-plugin/skills/understand/SKILL.md) writes a JSON configuration file to your project root. This stores the boolean flag that controls subsequent hook behavior.

Run this command from your project root:

```bash
understand --auto-update

```

This creates or updates [`.understand-anything/config.json`](https://github.com/Egonex-AI/Understand-Anything/blob/main/.understand-anything/config.json) with:

```json
{
  "autoUpdate": true
}

```

### Post-Commit Hook Activation

The repository's hook system, defined in [`hooks/hooks.json`](https://github.com/Egonex-AI/Understand-Anything/blob/main/hooks/hooks.json), monitors Git operations and triggers updates when specific conditions are met. According to the source code at lines 9-19, the hook validates three conditions before emitting an auto-update prompt:

- A Git-related command (`commit`, `merge`, `rebase`, etc.) is running
- [`.understand-anything/config.json`](https://github.com/Egonex-AI/Understand-Anything/blob/main/.understand-anything/config.json) exists and contains `"autoUpdate": true`
- The knowledge-graph files are present in the repository

### Incremental Update Execution

When conditions are met, the hook instructs Claude-Code to read [`hooks/auto-update-prompt.md`](https://github.com/Egonex-AI/Understand-Anything/blob/main/hooks/auto-update-prompt.md) and execute the incremental update script. As implemented in lines 245-252 of that file, this process loads the existing [`fingerprints.json`](https://github.com/Egonex-AI/Understand-Anything/blob/main/fingerprints.json), re-analyzes only the changed files, patches the fingerprint map, and saves the updated graph without requiring a full rebuild.

## Prerequisites: Baseline Fingerprints Required

Before the first auto-update runs, you must generate a **baseline fingerprint**. The `build-fingerprints.mjs` skill creates this baseline and stores it under `.understand-anything/`. 

According to the implementation in [`understand-anything-plugin/skills/understand/SKILL.md`](https://github.com/Egonex-AI/Understand-Anything/blob/main/understand-anything-plugin/skills/understand/SKILL.md) (lines 746-765), if the baseline is missing, the first incremental run treats every file as *STRUCTURAL* and falls back to full graph regeneration, effectively disabling the performance benefit of incremental updates.

Generate the baseline first:

```bash
node ./understand-anything-plugin/skills/understand/build-fingerprints.mjs

```

## Step-by-Step Setup

Follow these commands to enable and use auto-update in your workflow:

**1. Enable auto-update**

```bash
understand --auto-update

```

**2. Create baseline fingerprints (first time only)**

```bash
node ./understand-anything-plugin/skills/understand/build-fingerprints.mjs

```

**3. Use your normal Git workflow**

```bash
git add .
git commit -m "Refactor data-flow module"

```

When you commit, you will see a console message:

```

[understand-anything] Commit detected with auto-update enabled.

```

The hook automatically runs the incremental update script in the background.

## Managing Auto-Update Settings

You can disable the feature at any time using the `--no-auto-update` flag:

```bash
understand --no-auto-update

```

This writes `"autoUpdate": false` to the config file, preventing the post-commit hook from triggering.

To manually trigger an incremental update outside of a commit (for example, after a large rebase), invoke the script directly:

```bash
node ./understand-anything-plugin/skills/understand/build-fingerprints.mjs --incremental

```

## Summary

- The `--auto-update` flag writes configuration to [`.understand-anything/config.json`](https://github.com/Egonex-AI/Understand-Anything/blob/main/.understand-anything/config.json) as defined in [`understand-anything-plugin/skills/understand/SKILL.md`](https://github.com/Egonex-AI/Understand-Anything/blob/main/understand-anything-plugin/skills/understand/SKILL.md)
- The hook logic in [`hooks/hooks.json`](https://github.com/Egonex-AI/Understand-Anything/blob/main/hooks/hooks.json) detects Git commits and checks the config file before triggering updates
- Incremental updates run via [`hooks/auto-update-prompt.md`](https://github.com/Egonex-AI/Understand-Anything/blob/main/hooks/auto-update-prompt.md), which patches only changed files using existing [`fingerprints.json`](https://github.com/Egonex-AI/Understand-Anything/blob/main/fingerprints.json)
- A baseline fingerprint is required before auto-update works; without it, the system falls back to full regeneration
- Disable auto-update anytime with `--no-auto-update`

## Frequently Asked Questions

### What file does --auto-update create?

The command creates or modifies [`.understand-anything/config.json`](https://github.com/Egonex-AI/Understand-Anything/blob/main/.understand-anything/config.json) in your project root. This file contains a JSON object with an `autoUpdate` boolean property that the post-commit hook reads to determine whether to trigger incremental updates.

### Why do I need a baseline fingerprint before using auto-update?

The incremental update system compares current file states against stored fingerprints to identify changes. Without the baseline generated by `build-fingerprints.mjs`, the system cannot determine what changed, forcing a full graph rebuild on the first run and negating the performance benefits of incremental patching.

### How do I disable auto-update after enabling it?

Run `understand --no-auto-update` to write `"autoUpdate": false` to the configuration file. This prevents the hook in [`hooks/hooks.json`](https://github.com/Egonex-AI/Understand-Anything/blob/main/hooks/hooks.json) from executing the update prompt on subsequent commits, effectively pausing automatic synchronization without removing the knowledge graph data.

### Can I run the incremental update manually without committing?

Yes. You can manually invoke the incremental update script by running `node ./understand-anything-plugin/skills/understand/build-fingerprints.mjs --incremental`. This is useful after operations like rebasing or cherry-picking that modify history without triggering post-commit hooks.