← CLI reference
§07The index

chi index

Build or refresh this repository's knowledge graph.

chi index [OPTIONS] [PATH]

Works out for itself what is needed: an empty graph is indexed whole, an existing one has only its changed files recompiled and its deleted ones forgotten. Name a file to refresh just that file. --full rebuilds from scratch.

Optional either way: the graph refreshes itself when a model asks it something. Running this is the explicit path.

Arguments
ArgumentWhat it is
[PATH]What to index. A directory is a tree, a file is that file alone. Defaults to this repository
default: .
Options
FlagWhat it does
--fullRebuild from scratch instead of updating what changed. What --json and --timings have always reported on
--no-pruneIndex everything: dependencies, build output, hidden directories, and whatever .chignore says to skip. An order of magnitude more work, so it is asked for rather than assumed. Implies --full, because a wider scope is not a difference against a narrower one
--detectReport the languages found and how well each is supported. Writes no graph unless --opaque is given too
--encryptSeal this repository's index at rest, converting it if it is not sealed already. Ordinarily decided for you — an index is sealed whenever this machine has a key — so this is for a repository indexed before, or one that opted out. Converting rebuilds the index and sets the plaintext store aside rather than overwriting it
--no-encryptIndex in the clear, for a corpus meant to be inspectable with ordinary tools. Decides only for an index that does not exist yet: forgetting a flag can never downgrade a sealed one
Advancedbenchmarking, A/B comparison and debugging
FlagWhat it does
--opaqueWith --detect, also record the files no adapter understands, so they are findable even though nothing can parse them
--timingsPer-stage timings, file taxonomy and the canonical graph hash. Implies --json

Global options

Accepted here as on every command. Repeated on each page so a reader who arrived from a search engine sees them too.

FlagWhat it does
--jsonMachine-readable output
--db <PATH>Knowledge graph to read. Defaults to this repository's .chi, found by walking up the way git finds .git
--sessions <PATH>Session memory to read. Same default as --db
--repo <PATH>Repository to act on. Defaults to the current one
--tokenizer <TOKENIZER>Tokenizer to count with
default: o200kone of: o200k · cl100k
--color <WHEN>When to colour the output: auto (a terminal, and NO_COLOR unset), always, or never
default: autoone of: auto · always · never