seo-drift

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SEO Drift Monitor (April 2026)

SEO漂移监控工具(2026年4月)

Git for your SEO. Capture baselines, detect regressions, track changes over time.

相当于SEO领域的Git工具。可捕获基准状态、检测退化情况并随时间跟踪变化。

Commands

命令

CommandPurpose
/seo drift baseline <url>
Capture current SEO state as a "known good" snapshot
/seo drift compare <url>
Compare current page state to stored baseline
/seo drift history <url>
Show change history and past comparisons

命令用途
/seo drift baseline <url>
捕获当前SEO状态作为“已知正常”的快照
/seo drift compare <url>
将当前页面状态与已存储的基准状态进行对比
/seo drift history <url>
显示变更历史及过往对比记录

What It Captures

捕获内容

Every baseline records these SEO-critical elements:
ElementFieldSource
Title tag
title
parse_html.py
Meta description
meta_description
parse_html.py
Canonical URL
canonical
parse_html.py
Robots directives
meta_robots
parse_html.py
H1 headings
h1
(array)
parse_html.py
H2 headings
h2
(array)
parse_html.py
H3 headings
h3
(array)
parse_html.py
JSON-LD schema
schema
(array)
parse_html.py
Open Graph tags
open_graph
(dict)
parse_html.py
Core Web Vitals
cwv
(dict)
pagespeed_check.py
HTTP status code
status_code
fetch_page.py
HTML content hash
html_hash
(SHA-256)
Computed
Schema content hash
schema_hash
(SHA-256)
Computed

每个基准快照会记录以下SEO关键元素:
元素字段来源
标题标签
title
parse_html.py
元描述
meta_description
parse_html.py
规范URL
canonical
parse_html.py
Robots指令
meta_robots
parse_html.py
H1标题
h1
(数组)
parse_html.py
H2标题
h2
(数组)
parse_html.py
H3标题
h3
(数组)
parse_html.py
JSON-LD schema
schema
(数组)
parse_html.py
Open Graph标签
open_graph
(字典)
parse_html.py
核心网页指标(Core Web Vitals)
cwv
(字典)
pagespeed_check.py
HTTP状态码
status_code
fetch_page.py
HTML内容哈希
html_hash
(SHA-256)
计算生成
Schema内容哈希
schema_hash
(SHA-256)
计算生成

How Comparison Works

对比机制

The comparison engine applies 17 rules across 3 severity levels. Load
references/comparison-rules.md
for the full rule set with thresholds, recommended actions, and cross-skill references.
对比引擎会在3个严重级别下应用17条规则。完整规则集(含阈值、建议操作及跨技能参考)可查看
references/comparison-rules.md

Severity Levels

严重级别

LevelMeaningResponse Time
CRITICALSEO-breaking change, likely traffic lossImmediate
WARNINGPotential impact, needs investigationWithin 1 week
INFOAwareness only, may be intentionalReview at convenience

级别含义响应时间
CRITICAL(严重)破坏SEO的变更,可能导致流量损失立即处理
WARNING(警告)可能产生影响,需调查1周内处理
INFO(信息)仅作告知,可能为有意变更方便时查看

Storage

存储

All data is stored locally in SQLite:
~/.cache/claude-seo/drift/baselines.db
所有数据均本地存储于SQLite数据库:
~/.cache/claude-seo/drift/baselines.db

Tables

数据表

  • baselines: Captured snapshots with all SEO elements
  • comparisons: Diff results with triggered rules and severities
URL normalization ensures consistent matching: lowercase scheme/host, strip default ports (80/443), sort query parameters, remove UTM parameters, strip trailing slashes.

  • baselines:存储包含所有SEO元素的捕获快照
  • comparisons:存储差异结果,含触发的规则及严重级别
URL标准化确保匹配一致性:将协议/主机转为小写、去除默认端口(80/443)、排序查询参数、移除UTM参数、删除末尾斜杠。

Command:
baseline

命令:
baseline

Captures the current state of a page and stores it.
Steps:
  1. Validate URL (SSRF protection via
    google_auth.validate_url()
    )
  2. Fetch page via
    scripts/fetch_page.py
  3. Parse HTML via
    scripts/parse_html.py
  4. Optionally fetch CWV via
    scripts/pagespeed_check.py
    (use
    --skip-cwv
    to skip)
  5. Hash HTML body and schema content (SHA-256)
  6. Store snapshot in SQLite
Execution:
bash
python scripts/drift_baseline.py <url>
python scripts/drift_baseline.py <url> --skip-cwv
Output: JSON with baseline ID, timestamp, URL, and summary of captured elements.

捕获页面当前状态并存储。
步骤:
  1. 验证URL(通过
    google_auth.validate_url()
    实现SSRF防护)
  2. 通过
    scripts/fetch_page.py
    获取页面内容
  3. 通过
    scripts/parse_html.py
    解析HTML
  4. 可选:通过
    scripts/pagespeed_check.py
    获取核心网页指标(使用
    --skip-cwv
    可跳过)
  5. 对HTML主体及Schema内容计算SHA-256哈希值
  6. 将快照存储至SQLite数据库
执行方式:
bash
python scripts/drift_baseline.py <url>
python scripts/drift_baseline.py <url> --skip-cwv
输出: 包含基准ID、时间戳、URL及捕获元素摘要的JSON数据。

Command:
compare

命令:
compare

Fetches the current page state and diffs it against the most recent baseline.
Steps:
  1. Validate URL
  2. Load most recent baseline from SQLite (or specific
    --baseline-id
    )
  3. Fetch and parse current page state
  4. Run all 17 comparison rules
  5. Classify findings by severity
  6. Store comparison result
  7. Output JSON diff report
