seo-drift
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSEO Drift Monitor (April 2026)
SEO漂移监控工具(2026年4月)
Git for your SEO. Capture baselines, detect regressions, track changes over time.
相当于SEO领域的Git工具。可捕获基准状态、检测退化情况并随时间跟踪变化。
Commands
命令
| Command | Purpose |
|---|---|
| Capture current SEO state as a "known good" snapshot |
| Compare current page state to stored baseline |
| Show change history and past comparisons |
| 命令 | 用途 |
|---|---|
| 捕获当前SEO状态作为“已知正常”的快照 |
| 将当前页面状态与已存储的基准状态进行对比 |
| 显示变更历史及过往对比记录 |
What It Captures
捕获内容
Every baseline records these SEO-critical elements:
| Element | Field | Source |
|---|---|---|
| Title tag | | |
| Meta description | | |
| Canonical URL | | |
| Robots directives | | |
| H1 headings | | |
| H2 headings | | |
| H3 headings | | |
| JSON-LD schema | | |
| Open Graph tags | | |
| Core Web Vitals | | |
| HTTP status code | | |
| HTML content hash | | Computed |
| Schema content hash | | Computed |
每个基准快照会记录以下SEO关键元素:
| 元素 | 字段 | 来源 |
|---|---|---|
| 标题标签 | | |
| 元描述 | | |
| 规范URL | | |
| Robots指令 | | |
| H1标题 | | |
| H2标题 | | |
| H3标题 | | |
| JSON-LD schema | | |
| Open Graph标签 | | |
| 核心网页指标(Core Web Vitals) | | |
| HTTP状态码 | | |
| HTML内容哈希 | | 计算生成 |
| Schema内容哈希 | | 计算生成 |
How Comparison Works
对比机制
The comparison engine applies 17 rules across 3 severity levels. Load
for the full rule set with thresholds,
recommended actions, and cross-skill references.
references/comparison-rules.md对比引擎会在3个严重级别下应用17条规则。完整规则集(含阈值、建议操作及跨技能参考)可查看。
references/comparison-rules.mdSeverity Levels
严重级别
| Level | Meaning | Response Time |
|---|---|---|
| CRITICAL | SEO-breaking change, likely traffic loss | Immediate |
| WARNING | Potential impact, needs investigation | Within 1 week |
| INFO | Awareness only, may be intentional | Review 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.dbTables
数据表
- 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命令:baseline
baselineCaptures the current state of a page and stores it.
Steps:
- Validate URL (SSRF protection via )
google_auth.validate_url() - Fetch page via
scripts/fetch_page.py - Parse HTML via
scripts/parse_html.py - Optionally fetch CWV via (use
scripts/pagespeed_check.pyto skip)--skip-cwv - Hash HTML body and schema content (SHA-256)
- Store snapshot in SQLite
Execution:
bash
python scripts/drift_baseline.py <url>
python scripts/drift_baseline.py <url> --skip-cwvOutput: JSON with baseline ID, timestamp, URL, and summary of captured elements.
捕获页面当前状态并存储。
步骤:
- 验证URL(通过实现SSRF防护)
google_auth.validate_url() - 通过获取页面内容
scripts/fetch_page.py - 通过解析HTML
scripts/parse_html.py - 可选:通过获取核心网页指标(使用
scripts/pagespeed_check.py可跳过)--skip-cwv - 对HTML主体及Schema内容计算SHA-256哈希值
- 将快照存储至SQLite数据库
执行方式:
bash
python scripts/drift_baseline.py <url>
python scripts/drift_baseline.py <url> --skip-cwv输出: 包含基准ID、时间戳、URL及捕获元素摘要的JSON数据。
Command: compare
compare命令:compare
compareFetches the current page state and diffs it against the most recent baseline.
Steps:
- Validate URL
- Load most recent baseline from SQLite (or specific )
--baseline-id - Fetch and parse current page state
- Run all 17 comparison rules
- Classify findings by severity
- Store comparison result
- 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-cwvOutput: 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获取页面当前状态并与最新基准状态对比差异。
步骤:
- 验证URL
- 从SQLite加载最新基准(或通过指定特定基准)
--baseline-id - 获取并解析页面当前状态
- 运行全部17条对比规则
- 按严重级别分类结果
- 存储对比结果
- 输出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.htmlCommand: history
history命令:history
historyShows all baselines and comparisons for a URL.
Execution:
bash
python scripts/drift_history.py <url>
python scripts/drift_history.py <url> --limit 10Output: 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:
| Finding | Recommendation |
|---|---|
| Schema removed or modified | Run |
| CWV regression | Run |
| Title or meta description changed | Run |
| Canonical changed or removed | Run |
| Noindex added | Run |
| H1/heading structure changed | Run |
| OG tags removed | Run |
| Status code changed to error | Run |
检测到漂移时,会推荐相应的专业技能:
| 发现 | 推荐操作 |
|---|---|
| Schema被移除或修改 | 运行 |
| 核心网页指标退化 | 运行 |
| 标题或元描述变更 | 运行 |
| 规范URL变更或移除 | 运行 |
| 添加了Noindex指令 | 运行 |
| H1/标题结构变更 | 运行 |
| OG标签被移除 | 运行 |
| 状态码变为错误码 | 运行 |
Error Handling
错误处理
| Scenario | Action |
|---|---|
| URL unreachable | Report error from |
| No baseline exists for URL | Inform user and suggest running |
| SSRF blocked (private IP) | Report |
| SQLite database missing | Auto-create on first use. No error. |
| CWV fetch fails (no API key) | Store |
| Page returns 4xx/5xx | Still capture as baseline (status code IS a tracked field). |
| Multiple baselines exist | Use most recent unless |
| 场景 | 操作 |
|---|---|
| URL无法访问 | 报告 |
| 该URL无基准快照 | 告知用户并建议先运行 |
| SSRF被拦截(私有IP) | 报告 |
| SQLite数据库缺失 | 首次使用时自动创建,不报错。 |
| 核心网页指标获取失败(无API密钥) | CWV字段存储为 |
| 页面返回4xx/5xx状态码 | 仍将其捕获为基准快照(状态码本身就是跟踪字段)。 |
| 存在多个基准快照 | 除非指定 |
Security
典型工作流
—
部署前后检查
- All URL fetching goes through which enforces SSRF protection (blocks private IPs, loopback, reserved ranges, GCP metadata endpoints)
scripts/fetch_page.py - 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 anywhere in the pipeline
verify=False
/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?—