/snowflake-cortex-code:cortex-runfrom snowflake-cortex-code
Sends a prompt to the Cortex Code backend, bypassing auto-routing. Supports local CLI and remote MCP delegation modes with security envelopes (RO, RW, RESEARCH).
Ships in snowflake-cortex-code. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Send a prompt to the selected Cortex Code backend, bypassing the auto-routing keyword filter. Use this when the user explicitly wants Cortex Code to handle their request.
Before checking CLI prerequisites, run:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/run_python.sh" "${CLAUDE_PLUGIN_ROOT}/scripts/router/backend.py"
Codex may use ${PLUGIN_ROOT} instead. In Devin, use the absolute plugin root the prompt hook gives you. Stop on an error.
remote: take the text after $cortex-run or /cortex-run as the task (ask
for a task if none was provided), then read and follow
Remote MCP delegation. Use only the
exact returned native MCP tool. Skip all local prerequisites and steps below.
Remote mode does not provide local envelopes or automatic file access.local: follow the existing CLI workflow below.Cortex Code CLI must be installed and on PATH:
which cortex && cortex --version
If cortex is not found, load the snowflake-cortex-code:cortex-setup skill to install it. Do NOT proceed without it.
This step is mandatory. Do it first, every time.
which cortex 2>/dev/null && cortex --version
If cortex is NOT found or the command fails:
snowflake-cortex-code:cortex-setup skill using the Skill tool.The user's message after the command ($cortex-run, or /snowflake-cortex-code:cortex-run in Devin CLI) is the prompt to send. If the user typed only the command with no additional text, ask what they want to do in Snowflake.
In Devin CLI and Devin Desktop, ${CLAUDE_PLUGIN_ROOT} is not set in your shell. The prompt hook supplies the absolute plugin root: use it in place of ${CLAUDE_PLUGIN_ROOT} in every command below, and add --host devin_cli to execute_cortex.py.
Pick the envelope based on what the operation needs:
| Envelope | Use when | Blocks |
|---|---|---|
| RO | Queries, reads, exploration | Edit, Write, destructive Bash |
| RW | Data modifications, DDL | Destructive Bash (rm -rf, sudo) |
| RESEARCH | Exploration + web access | Edit, Write, destructive Bash |
| DEPLOY | Full access needed | Nothing |
Default to RO. Use RW only when the user asked to create, alter, load or delete something.
Run the prompt through the execution script:
Use the shared launcher in Bash (Git Bash on Windows). It prefers python3,
accepts python only if it is Python 3, and never retries a failed script.
On a configuration/policy error, STOP and report it; do not switch interpreters
or bypass the plugin.
bash "${CLAUDE_PLUGIN_ROOT}/scripts/run_python.sh" "${CLAUDE_PLUGIN_ROOT}/scripts/router/execute_cortex.py" \
--prompt "USER_PROMPT_HERE" \
--envelope "RO"
When the user asked for a change (create, alter, load or delete):
bash "${CLAUDE_PLUGIN_ROOT}/scripts/run_python.sh" "${CLAUDE_PLUGIN_ROOT}/scripts/router/execute_cortex.py" \
--prompt "USER_PROMPT_HERE" \
--envelope "RW"
To specify a Snowflake connection:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/run_python.sh" "${CLAUDE_PLUGIN_ROOT}/scripts/router/execute_cortex.py" \
--prompt "USER_PROMPT_HERE" \
--envelope "RO" \
--connection "connection_name"
Format Cortex's output for the user:
Before sending the prompt, prepend relevant context from the current Claude Code conversation:
# Context from Claude Code Session
[Last 2-3 relevant exchanges — Snowflake-specific details only]
# User Request
[The original prompt]
Keep context minimal — Cortex only sees what you send in each prompt (unless resuming a session).
--resume-last vs freshEvery Cortex invocation returns a session_id that is persisted automatically. Follow-up
turns can resume that session so Cortex sees the prior conversation — real multi-turn,
not one-shot batches per prompt.
--resume-last when the current prompt is a continuation of the
previous Cortex turn: "keep going", "apply the top suggestion", "dig deeper",
"also show me ...", "and for last quarter", "fix that", or any clarification
of an answer Cortex just gave.--resume-last (start fresh) when the user switches topics, asks
about a different database/warehouse, or begins a clearly new task.--resume <session_id> is also accepted if you have an explicit id.# Follow-up on the previous Cortex turn
bash "${CLAUDE_PLUGIN_ROOT}/scripts/run_python.sh" "${CLAUDE_PLUGIN_ROOT}/scripts/router/execute_cortex.py" \
--prompt "also show me the column types" --envelope "RO" \
--resume-last
User: $cortex-run show me tables in the RAW schema
User: $cortex-run create a dynamic table that aggregates daily sales
User: $cortex-run (no prompt)
--resume-last for follow-up prompts so Cortex retains conversation context. For new topics, omit it and include relevant context in the prompt instead.--permission-prompt-tool stdio — every tool call is gated by envelope_policy.decide() at the process boundary. In Codex (--codex), tool calls are auto-approved and only the envelope selection is validated.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
3 skills in this plugin
/cortex-routerRoutes Snowflake operations to the selected local CLI or remote MCP backend. Loaded by the prompt filter for requests such as 'show Snowflake warehouses', 'list Snowflake tables', 'check data quality', 'inspect governance', and 'analyze Snowflake queries'. Not for direct invocation or local file work; use $cortex-run for explicit delegation./cortex-setupSets up the selected Cortex Code backend: local CLI or host-authenticated remote MCP. Use when cortex is not installed, when the user asks to set up Cortex Code, when routing fails because the CLI is missing, or when the configured remote tool is missing or needs authentication. In Devin, also installs Snowflake AIM for database migrations (local mode). Triggers: setup cortex, install cortex, cortex not found, CLI not installed, set up snowflake, install AIM, set up migrations, configure remote MCP.npx claudepluginhub snowflake-labs/snowflake-ai-kit --plugin snowflake-cortex-codeOther plugins' skills for the same job