CodeContext AI
Turn any file into agent-ready context docs.
What it does
CodeContext AI right-clicks into any file in your workspace and generates a structured Markdown "context document" describing it — purpose, inputs/outputs, side effects, execution flow, and risk areas for every function it finds.
It's built for a specific use case: feeding other AI agents (test generators, refactoring tools, doc generators, code review bots) a compact, structured summary of a file instead of dumping the raw source into their prompt. Point it at a file, get back a .md blueprint next to it.
Features
- One right-click, one doc. Right-click any file in the Explorer → Generate Code Context → a matching
.md file appears next to it.
- Scope-aware analysis. Automatically detects whether a file is a single function or a full multi-function/class file, and adjusts the analysis accordingly.
- Context-window safe. Large files are automatically split and re-assembled so analysis doesn't silently truncate or fail on big files.
- Bring your own model. Works with any provider/model supported by your configured gateway (OpenAI, OpenRouter, Cohere, and others).
- Secrets handled properly. Your API key is stored using VS Code's encrypted
SecretStorage — never written to settings.json, never logged.
Requirements
- An API key for your chosen LLM provider (e.g. OpenRouter, OpenAI, Cohere).
- An internet connection — analysis is performed by a remote model, not locally.
Getting started
- Install the extension.
- On first use, you'll be prompted to configure your provider and API key (or run CodeContext AI: Configure from the Command Palette at any time).
- Right-click any file in the Explorer and choose Generate Code Context.
- A
<filename>.md file appears in the same folder with the generated context.
Configuration
| Setting |
Description |
Default |
codeContextAgent.defaultProvider |
The model provider to use (e.g. openai, openrouter, cohere) |
openai |
codeContextAgent.defaultModel |
The specific model name/ID to request from that provider |
provider default |
Your API key is not a setting — it's entered through the guided configuration flow and stored securely via VS Code's Secret Storage, scoped to this extension.
⚠️ Privacy & security
This extension sends the contents of the file you select to a third-party LLM provider for analysis. Please keep this in mind:
- Only run this on files you're comfortable sending to your configured provider.
- The extension will warn you before processing files that look like they might contain secrets (
.env, credentials, keys, etc.) or files above a size threshold — but this is a heuristic, not a guarantee. Use your own judgment on sensitive codebases.
- No code, keys, or output is sent to us (the extension authors) or to Anthropic/any AI provider other than the one you explicitly configure. All requests go directly from your machine to your chosen provider using your own API key.
- We recommend against running this on files containing hardcoded secrets, PII, or proprietary algorithms you don't want leaving your machine, regardless of the built-in warnings.
Known limitations
- Scope detection (single function vs. full file) is heuristic-based and may occasionally misclassify unusual code styles — it's designed to fail safe (falls back to the chunked, file-scope path) rather than fail silently.
- Very large files are processed in chunks; function boundaries that fall exactly on a chunk split may occasionally be documented with slightly less context than functions fully contained in one chunk.
- Output quality depends entirely on the model/provider you configure.
Feedback & contributing
Found a bug or have a feature request? Open an issue on the GitHub repository or use the in-editor feedback option.
License
MIT
| |