Indexing & Watch
Indexing is the first step to building your knowledge graph. NestWeaver parses source files across 32 languages, resolves cross-file references with confidence scoring, computes PageRank for symbol importance, and stores everything in a LadybugDB graph database. The index command auto-detects the repo root from .git and supports incremental re-indexing on subsequent runs — only changed files are re-parsed.
Command reference
Section titled “Command reference”| Command | Description | Key Flags |
|---|---|---|
index | Parse and index a repository | --repo, --name, --db, --force, --with-trigrams, --with-git-activity, --config, --json, --fail-on-skip, --setup |
watch | Live re-indexing via filesystem watcher | positional repo path, --db, --instance, --config, --refresh-wiki-hours, --force |
watch-stop | Stop the daemon’s active file watcher | --db |
list-repos | List all indexed repositories | --instance, --json, --db, --config |
remove-repo | Remove a repo and all its data from the graph | positional target, --db |
prune-stale | Remove repos/vaults whose source paths no longer exist | --db, --json |
stale-check | Compare each repo’s indexed SHA and resolver generation | --json, --db, --config |
Indexing a repository
Section titled “Indexing a repository”# Index the current directory (auto-detects .git)nestweaver index
# Index a specific path with a custom namenestweaver index --repo ./my-project --name my-project
# Full re-index, bypassing incremental detectionnestweaver index --repo ./my-project --force
# Index with git activity data for recency-based rankingnestweaver index --repo ./my-project --with-git-activity --config ./instance.toml
# Index with trigram tables for faster regex searchnestweaver index --repo ./my-project --with-trigramsUse --name to avoid basename collisions when multiple repos share generic names like “client” or “server”. Without it, NestWeaver derives the name from the directory basename, which can clash.
--with-git-activity mines git history to write a recency sidecar that demotes dormant code at rank time. This is useful for large repos where recently active files should surface higher in query results.
--with-trigrams builds a trigram posting table that accelerates regex-search. The trigram index adds some time to the initial build but makes subsequent regex queries significantly faster.
What indexing skips and discloses
Section titled “What indexing skips and discloses”Indexing reports what it could not read instead of failing silently or failing the whole run. --json lists each skip under skipped_files with a reason code, and coverage_status reads "degraded" whenever a skip is not a deliberate exclusion. --fail-on-skip exits 1 in that case, which is the gate to use in CI.
- Unreadable files and directories. An unreadable source in a language that cannot define an API contract is skipped and disclosed. An unreadable JavaScript, TypeScript, Java or Kotlin source fails the index instead, because it might be a route handler and skipping it would publish an incomplete contract set. An unreadable directory gets one disclosure, not one per file.
- Files that vanish mid-scan, for example during a checkout or rebase, are indexed as deletions.
- Binary files with a source extension (an MPEG transport stream named
.ts) are skipped as onebinaryrow. - Ignored files.
.gitignore,.ignoreand.git/info/excludeare honoured, including for tracked files. The watcher reconciles edits to those files: newly hidden sources leave the graph and newly visible ones are indexed. - A malformed OpenAPI spec is skipped and disclosed as degraded coverage rather than failing every index. Pathologically nested specs are refused quickly.
- Unsafe roots. System pseudo-filesystems such as
/proc,/sysand/dev, and other system roots, are refused as repo or vault roots.
Indexing never runs programs from the repository it reads. Git is called with the repository’s hooks, fsmonitor, credential helpers, filter, textconv and external-diff drivers, pager and askpass programs disabled, and Git metadata that points into another repository (a forged commondir or gitfile) is refused. Working-tree status and diff calls also pass --ignore-submodules=dirty, so a submodule’s own filter programs never run; a submodule whose recorded commit moved still shows as changed. Submodule contents are not indexed.
Go files marked //go:build ignore (or the legacy // +build ignore) are left out of package resolution and build variants, as go build leaves them out.
Upgrading to 12.2.8
Section titled “Upgrading to 12.2.8”Stop the old daemon and back up with the previous binary before installing. Resolver generation is 24 and parsed cache version is 18. Force re-index every repository once, then refresh any vault that still reports stale Markdown derivation. Keep the same database and config bindings. A plain incremental index can leave old graph facts unchanged at Git HEAD.
nestweaver index --repo /path/to/repo --db /path/to/nestweaver.lbug --config /path/to/instance.toml --forcenestweaver brain refresh /path/to/vault --db /path/to/nestweaver.lbug --config /path/to/instance.tomlnestweaver stale-check --db /path/to/nestweaver.lbug --config /path/to/instance.tomlMarkdown derivation 4 updates eligible vaults on daemon startup. LadybugDB 0.22.3 retains storage format 49. If upgrading from an older engine, preserve the old-binary backup for the storage-format 47→49 rollback boundary. See the 12.2.8 release and upgrade guide for the distinction.
Upgrading to 12.2.5
Section titled “Upgrading to 12.2.5”Before running the new version against an existing database, stop the old daemon and back up with the previous binary. The new engine can migrate storage format 47 to 49; downgrading after migration requires that backup. Force re-index each repository once for resolver generation 21 and parsed cache version 15, keeping your normal database and config bindings.
Upgrading to 12.2.4
Section titled “Upgrading to 12.2.4”12.2.4 uses resolver generation 19, parsed cache 13 and Markdown derivation 3. Compared with 12.2.3 (generation 17 / cache 11), Scala cached declarations and PHP namespace/alias resolution changed. Force-index every repository, then refresh each registered vault for encoded and absolute in-vault note links:
nestweaver index --repo /path/to/repo --db /path/to/nestweaver.lbug --forcenestweaver brain refresh /path/to/vault --db /path/to/nestweaver.lbugnestweaver stale-check --db /path/to/nestweaver.lbugPreserve the installation’s --config binding as well. A plain incremental run
may keep old edges. See 12.2.4 release and upgrade and
verify agent activation. Earlier instructions below
remain historical upgrade guidance.
Upgrading to 12.2.3
Section titled “Upgrading to 12.2.3”12.2.3 includes the release-hardening fixes since 12.2.2. The resolver generation moves from 12 to 17, and parsed cache from 8 to 11. Existing graphs can retain missing Go call edges even when their sources are unchanged. Rebuild each repository once, then refresh each registered vault against the rebuilt graph:
nestweaver stale-check --db /path/to/nestweaver.lbugnestweaver index --repo /path/to/my-project --db /path/to/nestweaver.lbug --forcenestweaver brain refresh /path/to/my-vault --db /path/to/nestweaver.lbugRepeat the index for every repository and the refresh for every vault. Preserve
your usual --config binding too. A plain index at HEAD can leave the old
resolver generation unchanged. stale-check exits 2 for a mismatched generation;
dead-code refuses instead of returning results from stale edges.
This release repairs Go slice-range receiver ownership, factory-call receivers, package-member recreation and if/switch/case binding lifetimes. See the 12.2.3 release notes for the other fixes and upgrade checks. New databases need no resolver migration. An incompatible LadybugDB storage format requires the publication rebuild procedure, rather than only a forced index.
Upgrading to 12.2.2
Section titled “Upgrading to 12.2.2”12.2.2 changes how calls and imports resolve (resolver generation 12, parsed cache 8) and how vault links are derived. After upgrading, run both steps once:
# Once per repository: a full re-index, not an incremental onenestweaver index --repo ./my-project --db ./nestweaver.lbug --force
# Once per vault: re-derive notes and linksnestweaver brain refresh ./my-vault --db ./nestweaver.lbugUntil a repository is re-indexed, stale-check exits 2 for it, dead-code refuses, and blast-radius misses the new edges. The vault refresh is not automatic in this release, because the Markdown derivation version did not change; without it, [[wikilink]] values in frontmatter relationships and [[Note#^id]] block references keep their old, unresolved state.
Upgrading: re-index with --force
Section titled “Upgrading: re-index with --force”Every graph records the resolver generation that built it, and compatibility is an exact match. When a release changes how calls and imports resolve, nestweaver stale-check reports the repo as outdated_resolver and exits 2, dead-code refuses, and rankings are marked stale. Re-index once per repo with --force:
nestweaver stale-check --db ./nestweaver.lbugnestweaver index --repo ./my-project --db ./nestweaver.lbug --forceA plain index is not enough: a generation-stale repo can already be at git HEAD, so the incremental path finds nothing to do. In 12.2.8 the generation is 23; every repository recorded at another generation needs one forced re-index. Use the release-specific notes above for vault refresh instructions.
An index that is killed part-way is recorded as incomplete: stale-check reports the repo as incomplete, and the next index rebuilds it in full.
Live re-indexing
Section titled “Live re-indexing”# Watch for changes and re-index incrementallynestweaver watch
# Watch a specific reponestweaver watch ./my-projectThe watcher monitors for creates, modifies, and deletes of supported source files. Changes are debounced into 2-second windows, and each batch triggers an incremental re-index. This keeps the graph current as you code without manual re-runs. A watcher batch resolves against the whole repository the same way a full index does, so re-exports and type-aware member calls into unchanged files keep their edges; a file the batch cannot re-parse keeps its existing edges. Press Ctrl-C to stop cleanly.
The watcher runs inside the daemon. If a watch was killed without a clean shutdown, nestweaver watch-stop releases the watcher slot (it does not start a daemon), or watch --force replaces the old watcher. A watcher that cannot publish a batch is reported by nestweaver brain status.
Managing indexed repos
Section titled “Managing indexed repos”# List all indexed reposnestweaver list-repos --json
# Remove a repo by name, path, or UIDnestweaver remove-repo my-project
# Clean up repos whose directories were deleted or movednestweaver prune-staleremove-repo accepts a repo name, remote URL, filesystem path, file:// URL, or UID, including the exact URL: and UID lines list-repos prints. A name several repos share is ambiguous: the command exits 3 and lists them, so pass the UID. It cascade-deletes all symbols, files, services, and contracts belonging to that repo. On-disk files are not touched.
prune-stale scans every indexed repo and vault, checks whether its source path still exists on disk, and removes those whose path is not found. A path that cannot be checked (for example, an unreadable parent directory) is kept and reported as a warning. Run it after reorganizing or deleting project directories to keep the graph clean.