Context Bundle for AI
Copy complete files and exact code selections into clean, structured context for AI assistants — without manually opening, copying, and labeling every file.
Context Bundle for AI uses VS Code's native file picker, searches the entire workspace, supports unsaved editor content, and can copy the result to the clipboard or save it as a text file.
Features
- Native VS Code file picker with a strong filename and a dimmed, searchable path.
- Complete workspace search without silently limiting the list to the first N files.
- Multi-file selection from the Explorer, editor, or Command Palette.
- Add all open files with one picker button.
- Partial file context that stores exact snapshots of selected code.
- Full-file override: selecting a partial file includes its current full content instead.
- Relative or absolute paths, switchable directly from the picker.
- Custom file separator configured in VS Code Settings.
- Clipboard and file output.
- Unsaved editor support for complete open files.
- Binary and oversized-file protection.
- Multi-root workspace support.
Quick start
- Right-click a file, folder, or editor and choose Copy Context For AI.
- Search for files by filename or directory path.
- Select any complete files you want to include.
- Optionally use the toolbar buttons to add every open file or switch path style.
- Press Enter.
- Choose Copy to clipboard or Save to file.
You can also launch Copy Context For AI from the Command Palette.
Complete files are emitted as a path, a blank line, and the current file content:
src/example.ts
export const answer = 42;
Files are joined using the configured separator. The default separator is:
---
No extra Path: or Content: labels are added.
Partial file context
Partial context is disabled by default. Enable:
Context Bundle for AI: Add Partial Content Function
Then select code in an editor, right-click it, and choose Add Selection to AI Context. Multiple selections and repeated additions are supported.
Each selection is stored as an exact text snapshot. Later edits to the source file do not change previously stored partial content.
A partial selection is emitted using a GitHub-style line anchor:
src/example.ts#L15-L28
export function calculateTotal() {
// Exact selected content
}
For a single line:
src/example.ts#L15
export const answer = 42;
Files with stored fragments show a blue selection icon in the picker. Hover over the icon to see Partial.
- Leave the file unchecked to include its stored partial selections.
- Select the file to include its current complete content and suppress its partial selections in that output.
- Use the Clear partial file context toolbar button to delete every stored fragment for the current workspace.
Partial snapshots are stored locally in VS Code's workspace storage, not inside your project.
Settings
| Setting |
Default |
Description |
aiContext.pathStyle |
relative |
Writes paths relative to the workspace or as absolute file-system paths. |
aiContext.exclude |
Common dependency and build folders |
Glob for files and directories hidden from the picker. |
aiContext.fileSeparator |
\n\n---\n\n |
Text inserted between context sections. Supports \n, \r, and \t. |
aiContext.maxFileSizeKB |
1024 |
Maximum size of one complete file or one partial selection. |
aiContext.addPartialContentFunction |
false |
Enables persistent partial-file context and its context-menu command. |
Example custom separator in settings.json:
{
"aiContext.fileSeparator": "\\n\\n===== NEXT FILE =====\\n\\n"
}
Commands
| Command |
Purpose |
| Copy Context For AI |
Opens the file picker and builds the context. |
| Add Selection to AI Context |
Stores selected editor text when partial context is enabled. |
Installation from VSIX
- Open the Extensions view in VS Code.
- Choose Views and More Actions... (
...).
- Select Install from VSIX....
- Choose
context-bundle-for-ai-1.0.0.vsix.
Development
npm install
npm test
npm run package
Press F5 in VS Code to launch an Extension Development Host.
Privacy
Context Bundle for AI does not send files, selections, or telemetry anywhere. It only reads the files you choose and writes to the clipboard, a destination you select, or VS Code's local workspace storage.
License
MIT