How to Enable Blarify Code Indexing¶
Blarify is an optional code-graph indexer that imports your codebase into a Kuzu embedded database, enabling memory-aware queries over code structure. It is disabled by default and never activates automatically in non-interactive environments such as CI pipelines.
Contents¶
- Prerequisites
- Enable Blarify
- What Happens at Launch
- Consent and the "Don't Ask Again" Cache
- Non-Interactive Mode
- Staleness Detection
- Troubleshooting
Prerequisites¶
- Install the
blarifyPython package: - Optionally install
scip-pythonfor a ~330× indexing speed increase:
Enable Blarify¶
Set the AMPLIHACK_ENABLE_BLARIFY environment variable to 1 when launching:
Without this variable, the blarify prompt is never shown and indexing never runs, regardless of any other configuration.
To always enable blarify in your shell, add the export to your profile:
What Happens at Launch¶
When AMPLIHACK_ENABLE_BLARIFY=1 is set and the session is interactive, amplihack:
- Checks staleness — queries the Kuzu database to determine whether the index is current.
- Estimates time — measures the codebase and estimates how long indexing will take (e.g.
~30 seconds). - Prompts the user — asks whether to index now, offering a "don't ask again" option.
- Runs the orchestrator — if the user consents, runs
OrchestratorandPrerequisiteCheckerto import the codebase.
If the index is already fresh, step 3 is skipped and no prompt is shown.
Consent and the "Don't Ask Again" Cache¶
When you answer the blarify prompt, you can choose to cache your decision for this project. amplihack stores the consent in a per-project cache file:
On subsequent launches in the same project, the prompt is skipped and the log records:
To reset the cache and be prompted again, delete the cache file:
Or delete all cached consents:
Non-Interactive Mode¶
In non-interactive environments — shells without a TTY, CI runners, scripts using pipes — blarify is always skipped, even when AMPLIHACK_ENABLE_BLARIFY=1 is set. No prompt is shown and no indexing runs.
amplihack detects non-interactive mode via _is_noninteractive(), which checks for an attached TTY. This is intentional: indexing during automated runs would block pipelines and fail silently on machines without blarify installed.
# This will NOT run blarify — stdin is a pipe, not a terminal
echo "" | AMPLIHACK_ENABLE_BLARIFY=1 amplihack launch
# This WILL run blarify — stdin is an interactive terminal
AMPLIHACK_ENABLE_BLARIFY=1 amplihack launch
Staleness Detection¶
Before prompting, amplihack calls check_index_status() to determine whether the existing Kuzu index matches the current codebase state. The returned status has an is_stale flag:
is_stale | Behavior |
|---|---|
True | Prompt is shown; user can choose to re-index. |
False | Prompt is skipped; the fresh index is used as-is. |
Staleness is based on file modification times and content hashes stored in the index. A newly created project always reports is_stale = True.
Troubleshooting¶
Blarify prompt never appears¶
Check that all three conditions are met:
# 1. Variable must be set to '1' (not 'true', not 'yes')
echo $AMPLIHACK_ENABLE_BLARIFY # Should print: 1
# 2. Session must be interactive
[ -t 0 ] && echo "interactive" || echo "non-interactive"
# 3. blarify package must be importable
python3 -c "import blarify; print('ok')"
Indexing fails with "PrerequisiteChecker error"¶
# Run the prerequisite check standalone to see the failure reason
python3 -c "
from amplihack.memory.kuzu.indexing.prerequisite_checker import PrerequisiteChecker
checker = PrerequisiteChecker()
result = checker.check()
print(result)
"
Index is always stale¶
Delete the index and re-run to force a clean build:
See Also¶
- Blarify Integration Overview — architecture, node types, schema
- Blarify Quick Start — first-time setup with Neo4j
- CLI Reference —
AMPLIHACK_ENABLE_BLARIFYenvironment variable