Execution:
bash
python scripts/drift_compare.py <url>
python scripts/drift_compare.py <url> --baseline-id 5
python scripts/drift_compare.py <url> --skip-cwv
Output: JSON with all triggered rules, old/new values, severity, and actions.
After comparison, offer to generate an HTML report:
bash
python scripts/drift_report.py <comparison_json_file> --output drift-report.html

获取页面当前状态并与最新基准状态对比差异。
步骤:
  1. 验证URL
  2. 从SQLite加载最新基准(或通过
    --baseline-id
    指定特定基准)
  3. 获取并解析页面当前状态
  4. 运行全部17条对比规则
  5. 按严重级别分类结果
  6. 存储对比结果
  7. 输出JSON差异报告
执行方式:
bash
python scripts/drift_compare.py <url>
python scripts/drift_compare.py <url> --baseline-id 5
python scripts/drift_compare.py <url> --skip-cwv
输出: 包含所有触发规则、新旧值、严重级别及建议操作的JSON数据。
对比完成后,可生成HTML报告:
bash
python scripts/drift_report.py <comparison_json_file> --output drift-report.html

Command:
history

命令:
history

Shows all baselines and comparisons for a URL.
Execution:
bash
python scripts/drift_history.py <url>
python scripts/drift_history.py <url> --limit 10
Output: JSON array of baselines (newest first) with timestamps and comparison summaries.

显示某一URL的所有基准快照及对比记录。
执行方式:
bash
python scripts/drift_history.py <url>
python scripts/drift_history.py <url> --limit 10
输出: 按时间倒序排列的基准快照JSON数组,含时间戳及对比摘要。

Cross-Skill Integration

跨技能集成

When drift is detected, recommend the appropriate specialized skill:
FindingRecommendation
Schema removed or modifiedRun
/seo schema <url>
for full validation
CWV regressionRun
/seo technical <url>
for performance audit
Title or meta description changedRun
/seo page <url>
for content analysis
Canonical changed or removedRun
/seo technical <url>
for indexability check
Noindex addedRun
/seo technical <url>
for crawlability audit
H1/heading structure changedRun
/seo content <url>
for E-E-A-T review
OG tags removedRun
/seo page <url>
for social sharing analysis
Status code changed to errorRun
/seo technical <url>
for full diagnostics

检测到漂移时,会推荐相应的专业技能:
发现推荐操作
Schema被移除或修改运行
/seo schema <url>
进行完整验证
核心网页指标退化运行
/seo technical <url>
进行性能审计
标题或元描述变更运行
/seo page <url>
进行内容分析
规范URL变更或移除运行
/seo technical <url>
进行可索引性检查
添加了Noindex指令运行
/seo technical <url>
进行可抓取性审计
H1/标题结构变更运行
/seo content <url>
进行E-E-A-T审核
OG标签被移除运行
/seo page <url>
进行社交分享分析
状态码变为错误码运行
/seo technical <url>
进行完整诊断

Error Handling

错误处理

ScenarioAction
URL unreachableReport error from
fetch_page.py
. Do not guess state. Suggest user verify URL.
No baseline exists for URLInform user and suggest running
baseline
first.
SSRF blocked (private IP)Report
validate_url()
rejection. Never bypass.
SQLite database missingAuto-create on first use. No error.
CWV fetch fails (no API key)Store
null
for CWV fields. Skip CWV rules during comparison.
Page returns 4xx/5xxStill capture as baseline (status code IS a tracked field).
Multiple baselines existUse most recent unless
--baseline-id
specified.

场景操作
URL无法访问报告
fetch_page.py
返回的错误。请勿猜测状态,建议用户验证URL。
该URL无基准快照告知用户并建议先运行
baseline
命令。
SSRF被拦截(私有IP)报告
validate_url()
的拦截结果,绝不绕过。
SQLite数据库缺失首次使用时自动创建,不报错。
核心网页指标获取失败(无API密钥)CWV字段存储为
null
,对比时跳过CWV相关规则。
页面返回4xx/5xx状态码仍将其捕获为基准快照(状态码本身就是跟踪字段)。
存在多个基准快照除非指定
--baseline-id
,否则使用最新的基准快照。

Security

典型工作流

部署前后检查

  • All URL fetching goes through
    scripts/fetch_page.py
    which enforces SSRF protection (blocks private IPs, loopback, reserved ranges, GCP metadata endpoints)
  • No curl, no subprocess HTTP calls -- only the project's validated fetch pipeline
  • All SQLite queries use parameterized placeholders (
    ?
    ), never string interpolation
  • TLS always verified -- no
    verify=False
    anywhere in the pipeline

/seo drift baseline https://example.com     # 部署前

Typical Workflows

... 执行部署 ...

Pre/Post Deployment Check

/seo drift baseline https://example.com     # Before deploy
/seo drift compare https://example.com # 部署后
undefined

... deploy happens ...

持续监控

/seo drift compare https://example.com # After deploy
undefined
/seo drift baseline https://example.com     # 初始捕获

Ongoing Monitoring

... 数周后 ...

/seo drift baseline https://example.com     # Initial capture
/seo drift compare https://example.com # 检查是否存在漂移 /seo drift history https://example.com # 查看所有变更
undefined

... weeks later ...

流量下降排查

/seo drift compare https://example.com # Check for drift /seo drift history https://example.com # Review all changes
undefined
/seo drift compare https://example.com      # 发生了哪些变更?
/seo drift history https://example.com      # 变更发生在何时?

Investigating a Traffic Drop

/seo drift compare https://example.com      # What changed?
/seo drift history https://example.com      # When did it change?