# Rally skill: run a creator program for a brand

You are connected to Rally, which runs creator programs: human and AI
creators, briefs, content review, tracking and attribution, payouts, paid
ads. You act for the brand with the role of your key. This file is the
runbook; the tool descriptions are the reference.

## First minute

1. `rally_whoami`: the workspace, your roles, whether you are autonomous,
   the plan and what is left of its monthly limits.
2. `rally_setup_status`: the seven onboarding steps, which are done, what to
   call next, and the two things only a person can do.
3. Read `rally://docs/mcp` once for conventions.

## Too many tools?

If your client caps active tools, reconnect with a scope in the URL:
`/mcp?profile=core` (day-to-day), `/mcp?profile=onboarding`,
`/mcp?domains=programs,briefs,ads`, or `/mcp?tools=a,b`. The `rally_*` tools
are always present.

## Conventions

- Tools are `verb_noun`. Reads are free; call them before writes to get ids.
  Writes change the workspace and are audited as "via: mcp" under your key.
- Ids: list first, then act. Never guess an id.
- Full-replace writes (`update_branding`) need every field you want kept:
  read, then write.
- Publishing is a separate step from creating: `create_brief` then
  `publish_brief`; `create_knowledge` then `publish_knowledge` (with the
  `version` id); `create_program` → `get_program_draft` →
  `update_program_draft` → `publish_program_version` → `publish_program_page`.
- Files: `rally_upload_asset` (url or base64) gives an `asset_id` for logos
  (`kind: logo`), brief references (`reference`) and music.

## Waiting

Long work returns an id and runs in the background: AI ads
(`generate_ai_ad`), AI creator builds, reaction clips, still edits, sourcing
runs, Studio generations, ad launches. Call
`rally_wait_for {kind, id, timeout_s}` instead of polling in a loop. States:
`running`, `succeeded`, `failed`, `needs_human`. If it is still running at the
timeout, call it again; do not hammer the read tools.

## What needs a person

High-risk writes (payouts, ledger adjustments, publishing to social, ad
launch/budget/resume, deletions, members, keys) return
`{"status": "pending_confirmation", "action_id": ...}` unless your key is
autonomous. Tell the person plainly what you asked for and where to approve
it (Settings > Agents & MCP), then `rally_wait_for {kind: "confirmation", id}`.
Do not retry the same write while one is pending.

Two onboarding sub-steps touch the brand's own systems:
- the `rally.js` snippet and the lead/sale reporting in the brand's codebase:
  `tracking_install_guide {stack, lang}` returns the exact snippets and a
  complete coding-agent prompt for that stack (the same text the Tracking
  page shows). If you have the repo, follow it yourself; otherwise hand the
  prompt to whoever does. `create_api_key {scopes: [attribution:write]}`
  then `with_key: "1"` puts the key where the prompt needs it.
- the Stripe webhook endpoint (`tracking_install_guide.stripe_webhook_url`)
  and its signing secret (`save_provider`, slug `stripe`) — a person adds it
  in the Stripe dashboard.
For paid ads, `pixel_install_prompt {id}` is the Meta/TikTok pixel install
prompt for an ad account. To put the creator portal inside the brand's own
web app, `embed_install_guide {module, framework}` has the snippets and a
brief for the brand's codebase. Then **verify before marking**:
`verify_tracking {hostname}` must return `verification.ok: true`;
`rally_setup_status` shows the same under the payments step's
`verification` (rally.js, leads/sales signals, Stripe, ad pixels). If an ad
account is connected, `verify_ad_account_pixel {id}` reports whether the
pixel exists and which events (PageView, Lead, Purchase) are arriving. Only
then `mark_setup_step payments`.

## Onboard a brand (the demo script)

1. `import_from_source {url}`: brand, knowledge and program proposals from
   the website. Save: `update_branding` (+ logo upload), `create_knowledge` +
   `publish_knowledge` per item, `create_claim`, `set_disclosure`.
2. Program: `list_program_templates` → `tailor_program_template` →
   `apply_program_template`; or build by hand (above). A template's pictures
   carry its company's brand: replace the banner (`rally_upload_asset` +
   `set_program_page_visual {banner: {asset_id}}`, or
   `generate_program_page_image` for the `banner` slot) before
   `publish_program_page`. `confirm_application_form {fields}` replaces the
   questions and confirms in one call.
3. `create_rubric` for who to look for (`min_score` is 0–10).
4. `create_learning_path` + `publish_learning_path`; two or three
   `create_brief` + `publish_brief`.
5. Payments and tracking (person), `mark_setup_step payments`.
6. `add_support_channel` (scope `program` or `creator`), `mark_setup_step launch`.
   Notification preferences are per person; an agent key has none, so the
   person sets theirs under Settings → Notifications.
Then: `adopt_ai_creator` from the library, `generate_ai_ad` from a brief,
`rally_wait_for`, review (`get_ai_ad_run`, `revise_ai_ad`), `decide_review`,
publish (confirmation), optionally `validate_ad` → `launch_ad` (confirmation).

## Errors

Tool errors carry `{error, code, status, hint}`. `402`: a plan limit; a
person upgrades under Settings > Billing. `403`: your key's role lacks the
permission; ask for a wider key. `404`: wrong id, list again. `429`: slow
down. `409`: state conflict (already published, not live); read the resource.

## Naming

Programs: the brand's name plus "Creators" or "Partners" unless told
otherwise. Briefs: the hook in a few words. Slugs: lowercase, dashes.
Keep copy in the brand's voice from `get_branding` and the knowledge base.
