---
sharksapi_version: p-fdb1e908f0
name: command-center-agent
description: Recurring task for AI agents — check dashboard strategy cards for pending AI-controlled tasks, execute them using SharksAPI tools, and mark them complete. Designed for Claude Cowork recurring tasks or scheduled agent runs.
allowed-tools: [read_dashboard, get_dashboard, get_strategy_status, update_strategy_task, get_gsc_top_queries, get_gsc_top_pages, get_gsc_brand_queries, analyze_pagespeed, analyze_schema, get_ga4, get_ga4_channels, get_ga4_events, scrape_website, list_wp_posts, create_wp_post]
metadata:
  triggers: [check command center, run agent tasks, execute strategy tasks, check dashboard tasks, command center agent, recurring dashboard check]
---

# Command Center Agent

Recurring task: check a SharksAPI dashboard for AI-controlled strategy cards with pending tasks, execute what you can, and mark tasks complete.

**Use this as a recurring task in Claude Cowork, scheduled agents, or any AI agent that runs periodically.**

## Prerequisites

- SharksAPI agent credentials (Bearer token)
- Dashboard public_token (the dashboard to monitor)
- Use direct A2A tool calls via `POST https://sharksapi.ai/api/v1/a2a`, NOT browser/Chrome — it's faster and more reliable

All JSON snippets below are `params` payloads for the direct tool-call endpoint:

```http
POST https://sharksapi.ai/api/v1/a2a
Authorization: Bearer {access_token}
Content-Type: application/json
```

## Step 1: Read the Dashboard (one call, full data)

```json
{"jsonrpc": "2.0", "method": "tasks/send", "id": "1",
 "params": {"tool": "read_dashboard", "arguments": {"token": "{dashboard_token}"}}}
```

`read_dashboard` returns the **whole dashboard in one call** — every widget's live values AND each `strategy_card` already includes its `widget_id` plus a `strategy` object with `mode`, `progress_pct`, delegation info (`assigned_by`, `depends_on`, `conditions`), and the full `tasks[]` list (each with `task_id`, `title`, `done`, `skipped`, `label`, `mode`). **Never open the `/{token}/index.html` URL in a browser — it is slow and wasteful; `read_dashboard` gives you everything structured.**

From the response, pick the `strategy_card` widgets and the pending tasks (`done: false`) inside them. You usually do NOT need a second call — but `get_strategy_status` (Step 2) can refresh a single card if needed.

**If a card has `assigned_by: "manager"`,** it came from the Turundusjuht — respect its `depends_on` (wait until those agents deliver) and `conditions` before acting.

## Step 2: Check Each Strategy Card

For each strategy_card widget:

```json
{"tool": "get_strategy_status", "arguments": {
  "token": "{dashboard_token}",
  "widget_id": {widget_id}
}}
```

Check the response:
- `mode`: use `ai_controlled` as the preferred queue, but do not treat `human_controlled` as an API block when the user asked the agent to handle the work
- `tasks[]`: find tasks where `is_completed` is `false`
- `progress_pct`: overall progress

**If no AI-controlled cards with pending tasks exist:**
Report: "Command Center has no pending AI agent tasks." and stop.

## Step 3: Execute Pending Tasks

For each pending strategy task the agent should handle:

1. **Read the task title and description** — understand what needs to be done
2. **Determine which tools to use** based on the task:

