ViewGrain
Review code by its intent, at any zoom level (system, area, file, function, step), instead of reading it line by line.
ViewGrain parses your repository into a graph of areas, files and functions, then uses a language model to write a short statement of what each part is for. You start at the top and zoom into whatever needs a closer look. In a branch or pull request, each changed part shows what it did before, what it does now, and whether its meaning changed.
Features
- Codebase mode: explore what a repository does, top-down, from the whole system to individual steps inside a function.
- Changes mode: review your branch against its base, or a GitHub pull request by number or URL, as before → after intent. Changes whose meaning shifted, and concerns the model can point to in the code, are flagged.
- Evidence, not guesses: every intent cites what it is based on (signatures, calls, side effects, tests, docs, commit messages and the PR description), and you can jump to the code.
- Review as you go: mark parts understood or concerning, ask "why?" about any part, and write comments on whatever is in view. For a pull request, comments post to GitHub as one review.
- Cost up front: large runs (such as a whole-codebase overview) show an estimated token cost and ask before starting. Generated intents are cached, so unchanged code is not summarized twice.
Supported languages
TypeScript, TSX, JavaScript (.js, .jsx, .mjs, .cjs) and Python. Files in other languages are left out of the graph.
Getting started
- Open a folder, then click the ViewGrain icon in the activity bar.
- Run ViewGrain: Choose Model Provider… and pick one:
- Anthropic, OpenAI or Google Gemini, using your own API key
- Ollama or LM Studio, running locally
- any OpenAI-compatible server
- Browse the Intent Outline, or click Open Intent View for the zoomable view.
- To review changes, use Review Changes vs Base Branch or the GitHub icon (Review GitHub Pull Request…). The first pull request prompts you to sign in to GitHub.
Choose Models… picks separate models for the many small summaries (a fast, cheap one) and the few high-level ones (your strongest). The fast tier can even use a different provider, for example a local Ollama model for functions and Claude for areas.
Settings
| Setting |
What it does |
viewgrain.provider |
Model provider |
viewgrain.models.fast / viewgrain.models.smart |
Model IDs for the two tiers (empty = provider default) |
viewgrain.baseUrl |
Server URL for Ollama, LM Studio or an OpenAI-compatible server |
viewgrain.fastTier.provider / viewgrain.fastTier.baseUrl |
Optional separate provider for the fast tier |
viewgrain.local.contextWindow |
Context window requested from local models |
viewgrain.autoGenerate |
Generate intents automatically for what you are viewing (default on) |
viewgrain.changes.baseBranch |
Base branch for changes mode (empty = detect) |
Privacy and data
- Your code goes to the model provider you choose. To write intents, ViewGrain sends source code and related context (function bodies, signatures, tests, comments, commit messages, PR descriptions) to that provider. With a hosted provider (Anthropic, OpenAI, Gemini), that provider's data policies apply. With Ollama, LM Studio or a local OpenAI-compatible server, code stays on your machine.
- Generation is automatic by default. Intents are generated for whatever you are viewing. Set
viewgrain.autoGenerate to false to generate only on demand.
- API keys are stored in VS Code's secret storage, never in settings files.
ANTHROPIC_API_KEY, OPENAI_API_KEY and GEMINI_API_KEY / GOOGLE_API_KEY from the environment also work.
- GitHub: ViewGrain signs in through VS Code's built-in GitHub authentication, with the
repo scope, which is needed to read pull requests in private repositories and post reviews. It posts to GitHub only when you submit a review.
- No telemetry. ViewGrain collects nothing about you or your usage. Generated intents and review marks are stored locally in VS Code's extension storage.
Commands
All commands are in the Command Palette under ViewGrain:. Use Rebuild Intent Graph after large changes outside the editor, Test Model Connection to check your setup, and Clear Generated Intents to empty the cache.
| |