Logo Get
你即將為以下公司擷取經過驗證的標誌:$ARGUMENTS。
你是一名工頭,負責調度並行的子代理 — 每間公司一個。每個子代理獨立搜尋、下載、驗證並儲存單一標誌。你負責協調、批次處理使用者提示,並產出最終的摘要表格。
參數解析
按照以下方式解析 $ARGUMENTS:
- 偵測選擇性的
--out <path>旗標(可在字串中任何位置)。將其移除;將<path>解析為絕對路徑。預設值:目前工作目錄下的./logos/。 - 將剩餘部分視為以逗號分隔的公司名稱列表。去除每個項目的前後空白。跳過空白項目。
- 如果解析出的公司名稱為零,則透過
AskUserQuestion詢問使用者,並停止。
建立輸出目錄(如果不存在):(mkdir -p)。
步驟 1 — 消除歧義階段
在調度任何子代理之前,先根據你自己的判斷掃描公司列表:
- 針對每個名稱,判斷:是否存在一個明確占主導地位的商業實體?(例如「apple」→ Apple Inc、「google」→ Google LLC、「stripe」→ Stripe Inc — 是。「acme」→ 否。「delta」→ 有歧義:Delta Air Lines、Delta Faucet、Delta Dental。)
- 對於真正有歧義的名稱,將它們批次放入一次
AskUserQuestion呼叫中,每個歧義名稱一個問題。針對每個名稱,提供 3–5 個合理選項 + 一個「其他(請指定)」選項。 - 使用使用者確定後的名稱作為本次執行的正式公司名稱。
如果沒有名稱有歧義,則完全跳過此步驟。
步驟 2 — 調度子代理(每波 8 個並行)
以每波最多 8 個的並行方式(單一訊息中最多 8 個 Agent 工具呼叫)為每間公司調度一個 Agent。等待該波完成後再調度下一波。
每個 Agent 呼叫使用 subagent_type: general-purpose,並包含一個自包含的提示 — 請參閱下方的子代理提示範本。根據每個呼叫的需要插入 {{COMPANY}}、{{OUT_DIR}}、{{MODE}}。
追蹤哪個子代理對應哪間公司,以便在最終摘要中歸因結果。
步驟 3 — 彙總結果
每個子代理會回傳一個結構化報告:
status: ok | needs_soft_fallback | failed
path: <已儲存檔案的絕對路徑,或 null>
note: <≤120 個字元:命中的層級、尺寸、格式、變體 — 或 — 失敗原因>
根據狀態進行分類。如果任何結果是 needs_soft_fallback,請一次透過 AskUserQuestion 詢問使用者:
嚴格驗證失敗:<公司列表>。要為這些公司顯示較弱的相符項目(大約是現行標誌,色彩大致正確,可能僅有圖示)嗎?請選擇要重試的項目。
對於使用者同意的每個名稱,以軟模式(並行波,上限 8 個)調度一個新的子代理。合併結果。
步驟 4 — 最終摘要
向使用者顯示:
Saved to: <absolute output directory>
apple ✓ apple.svg (Tier 3 Wikipedia, SVG)
google ✓ google.png (Tier 1 website, 800×272 PNG, wordmark)
acme-corp ⚠ needs soft fallback (only outdated logo found) → user declined
zorp ✗ no qualifying logo found
子代理提示範本
將以下自包含提示傳遞給每個子代理。插入 {{COMPANY}}(確定後的公司名稱)、{{OUT_DIR}}(絕對輸出目錄)、{{SLUG}}(小寫,空格與 & 轉為 -,移除其他標點符號,但保留 . 以用於 .ai/.io 網域,例如 JP Morgan → jp-morgan,Adopt.ai → adopt-ai)、{{MODE}}(strict 或 soft):
Your job: fetch ONE verified logo for the company **{{COMPANY}}**.
Output directory (absolute): {{OUT_DIR}}
Create it if it doesn't exist.
Mode: {{MODE}}
WORKFLOW (try tiers in order, stop at first verified success):
**Tier 1 — Company website header / press kit**
1. Determine the official website URL using your own knowledge (e.g. "Apple" → https://www.apple.com, "JP Morgan" → https://www.jpmorganchase.com).
2. WebFetch the homepage. Look for the primary logo in the HTML — usually inside <header>, <nav>, or an element with class/id containing "logo". Resolve relative URLs to absolute.
3. Many companies link to a press kit, brand assets, or media page (look for /press, /brand, /media, /about, /trust, footer links). Follow them — they often have the highest-quality wordmark.
4. Download with: curl -L -A "Mozilla/5.0" -o /tmp/{{SLUG}}_candidate_N.<ext> "<url>" (use the right extension based on URL or content-type)
5. Check size: sips -g pixelWidth -g pixelHeight <file>. REJECT if either dimension < 100. Skip the size check for SVG (vector, infinitely scalable).
6. If the homepage WebFetch fails or no logo is found, do ONE retry: WebSearch for "{{COMPANY}} official site", grab the top result's domain, retry from step 2.
**Tier 2 — DuckDuckGo image search**
1. WebFetch https://duckduckgo.com/?q={{URL-encoded COMPANY}}+logo&iax=images&ia=images
2. If the first query returns weak results, try variants: "{{COMPANY}} logo png wordmark", "{{COMPANY}} brand assets", "{{COMPANY}} press kit logo".
3. Extract up to 5 candidate image URLs. Download, size-check, verify each.
**Tier 3 — Wikipedia infobox**
1. WebFetch https://en.wikipedia.org/wiki/{{COMPANY with spaces as underscores}}
2. If the page is a disambiguation page or 404, try variants: `{{Company}}_(company)`, `{{Company}}_Inc`.
3. Locate the infobox image (typically the first image inside `.infobox`). Download, size-check.
**VERIFICATION** — after each successful download, use the `Read` tool to view the image (you can see images directly).
**Strict mode** — REJECT the candidate if any of these fail:
- **Identity**: unmistakably {{COMPANY}}'s logo (not a competitor, fan art, meme, or a different company with a similar name).
- **Currency**: the current logo per your knowledge cutoff (not a clearly-outdated version).
- **Color fidelity**: brand colors match what you know.
- **Variant**: prefer the FULL WORDMARK or LOCKUP (icon + text) over icon-only. If only icon-only is findable in strict mode, return `needs_soft_fallback` rather than `ok`.
**Soft mode** — REJECT only if:
- Identity is wrong (different company, fan art, meme).
- Tolerate outdated-but-recognizable variants, minor color shifts (JPEG compression, lighting), and icon-only when no wordmark exists.
If verified: rename `/tmp/{{SLUG}}_candidate_N.<ext>` to `{{OUT_DIR}}/{{SLUG}}.<ext>`. If a file with that name already exists, increment: `{{SLUG}}-2.<ext>`, `{{SLUG}}-3.<ext>`, etc.
REPORT — return ONE message in exactly this format (no extra prose):
status: ok | needs_soft_fallback | failed
path: <absolute path to saved file, or null>
note: <≤120 chars: tier hit, dimensions, format, variant — OR — reason for failure>
Rules:
- Don't retry transient failures (timeouts, 5xx) — fall through to the next tier.
- Never save an unverified file.
- "No API" = no auth-required / paid APIs (e.g. Clearbit's logo API, Brandfetch's commercial API). Incidental hits on logo CDNs and aggregators (logo.dev, seeklogo.com, worldvectorlogo.com, etc.) discovered via image search are fine — they're just hosted images, not API calls.
- needs_soft_fallback = candidates exist but failed strict (icon-only when wordmark expected, outdated, color-shifted).
- failed = no candidates at all across all tiers.
行為備註
- 並行上限是真實的:任何時候都不得超過 8 個子代理同時在執行。
- 不要過度擷取:如果第 1 層成功,子代理應立即停止,不會嘗試第 2 或第 3 層。
- 軟回退是選擇性的:未經使用者明確同意,切勿執行軟模式。
- 不要捏造:如果無法驗證任何標誌,請誠實回傳
failed,並附上有用的說明。