Skip to content

Open-source SEO, GEO, and marketing skills for AI agents.

feat: cache target URL in business context for repeat audits

Tong7e4f3e23336e
diff --git a/seo/seo-analysis/SKILL.md b/seo/seo-analysis/SKILL.md
index 5c36da7e..6276f2f4 100644
--- a/seo/seo-analysis/SKILL.md
+++ b/seo/seo-analysis/SKILL.md
@@ -34,15 +34,36 @@ cold.
---
-## Step 0 — Ask for the Website URL
+## Step 0 — Establish the Website URL
-Before doing anything else, ask the user:
+Before doing anything else, check for previously audited sites:
+
+```bash
+ls ~/.toprank/business-context/*.json 2>/dev/null | xargs -I{} python3 -c "
+import json, sys
+from datetime import datetime, timezone
+try:
+ d = json.load(open(sys.argv[1]))
+ gen = datetime.fromisoformat(d.get('generated_at', '1970-01-01T00:00:00+00:00'))
+ age = (datetime.now(timezone.utc) - gen.astimezone(timezone.utc)).days
+ print(f\"{d.get('target_url', d.get('domain','?'))} (audited {age}d ago)\")
+except: pass
+" {}
+```
+
+**If one or more cached sites are listed**, show them and ask:
+
+> "I've audited these sites before — use one, or enter a different URL:
+> 1. https://example.com (audited 12 days ago)
+> 2. Enter a different URL"
+
+If the user picks a cached site, load `target_url` from that domain's `~/.toprank/business-context/<domain>.json` and set it as `$TARGET_URL`. Skip to Phase 0.
+
+**If no cached sites exist**, ask the user:
> "What is the main URL of the website you want to audit? (e.g. https://yoursite.com)"
-Wait for their answer. Store this as the **target URL** — it is needed for the
-entire audit: URL Inspection API calls, technical crawl, metadata fetching, and
-matching against GSC properties.
+Wait for their answer. Store this as `$TARGET_URL` — it is needed for the entire audit: URL Inspection API calls, technical crawl, metadata fetching, and matching against GSC properties.
Once you have the URL, also attempt to auto-detect it from the repo to confirm
or catch mismatches:
diff --git a/seo/shared/business-context.md b/seo/shared/business-context.md
index ca857e47..af05fb17 100644
--- a/seo/shared/business-context.md
+++ b/seo/shared/business-context.md
@@ -93,6 +93,7 @@ from datetime import datetime, timezone
# --- fill from user answers + inferred data ---
domain = "$DOMAIN"
+target_url = "$TARGET_URL"
business_name = "<user answer 1, or inferred from homepage title>"
business_summary = "<1-2 sentence distillation>"
industry = "<inferred from homepage + GSC topics>"
@@ -107,6 +108,7 @@ notes = "<note if answers were inferred rather than user-provided>"
data = {
"domain": domain,
+ "target_url": target_url,
"generated_at": datetime.now(timezone.utc).isoformat(),
"business_name": business_name,
"business_summary": business_summary,
@@ -176,6 +178,7 @@ If GSC was unavailable and the audit is technical-only (Phase 5):
```json
{
"domain": "example.com",
+ "target_url": "https://example.com",
"generated_at": "2026-04-07T12:00:00+00:00",
"business_name": "Acme Corp",
"business_summary": "Project management software for remote engineering teams.",