Context & Search
These commands retrieve information from the NestWeaver knowledge graph. The context command is the workhorse — it runs Personalized PageRank seeded from your query to surface structurally relevant symbols, ranked by importance. For targeted reading, read-symbols returns just a symbol’s source span without reading the whole file.
Command reference
Section titled “Command reference”| Command | Description | Key Flags |
|---|---|---|
context | PPR-ranked context around seed symbols | --intent, --limit, --token-budget, --feature, --config, --json |
search | Full-text search across indexed symbols | --limit, --json, --config |
symbol | Look up a symbol by name or UID | --instance, --json |
read-symbols | Read a symbol’s source span | --neighbors, --token-budget, --root, --json |
regex-search | Regex search over indexed text | --path-prefix, --kinds, --limit, --max-millis, --json |
count-patterns | Count regex matches per pattern | --path-prefix, --kinds, --json |
investigate | Orient on a topic in one call | --scope, --token-budget, --root, --json |
repo-map | Token-budgeted structural skeleton | --token-budget, --json |
summary | Hierarchical code summaries | --level, --token-budget, --target, --json |
Context retrieval
Section titled “Context retrieval”The context command is the primary way to pull ranked, relevant information from the graph. Seed it with symbol names, file paths, or both — NestWeaver resolves them to graph nodes and walks outward using Personalized PageRank.
# Get context for a symbolnestweaver context processPayment
# Multiple seedsnestweaver context processPayment CheckoutService
# Seed from a file pathnestweaver context src/checkout/payment.ts
# With intent tuningnestweaver context processPayment --intent analyze-impact
# With token budget for LLM context windowsnestweaver context processPayment --token-budget 4000
# Feature-scoped context (requires instance config)nestweaver context --feature device-pairing --config ./instance.tomlIntent tuning
Section titled “Intent tuning”The --intent flag adjusts the PPR damping factor and edge-type weights to bias results toward different goals:
find-definition— favors definition edges; surfaces where a symbol is declared.understand-architecture— favors module and containment edges; surfaces structural context.analyze-impact— favors call and dependency edges; surfaces what a change would affect.general-context— balanced weights across all edge types (default).
Token budget vs. limit
Section titled “Token budget vs. limit”--token-budget takes precedence over --limit. When set, NestWeaver truncates the output to fit an approximate token count (estimated as characters / 4). Use --token-budget when feeding results into an LLM context window; use --limit when you just want a fixed number of results.
Search
Section titled “Search”Full-text search across all indexed symbols. Returns matches ranked by BM25 relevance.
# Search by name substringnestweaver search "UserService"
# With result limitnestweaver search "process" --limit 20 --jsonSymbol lookup
Section titled “Symbol lookup”Look up a specific symbol by name or UID. Useful for disambiguation and quick inspection.
# Look up a symbolnestweaver symbol processPayment
# Disambiguate with UIDnestweaver symbol "sym:repo:...:abc:42"Exit codes: 0 = found, 2 = not found, 3 = ambiguous (multiple matches — prints candidates with their UIDs so you can re-query with the exact one).
Reading source
Section titled “Reading source”# Read a symbol's sourcenestweaver read-symbols processPayment
# Include 1 adjacent symbol for surrounding contextnestweaver read-symbols processPayment --neighbors 1
# Budget-aware readingnestweaver read-symbols processPayment CheckoutService --token-budget 4000Regex search
Section titled “Regex search”Search indexed text with regular expressions. count-patterns is the counting counterpart — it returns match counts per pattern without bodies.
# Regex over indexed textnestweaver regex-search 'fn\s+authenticate'
# Restrict to a path prefix and kindnestweaver regex-search '(?i)todo' --path-prefix src/ --kinds Symbol --limit 20
# Count matches without returning bodiesnestweaver count-patterns 'TODO' 'FIXME' --path-prefix src/Investigation
Section titled “Investigation”The investigate command orients you on a topic in a single call. It runs hybrid retrieval (PPR + BM25 + pseudo-relevance feedback), groups results into architectural domains, inlines high-confidence symbol bodies, and persists a bundle with a 24-hour TTL. Use investigate-expand and investigate-hydrate to drill into specific domains or hydrate additional symbols from the bundle.
# Orient on a topic — architectural map + bundle_idnestweaver investigate "device pairing"
# Scoped to a repo with a larger budgetnestweaver investigate "how indexing works" --scope repo:nestweaver --token-budget 8000Repo map and summaries
Section titled “Repo map and summaries”repo-map produces a token-budgeted structural skeleton of the codebase, ranked by PageRank so the most connected symbols appear first. summary generates hierarchical summaries at different granularity levels.
# Structural skeleton ranked by PageRanknestweaver repo-map --token-budget 2000
# File-level summariesnestweaver summary --level file --json
# Cluster-level architecture summarynestweaver summary --level cluster --token-budget 2000Summary levels:
symbol— function and class details: signatures, parameters, return types.file— exports and imports per file.cluster— community-level architecture: what each detected module cluster does and how clusters relate.
Summaries are deterministic and derived from graph data — no LLM is involved.