> [!WARNING]
>
> **Preview**
>
>
> This feature is
>
> subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the
> [Service Specific
> Terms](https://docs.cloud.google.com/terms/service-terms#1).
>
> Pre-GA features are available "as is" and might have limited support.
>
> For more information, see the
> [launch stage descriptions](https://cloud.google.com/products/#product-launch-stages).

The `curate-context` skill in Google Cloud Data Agent Kit lets you create, import,
edit, and publish Knowledge Catalog (formerly Dataplex Universal Catalog) context sets from your coding
environment. You can manage table guidance, business definitions, and verified
SQL as local Markdown files in a version-control system (such as Git). Those
files ground AI agents in consistent domain knowledge. Supported environments
include Antigravity CLI, Claude Code, Codex CLI, Visual Studio Code
(VS Code), and other VS Code-based IDEs (such as Antigravity IDE and Cursor).
For the complete list of supported environments, see [Install
Data Agent Kit](https://docs.cloud.google.com/data-agent-kit/install).

This guide is for data engineers, analytics engineers, and data stewards who
want to author and publish context sets locally with a coding agent or IDE.
Context sets built with Data Agent Kit share the same entry
hierarchy as context sets built by Knowledge Studio enrichment tasks, so both
approaches are interoperable. For context set concepts and an authoring
comparison, see [Context sets overview](https://docs.cloud.google.com/knowledge-catalog/docs/context-sets.md.txt).
To run scheduled enrichment in the Google Cloud console, see [About enrichment
tasks](https://docs.cloud.google.com/knowledge-catalog/docs/about-enrichment-tasks).

## Key concepts

The following table describes the four components you use to curate context sets
locally:

| Component | Role |
|---|---|
| Data Agent Kit | Data Agent Kit provides a plugin for CLI coding agents and an extension for VS Code-based IDEs. These integrations connect your development environment to Google Cloud data services through reusable agent workflows called *skills* . Data Agent Kit comes preinstalled in Cloud Shell and Cloud Workstations. For more information, see [Data Agent Kit overview](https://docs.cloud.google.com/data-agent-kit/overview.md.txt). |
| `curate-context` skill | The `curate-context` skill directs your coding agent to inspect live schemas and local documentation, author context set files, and validate SQL before publishing. For more information, see the [`curate-context` skill](https://github.com/GoogleCloudPlatform/data-agent-kit-plugin/tree/main/skills/curate-context) in the `data-agent-kit-plugin` repository on GitHub. |
| Open Knowledge Format bundle | An Open Knowledge Format (OKF) v0.2 bundle is a local `bundle/` directory that contains Markdown files with YAML frontmatter and a `_links.yaml` file. Keep repository files, such as `README.md` and `CONTRIBUTING.md` files, outside the `bundle/` directory. For more information, see the [Open Knowledge Format repository](https://github.com/GoogleCloudPlatform/open-knowledge-format) on GitHub. |
| `kcmd` CLI | The `kcmd` CLI is the command-line tool in the scoped `@google-cloud/kcmd` npm package. The CLI pulls remote context sets locally, previews diffs with the `--dry-run` flag, and pushes approved bundles to Knowledge Catalog. The tool also manages the root `catalog.yaml` file. Don't edit the `catalog.yaml` file by hand. For more information, see [Metadata as Code](https://github.com/GoogleCloudPlatform/knowledge-catalog/tree/main/toolbox/mdcode) in the `knowledge-catalog` repository on GitHub. |

## Limitations

The `curate-context` skill has the following limitations:

- **Out-of-scope operations.** The skill doesn't certify entries, modify Identity and Access Management (IAM) allow policies, create or edit business glossary terms in `@dataplex` (you can still link to existing terms), write aspects onto source entries (such as `@bigquery`), author parameterized `query-template` entries, create `schema-join` entry links, or author Open Semantic Interchange (OSI) semantic ontology YAML files.
- **Location compatibility.** Each external `reference` or `definition` entry link target must match the context set's location or be a `global` business glossary term. This rule applies to regional (for example, `us-central1`), multi-region (for example, `us` or `eu`), and `global` context sets. For example, a `global` or multi-region context set can't create entry links to a table in `us-central1`. To document tables across multiple locations, create a separate context set for each location. Otherwise, keep each table's `resource:` frontmatter field and omit cross-location entry links from the `bundle/_links.yaml` file.
- **Quotas.** Large context sets (100 or more entries, or 200 or more links) are subject to regional per-user entry link request quotas. Focus the `bundle/_links.yaml` file on primary `reference`, `definition`, and `related` links rather than dense all-pairs links. For more information, see [Quotas and limits](https://docs.cloud.google.com/knowledge-catalog/docs/quotas.md.txt).
- **No built-in version history or Git sync.** Knowledge Catalog stores only the most recently pushed state and doesn't sync with Git automatically. Commit the root `catalog.yaml` file and `bundle/` directory to your own Git repository for pull-request reviews and revision history.
- **Billing.** Catalog lookups, queries, and writes run under your Google Cloud credentials and project. SQL compile checks read no table rows: BigQuery dry runs incur no query charges, and query plans or `EXPLAIN` checks use existing provisioned instances (standard instance charges apply). Optional live test queries (scoped with aggregates or a row limit) incur standard query charges, and pushed entries incur standard Knowledge Catalog metadata storage charges. Separate subscription or model-usage charges might apply if you use a third-party coding agent. For details, see [Knowledge Catalog
  pricing](https://cloud.google.com/products/knowledge-catalog/pricing) and [BigQuery pricing](https://cloud.google.com/bigquery/pricing).

## Before you begin

1. Optional: Enable the APIs for any data sources that you plan to
   document in the same project. For example, enable the BigQuery API:

   ```bash
   gcloud services enable bigquery.googleapis.com
   ```

<br />

Enabling the Dataplex API automatically enables the
Knowledge Catalog remote Model Context Protocol (MCP)
server.

### Required roles

To work with remote context sets using Data Agent Kit, you need
the roles required for all tasks plus the context set role that matches your
workflow. Optional roles apply only if you validate BigQuery SQL
or link existing business glossary terms.

#### Roles for all tasks


To get the permissions that
you need to connect to Google Cloud and inspect catalog metadata with Data Agent Kit,

ask your administrator to grant you the
following IAM roles:

- [**MCP Tool User**](https://docs.cloud.google.com/iam/docs/roles-permissions/mcp.md.txt#mcp.toolUser) (`roles/mcp.toolUser`) on the project where you run MCP tool calls
- [**Service Usage Consumer**](https://docs.cloud.google.com/iam/docs/roles-permissions/serviceusage.md.txt#serviceusage.serviceUsageConsumer) (`roles/serviceusage.serviceUsageConsumer`) on the quota project
- [**Dataplex Catalog Viewer**](https://docs.cloud.google.com/iam/docs/roles-permissions/dataplex.md.txt#dataplex.catalogViewer) (`roles/dataplex.catalogViewer`) on the project hosting your source entries (and the context set project, if reading entry links)


These predefined roles contain

the permissions required to connect to Google Cloud and inspect catalog metadata with Data Agent Kit. To see the exact permissions that are
required, expand the **Required permissions** section:


#### Required permissions

The following permissions are required to connect to Google Cloud and inspect catalog metadata with Data Agent Kit:

- Call remote MCP servers: `mcp.tools.call`
- Consume API quota with Application Default Credentials (ADC): `serviceusage.services.use`
- Search and inspect catalog entries, entry links, schemas, and glossary terms:
  - `dataplex.projects.search`
  - `dataplex.entries.get`
  - `dataplex.entries.list`
  - `dataplex.entryGroups.get`
  - `dataplex.entryGroups.list`
  - `dataplex.entryLinks.get`
  - `dataplex.glossaries.get`
  - `dataplex.glossaryTerms.get`

#### Roles for context sets


To get the permissions that
you need to export, create, update, or share context sets,

ask your administrator to grant you the
following IAM roles:

- Export an existing context set read-only without edits: [**Dataplex Content User**](https://docs.cloud.google.com/iam/docs/roles-permissions/dataplex.md.txt#dataplex.contentUser) (`roles/dataplex.contentUser`) on the context set
- Create a context set on first push: [**Dataplex Content Creator**](https://docs.cloud.google.com/iam/docs/roles-permissions/dataplex.md.txt#dataplex.contentCreator) (`roles/dataplex.contentCreator`) on the project hosting the context set
- Update entries and links in an existing context set: [**Dataplex Content Editor**](https://docs.cloud.google.com/iam/docs/roles-permissions/dataplex.md.txt#dataplex.contentEditor) (`roles/dataplex.contentEditor`) on the context set
- Grant access on an existing context set that you didn't create: [**Dataplex Content Admin**](https://docs.cloud.google.com/iam/docs/roles-permissions/dataplex.md.txt#dataplex.contentAdmin) (`roles/dataplex.contentAdmin`) on the context set


These predefined roles contain

the permissions required to export, create, update, or share context sets. To see the exact permissions that are
required, expand the **Required permissions** section:


#### Required permissions

The following permissions are required to export, create, update, or share context sets:

- Export an existing context set read-only without edits:
  - `dataplex.entryGroups.getContextSet`
  - `dataplex.entries.getContext`
  - `dataplex.entries.listContext`
- Create a context set on first push:
  - `dataplex.entryGroups.createContextSet`
  - `dataplex.entryGroups.list`
- Update entries and links in an existing context set:
  - `dataplex.entryGroups.getContextSet`
  - `dataplex.entryGroups.updateContextSet`
  - `dataplex.entries.createContext`
  - `dataplex.entries.getContext`
  - `dataplex.entries.listContext`
  - `dataplex.entries.updateContext`
  - `dataplex.entries.deleteContext`
  - `dataplex.entryLinks.create`
  - `dataplex.entryLinks.delete`
  - `dataplex.entryLinks.get`
  - `dataplex.entryLinks.update`
  - `dataplex.entries.link`
  - `dataplex.entryGroups.useReferenceEntryLink`
  - `dataplex.entryGroups.useRelatedEntryLink`
  - `dataplex.entryGroups.useDefinitionEntryLink`
- Grant access on an existing context set that you didn't create:
  - `dataplex.entryGroups.getIamPolicy`
  - `dataplex.entryGroups.setIamPolicy`

The following context set access rules apply:

- When `kcmd push` creates a context set for the first time, Knowledge Catalog automatically grants you the **Dataplex Content Admin** (`roles/dataplex.contentAdmin`) role on that context set. This role includes all **Dataplex Content Editor** (`roles/dataplex.contentEditor`) and **Dataplex Content User** (`roles/dataplex.contentUser`) permissions.
- You don't need write or link permissions on the source `@bigquery` system entry group to create `reference` links to your tables.
- The **Dataplex Content User** (`roles/dataplex.contentUser`) role doesn't include `dataplex.entryLinks.get`. To read entry links in a context set read-only, also grant **Dataplex Catalog Viewer** (`roles/dataplex.catalogViewer`) on the context set project.

#### Optional roles for data sources and glossaries


To get the permissions that
you need to validate BigQuery SQL or link existing glossary terms,

ask your administrator to grant you the
following IAM roles:

- Run compile checks and optional test queries on BigQuery tables:
  - [**BigQuery Job User**](https://docs.cloud.google.com/iam/docs/roles-permissions/bigquery.md.txt#bigquery.jobUser) (`roles/bigquery.jobUser`) on the billing project
  - [**BigQuery Data Viewer**](https://docs.cloud.google.com/iam/docs/roles-permissions/bigquery.md.txt#bigquery.dataViewer) (`roles/bigquery.dataViewer`) on the source BigQuery datasets or tables
- Link context set entries to existing glossary terms: [**Dataplex Catalog Editor**](https://docs.cloud.google.com/iam/docs/roles-permissions/dataplex.md.txt#dataplex.catalogEditor) (`roles/dataplex.catalogEditor`) on the project hosting the glossary


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).


These predefined roles contain

the permissions required to validate BigQuery SQL or link existing glossary terms. To see the exact permissions that are
required, expand the **Required permissions** section:


#### Required permissions

The following permissions are required to validate BigQuery SQL or link existing glossary terms:

- Run compile checks and optional test queries on BigQuery tables:
  - `bigquery.jobs.create`
  - `bigquery.tables.get`
  - `bigquery.tables.getData`
- Link context set entries to existing glossary terms: `dataplex.glossaryTerms.use`


You might also be able to get
these permissions
with [custom roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles.md.txt) or
other [predefined roles](https://docs.cloud.google.com/iam/docs/roles-overview.md.txt#predefined).

If you document non-BigQuery data sources (such as
Spanner, Cloud SQL, AlloyDB for PostgreSQL, BigLake,
or Dataproc Metastore), you also need read-only viewer access on those
source resources. For full permission details, see the Required roles section of
[Manage context
sets](https://docs.cloud.google.com/knowledge-catalog/docs/manage-context-sets#required-roles).

### Install and configure Data Agent Kit

Install version 1.3.0 or later of the Data Agent Kit plugin or
extension, and enable **Knowledge Catalog** to configure the `curate-context`
skill and remote MCP server (`dak-kc` in the CLI plugin,
`datacloud_knowledge_catalog_remote` in the IDE extension).

Select your environment:

### Antigravity CLI

1. Install the plugin:

   ```bash
   agy plugin install \
       https://github.com/GoogleCloudPlatform/data-agent-kit-plugin
   ```
2. Start Antigravity CLI in your terminal:

   ```bash
   agy
   ```
3. In the agent prompt, configure Data Agent Kit:

   ```text
   /dak:dak-setup
   ```
4. Follow the setup prompts described after the tabs and confirm the
   summary to save your configuration.

5. Restart Antigravity CLI to load the saved configuration.

### Claude Code

1. Add the marketplace and install the plugin:

   ```bash
   claude plugin marketplace add \
       https://github.com/GoogleCloudPlatform/data-agent-kit-plugin
   claude plugin install dak@dak-marketplace
   ```
2. Start Claude Code in your terminal:

   ```bash
   claude
   ```
3. In the agent prompt, configure Data Agent Kit:

   ```text
   /dak:dak-setup
   ```
4. Follow the setup prompts described after the tabs and confirm the
   summary to save your configuration.

5. Restart Claude Code to load the saved configuration.

### Codex CLI

1. Add the marketplace and install the plugin:

   ```bash
   codex plugin marketplace add GoogleCloudPlatform/data-agent-kit-plugin
   codex plugin add dak@dak-marketplace
   ```
2. Start Codex CLI with the sandbox temporarily disabled so setup can
   configure MCP servers:

   ```bash
   codex -s danger-full-access
   ```

   > [!CAUTION]
   > **Caution:** The `-s danger-full-access` flag disables the Codex CLI sandbox and grants unrestricted file system and network access for that session. Run it only in a trusted directory to complete `$dak:dak-setup`, then exit and restart Codex CLI with the default sandbox enabled.

3. In the agent prompt, configure Data Agent Kit:

   ```text
   $dak:dak-setup
   ```
4. Follow the setup prompts described after the tabs and confirm the
   summary to save your configuration.

5. Exit the unsandboxed session and restart Codex CLI with the default
   sandbox enabled (`codex`).

### VS Code-based IDEs

1. In VS Code, Antigravity IDE, or Cursor, press <kbd>Control+Shift+X</kbd> (or <kbd>Command+Shift+X</kbd> on macOS) to open **Extensions**.
2. Search for `Google Cloud Data Agent Kit`, and then click **Install**.
3. Click the **Google Cloud Data Agent Kit** sign-in link in the status bar and sign in using your browser.
4. On the **Select services** page, select **Knowledge Catalog** and any data sources you plan to document, and then click **Next**.

When you run `dak-setup` in a CLI agent, answer these prompts in order before
confirming the summary:

- **Project ID.** Your Google Cloud project ID (not the display name or project number), or confirm the default from the Google Cloud CLI.
- **Region.** Your Google Cloud region (for example, `us-central1`, not a zone like `us-central1-a`), or confirm the default.
- **Service integrations.** **Knowledge Catalog** and any data sources you plan to document (for example, **BigQuery** , **AlloyDB** , **Cloud SQL** , or **Spanner**).

For other Agent Plugins-compatible agents, point your plugin install command at
`https://github.com/GoogleCloudPlatform/data-agent-kit-plugin`. For additional
installation details, see [Install
Data Agent Kit](https://docs.cloud.google.com/data-agent-kit/install) and the
[Data Agent Kit plugin
repository](https://github.com/GoogleCloudPlatform/data-agent-kit-plugin) on
GitHub.

### Optional: Install the `kcmd` CLI

To pull existing context sets from or publish context sets to
Knowledge Catalog, install the scoped
`@google-cloud/kcmd` package. This CLI requires Node.js 22.12 or later. You can
skip this procedure if you only plan to author standalone local OKF files. If
you target a remote context set without installing `kcmd` first, the coding
agent detects the missing CLI when presenting the authoring plan and asks for
confirmation before installing it. For Node.js installation packages, see
[Download Node.js](https://nodejs.org/en/download) on the Node.js website.

1. Verify that Node.js 22.12 or later is installed:

   ```bash
   node --version
   ```
2. Install the scoped `@google-cloud/kcmd` package globally:

   ```bash
   npm install -g @google-cloud/kcmd
   ```

   Install only the scoped `@google-cloud/kcmd` package. Don't install an
   unscoped `kcmd` package from npm or PyPI.
3. Verify that `kcmd` is available on your `PATH`:

   ```bash
   kcmd --version
   ```

For standalone `kcmd` CLI usage outside a coding agent, see [Metadata as
Code](https://github.com/GoogleCloudPlatform/knowledge-catalog/tree/main/toolbox/mdcode)
in the `knowledge-catalog` repository on GitHub.

### Gather your source materials

The `curate-context` skill is designed to ground entries in your provided
sources instead of guessing schemas or metrics. Review the agent's authoring
plan and generated files before publishing. If your prompt provides no inputs,
the agent stops and asks before running. Gather the inputs relevant to your
task:

- **Data source tables or datasets.** Table names or search topics in BigQuery, Spanner, BigLake (Apache Iceberg REST catalog, Lakehouse runtime catalog for Apache Hive, and Delta Sharing), Cloud SQL (MySQL, PostgreSQL, and SQL Server), AlloyDB, or Dataproc Metastore (Hive Metastore). Omit for documents-only context sets.
- **Local documents.** Markdown, YAML, or plain text files (such as standard operating procedures, metric definitions, policy updates, or caveat notes).
- **Verified SQL queries.** SQL files with executable queries that use literal values instead of parameterized `@param` placeholders.
- **Existing OKF v0.2 bundle (for imports).** A local folder containing Markdown files with `type:` frontmatter, an `index.md` file, or a `_links.yaml` file.
- **Existing business glossary terms (optional).** Published terms in Knowledge Catalog. The agent finds and adds `definition` links to matching terms automatically without editing or creating glossary terms.

In the example prompts in this guide, replace illustrative values
(`cymbal-analytics`, `sales-analytics`, `revenue-context`, table names, and
paths such as `./docs/revenue_definitions.md`, `./sql/revenue_queries.sql`, and
`./revenue-okf/`) with your own resources and local folders.

## Create a context set from tables and documents

You can author a context set from one or more data sources, business documents
only, verified SQL queries, or a combination of those inputs. For supported
sources and file types, see the [Gather your source
materials](https://docs.cloud.google.com/knowledge-catalog/docs/curate-context-sets-data-agent-kit#gather-source-materials) section of this document.

To create a context set from tables and documents, follow these steps:

> [!CAUTION]
> **Caution:** Let the first `kcmd push` create the entry group automatically with type `context-set`. Don't precreate a standard entry group with `gcloud dataplex
> entry-groups create`, because an entry group's type can't change after creation.

1. Open a terminal in your project directory containing any local business
   documents or verified SQL files, and start your coding agent.

2. Enter a prompt naming the source tables, local files, and target context set
   settings (project, location, and context set ID), or ask for local files
   only:

   ```text
   Build a Knowledge Catalog context set named sales-analytics in project
   cymbal-analytics (location us) from BigQuery tables
   cymbal-analytics.crm.accounts and cymbal-analytics.billing.mrr_movements,
   using ./docs/revenue_definitions.md and ./sql/revenue_queries.sql.
   ```

   If you name tables loosely (for example, "our revenue tables"), the skill
   searches Knowledge Catalog, checks live schemas, and
   flags lookalike, staging, or deprecated tables for you to confirm.
3. Review the authoring plan the agent presents before writing local files.
   Exact formatting varies by agent and model, and the plan typically includes
   these items:

   - **Missing `kcmd` notice (conditional).** Prompt to approve installing `@google-cloud/kcmd` (`npm install -g @google-cloud/kcmd`) if missing.
   - **Target layout.** Project, location, context set ID (lowercase letters, digits, and hyphens only), display name, description, and workspace `bundle/` path.
   - **Discovered assets and glossary terms.** Inspected tables with verified keys, excluded lookalike or staging tables, and matching existing glossary terms for `definition` links.
   - **Planned OKF files and links.** Index, table context, and concept pages; SQL queries queued for the `queries` aspect; and `reference`, `definition`, and `related` links in the `bundle/_links.yaml` file.
   - **Conflicts and open questions.** Source disagreements, declined out-of-scope requests (such as creating glossary terms), undocumented column or filter questions, and an optional test query against live table data.
4. Reply to approve the authoring plan and explicitly answer each open question
   (such as `kcmd` installation, filter rules, and whether to run a live test
   query).

5. Wait several minutes while the agent authors and validates `bundle/`
   (installing `kcmd` first if confirmed). A new context set uses a
   progressive-disclosure layout similar to the following example:

       bundle/
       ├── agents.md                                   # Root router (Context Set)
       ├── assets.md                                   # Data assets index
       ├── assets/bigquery/cymbal-analytics/
       │   ├── crm.md                                  # Dataset index
       │   ├── crm/accounts.md                         # Table context page
       │   ├── billing.md                              # Dataset index
       │   └── billing/mrr_movements.md                # Table context and queries
       ├── documents.md                                # Business documents index
       ├── documents/net-revenue-retention.md          # Concept document
       └── _links.yaml                                 # Entry links

   The skill instructs your coding agent to document columns from your provided
   sources rather than silently inventing descriptions from column names. The
   agent stores concrete, executable SQL queries with literal values in each
   table page's `dataplex-types.global.queries` aspect (`userManaged: true`)
   and compile-checks them before publishing without reading table rows
   (BigQuery dry run, Spanner query plan, or
   `EXPLAIN` for Cloud SQL MySQL and PostgreSQL and
   AlloyDB).
6. Review the validation summary and publish preview before pushing:

   - **Validation status.** Local bundle check, `kcmd push --dry-run` counts (create, update, delete), SQL compile-check results, and any requested live test query output.
   - **Change summary.** Added, updated, and deleted entries, `queries` aspect updates, entry link changes in the `bundle/_links.yaml` file (including any omitted cross-location links), and secondary writes such as updating the catalog search summary.
   - **Findings.** Unresolved source conflicts, ripple mismatches, declined out-of-scope requests, and undocumented columns without grounded descriptions.

   Optional: To catch runtime errors (such as empty results or divide-by-zero),
   ask the agent to run a test query against live table data using aggregates
   or a row limit (standard query charges apply).
7. If you track your workspace in Git, commit or back up your files before
   publishing, because `kcmd push` can rerender local pages or move links into
   frontmatter.

8. Reply to approve publishing (1 to 2 minutes while `kcmd push` runs, reports
   any rewritten local files, and verifies live entries). The verification
   summary ends with a line similar to the following:

       Published context set: projects/cymbal-analytics/locations/us/entryGroups/sales-analytics

For additional verification steps, see the [Verify and consume your context
set](https://docs.cloud.google.com/knowledge-catalog/docs/curate-context-sets-data-agent-kit#verify-consume) section of this document.

## Import or export an OKF bundle

Because OKF v0.2 stores catalog knowledge as plain Markdown files with YAML
frontmatter, you can import existing bundles into
Knowledge Catalog or export published context sets to
local OKF files.

### Import an existing OKF bundle

You can import and publish an existing OKF v0.2 folder (Markdown files with
`type:` frontmatter, an `index.md` file, or a `_links.yaml` file) in place
without rebuilding entries by hand.

To import an existing OKF bundle, follow these steps:

1. Open your coding agent in the directory containing your OKF bundle.
2. Prompt the agent to import your folder into a target context set, replacing
   the example path, IDs, and location with your own values:

   ```text
   Import the OKF bundle in ./revenue-okf/ into a Knowledge Catalog context
   set named revenue-context in project cymbal-analytics (location us) and
   enrich thin table pages with verified BigQuery schemas.
   ```
3. When the agent presents the import plan, select a layout option and answer
   any open questions (such as whether to run an optional live test query):

   - **Convert to the progressive-disclosure layout (recommended).** Adds the `agents.md`, `assets.md`, and `documents.md` files with container indexes in place. Folds concrete SQL and `Attested Computation` pages into each table page's `queries` aspect (preserving attribution) and removes replaced files (such as folded pages and an untyped root `index.md` file). Commit or back up your folder first.
   - **Keep your current directory structure as-is.** Keeps existing folders, custom paths, `Attested Computation` pages, and non-Markdown assets unchanged.

   Both modes link `bundle` to your folder in place (unless you ask for a copy)
   and enrich thin table pages in append-only mode with verified schemas. The
   skill is designed to preserve upstream OKF v0.2 metadata (`sources`,
   `usage_window`, `generated`, `verified`, `status`, `stale_after`, and custom
   extension keys) and footnotes without adding unverified certification
   metadata.
4. Wait 1 to 3 minutes while the agent enriches and validates the bundle.

5. Review the validation summary and publish preview, and commit or back up
   your folder if needed.

6. Reply to approve publishing to Knowledge Catalog.

### Export a remote context set locally

Download an existing remote context set (including sets created by Knowledge
Studio enrichment tasks) to local OKF files for inspection, backup, or Git
version control without modifying the pulled content.

To run a read-only export, follow these steps:

1. Open your coding agent in an empty directory and ask for a read-only export:

   ```text
   Export the existing Knowledge Catalog context set sales-analytics from
   project cymbal-analytics (location us) into a local OKF folder without
   making edits.
   ```
2. Approve the target context set and destination directory when prompted.

The agent runs `kcmd init` (and `kcmd pull` if needed) to populate `bundle/`,
lists any structural or semantic findings in a local summary without rewriting
pulled files, and makes no remote writes.

## Edit and maintain an existing context set

Refine a context set with natural-language prompts or by editing local OKF
files directly. If local files exist and you don't ask to pull or push, the
`curate-context` skill edits them in place without remote catalog calls.

To update a context set and publish changes, follow these steps:

1. Open your coding agent in your existing workspace (or in an empty directory when pulling a remote context set for the first time).
2. Describe the targeted update and cite any updated source files:

   ```text
   Pull the sales-analytics context set from project cymbal-analytics
   (location us). Update the net-revenue-retention definition to exclude
   internal test accounts (test_account_flag = FALSE) based on
   ./docs/q4_policy_update.md, check for affected queries, and publish the
   update.
   ```
3. Review the proposed edit plan:

   - Inspect *ripple effects* flagged across `bundle/` and entry links (concept documents, table pages, and SQL queries affected by the change), and choose whether to include those updates.
   - Confirm that untouched entries remain unchanged, including `Context
     Overlay` pages from Knowledge Studio enrichment and existing `query-template` entries.
4. Reply to approve the edit plan.

5. Review the validation summary and publish preview. If the preview shows
   unexpected updates or deletions, a teammate might have published changes
   since your last pull. Don't approve the push; ask the agent to back up your
   local edits, pull the published version from
   Knowledge Catalog, reapply your changes, and run
   another publish preview.

6. Reply to approve pushing to Knowledge Catalog.

## Grant access to a published context set

Context sets don't inherit read access from standard project viewer roles or
**Dataplex Catalog Admin** (`roles/dataplex.catalogAdmin`). Because
`curate-context` doesn't modify IAM allow policies, you must
explicitly grant reader access after publishing so teammates and downstream
agents can read the entries. If you didn't create the context set yourself, you
need the **Dataplex Content Admin** (`roles/dataplex.contentAdmin`) role on the
context set to update its allow policy.

Grant the **Dataplex Content User** (`roles/dataplex.contentUser`) role on your
context set entry group using the `gcloud dataplex entry-groups
add-iam-policy-binding` command:

```bash
gcloud dataplex entry-groups add-iam-policy-binding CONTEXT_SET_ID \
    --location=LOCATION \
    --project=PROJECT_ID \
    --member=PRINCIPAL \
    --role=roles/dataplex.contentUser
```

Replace the following:

- `CONTEXT_SET_ID`: the ID of your context set entry group
- `LOCATION`: the Google Cloud location of the context set, such as `us` or `us-central1`
- `PROJECT_ID`: the ID of the project hosting the context set
- `PRINCIPAL`: the principal to grant access to, such as `group:analysts@example.com` or `user:dana@example.com`

To grant roles through the Google Cloud console, open the **Knowledge Studio**
page, select **Context sets** , open your context set, and click **Permissions**
on the top action bar. For command reference details, see the [`gcloud dataplex
entry-groups
add-iam-policy-binding`](https://docs.cloud.google.com/sdk/gcloud/reference/dataplex/entry-groups/add-iam-policy-binding)
command. For more information about viewing and managing context sets in the
Google Cloud console, see [Manage context
sets](https://docs.cloud.google.com/knowledge-catalog/docs/manage-context-sets).

## Verify and consume your context set

After you publish your context set and grant reader access, verify that it's
discoverable and returns grounded domain context:

1. **Inspect in Knowledge Studio.** In the Google Cloud console, open
   **Knowledge Studio** , select **Context sets** , and open your context set to
   verify its entries and links. Click **Explore** on the top action bar to
   inspect the context graph.

2. **Optional: List published entries with the gcloud CLI.** Check
   your entry group using the same `CONTEXT_SET_ID`,
   `LOCATION`, and `PROJECT_ID`
   values from the previous section:

   ```bash
   gcloud dataplex entries list \
       --entry-group=CONTEXT_SET_ID \
       --location=LOCATION \
       --project=PROJECT_ID
   ```
3. **Test retrieval with the `discover-assets` skill.** Use `curate-context` to
   author and publish, and use the companion `discover-assets` skill (bundled
   in Data Agent Kit) to query your context set. In a fresh
   agent prompt, ask a business question such as one of the following:

   - **Metric definitions and filter rules.** `Which tables and filters
     should I use to calculate net revenue retention?`
   - **Table caveats and lookalike exclusions.** `Which accounts table is
     authoritative for reporting, and which table should I avoid?`
   - **Grounded SQL generation.** `Write a BigQuery SQL query for monthly
     expansion MRR using our curated revenue context.`

   The `discover-assets` skill prioritizes context set entries
   (`parent_entrygroup_type=context-set`) through `search_entries` and calls
   `lookup_context` on the remote MCP server so the agent grounds answers and
   SQL in your curated definitions.

Applications such as Gemini Enterprise and custom agents can also read
published context sets through MCP or Knowledge Catalog
APIs. For command details, see the [`gcloud dataplex entries
list`](https://docs.cloud.google.com/sdk/gcloud/reference/dataplex/entries/list) command. To delete a test
context set, see the Delete a context set section of [Manage context
sets](https://docs.cloud.google.com/knowledge-catalog/docs/manage-context-sets#delete-context-set). For more
information, see [Explore data assets in Knowledge
Studio](https://docs.cloud.google.com/knowledge-catalog/docs/explore-data-assets), [Retrieve context for data
assets](https://docs.cloud.google.com/knowledge-catalog/docs/retrieve-data-context), and [Use the
Knowledge Catalog remote MCP
server](https://docs.cloud.google.com/knowledge-catalog/docs/use-remote-mcp).

## Troubleshoot

Use the following solutions to resolve common `kcmd` and remote MCP server
issues when curating context sets.

### Authentication errors during `kcmd` or MCP tool calls

If `kcmd` or remote MCP server tool calls fail to authenticate after initial
setup, your cached session tokens might be expired. To recover, exit your coding
agent, refresh both user credentials and ADC, and restart your agent:

```bash
gcloud auth login && gcloud auth application-default login
```

### `SERVICE_DISABLED` or permission error for the target project

If the agent reports that the Dataplex API isn't enabled on the target
project (`SERVICE_DISABLED` or permission denied), the skill stops without
switching projects or modifying local files. Complete one of the following
actions:

- Confirm that you replaced the example project ID (`cymbal-analytics`) with your own project ID.
- Enable the Dataplex API in your target project:

  ```bash
  gcloud services enable dataplex.googleapis.com \
      --project=PROJECT_ID
  ```

  Replace `PROJECT_ID` with your target project ID.
- Reply to tell the agent to use a different target project or to edit the
  bundle locally without publishing.

### HTTP `403 Forbidden` error immediately after the first push

When `kcmd push` creates a context set for the first time,
Knowledge Catalog automatically grants your account the
**Dataplex Content Admin** (`roles/dataplex.contentAdmin`) role on that entry
group. If read calls return an HTTP `403 Forbidden` status code immediately
after the first push, wait 1 to 3 minutes for permission propagation and retry
(`kcmd push` waits up to 120 seconds by default).

### Publish preview marks published entries as uncreated after a Git clone

The `kcmd` CLI compares local `bundle/` files against
Knowledge Catalog using the `scope` field in the root
`catalog.yaml` file rather than hidden local state. After a fresh Git clone, a
publish preview (`kcmd push --dry-run`) treats published entries as uncreated in
these cases:

- The `catalog.yaml` file points to a different project, location, or context set ID (for example, if the file wasn't committed to Git and you reinitialize the workspace with another target).
- Your account can't read the target context set, so `kcmd` treats the entry group as pending during a dry run.

If the `catalog.yaml` file isn't in the clone, `kcmd push --dry-run` fails with
a missing manifest error (`Cannot find catalog manifest at 'catalog.yaml'`).

Verify that you have read access to the context set, and then initialize a fresh
workspace before pushing:

1. Ask your coding agent to initialize a workspace for the same context set in
   an empty directory and pull the remote context set.

2. Copy your intended edits into that workspace and run another publish
   preview.

If you want to keep local-only OKF files, don't run `kcmd pull --force-remove`.
The `--force-remove` flag deletes local OKF files that aren't in
Knowledge Catalog.

For Data Agent Kit IDE extension errors and status bar warnings,
see [Troubleshoot](https://docs.cloud.google.com/data-agent-kit/troubleshooting.md.txt).

## What's next

Concept

### [Context sets overview](https://docs.cloud.google.com/knowledge-catalog/docs/context-sets.md.txt)


Understand context set architecture, entry categories, and how downstream AI agents consult curated context.

Task

### [Manage context sets](https://docs.cloud.google.com/knowledge-catalog/docs/manage-context-sets.md.txt)


Create, view, and delete context sets, and edit container properties in the Google Cloud console.

Concept

### [About enrichment tasks](https://docs.cloud.google.com/knowledge-catalog/docs/about-enrichment-tasks.md.txt)


Learn how cloud-managed enrichment tasks automate metadata generation and self-learning in Knowledge Studio.

Concept

### [Data Agent Kit overview](https://docs.cloud.google.com/data-agent-kit/overview.md.txt)


Explore additional coding-agent skills and MCP integrations available in Data Agent Kit.