Cortex Code VS Code Extension
A VS Code wrapper for the Cortex Code CLI — bringing AI-powered Snowflake development directly into your editor.
This extension provides a graphical interface for the Cortex Code CLI, enabling chat-based AI assistance, SQL execution, and Snowflake object exploration without leaving VS Code.
Disclaimer: This project is not supported by, affiliated with, or endorsed by Snowflake Inc. or any related entities. This is an independent, community-developed extension.
Prerequisites
Snowflake CLI is required. This extension uses the cortex and snow commands from the Snowflake CLI. Install it before using this extension:
- Install Snowflake CLI: Follow the official installation guide
- Configure a connection: Run
snow connection add to set up your Snowflake connection
- Verify installation: Run
cortex --version and snow --version in your terminal
If the CLI is not in your system PATH, you can configure custom paths in VS Code settings:
cortex.cliPath: Path to cortex executable
cortex.snowCliPath: Path to snow executable
Features
- Chat in Secondary Sidebar: Conversational AI for Snowflake development (in the Cortex Code sidebar)
- Model Selection: Choose between Claude Opus 4.6/4.5, Sonnet 4.5/4.0, or Auto
- File References: Use
@ to reference files in your chat messages
- Tool Execution Details: See the actual commands and queries being executed
- Relative File Paths: File operations show clean paths relative to your project
- Workspace Detection: Prompts to open/create a workspace folder when needed
- SQL Execution: Run queries directly from the editor with
Ctrl+Enter
- CodeLens: [Run] [Explain] [Validate] actions above SQL statements
- Snowflake Explorer: Browse databases, schemas, tables, and views
- Connection Management: Quick-switch between Snowflake connections
- Database Context Selector: Add database/schema/table context to chat
- Custom Instructions: Configure AI behavior with
agents.md files
- Tool Permissions: Control which tools Cortex can use
- Debug Mode: Inspect API calls and responses
Installation
From VS Code Marketplace (Recommended)
- Open VS Code
- Go to Extensions (
Cmd+Shift+X / Ctrl+Shift+X)
- Search for "Cortex Code Extension for Snowflake"
- Click Install
Or install via command line:
code --install-extension Boon67.cortex-code-extension-for-snowflake
From Source (For Contributors)
# Clone the repository
git clone https://github.com/Boon67/vscode_cortex_plugin.git
cd vscode_cortex_plugin
# Install dependencies
npm install
# Build and package
npm run package
# Install the generated VSIX
code --install-extension cortex-code-extension-for-snowflake-0.1.5.vsix
For development, open the folder in VS Code and press F5 to launch the Extension Development Host.
Usage
Opening Chat
- Press
Ctrl+Shift+C (or Cmd+Shift+C on Mac)
- Click "Open Chat" in the Cortex Agent sidebar view
- The chat opens in the secondary sidebar (Cortex Code panel on the right)
Model Selection
Select your preferred AI model from the dropdown in the chat footer:
- Auto: Automatic model selection (default)
- Claude Opus 4.6: Most capable model
- Claude Opus 4.5: High capability model
- Claude Sonnet 4.5: Balanced performance
- Claude Sonnet 4.0: Fast responses
Plan Mode
Enable Plan Mode to have the assistant gather requirements before implementing:
- Click the Plan button in the chat footer to toggle plan mode
- When active, the button is highlighted
- Send your request - the assistant will ask clarifying questions one at a time
- Answer each question to refine the requirements
- After gathering information, a
product_plan.md file is generated
- Review and confirm the plan before implementation begins
Plan mode is useful for:
- Complex implementation tasks
- Multi-file changes
- Ensuring alignment before coding starts
File References
Reference files in your chat messages using @:
- Type
@ in the chat input
- Start typing a filename to filter
- Use arrow keys to navigate, Enter to select
- The file path is inserted into your message
Running SQL
- Open a
.sql file
- Click
[Run] in the CodeLens above a statement, or
- Select SQL and press
Ctrl+Enter
Switching Connections
- Click the connection name in the status bar
- Select a connection from your
~/.snowflake/connections.toml
Database Context Selector
Add database context to your chat messages for more relevant responses:
- Click the connection info area in the chat panel footer
- Select a connection from the list
- Optionally drill down to select a database, schema, or specific tables
- Click "Add to context" at any level - you don't need to select tables
- The selected context appears as a label above the chat input
- Remove context by clicking the X on the context label
Context levels:
- Connection only:
OREGON
- Connection + Database:
OREGON › SALES_DB
- Connection + Database + Schema:
OREGON › SALES_DB.PUBLIC
- With specific tables:
OREGON › SALES_DB.PUBLIC (3 tables)
Note: The chat connection is independent from the Snowflake Explorer connection.
Custom Instructions
Configure default AI behavior using agents.md files:
- Global instructions: Create
~/.cortex/agents.md for default instructions
- Workspace instructions: Create
agents.md in your workspace root to override
- Click the document icon in the chat toolbar to edit instructions
- The icon turns blue when custom instructions are active
Example agents.md:
# Custom Instructions
## SQL Style
- Always use uppercase for SQL keywords
- Include comments explaining complex logic
- Use CTEs instead of subqueries
## Project Structure
- Deploy scripts go in /deploy folder
- Use semantic versioning for releases
Control which tools Cortex can use:
Click the wrench icon in the chat toolbar
Toggle individual tools on/off:
- SQL Execution: Run queries on Snowflake
- Shell Commands: Execute terminal commands
- File Operations: Read/write/edit files
- Search: Glob and grep operations
- Web: Fetch URLs and search the web
If a disabled tool is needed, a "Run" button appears to execute it once
Debug Mode
Inspect all API calls and responses:
- Click the bug icon in the chat toolbar (turns green when active)
- Opens the "Cortex Code Debug" output channel
- Shows:
- User input with timestamps
- Database context appended to messages
- Tool calls with full input parameters
- Tool results (truncated for readability)
- Assistant responses
- Errors and exceptions
Configuration
| Setting |
Description |
Default |
cortex.defaultConnection |
Default Snowflake connection name |
"" |
cortex.autoComplete.enabled |
Enable auto-completions |
true |
cortex.inlineExecution.enabled |
Enable CodeLens SQL execution |
true |
cortex.metadataCache.ttlSeconds |
Metadata cache TTL |
300 |
cortex.cliPath |
Path to cortex CLI |
"cortex" |
cortex.tools.enabledTools |
List of enabled tools |
[all tools] |
Keyboard Shortcuts
| Shortcut |
Action |
Ctrl+Shift+C |
Open Chat |
Ctrl+Enter |
Run SQL |
Ctrl+Shift+Enter |
Validate SQL |
Ctrl+K Ctrl+C |
Ask about selection |
Ctrl+K Ctrl+E |
Explain selection |
| Icon |
Description |
| 📄 Document |
Custom instructions (agents.md) |
| 🔧 Wrench |
Tool permissions |
| 🐛 Bug |
Debug mode |
| Clear chat |
Clear conversation history |
| Control |
Description |
| Connection info |
Shows current Snowflake connection - click to add context |
| Model dropdown |
Select AI model (Auto, Claude Opus 4.6/4.5, Sonnet 4.5/4.0) |
Development
# Watch mode
./scripts/build.sh --watch
# Production build
./scripts/build.sh --production
# Package extension
npm run package
License
Apache 2.0 - See LICENSE for details.