| Task mentions... | Tools to use |
|---|---|
| meta description, title tag | `get_gsc_top_pages`, `scrape_website` |
| schema, structured data | `analyze_schema` |
| page speed, images, CWV | `analyze_pagespeed` |
| re-index, sitemap | Note for human (can't do via API) |
| blog post, article | `list_wp_posts`, `create_wp_post` |
| keyword research | `get_gsc_top_queries`, `get_gsc_brand_queries` |
| analytics, traffic | `get_ga4`, `get_ga4_channels`, `get_ga4_events` |
| content refresh | `scrape_website`, `list_wp_posts` |

3. **Execute the task** — call the relevant tools, do the work
4. **Mark task complete:**

```json
{"tool": "update_strategy_task", "arguments": {
  "token": "{dashboard_token}",
  "widget_id": {widget_id},
  "task_id": {task_id},
  "is_completed": true
}}
```

5. **If a task cannot be completed by AI** (requires human action like logging into Google Search Console, uploading images, etc.), skip it and note it in the summary.

## Step 4: Report

After processing all cards, produce a summary:

```
Command Center check complete.

Processed: {N} strategy cards
Tasks completed: {N}
Tasks skipped (human required): {N}
Tasks already done: {N}

Details:
- [SEO Strategy] Completed: "Update meta description on /pricing" — analyzed page, suggested improvement
- [SEO Strategy] Skipped: "Submit sitemap to GSC" — requires human login to Google Search Console
- [Content Strategy] Completed: "Write blog draft about referral marketing" — draft published to WordPress
```

## Scheduling — run this as a Claude Cowork recurring task

This is the intended trigger: each teammate sets up ONE recurring task in their own
Claude Cowork, pointed at THEIR dashboard token. No server cron, no browser — Cowork
wakes the agent on schedule and it works via the A2A API.

**Setup:** Claude Cowork → create a recurring task (e.g. daily 09:00) → paste a prompt
below. Connect SharksAPI once (the credentials from your invite / agent registration)
so the A2A tools are available.

**Teammate agent (SEO / Copywriter / Paid / Analyst / Event) — daily prompt:**
```
Run my SharksAPI Command Center for dashboard token {YOUR_DASHBOARD_TOKEN}.
0. Refresh skills: read the sharksapi_version front-matter of my installed
   .claude/skills/*/SKILL.md, call check_skill_updates with [{slug, version}].
   Re-install anything stale or in new_team_skills — platform: re-download the URL
   (the file already carries the new sharksapi_version); team: get_team_skill(slug).
1. Memory: if this task's payload did NOT include a memory context from the manager,
   call memory_bootstrap FIRST — it returns the workspace constraints (incl. my
   channel's autonomy setting manual/approve/auto), facts, my open task_state and
   latest decisions. Treat constraints as hard rules; "approve" means submit for
   approval, never publish directly.
2. read_dashboard(token) → my widgets, strategy cards with tasks, AND action_items
   (draft to-dos the manager created by reviewing my content). action_items is
   scoped to ME — only the drafts I submitted — so I never grab a teammate's draft.
3. Process action_items first — this is the manager's feedback loop:
   - drafts_to_revise: apply each review_note, then revise_draft(draft_id, body) → back to pending.
   - drafts_to_publish: post it to its channel, then review_draft(draft_id, action:"publish").
4. For each strategy card, work the pending tasks (done:false), AI-controlled first.
   If a card has assigned_by:"manager", respect its depends_on (wait for those agents
   to deliver) and conditions before acting.
5. Execute with SharksAPI tools (GSC/GA4/WordPress/ads/etc.). WRITE-THROUGH memory:
   every important decision, result or lesson → memory_write IMMEDIATELY (scope
   channel:<my role>; short, dated, measurable) — an interrupted session must not
   lose memory. Content needing sign-off (post, text, newsletter, ad, SEO change)
   → submit_draft so the manager approves; don't publish unreviewed.
6. update_strategy_task to mark each finished task done.
7. End: memory_write/update my task_state (what I did, what is next; link task_id),
   then reply with a short summary: skills updated, drafts revised/published, tasks
   completed, pending.
A2A API only — never open the dashboard URL in a browser.
```

**Manager (Turundusjuht) — daily prompt:**
```
Run my SharksAPI Turundusjuht Command Center for manager token {MANAGER_TOKEN}.
1. memory_bootstrap → the workspace's shared brain: constraints (incl. per-channel
   autonomy), facts, open task_state, latest decisions. Work inside it.
2. read_dashboard(token) → team rollup (each agent's status/progress), top issues, plan.
3. list_drafts(status:"open") → review what agents submitted: review_draft with
   approve / request_changes (+ note) / edit / schedule / reject. Your decision becomes
   the agent's next to-do (it shows in their read_dashboard action_items).
4. Where the plan needs new work, delegate_to_agents (with depends_on + conditions).
   Before delegating, call memory_bootstrap(role: <channel>) and ATTACH the returned
   package to the A2A task payload — the channel agent then starts with full context
   and needs no read access of its own.
5. Review "Agentide sisendid plaani" — accept or decline teammate proposals. Promote
   channel results that matter team-wide into global memory (memory_write scope
   global) — only you may write global.
6. Weekly: memory_review → merge duplicates (supersedes_id), archive expired, flag
   contradictions to the human. Record your own decisions with memory_write as you go.
7. Reply with: what's on track, what's blocked, what you approved/delegated.
A2A API only — never open the dashboard URL in a browser.
```

**Frequency:** daily is typical; 1–5×/day or on-demand for fast-moving work. Each
agent runs its own task independently and rolls up to the manager automatically.

## Keeping skills current

Skills evolve — the platform updates `recommended_skills` and the manager can
publish new team skills with `promote_skill`. The platform stamps a
`sharksapi_version` into the front matter of every served skill file (e.g.
`p-1c4452cff8` for a platform skill, `team-v3` for a team skill), so you never
compute or hand-write it — just read it. Step 0 of the recurring task closes the gap:

1. Collect `[{slug, version}]` by reading the `sharksapi_version` line of each
   installed skill's front matter.
2. `check_skill_updates(installed: [...])` → returns `checked[]` (each with
   `stale`, `current_version`, `fetch`), `new_team_skills[]`, and `updates_available`.
   This call also reports your installed set back to the platform, so the manager
   Command Center shows which skills your team has integrated.
3. For every `stale:true` entry and every `new_team_skills` entry, re-install:
   platform skills via their `fetch` URL, team skills via `get_team_skill(slug)`.
   The fetched content already carries the new `sharksapi_version` — no write-back
   needed. (If your skills folder is read-only, saving the refreshed copy anywhere
   your agent can read it is enough; the report in step 2 still went through.)

This way an agent provisioned weeks ago self-heals to the latest skills on its next
run — no manual reinstall, no drift between teammates.

## When a required tool is missing from tools/list

While executing a strategy task you may discover the agent needs a tool that isn't in its current `tools/list` (e.g. the task says "check Google Alerts mentions" but `get_google_alerts` is not available). This usually means the matching service is simply not connected on this project yet — it does NOT mean SharksAPI lacks the integration.

**Do this instead of telling the user the integration doesn't exist:**

```http
POST https://sharksapi.ai/api/v1/agents/{your_agent_id}/connections/init
Authorization: Bearer {access_token}
Content-Type: application/json

{"service": "<connection_slug>"}
```

Common `service` slugs: `google_alerts`, `ga4`, `gsc`, `pipedrive`, `merit_aktiva`, `wordpress`, `facebook`, `linkedin`, `google_ads`, `meta_ads`, `notion`, `klaviyo`.

The response includes a `direct_oauth_url`. **Paste that URL into your reply to the human user verbatim and ask them to click it to connect the service.** Do NOT open, follow, fetch, or "test" the URL yourself — the OAuth flow is interactive and must be completed by the human.

Only if the endpoint returns HTTP `404` with `"error": "unsupported_service"` may you legitimately tell the user that SharksAPI does not support that integration. Until then, default to the self-service init flow.

When this happens mid-task, mark the affected strategy task as still pending (do NOT call `update_strategy_task` to mark it complete) and surface the OAuth URL in the Step 4 report.

## Important Rules

- Prefer `ai_controlled` cards first, but `update_strategy_task` can mark any accessible strategy task when the user asks the agent to do the work
- **Use A2A API, not browser** — `get_strategy_status` and `update_strategy_task` are direct API calls
- **Don't re-do completed tasks** — check `is_completed` before executing
- **If fewer than 2 pending tasks**, still complete what's available
- **Download relevant skills** if the task requires a specific workflow — check `GET /api/v1/a2a/skills` for matching skill.md files (e.g., blog-writer.skill.md for content tasks, seo-audit.skill.md for SEO tasks)
