Community研究與資料分析github.com

衝突檢測器 (Conflict Detector)

跨文件衝突檢測器。用於當使用者有兩個或更多文件、資料集或提取的事實表並想找出它們之間的矛盾時。觸發詞為「檢測衝突」、「找出矛盾」、「這些文件是否一致」、「交叉比對主張」、「不一致檢查」,或當比較跨多個來源的主張時。執行三個檢測層級:實體 (同一鍵的數值/布林值不匹配)、子句 (類別不匹配) 和論點 (自由文字不一致)。輸出機器可讀的衝突報告 (JSON / CSV / Markdown)。

衝突檢測器 (Conflict Detector) 是什麼?

這是一個自包含的技能,旨在尋找一組文件中的矛盾。它會載入每份文件 (透過路徑、內嵌文字或內嵌 JSON),提取其中的事實,並透過跨文件規則引擎,根據規範金鑰配對主張,然後標記不匹配的部分。該技能支援三個檢測層級:實體層級 (同一規範金鑰的數值或布林值不匹配,嚴重性高)、子句層級 (類別不匹配,嚴重性中等) 和論點層級 (自由文字不一致,嚴重性低)。它廣泛適用於 Claude Code、Codex、Cursor 等 AI 代理平台,透過命令列介面 (CLI) 操作。使用者可以使用 `validate` 命令驗證配置、使用 `list-docs` 列出文件來源,或使用 `run` 命令執行檢測並指定輸出格式 (JSON、CSV、Markdown)。報告會輸出到 `./conflicts/` 目錄,其中 JSON 格式是主要的機器可讀合約。此技能對於審計從多個來源提取的事實表、交叉比對跨文件的主張或確保內部一致性至關重要。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/JiamingShi-JsPhys/agent-skills/tree/HEAD/skills/conflict-detector

Installed? Explore more 研究與資料分析 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

衝突檢測器

一個自包含的技能,用於尋找一組文件中的矛盾。每份文件都會被載入 (路徑 / 內嵌文字 / 內嵌 JSON),提取其中的事實,然後一個跨文件規則引擎會根據規範金鑰配對主張並標記不匹配的部分。

強制工作流程

相依性引導 (首次使用時執行)

在首次執行前,探查此技能的執行期相依性:

  • 核心:純標準函式庫 — 無需安裝。
  • 可選:PyYAML (僅當配置/輸入是 .yaml 檔案時需要;JSON 輸入可僅使用標準函式庫處理)。

如果缺少 PyYAML 且輸入是 YAML,請告知使用者並詢問是否要 pip install pyyaml;僅在使用者確認後才安裝。未經明確同意,切勿安裝到全域環境中。

  1. 載入 YAML 配置 (參考 config/examples/two_docs.yaml)。
  2. 確認每個 documents[].value / documents[].path 都可訪問。
  3. 執行 python -m src.cli run --config <path> [--format json,csv,md]。
  4. 報告每個層級的衝突數量,並指導使用者前往 ./conflicts/conflicts_<run_id>.*。

使用時機

  • 必須檢查兩個或更多文件、資料集或提取的事實表之間是否存在矛盾。
  • 使用者要求「檢測衝突」、「找出矛盾」、「交叉比對主張」或詢問「這些文件是否一致」。
  • 一個主張 (數字、狀態、命名事實) 出現在多個來源中,必須跨來源進行比較。
  • 從文件中提取的事實表必須在依賴其結果前,審計其內部一致性。

使用範例

# 在執行前驗證配置 (快速,不寫入報告)。
python -m src.cli validate --config config/examples/two_docs.yaml

# 列出配置解析後的文件來源。
python -m src.cli list-docs --config config/examples/two_docs.yaml

# 執行檢測;選擇輸出格式 (預設:json)。
python -m src.cli run --config config/examples/two_docs.yaml --format json,csv,md

報告會寫入到 ./conflicts/conflicts_<run_id>.{json,csv,md};JSON 是機器可讀的合約。

錯誤處理

  • 配置無效 (validate 以非零狀態碼退出) — 修正報告中提到的欄位並重新驗證;不要手動繞過綱要違規。
  • 文件來源無法訪問 — 執行中止並指出有問題的 documents[] 條目;請驗證路徑或內嵌值,然後重試。
  • 未發現衝突 — 這是一個有效且可報告的結果 (空報告),不是錯誤;請明確說明,不要重新執行。
  • 意外的退出碼 — 逐字報告錯誤訊息;不要退而求其次地手動比較文件。

檢測層級

層級種類嚴重性範例
entitynumeric_mismatch, boolean高speed = 10 與 speed = 20
clausecategorical中status = "active" 與 status = "archived"
argumentcategorical (文字)低不一致的自由文字行

限制

  • 提取是以鍵值為導向;自由文字段落僅在 argument 層級參與 (基於行的比較)。
  • 單位正規化是透過表格驅動 (unit_map);自訂單位規則必須透過配置提供。

Individual skills in this repo

This repo contains 3 individual skills — each has its own dedicated page.

JiamingShi-JsPhys/agent-skills

Document evolution tracker. Use when the user has a family of document versions (timestamped or sequentially named files) and wants to see how the document changed over time -- which paragraphs / lines / sentences were added, removed, or modified between consecutive versions, and how a set of named concepts (or auto-detected headings) evolved (introduced / retained / modified / dropped). Triggers on "track document changes", "version history", "what changed between drafts", "concept lineage", "document evolution". Emits a Markdown + JSON timeline.

JiamingShi-JsPhys/agent-skills

Longitudinal statistical analysis pipeline. Use when the user has panel / repeated-measures data (one or more sessions per subject, with between-subject conditions) and wants to run a reproducible analysis: descriptive stats, a manipulation check, a linear mixed model, a lagged mediator, or a sensitivity analysis over random-effects / covariance structures. Triggers on any of the phrases "LMM", "mixed model", "repeated measures", "longitudinal analysis", "mediation over time", "lagged mediator", "sensitivity analysis of RE structure". When fired, load the YAML config that lists the enabled steps, run the pipeline, and report the per-step results plus the generated CSVs.

JiamingShi-JsPhys/agent-skills

State manager for multi-dimensional computational experiments. Iterate a parameter grid over many rounds, snapshot declared critical files each round, audit every round (params, hashes, timestamps, status), and roll back to any round non-destructively. Use it when a workflow runs hundreds of rounds across multiple parameter dimensions and needs per-round snapshots, full audit trail, and arbitrary rollback - e.g. longitudinal studies, parameter scans, or symbolic/ numerical sweeps calling external solvers (Mathematica, GAP, SymPy, custom scripts).

相關技能