一键导入
compare-framework
Semantic comparison workflow for validating equivalence between artifacts.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Semantic comparison workflow for validating equivalence between artifacts.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
This skill should be used when the user asks to "plan a blog post", "research for blog", "draft a blog post", "critique a draft", "deformulize a post", "commit blog changes", "editorial review", "voice check", "style check", "audit blog", "content audit", "audit series", or "audit drafts".
This skill should be used when the user asks to "commit code", "review code", "fix lint/type error", "improve performance", "compare code", "shrink code", "generate spec from code", "investigate code", or "create handoff prompt".
This skill should be used when the user asks to "create documentation", "build docs", "review docs", "compare documents", "compress docs", "adversarial review docs", or "commit docs".
Unified identify-verify-stage-commit logic reused by other skills.
Pre-edit investigation workflow for understanding code and behavior before changes.
Validation-driven compression workflow that requires semantic comparison before approval.
| name | compare-framework |
| description | Semantic comparison workflow for validating equivalence between artifacts. |
Compare two artifacts (code, documents, configs) for behavioral/execution equivalence.
CRITICAL: Steps 1-2 MUST run in parallel (single message, two Task calls). Extract independently — NEVER pre-populate with "items to verify" or prime with change knowledge. Targeted validation inflates scores.
Use Task tool with subagent_type: "general-purpose", model: "sonnet":
**SEMANTIC EXTRACTION**
**Artifact**: {{path}} | **Type**: {{code|document|config}}
Extract ALL {{type-specific items}} from this artifact.
Rules: Extract ALL items (not just obvious), normalize to standard forms, include line numbers, note confidence level.
Output Format (JSON):
{ "items": [...], "relationships": [...], "metadata": {...} }
Execute: Single message with TWO Task calls.
def calculate_equivalence(primary_comp, relationship_comp, structure_comp):
weights = {"primary": 0.4, "relationship": 0.4, "structure": 0.2}
base_score = sum(weights[k] * scores[k] for k in weights)
if breaking_changes > 0:
base_score *= 0.5
if critical_relationships_broken > 0:
base_score *= 0.7
return base_score
| Score | Interpretation |
|---|---|
| >=0.95 | Equivalent - safe to proceed |
| 0.85-0.94 | Mostly equivalent - review carefully |
| 0.70-0.84 | Significant differences |
| <0.70 | BREAKING - not equivalent |
| Type | Severity | Trigger |
|---|---|---|
| Breaking change | CRITICAL | Core contract changed |
| Relationship loss | HIGH | Dependency removed |
| Structural change | MEDIUM | Organization differs |
| Minor difference | LOW | Cosmetic changes |
## Comparison: {{A}} vs {{B}}
### Equivalence Summary
- **Score**: {score}/1.0 ({interpretation})
- **Primary Preservation**: {score}/1.0
- **Relationship Preservation**: {score}/1.0
- **Structure**: {score}/1.0
### Warnings ({count})
**{severity}**: {description}
### Shared ({count})
- {item} - Match: {type}
### Unique to A ({count})
- {item}
### Unique to B ({count})
- {item}
### Recommendation
{SAFE|REVIEW|BREAKING}