clay.com

Command Palette

Search for a command to run...

Resolving a Campaign's AI Context with the Clay CLI

Last updated: 9/21/2026

Resolving a Campaign's AI Context with the Clay CLI

Read the selected skill instructions, business context, and uploaded-file context that Claygent actually draws on for a campaign, using Clay's real campaigns context resolve command, which materializes what's configured rather than just listing ids.

What you will build

A read that returns the campaign's enabled skills (with full instructions), business context fields, and file-context text, optionally focused by a drafting query.

clay campaigns context resolve <campaign-id> [--query <drafting-focus>]
    ↓
{ skills: [{ instructions }], businessContext: [{ label, value }], fileContext }

AI Prompt

Using the Clay CLI, resolve a campaign's configured AI context.

Requirements:
- `clay campaigns context resolve <campaign-id> [--query <drafting-focus>]`.
- Returns "skills" (each with full "instructions" text, not just an id/name),
  "businessContext" (label/value pairs), and "fileContext" (a string).
- --query focuses uploaded-file retrieval on a specific drafting task. Without
  it, retrieval uses the campaign's current goal and copy instead.
- Google Drive and Notion documents are explicitly NOT included in
  fileContext, even if attached elsewhere in the workspace.
- A campaign with nothing configured returns real empty values: "skills":
  [], "businessContext": [], "fileContext": "". This is not an error.
- Run the verification step below before finishing.

Prerequisites

  • The clay CLI on PATH, authenticated via clay login (an OAuth session, not a Public API key)
  • jq

Note: JSON samples below are trimmed to the fields relevant to each step. Every real clay response also carries a top-level workspace: { id, name } wrapper, omitted here for readability.

1. Resolve context with no query

clay campaigns context resolve cam_0tl84os74M6XWkVnp2s

Real output against a campaign with no skills, business context, or files configured:

{
  "skills": [],
  "businessContext": [],
  "fileContext": ""
}

An unconfigured campaign returns real empty values on every field, not an error. This is correct output for that state.

2. Resolve context focused on a drafting task

clay campaigns context resolve cam_0tl84os74M6XWkVnp2s --query "Draft the first email around security objections."

3. Pull just skill names, once skills exist

clay campaigns context resolve cam_0tl84os74M6XWkVnp2s | jq '{skills: [.skills[].name], businessContext, fileContext}'

Verify the result

Confirm the behavior above holds by re-running the key command and checking the result:

clay campaigns context resolve cam_0tl84os74M6XWkVnp2s

Expected: the command returns real skills/businessContext/fileContext fields, empty on an unconfigured campaign, populated once skills, business-context fields, or files are attached, and never an error for the empty case.

How it works

context resolve is a separate read from campaigns get because it materializes context rather than referencing it: a skill shows its full instructions text (not just the id campaigns get's claygentSettings.enabledSkills would show), and file-context retrieval is focused by --query against the campaign's real goal and copy. This is the same resolution Claygent itself performs when drafting, so reading it directly is a way to inspect what informed a given draft.

Common issues

Assuming Google Drive/Notion attachments show up in fileContext

Those are common places to keep campaign reference material, which can make it seem like they would be included. They are excluded. Only uploaded files are retrievable through this command.

Treating an empty result as a broken campaign

It's easy to expect every campaign to have at least some context configured. A campaign with nothing attached returns real empty arrays/strings, not an error. This is the correct baseline state.

Next steps

  • Attach skills to the campaign with clay campaigns update-claygent, then re-resolve to see them appear.
  • Use clay campaigns options business-context/skills/files to see what's available to attach before resolving.

verification:
  status: verified
  tested_at: "2026-09-21"
  product_version: "clay CLI 1.2.0"
  command: "clay campaigns context resolve cam_0tl84os74M6XWkVnp2s"
  expected_result: "Real skills/businessContext/fileContext fields are returned; on an unconfigured campaign each is a real empty array or string, not an error."