Install
openclaw skills install patent-retriever-bigqueryTeam ZeeLin’s production-grade patent evidence retrieval skill for Google Patents BigQuery. Converts natural-language research intent into auditable multi-ro...
openclaw skills install patent-retriever-bigqueryTeam ZeeLin skill for Google Patents retrieval via BigQuery. This skill performs patent retrieval and structured output generation only. It does not provide legal conclusions.
Purpose:
Required env:
GOOGLE_APPLICATION_CREDENTIALSGOOGLE_CLOUD_PROJECTRun this:
python3 -m pip install -r requirements.txt
RUN_ID="quick_$(date +%Y%m%d_%H%M%S)"; RUN_DIR="results/${RUN_ID}"; mkdir -p "$RUN_DIR"
python3 scripts/patent_search.py --keywords "ai sentiment analysis" --limit 80 --output "$RUN_DIR/seed_raw.json"
python3 scripts/build_query_plan.py --topic "Public Opinion + AI" --keywords "public opinion ai sentiment" --task-id "$RUN_ID" --seed-raw "$RUN_DIR/seed_raw.json" --concept-output "$RUN_DIR/concept_scan.json" --plan-output "$RUN_DIR/query_plan.json"
python3 scripts/patent_search_plan.py --plan "$RUN_DIR/query_plan.json" --output-raw "$RUN_DIR/retriever_raw.json" --output-retriever "$RUN_DIR/retriever_result.json" --min-results 20
Expected outputs:
$RUN_DIR/concept_scan.json$RUN_DIR/query_plan.json$RUN_DIR/retriever_raw.json$RUN_DIR/retriever_result.jsonIf it fails:
seed -> build_plan -> execute_plan.20 unless the user explicitly requests another value.query_plan.json (filters) before execution.Required environment variables:
GOOGLE_APPLICATION_CREDENTIALSGOOGLE_CLOUD_PROJECTInstall dependencies:
python3 -m pip install -r requirements.txt
Optional environment check:
python3 - <<'PY'
import os
required = ["GOOGLE_APPLICATION_CREDENTIALS", "GOOGLE_CLOUD_PROJECT"]
missing = [k for k in required if not os.getenv(k)]
print({"ok": not missing, "missing": missing})
PY
keywords_all / keywords_any / keywords_anchor_any / keywords_notipc_prefix_any / cpc_prefix_anyassignee_any / inventor_anycountry_inpub_date_from / pub_date_to / filing_date_from / filing_date_toField source: query_plan.json (schema: schemas/query_plan.schema.json).
min_results: default 20US,CN,WO,EP,JP,KRyears_back=82021) => from=20210101, to=202112312021-2023) => from=20210101, to=20231231--years-back NCreate a run directory first:
RUN_ID="run_$(date +%Y%m%d_%H%M%S)"
RUN_DIR="results/${RUN_ID}"
mkdir -p "$RUN_DIR"
python3 scripts/patent_search.py \
--keywords "<keywords>" \
--limit 80 \
--output "$RUN_DIR/seed_raw.json"
python3 scripts/build_query_plan.py \
--topic "<topic>" \
--keywords "<keywords>" \
--task-id "$RUN_ID" \
--years-back 8 \
--country-in "US,CN,WO,EP,JP,KR" \
--seed-raw "$RUN_DIR/seed_raw.json" \
--concept-output "$RUN_DIR/concept_scan.json" \
--plan-output "$RUN_DIR/query_plan.json"
When the user explicitly requests country/year/assignee filters, patch query_plan.json before execution.
python3 - <<'PY'
import json
import os
from pathlib import Path
plan_path = Path(os.environ["RUN_DIR"]) / "query_plan.json"
plan = json.loads(plan_path.read_text(encoding="utf-8"))
# Example override: 2021-2023 + US + keyword constraints
for r in plan.get("query_rounds", []):
f = r.setdefault("filters", {})
f["country_in"] = ["US"]
f["pub_date_from"] = 20210101
f["pub_date_to"] = 20231231
f.setdefault("keywords_any", [])
f["keywords_any"] = list(dict.fromkeys(f["keywords_any"] + ["sentiment", "public opinion", "risk"]))
plan_path.write_text(json.dumps(plan, ensure_ascii=False, indent=2), encoding="utf-8")
print({"updated": str(plan_path)})
PY
python3 scripts/patent_search_plan.py \
--plan "$RUN_DIR/query_plan.json" \
--output-raw "$RUN_DIR/retriever_raw.json" \
--output-retriever "$RUN_DIR/retriever_result.json" \
--min-results 20
python3 scripts/schema_check.py --input "$RUN_DIR/concept_scan.json" --schema schemas/concept_scan.schema.json
python3 scripts/schema_check.py --input "$RUN_DIR/query_plan.json" --schema schemas/query_plan.schema.json
python3 scripts/schema_check.py --input "$RUN_DIR/retriever_result.json" --schema schemas/retriever_result.schema.json
Example A:
Find US patents on AI public-opinion early warning from 2021 to 2023, at least 30 resultstopic="AI public opinion early warning"keywords="ai public opinion early warning sentiment"country_in=["US"], pub_date_from=20210101, pub_date_to=20231231--min-results 30Example B:
Search multimodal emotion recognition patents in CN/JP/KR over the last 5 years, focus on Tencent and ByteDance--years-back 5country_in=["CN","JP","KR"]assignee_any=["Tencent","ByteDance"]Retrieval completed.
Effective filters:
- Countries: ...
- Publication date range: ...
- Filing date range: ...
- Keywords (any/all/not): ...
- Assignee/Inventor filters: ...
Results:
- Patent count: ...
- Country distribution: ...
- Latest publication date: ...
Files:
- concept_scan: ...
- query_plan: ...
- retriever_raw: ...
- retriever_result: ...
Required output files:
concept_scan.jsonquery_plan.jsonretriever_raw.jsonretriever_result.jsonretriever_result.json minimum requirements:
patents count >= min_results (default 20)publication_number and titlereferences/methodology.mdexamples/quickstart.md