Repository Intelligence
Repository Intelligence is a VS Code extension and CLI that indexes source code locally, builds an evidence-backed repository model, tracks code changes, and maintains documentation inside the repository. AI prose is optional; when OpenAI is enabled, only selected/redacted context is sent using the user's API key. Hybrid retrievalRepository Q&A and documentation context now use deterministic hybrid retrieval with Reciprocal Rank Fusion (RRF). Independent channels rank exact symbol/path matches, SQLite FTS lexical hits, graph-proximate entities, semantic-artifact evidence, and entities changed in the latest indexed ChangeSet. The fused ranking is then bounded by the existing context budget and completeness rules. The current semantic channel is local and deterministic; it uses repository semantic artifacts rather than vector embeddings. A future embedding/vector channel can be added as another rank source without replacing the fusion contract. Analysis trust modelRepository Intelligence now persists unresolved relationship gaps and completeness summaries alongside graph edges. Consumers can distinguish a proven absence from a lower-bound graph with dynamic, external, ambiguous, or unsupported relationships. TypeScript additionally emits deeper compiler-backed/runtime-aware relationship facts for overrides, constructor injection, Nest-style routes/providers, middleware/handlers, event subscriptions/publications, persistence/query calls, and captured property reads/writes. See What the current foundation implements
Documentation producedThe managed documentation is repository-native and can include:
Architecture uses stable sections for overview, system context, components, dependencies, runtime flows, deployment, and detected subsystems. API documentation includes an API overview plus one managed section per detected endpoint. Module documentation includes an overview plus one section per detected capability/module. When a new module or endpoint is added, the repository diff marks only relevant documentation sections stale. The recommended workflow regenerates them locally during the pre-push check after the developer has committed code, so the resulting Markdown can be reviewed and committed explicitly. Inside each generated section, Repository Intelligence owns a generated sub-block and preserves a human-maintained sub-block. Human notes therefore survive later regenerations rather than being treated as disposable generated prose. Privacy modelRepository indexing and persistence are local. Repository source is not uploaded to a central indexing service. With AI enabled, Repository Intelligence builds a bounded evidence packet, redacts sensitive material, and sends only that selected context directly to the configured provider. OpenAI is available as a BYOK hosted provider. API keys are stored in VS Code SecretStorage. Offline evidence mode and local Ollama/compatible-provider adapters are also supported. VS CodeRequires desktop VS Code 1.95+ and a trusted filesystem workspace. Primary commands:
Relevant settings:
Run Repository Intelligence: Configure Provider / Set Provider API Key from the extension flow to store the API key securely rather than putting it in source or settings. CLIAfter building:
For OpenAI CLI use, provide the configured provider/model and Language and framework depthTypeScript/JavaScript remains the reference analyzer because it uses the TypeScript compiler API. Compiler programs are now separated by captured nested config boundaries instead of treating the repository as one root project, and repository-local relative The tool never executes repository code, compiler plugins, build scripts, or dependency initialization while indexing. Scale and incremental behaviorThe scanner caps remain 10,000 source files, 100 MiB captured source, and 2 MiB per file. Ordinary incremental updates reuse unchanged source bytes, re-analyze the changed TypeScript import-connected component instead of the whole repository, reuse disconnected project graph state, and update changed persistence rows. TypeScript compiler-config changes intentionally fall back to full structural analysis because they can change global resolution semantics. 200k LOC remains an engineering target, not a benchmark claim; production-scale benchmarking and longer-lived compiler-program reuse are still required. Build and testNode.js 20.11+ is required.
Test status for this implementationThe full verification suite passes on Node.js 20 and Node.js 24. Known boundaries
Documentation generation guardrailsManaged documentation uses document-specific generation contracts rather than one generic prompt. Architecture, API, module/capability, security, and onboarding sections each define required engineering topics and strict evidence rules. Generated claims are tagged to approved topics and rendered under stable Markdown subheadings. The provider is instructed to treat repository text as untrusted data, cite every factual claim, avoid inventing routes/status codes/authentication/deployment/configuration, distinguish static analysis from runtime behavior, avoid secret disclosure, and turn unsupported required topics into explicit evidence gaps rather than generic filler. API prompts additionally forbid assuming an endpoint is public merely because local authentication middleware was not detected; security prompts never certify controls or compliance. Ask Agent response designThe Ask Agent investigates a refreshed, immutable repository snapshot using read-only LangChain tools for source, search, graphs, architecture, behavior, security, changes, and analysis gaps. It retains bounded conversation context for the current extension session and supports activity events, provisional answer streaming, cancellation, and exact source references. Recommendations are supplied only when requested. Ask opens as a conversation with a composer anchored at the bottom. Press Enter to send or Shift+Enter for a new line. Follow-ups retain the conversation, Stop cancels an investigation, and New conversation clears it. Streaming follows the latest message unless you scroll up; use Latest to return. Investigation activity, sources, and limitations can be expanded in place. The Ask Agent uses task-specific evidence-only prompt contracts. Every AI answer must lead with a concise Ask defaults to 12 model calls, 24 tool executions, a 120-second investigation timeout, and a 100,000-character payload limit (a serialized character budget, not a model token limit). Discovery ignores common question words and prioritizes relevant files/symbols. Repeated and overlapping reads return only newly uncovered source lines plus stable references to earlier evidence. Reads are bounded to 240 lines / 12,000 source characters and report continuation coordinates. At 80% of the payload budget, Ask replaces the growing transcript with an evidence working set and continues with tools if all supplied evidence still fits. Only exhausted call budgets or an evidence working set that cannot fit force tool-free partial synthesis. Conversation history yields to source evidence; final citations must belong to the supplied working set. Local diagnostics record payload components, tool-result growth, wire bytes, compaction decisions, and stop reasons. Diagnostics and observabilityRepository Intelligence writes structured, local JSONL diagnostics to Open Repository Intelligence: Open Diagnostics (or Dashboard → Diagnostics) to filter by severity/component, search messages or operation IDs, inspect expandable error details, open the raw JSONL file, or open the VS Code Output channel. Execution/process discoveryExecution/process discovery is now a first-class derived-analysis DAG phase. Detected endpoints, conventional entrypoints, and registered/subscribed handlers seed bounded, branch-aware graph traversal across high-signal runtime relationships. Every flow carries evidence, confidence, termination reasons, unresolved gaps, and truncation state. Semantic artifacts consume these flows rather than rebuilding a single arbitrary call chain. See Relationship intelligenceThe structural DAG now includes a shared language-neutral relationship resolution phase. Language frontends contribute symbols and normalized relationship facts; repository-wide linking happens afterward through one conservative resolver. The Repository IR also has a formal core relationship vocabulary spanning structural, call/reference, type-system, DI, runtime, messaging, persistence, architecture, component, and execution-flow relationships. See |