Skip to main content


The Hack indexer is built into the Hack typechecker. Stable and nightly binaries of the Hack indexer are available.

Run the indexer

The indexer is run via the main glean CLI tool.

> cabal build exe:glean

And index your Hack repository with:

glean index hack DIR --repo name/hash


  • DIR is the root directory containing the Hack project (with .hhconfig)
  • name/hash is the name of the repository to create

Provide the usual --db-root and --schema or --service arguments to glean

In the shell

Hack source can also be indexed directly from the Glean shell:

:index hack DIR

Run the indexer (manually)

hh_server DIR --write-symbol-info JSON \
--config symbol_write_include_hhi=false \
--config symbolindex_search_provider=NoIndex \
--config lazy_decl=true \
--config lazy_parse=true \
--config lazy_init2=true \
--config enable_enum_classes=true \
--config enable_enum_supertyping=true


  • DIR is the root directory containing the .php files
  • JSON is the directory in which to write the output .json files
  • We need several config flags to instantiate hh_server for indexing

The generated files can be ingested into a Glean database using glean create.

Derived predicates

Several predicates should be derived after indexing. For each stored predicate in the schema you should glean derive the predicate.


The schema is in glean/schema/source/hack.angle