AI Context Stacker

Prepare file context and directory maps for models like ChatGPT, Claude, or Gemini within VS Code. Drag files into organized tracks to copy project context in one action.
Quick Start
- Install the extension from the VS Code Marketplace.
- Open the AI Context Stacker view in the Activity Bar.
- Stage Files by dragging them into the Staged Files panel.
- Or right-click a file in the Explorer to Add to AI Context Stack or Copy Content for AI Context.
- Quick Add files from anywhere using Ctrl+Alt+A / Cmd+Opt+A. Once the picker is open, use Ctrl+A to select all or Ctrl+Space to toggle individual selections.
- Preview context with Ctrl+Shift+V / Cmd+Shift+V (not available in Markdown files on Mac).
- Copy Stack by clicking the copy icon or pressing Ctrl+Shift+C / Cmd+Shift+C when focused on the Staged Files view.
- Paste into the LLM.
Tip: Press F1 or Ctrl+Shift+P / Cmd+Shift+P and type "AI Context Stacker" to view available commands.
Key Features
File Staging
Drag files or folders into the staging area to track and copy them in a single action.
- Token Counting: Token counts update as you type, with large files calculated in the background.
- Startup: Staged files persist between sessions and load automatically when VS Code opens.
- Folder Syncing: Rescan all staged folders or sync individual folders from their context menu.
- Multi-root Workspace Support: Staged files are grouped by project folder name. Works with GitHub Codespaces, WSL2, and SSH Remote sessions.
- Auto-Sync: Renames and deletes are reflected automatically as the project structure changes.
- Navigation: Right-click files in the Explorer to add them, copy their content, or reveal them in the stack. Right-click staged files to reveal them in the system file manager. Use Reveal in AI Context Stack to locate a file within the staged context.
Context Tracks
Create separate tracks for different tasks (e.g. Bug Fix #123, Refactor Auth). Each track maintains its own list of staged files.
- Reorder tracks by dragging or using Alt+↑ / Option+↑ and Alt+↓ / Option+↓
- Rename tracks inline with F2
- Switch between tracks with Ctrl+Alt+S / Cmd+Opt+S
Note: The extension always maintains at least one active track.
Token Warnings
Files are color-coded based on estimated token count:
- Amber over 5,000 tokens (configurable via settings)
- Red over 10,000 tokens
- Pinned files retain their pin icon while inheriting warning colors
Pinning and Filtering
Control which files remain in your stack and customize your view with pinning and filtering options.
- Pin files to prevent removal during Clear Stack
- Toggle Show Pinned Files Only to filter the view
- Copy commands respect the active filter
- Use Space to toggle pin on selected files
Pinned files persist across clears. This is useful for keeping core instruction files in the context.
Context Map
Optionally include an ASCII directory tree in the copied output.
# Context Map
├── components
│ ├── Header.tsx
│ ├── Sidebar.tsx
│ └── Footer.tsx
├── utils
│ ├── api.ts
│ └── helpers.ts
└── README.md
Selection-Aware Copying
Copy behavior adapts to the current selection:
- Files selected: Copies only the selected files.
- Nothing selected: Copies the entire visible stack (respecting active filters).
Commands
| Command |
Description |
Keybinding |
Copy Stack |
Copy all staged content based on active settings and filters. |
Ctrl+Shift+C / Cmd+Shift+C |
Copy and Clear Stack |
Copy context and clear unpinned files. |
Ctrl+X / Cmd+X (when focused) |
Copy Content |
Copy individual file or folder content. |
Ctrl+C / Cmd+C (when item focused) |
Preview Context |
Open a Markdown preview of the current stack. |
Ctrl+Shift+V / Cmd+Shift+V |
Sync All Staged Folders |
Rescan all staged folders for changes. |
Ctrl+R / Cmd+R (when focused) |
Sync Folder |
Rescan a specific staged folder for changes. |
|
Sync Folder with Context Stack |
Rescan a folder from the Explorer and update the stack. |
|
Keyboard Shortcuts
Global Shortcuts
| Shortcut |
Command |
| Ctrl+Alt+A / Cmd+Opt+A |
Add Files Picker |
| Ctrl+Alt+F / Cmd+Opt+F |
Add Folder Picker |
| Ctrl+Alt+K / Cmd+Opt+K |
New Track |
| Ctrl+Alt+S / Cmd+Opt+S |
Switch Track |
| Ctrl+Shift+V / Cmd+Shift+V |
Preview Context |
Quick Pickers (when open)
| Shortcut |
Command |
| Ctrl+A / Cmd+A |
Select All |
| Ctrl+Space |
Toggle Selection |
| Ctrl+J |
Move Focus Down (Vim-style) |
| Ctrl+K |
Move Focus Up (Vim-style) |
Staged Files View (when focused)
| Shortcut |
Command |
| Ctrl+R / Cmd+R |
Sync All Staged Folders |
| Ctrl+Shift+C / Cmd+Shift+C |
Copy Stack |
| Ctrl+X / Cmd+X |
Copy and Clear Stack |
| Ctrl+C / Cmd+C |
Copy File |
| Ctrl+A / Cmd+A |
Select All |
| Space |
Toggle Pin |
| Del / Cmd+Backspace |
Remove File |
| Shift+Del / Shift+Cmd+Backspace |
Clear Stack |
Context Tracks View (when focused)
| Shortcut |
Command |
| F2 |
Rename Track |
| Alt+↑ / Option+↑, Alt+↓ / Option+↓ |
Move Track |
| Del / Cmd+Backspace |
Delete Track |
| Shift+Del / Shift+Cmd+Backspace |
Reset All Tracks |
Settings
Configuration is managed via VS Code Settings.
| Setting |
Default |
Description |
aiContextStacker.excludes |
[] |
File patterns to exclude (glob patterns). |
aiContextStacker.defaultExcludes |
[] |
Base exclude patterns applied to all tracks. |
aiContextStacker.largeFileThreshold |
5000 |
Token count for Heavy warning (Amber). Red at 2x this value. |
aiContextStacker.showTreeMap |
true |
Include the ASCII directory tree in output. |
aiContextStacker.showTreeMapHeader |
true |
Show the title text above the tree map. |
aiContextStacker.treeMapText |
# Context Map |
Custom text for the map header. |
aiContextStacker.includeFileContents |
true |
Include the actual code/text of staged files. |
aiContextStacker.showFileContentsHeader |
true |
Show the title text above file contents. |
aiContextStacker.fileContentsText |
# File Contents |
Custom text for the contents header. |
aiContextStacker.logLevel |
INFO |
Control the verbosity of the Output Channel. Options: DEBUG, INFO, WARN, ERROR. |
Known Limitations
- Clipboard Size: Output is capped at 100MB to protect VS Code stability.
- Large Files: Files over 5MB are excluded from context.
- Token Estimates: Counts are approximate and may differ slightly from model-specific tokenizers.
- Binary Files: Binary assets are automatically skipped.
- Large Folders: Adding folders with more than 200 files requires confirmation.
- Web VS Code: Clipboard access in browser-based VS Code requires a secure HTTPS context.
Support
License
This project is licensed under the MIT License.