Snowflake for Gen AI · Topic 13 of 13

Cortex Code Capabilities, CLI Commands and Cortex Knowledge Extensions

Snowflake Cortex Code capabilities, the cortex CLI commands and flags, and Cortex Knowledge Extensions that share licensed content through Cortex Search.

  • 5 min
In a nutshell
  • CoCo forms: Snowsight, CLI, Desktop; all act within your RBAC.
  • CLI: cortex, connections.toml, /model, /guardrails, restricted session scope, plan mode.
  • CKE = Cortex Search service shared through listings, used with Cortex AI functions or Agent API.

What it is

This page deepens two earlier topics and adds one new one. Cortex Code (CoCo in the docs) is the AI coding agent for Snowflake work, and the exam checks what it can do, what controls its safety and how you drive the CLI. Cortex Knowledge Extensions (CKE) are a way to share and consume licensed text content through Cortex Search.

Developercortex CLIlocal shellconnects withSnowflake connectionconnections.tomlacts withinYour roleRBAC

How it works

Cortex Code capabilities

Cortex Code understands Snowflake RBAC, schemas and best practices, and supports data engineering, analytics, machine learning and agent building. It comes in three forms.

FormNotes
SnowsightInside Workspaces and admin pages; SQL and Python notebook authoring; visual diff; no local files
CLILocal shell; reads and writes local repositories; runs bash and git and SQL
DesktopStandalone IDE for macOS and Windows with plugins, skills, hooks, MCP and an agentic browser

Extensibility comes from MCP tools, the Agent Client Protocol, plugins, subagents, hooks, slash commands and Agent Skills. The CLI ships with built in Snowflake skills for agent creation, machine learning, data engineering and governance, and supports AGENTS.md files to shape behavior in a project. The Excel add in, Google Sheets add on and the Cortex Code Agent SDK are listed as preview.

Safety features in the CLI include Restricted Session Scope, OS level sandboxing, a three tier approval system and automatic risk assessment. Cortex Code is generally available across Snowsight, Desktop and CLI when cross-region inference is enabled on the account. Usage is billed by token consumption, and Desktop and CLI also offer a monthly subscription for individual developers.

Cortex Code CLI commands

Install with the script the docs provide (curl ... | sh on macOS, Linux and WSL, or a PowerShell irm ... | iex on Windows). The executable is cortex, placed in ~/.local/bin by default on Unix.

ItemWhat it does
cortexStarts the CLI; a setup wizard runs on first use
~/.snowflake/connections.tomlConnections listed by the wizard; shared with the Snowflake CLI (snow)
/modelLists models your role can use and switches model
/guardrailsRestricts the current session; /guardrails status shows the active restriction
--model autoSets the model for one invocation
--with-restricted-session-scope=READONLY_PMStarts with a named restricted scope

Plan mode asks you to confirm each action. A restricted session scope can make a session read only, allow only chosen roles or block chosen roles. Once active you can switch to another scope but cannot remove or relax it, so start a new session to work without it.

cortexstart CLIchooseConnectiontoml fileoptionalRestricted scoperead onlyworkPlan modeconfirm actions

The prerequisites are the SNOWFLAKE.CORTEX_USER or SNOWFLAKE.CORTEX_AGENT_USER database role and the Snowflake CLI.

Exam tip

A scenario about letting an agent explore a production account safely is solved with a restricted session scope or /guardrails, not by trusting the prompt.

Cortex Knowledge Extensions

A CKE is a Cortex Search service shared with other accounts through the Snowflake Marketplace, private listings or organizational listings. It brings licensed or proprietary unstructured content such as articles, research or forum posts into RAG applications without the consumer copying the content.

RoleDoes
ProviderLoads text into a table, creates a Cortex Search service on it, publishes the service as a listing; pays hosting costs; can cap the share of content consumers retrieve in a rolling 24 hours
ConsumerBuilds an app with Cortex AI functions or the Cortex Agent API using the CKE; pays the provider if the CKE is not free

A SOURCE_URL column supports citations. Auto fulfillment can replicate the service to other regions.

Provider tablelicensed textCortex SearchShared servicelistingqueried byConsumer agent or appanswer with citations

Restrictions: consumers can use it only in regions where it is available; usage based billing is not supported; a CKE is not supported on listings with Egress Cost Optimizer, and adding one turns that off; hitting the content protection threshold makes queries fail; disabling the underlying service breaks consumer apps.

Watch out

A CKE gives the consumer retrieval access, not a copy of the table. The provider controls the rolling 24 hour retrieval cap.

Common mistakes

Treating the CLI as running inside Snowflake. It runs locally and connects out.

Trying to relax a restricted scope mid session. Start a new session instead.

Sharing documents by copying tables. A CKE shares the search service, not the table.

Confusing provider and consumer costs. The provider pays hosting; the consumer pays the provider for a paid CKE and pays for the agent.

Skipping region checks. A CKE works only where it is available.

What to remember for the exam

  • CoCo forms: Snowsight, CLI, Desktop; all act within your RBAC.
  • CLI: cortex, connections.toml, /model, /guardrails, restricted session scope, plan mode.
  • CKE = Cortex Search service shared through listings, used with Cortex AI functions or Agent API.
  • Provider pays hosting and can cap retrieval per 24 hours; SOURCE_URL gives citations.

Check yourself

  • Which file lists the connections used by the cortex CLI wizard?

    ~/.snowflake/connections.toml, shared with the Snowflake CLI.

  • Can a restricted session scope be removed during a session?

    No, it can be switched but not removed or relaxed; start a new session.

  • What does a provider publish for a CKE?

    A Cortex Search service built on its text table, shared as a listing.

Topic 13 of 13 in Snowflake for Gen AI

Test yourself on Snowflake for Gen AI

The full Snowflake GES-C02 question bank has 585 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Snowflake. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.