Codebrain — understand your project in VS CodeAsk about your own code, follow source references, and understand changes before accepting them. The sidebar runs the local Python engine; an AI provider receives the selected source context when an explanation is needed. With local Ollama, that context goes to the local Ollama server instead. Install and startInstall Codebrain — Understand Your Code from the VS Code Marketplace when
published. For a downloaded
The extension is free to install. Cloud usage is billed or rate-limited by your
provider; Codebrain does not include credits or a shared API key. OpenRouter and
Ollama need no extra Python packages. Anthropic requires its Python SDK in the
interpreter selected by Codebrain: run Codebrain requires desktop VS Code 1.80+ with an on-disk folder. In SSH, WSL or Dev Containers, install Python/Git and optional Ollama in the remote environment where the workspace extension runs. Browser-only and virtual workspaces are not supported. In a multi-root workspace Codebrain currently analyzes the first folder. See data handling and privacy for what is sent to your selected provider and what stays on your computer. Run from source
Python is detected automatically ( Choose your model and API key
You can also type a model ID manually. OpenRouter selections are checked against
the chat-compatible catalogue before saving or sending a request; an incompatible
saved model opens setup instead of sending a chat request. If the catalogue cannot
be reached, the validation error is shown without making an inference request. OpenRouter
uses Other options:
Keys entered in the panel are saved in VS Code's encrypted
SecretStorage,
not in the repository, normal settings, or chat history. Leaving the key field
blank keeps the saved key. Remove the saved key deletes that provider's stored
key; an existing environment key may still be used. The chosen provider/model is
remembered across projects. Saving settings starts a fresh chat and makes that
selection take precedence over The panel sends the key to the local Python bridge through stdin, rather than command-line arguments. Model lists load on request; saving settings does not make a paid test-generation call. Explain changesSave your files, then click Explain changes or run Codebrain: Explain My Changes from the Command Palette. It explains staged edits, unstaged edits, new files, and deletions. Staged and unstaged versions are labeled separately. It uses the selected project folder's Git working tree, not committed history. It cannot determine whether AI or a person wrote a change. Binary contents are omitted. Large patches and source files are excerpted and marked. A clean checkout or one containing only excluded changes returns a message without making an AI request. Source links and follow-upsChat and settings are separate views. Use Back to chat to return without losing the current conversation. Answers use the full reading area; scrolling up while an answer streams keeps your reading position. All chat messages, including greetings and messages without search matches, go to the selected model. In-scope answers stream after the scope check. There are no canned greeting or missing-file answers in chat. If retrieval finds nothing, the model is told that source evidence is unavailable; it can give relevant help or ask for clarification without inventing project behavior. Authentication failures, rate limits, timeouts, empty output and interrupted streams are displayed as errors. Partial text remains visible with an Answer interrupted label; failed turns do not enter conversation memory. No canned reply or automatic provider switch substitutes for a failed API call. Click a reference such as Conversations and unfinished drafts are saved automatically in VS Code's local workspace storage, outside your repository. Closing VS Code, reloading the extension, or hiding the panel restores the selected chat when you reopen the same project/workspace. Reopening a chat does not call the AI again. Use the History icon in the toolbar to reopen earlier conversations. New chat preserves the previous chat in History. You can delete individual chats from History after confirming the deletion. Histories are separated by project; they are not uploaded to a Codebrain service or synced between computers. The complete transcript is retained locally. Only the last six successful question/answer pairs (up to 2,000 characters per message) are reused as model context. Failed/stopped/interrupted responses remain visible but are never sent as successful assistant turns. Closing during generation preserves the partial text; on reopening it is labeled interrupted. During streaming, snapshots are saved approximately every 250 ms; an abrupt process kill may lose the most recent unsaved portion. Normal shutdown flushes pending writes. Changing file access rules starts fresh model context without deleting the saved transcript. Source links in reopened chats are checked against current exclusions before opening. Save editor changes before asking; the engine reads files on disk, not unsaved buffers. Chat transcripts use ordinary local VS Code workspace storage. Provider keys entered in Model & API remain in encrypted SecretStorage and are not included in chat records. Text you type into the chat, including any sensitive content, is part of the saved transcript. Saved chats remain until you delete them or clear VS Code's workspace data. Choose which files can be sentOpen the settings icon → Manage excluded files to edit the
Or add a
These are additive exclusion globs. Basenames match anywhere; paths are relative
to the project root; a directory excludes its descendants. Negation ( The same exclusions apply to the project map, search, source excerpts, and Git
diffs, including deleted files. Focus and scopeCodebrain answers the actual engineering question first, with enough reasoning to understand the code or make a decision. There is no blanket short-answer limit. Unrelated tours, recaps and generic advice are discouraged unless they help. Chat uses a separate model-backed scope check before generating an answer. Code explanations, debugging, architecture, relevant examples, Codebrain setup and engineering follow-ups are allowed. Greetings and thanks remain natural. Unrelated songwriting, role changes and other off-topic tasks receive a brief, polite, model-generated boundary response. Music-related code is still within scope. Mixed requests should receive help with the coding portion only. User messages and history cannot change the purpose. Repository maps and source are supplied as untrusted user-role evidence, not system instructions. No scope control is exposed through chat or a settings toggle. Invalid or failed scope checks stop the request with an error instead of silently allowing it. Classifier JSON is never streamed into the chat. An allowed chat message makes two model calls: scope check, then the streamed answer. A declined/unclear message uses the gate's generated response. This adds latency and API usage. A model-backed gate is not a guarantee against every prompt injection; model quality and output behavior still require live evaluation. An optional live routing check is provided at the repository root:
This makes 19 real API/model calls using the provider environment settings
(including a local Accuracy and checksAnswers receive source with original line numbers. Search results are candidate matches, not proof of a runtime connection. The model is instructed to cite evidence and identify missing context; Codebrain does not run your app or verify that a suggested diagnosis is correct. From the repository root:
Checks use temporary Git checkouts and mocked providers/VS Code APIs. They do not require API keys and do not measure live model quality. |