diff --git a/README.md b/README.md index e8763ae..8090b76 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Claude Code marketplace,散發 **跨領域形式化公理體系** plugin。 │ ├── .claude-plugin/ │ │ └── plugin.json │ ├── skills/ # 三個 skill -│ ├── domains/ # 12+ 個內建公理化領域 +│ ├── domains/ # 14 個內建公理化領域(見 domains/INDEX.md) │ ├── foundations/ # 跨領域原則 + ASBE 方法論 │ ├── templates/ # YAML 模板 │ ├── README.md # plugin 使用說明 diff --git a/plugins/che-axiom-systems/CLAUDE.md b/plugins/che-axiom-systems/CLAUDE.md index 5bce568..9bc59a7 100644 --- a/plugins/che-axiom-systems/CLAUDE.md +++ b/plugins/che-axiom-systems/CLAUDE.md @@ -12,7 +12,7 @@ ## Skill 路徑慣例 -Skills 讀取 plugin 自帶資料時使用 `${CLAUDE_PLUGIN_ROOT}/` 前綴(Claude Code 自動提供的 env var)。寫入時依 cwd 判斷 maintainer / 使用者本地模式。詳見各 SKILL.md 開頭的「資料路徑」段落。 +Skills 讀取 plugin 自帶資料時使用 `${CLAUDE_PLUGIN_ROOT}/` 前綴(Claude Code 自動提供的 env var)。寫入採**結構偵測**:repo root(`git rev-parse --show-toplevel`)存在 `plugins/che-axiom-systems/.claude-plugin/plugin.json` → maintainer 模式,寫 `$ROOT/plugins/che-axiom-systems/domains/`;否則(含非 git cwd,fail-closed)→ 本地模式,寫 cwd 的 `axioms/`,擴充內建域用 `extensions.*` overlay、絕不寫入 plugin cache。詳見各 SKILL.md 開頭的「資料路徑」段落(本段為 canonical)。 ## 核心原則 diff --git a/plugins/che-axiom-systems/README.md b/plugins/che-axiom-systems/README.md index 221b6b6..6c5a077 100644 --- a/plugins/che-axiom-systems/README.md +++ b/plugins/che-axiom-systems/README.md @@ -32,8 +32,8 @@ Plugin 自帶 **14 個**已公理化的領域,安裝後可直接 `/axiom-looku ## 寫入位置(axiom-create) -- 若你在 `che-axiom-systems` repo 的 clone 內跑 `/axiom-create` → 寫到 cwd 的 `domains//`(maintainer 模式,方便後續 commit/PR) -- 若在其他 cwd → 寫到 cwd 的 `axioms//`(本地模式,私有領域) +- **Maintainer 模式**(結構偵測:repo root 存在 `plugins/che-axiom-systems/.claude-plugin/plugin.json`)→ 寫到 `/plugins/che-axiom-systems/domains//`,方便後續 commit/PR +- **本地模式**(其他 cwd;偵測失敗一律 fail-closed 到此)→ 寫到 cwd 的 `axioms//`(私有領域);擴充 plugin 內建域時寫 `axioms//extensions.*` overlay,絕不寫入 plugin cache ## 核心原則 diff --git a/plugins/che-axiom-systems/domains/apa7-style/domain.yaml b/plugins/che-axiom-systems/domains/apa7-style/domain.yaml index e6de749..5694575 100644 --- a/plugins/che-axiom-systems/domains/apa7-style/domain.yaml +++ b/plugins/che-axiom-systems/domains/apa7-style/domain.yaml @@ -8,3 +8,5 @@ maturity: bootstrapped entry_points: - CLAUDE.md - 01_core_axioms/writing_style.yaml + - 01_core_axioms/writing_guidelines.yaml + - 01_core_axioms/jars_standards.yaml diff --git a/plugins/che-axiom-systems/skills/axiom-create/SKILL.md b/plugins/che-axiom-systems/skills/axiom-create/SKILL.md index b1e5bc6..4c11b55 100644 --- a/plugins/che-axiom-systems/skills/axiom-create/SKILL.md +++ b/plugins/che-axiom-systems/skills/axiom-create/SKILL.md @@ -1,7 +1,6 @@ --- name: axiom-create -description: 建立新的公理化領域或在既有領域新增公理/定理。載入 ASBE 方法論引導結構化建立。 -user_invocable: true +description: 建立新的公理化領域,或在既有領域新增公理/定理/範例。當使用者要求「公理化某領域」、「新增公理」、「加定理」、「建立 axiom domain」時使用。遵循 ASBE 方法論與 SCD2(只增不改)原則。Create or extend axiomatization domains following the ASBE methodology. --- # axiom-create @@ -10,14 +9,14 @@ user_invocable: true ## 資料路徑與寫入策略 -**讀取**:方法論與既有 domain 從 `${CLAUDE_PLUGIN_ROOT}/foundations/`、`${CLAUDE_PLUGIN_ROOT}/domains/`、`${CLAUDE_PLUGIN_ROOT}/templates/` 載入(plugin 自帶的 reference data)。 +**讀取**:方法論與既有 domain 從 `${CLAUDE_PLUGIN_ROOT}/foundations/`、`${CLAUDE_PLUGIN_ROOT}/domains/`、`${CLAUDE_PLUGIN_ROOT}/templates/` 載入(plugin 自帶的 reference data)。`${CLAUDE_PLUGIN_ROOT}` 是 Claude Code 自動提供的 env var(plugin 安裝根目錄),可在 Bash 中以 `echo $CLAUDE_PLUGIN_ROOT` 取得;路徑慣例的 canonical 描述見 plugin CLAUDE.md「Skill 路徑慣例」。 **寫入**:分兩種情境 | 情境 | 判斷 | 寫入位置 | |------|------|---------| -| **Maintainer 模式** | cwd 在 che-axiom-systems repo(`git remote get-url origin` 包含 `che-axiom-systems`)| 直接寫入 cwd 的 `domains//`,使用者後續可 commit/PR | -| **使用者本地模式** | cwd 不是 maintainer repo | 寫入 cwd 的 `axioms//`(使用者私有目錄),並在最後提示「想 contribute 回 plugin,請 fork repo 後重跑」| +| **Maintainer 模式** | **結構偵測**:`ROOT=$(git rev-parse --show-toplevel)` 成功,且 `$ROOT/plugins/che-axiom-systems/.claude-plugin/plugin.json` 存在(repo 改名、fork、remote 別名都不影響判定)| 寫入 `$ROOT/plugins/che-axiom-systems/domains//`,使用者後續可 commit/PR | +| **使用者本地模式** | 非 maintainer repo;偵測失敗(含非 git cwd)一律 **fail-closed** 到此模式 | 寫入 cwd 的 `axioms//`(使用者私有目錄),並在最後提示「想 contribute 回 plugin,請 fork repo 後重跑」| skill 開始前先檢查 cwd 判斷模式,並告知使用者目前是哪個模式。 @@ -31,7 +30,7 @@ skill 開始前先檢查 cwd 判斷模式,並告知使用者目前是哪個模 ### Step 2: 如果是新領域 -1. 詢問領域名稱和範圍描述 +1. 詢問領域名稱和範圍描述;**名稱碰撞檢查**:已存在於 plugin 內建 domains、maintainer repo、或本地 `axioms/` → 建議改走 Step 3 擴充或換名;目標目錄已存在 → 停下確認,不覆寫 2. 讀取 `${CLAUDE_PLUGIN_ROOT}/foundations/asbe-methodology.md` 載入 ASBE 方法論 3. 讀取 `${CLAUDE_PLUGIN_ROOT}/templates/domain-template.yaml` 作為起點 4. 引導使用者定義: @@ -40,30 +39,31 @@ skill 開始前先檢查 cwd 判斷模式,並告知使用者目前是哪個模 - 每條公理要有 `statement_natural` + `statement_formal` (A1) - 每條公理要有 `violations` + `compliant` 範例 (A2) - 公理之間要獨立、一致、充分 (A4) -5. 依「資料路徑與寫入策略」判斷寫入位置:maintainer 模式寫 `/domains//`、使用者本地模式寫 `/axioms//` -6. **一併產生 domain manifest**:從 `${CLAUDE_PLUGIN_ROOT}/templates/domain-manifest.yaml` 複製為新領域的 `domain.yaml`,填入 `domain` / `description` / `format`(新領域一律 `yaml` + `bootstrapped`)/ `entry_points`;maintainer 模式下同步在 `domains/INDEX.md` 加一列 +5. 依「資料路徑與寫入策略」判斷寫入位置:maintainer 模式寫 `$ROOT/plugins/che-axiom-systems/domains//`、使用者本地模式寫 `/axioms//` +6. **一併產生 domain manifest**:從 `${CLAUDE_PLUGIN_ROOT}/templates/domain-manifest.yaml` 複製為新領域的 `domain.yaml`,填入 `domain` / `description` / `format`(新領域一律 `yaml` + `bootstrapped`)/ `entry_points`;maintainer 模式下同步在 `$ROOT/plugins/che-axiom-systems/domains/INDEX.md` 加一列 7. 讀取 `${CLAUDE_PLUGIN_ROOT}/foundations/cross-domain-principles.md`,檢查新公理是否與 plugin 內建領域矛盾 ### Step 3: 如果是擴充既有領域 -1. 列出 `${CLAUDE_PLUGIN_ROOT}/domains/`(plugin 內建)+ cwd 的 `domains/` 或 `axioms/`(本地)中的所有領域讓使用者選擇 -2. 讀取該領域的現有公理 -3. 引導使用者新增: +1. 列出 `${CLAUDE_PLUGIN_ROOT}/domains/`(plugin 內建)+ cwd 的 `domains/` 或 `axioms/`(本地)中的所有領域,**讓使用者先選定目標領域**,然後讀取該領域的現有公理 +2. **讀選定領域的 `domain.yaml` manifest**(缺失 → 視同 `markdown/legacy`,建議補 manifest),依 `format` 分流: + - `yaml` → 依 ASBE schema 新增(下方 4 照舊) + - `markdown` → 在 `entry_points` 所列檔案以散文附加,沿用該文件既有的標題/編號慣例;可主動提議 bootstrap 一份平行的 `*_bootstrapped.yaml`(參照 asbe 域先例),**不要**在散文檔內混入 YAML 欄位 + - `freeform` → 從 `entry_points` 進入該域自訂體系(如 japanese-narrative 的 `公理/`),依其組織方式新增;不強加 ASBE 欄位 +3. **決定寫入位置**:maintainer 模式 → 直接改 `$ROOT/plugins/che-axiom-systems/domains//`;**非 maintainer 模式擴充 plugin 內建域** → 寫 `/axioms//extensions.md|yaml` overlay(**絕不寫入 `${CLAUDE_PLUGIN_ROOT}` — 那是 plugin cache,下次更新即被清除**),lookup/validate 會以 `[local]` 來源顯示 +4. 引導使用者新增: - **新公理** — 必須與既有公理獨立(A4) - - **新定理** — 必須標明 `derives_from` 指向父公理(A3) - - **新範例** — 可以為既有公理補充 violations/compliant -4. 遵循 SCD2 原則:只新增,不修改既有公理 -5. 檢查跨域一致性 + - **新定理** — 必須標明 `derives_from` 指向父公理(A3;僅 yaml format) + - **新範例** — 可以為既有公理補充 violations/compliant(僅 yaml format) +5. 遵循 SCD2 原則:只新增,不修改既有公理。**maintainer 模式自檢**:寫入後跑 `git diff `,確認對既有公理只有新增行;發現修改/刪除 → 還原,改為新增澄清條目 +6. 檢查跨域一致性:讀取 `${CLAUDE_PLUGIN_ROOT}/foundations/cross-domain-principles.md` 比對 +7. **同步 manifest 與 INDEX**:若本次擴充新增了檔案、或改變了該域的 format/maturity 實態,更新該域 `domain.yaml`(`entry_points` 等);maintainer 模式下同步檢查 `$ROOT/plugins/che-axiom-systems/domains/INDEX.md` 該列 -### Step 4: 品質檢查 +### Step 4: 品質檢查(委派給 axiom-validate) -建立完成後,自動執行快速驗證: -- 每條新公理/定理是否有雙層表達? -- 每條是否有至少一個 violation 和一個 compliant 範例? -- ID 命名是否遵循慣例(A/T/C/R prefix)? -- 是否有與其他領域的潛在矛盾? +建立完成後,讀取 `${CLAUDE_PLUGIN_ROOT}/skills/axiom-validate/SKILL.md`,依其 manifest 分級流程(format 決定檢查方式、maturity 決定嚴重度上限)對**本次新增的項目**執行單一領域驗證 — 不在此複製檢查清單、也不綁定對方的步驟編號(凍結的副本必然 drift)。 -如果有問題,提示使用者修正。 +有問題提示使用者修正;修正**尚未發布**的草稿不受 SCD2 限制(SCD2 約束的是已發布公理)。 ## 完成後提示 diff --git a/plugins/che-axiom-systems/skills/axiom-lookup/SKILL.md b/plugins/che-axiom-systems/skills/axiom-lookup/SKILL.md index d3d9c39..5aeb4ce 100644 --- a/plugins/che-axiom-systems/skills/axiom-lookup/SKILL.md +++ b/plugins/che-axiom-systems/skills/axiom-lookup/SKILL.md @@ -1,7 +1,7 @@ --- name: axiom-lookup -description: 搜尋公理化系統中的公理、定理和概念。支援跨領域全文搜尋和特定領域查詢。 -user_invocable: true +description: 搜尋 plugin 內建的公理化領域(statistics、apa7-style、weight-control、ASBE、japanese-narrative 等)與使用者本地領域的公理、定理與概念。當使用者要查某條公理、問某領域有哪些公理、或問哪個 domain 涵蓋某概念時使用。Search or list axioms across the bundled axiomatization domains. +argument-hint: "[query] | --domain [query] | --list" --- # axiom-lookup @@ -12,20 +12,22 @@ user_invocable: true 公理資料隨 plugin 散布,存放在 `${CLAUDE_PLUGIN_ROOT}/domains/`。`${CLAUDE_PLUGIN_ROOT}` 是 Claude Code 自動提供的 env var(plugin 安裝根目錄),可在 Bash 中以 `echo $CLAUDE_PLUGIN_ROOT` 取得。本檔內所有 `domains/`、`foundations/`、`templates/` 都指 plugin-root-relative 位置,不是使用者 cwd。 +**搜尋範圍 = plugin 內建 ∪ 本地**:若 cwd 存在 `domains/` 或 `axioms/`(`/axiom-create` 本地模式的產物),一併納入搜尋與 `--list`;結果標明來源 `[plugin]` / `[local]`。 + ## 觸發方式 - `/axiom-lookup [query]` — 搜尋關鍵字 - `/axiom-lookup --domain statistics [query]` — 限定領域搜尋 -- `/axiom-lookup --list` — 列出所有領域及其公理數量 +- `/axiom-lookup --list` — 列出所有領域(format / maturity / entry point) ## 流程 ### Step 1: 解析查詢 從使用者輸入判斷: -- **有指定 domain** → 只搜尋該 domain -- **沒有指定 domain** → 搜尋所有 `${CLAUDE_PLUGIN_ROOT}/domains/` 下的領域 -- **`--list`** → 掃描 `${CLAUDE_PLUGIN_ROOT}/domains/` 列出總覽 +- **有指定 domain** → 只搜尋該 domain(先在 plugin 內建找,再找本地來源) +- **沒有指定 domain** → 搜尋所有 `${CLAUDE_PLUGIN_ROOT}/domains/` 下的領域 + 本地來源(見「資料路徑」) +- **`--list`** → 列出總覽(plugin 內建讀 INDEX;本地來源即時掃描,標 `[local]`) ### Step 2: 搜尋 @@ -37,33 +39,57 @@ user_invocable: true | `markdown` | 全文搜尋:標題 + 內文,以 `entry_points` 列的檔案優先 | | `freeform` | 全文搜尋,從 `entry_points`(如 `公理/INDEX.md`)進入該域自訂體系 | -使用 Grep 在 `${CLAUDE_PLUGIN_ROOT}/domains/` 目錄中執行上述策略。 +使用 Grep 在 `${CLAUDE_PLUGIN_ROOT}/domains/`(+ 本地來源)中執行上述策略。 + +**排除規則(一律套用)**:排除 `**/archive/**`、`**/archived/**`、`06_reference/` 等參考資料目錄、dotdirs(`.claude/`、`.vscode/`)與非文字資產(圖檔、PDF、網頁存檔)。archive 內是被取代的舊版公理,混入結果會讓使用者拿到新舊並列且無標記的答案。`yaml` domain 的欄位感知搜尋以該域公理 YAML 檔為目標(`entry_points` 所列檔案+同層兄弟 `*.yaml`,例如 apa7-style 的 `01_core_axioms/*.yaml`)。 -### Step 3: 呈現結果 +### Step 3: 呈現結果(依 format 選模板) -對每個匹配,顯示: +**yaml domain** — 完整卡片(欄位真實存在才能這樣顯示): ``` -📍 Domain: weight-control - A5_mass_conservation — Mass Conservation Axiom +📍 weight-control [yaml/bootstrapped] + A0_mass_conservation — Mass Conservation Axiom "Body mass change equals net mass flux" ΔM = Σ(mass_in) - Σ(mass_out) - File: domains/weight-control/weight_control_axioms.md:42 + File: domains/weight-control/weight_control_axioms.yaml:390 +``` + +**markdown domain** — 標題 + 摘錄 + 位置: +``` +📍 statistics [markdown/legacy] + § 最大概似原則 + 「…估計量的選擇以概似函數最大化為準…」 + File: domains/statistics/00_principles.md:57 ``` -如果結果跨多個領域,按 domain 分組顯示。 +**freeform domain** — entry-point 相對路徑 + 摘錄: +``` +📍 japanese-narrative [freeform/legacy] + 公理/J04_物の哀れ.md — 「…無常の美意識を物語の緊張構造に…」 +``` + +如果結果跨多個領域,按 domain 分組顯示。**嚴禁為 legacy domain 捏造 `id`/`one_liner`/formal statement 欄位** — 該 format 沒有的欄位就用對應模板呈現。 ### Step 4: 深入查看 -問使用者是否要: -- 展開某條公理的完整內容(含 violations/compliant 範例) -- 查看該公理的推導鏈(derives_from 向上追溯) -- 查看相關的跨域公理 +依結果的 format 提供選項: +- `yaml` 結果 → 展開完整內容(violations/compliant 範例)、推導鏈(`derives_from` 向上追溯)、相關跨域公理 +- `markdown` / `freeform` 結果 → 開啟該檔案的完整段落(這些 format 沒有 violations/derives_from 欄位,不提供該選項) + +## 錯誤處理 + +| 情況 | 行為 | +|------|------| +| 無參數裸呼叫 | 問使用者要搜尋什麼,或建議 `--list` 看領域總覽 | +| `--domain` 名稱不存在 | 列出 INDEX 中可用領域(含本地來源),不猜測、不模糊匹配後逕自執行 | +| 查無結果 | 輸出 `0 results for ""` + 建議:放寬關鍵字/`--list`/移除 `--domain` 限定 | +| `domain.yaml` 缺失(本地域常見) | 視同 `markdown/legacy` 全文搜尋,並建議補 manifest(與 axiom-validate 同措辭) | ## 特殊查詢 ### `--list` 模式 -**直接讀 `${CLAUDE_PLUGIN_ROOT}/domains/INDEX.md`**(決定性輸出,不靠即時掃描推測)。若要機器可讀版本,改讀各 domain 的 `domain.yaml` manifest。輸出格式: +**直接讀 `${CLAUDE_PLUGIN_ROOT}/domains/INDEX.md`** 作為輸出來源(決定性);領域總數由 INDEX 列數推導,範例中的 14 只是示意。另以一次 `ls domains/` 交叉核對目錄與 INDEX 是否漂移(這不是輸出來源,只是 drift 檢查)。輸出格式: ``` 📚 Axiomatization Systems — 14 domains diff --git a/plugins/che-axiom-systems/skills/axiom-validate/SKILL.md b/plugins/che-axiom-systems/skills/axiom-validate/SKILL.md index 95e61be..88d1227 100644 --- a/plugins/che-axiom-systems/skills/axiom-validate/SKILL.md +++ b/plugins/che-axiom-systems/skills/axiom-validate/SKILL.md @@ -1,7 +1,7 @@ --- name: axiom-validate -description: 驗證公理化系統的結構完整性(ASBE 合規)和跨領域一致性(無矛盾)。 -user_invocable: true +description: 驗證公理化領域的 ASBE 結構合規(A1–A5,依 domain.yaml 的 format/maturity 分級)與跨領域一致性。新增或修改公理後、或使用者要求檢查公理系統品質時使用。Validate axiom domains for ASBE compliance and cross-domain consistency. +argument-hint: "[domain] | --cross | --all" --- # axiom-validate @@ -10,13 +10,22 @@ user_invocable: true ## 資料路徑 -公理與方法論資料隨 plugin 散布,存放在 `${CLAUDE_PLUGIN_ROOT}/domains/` 與 `${CLAUDE_PLUGIN_ROOT}/foundations/`。`${CLAUDE_PLUGIN_ROOT}` 是 Claude Code 自動提供的 env var(plugin 安裝根目錄),可在 Bash 中以 `echo $CLAUDE_PLUGIN_ROOT` 取得。本檔內所有 `domains/`、`foundations/` 都指 plugin-root-relative 位置。 +公理與方法論資料隨 plugin 散布,存放在 `${CLAUDE_PLUGIN_ROOT}/domains/` 與 `${CLAUDE_PLUGIN_ROOT}/foundations/`。`${CLAUDE_PLUGIN_ROOT}` 是 Claude Code 自動提供的 env var(plugin 安裝根目錄),可在 Bash 中以 `echo $CLAUDE_PLUGIN_ROOT` 取得。本檔內所有 `domains/`、`foundations/` 都指 plugin-root-relative 位置,不是使用者 cwd。 + +**驗證範圍 = plugin 內建 ∪ 本地**:若 cwd 存在 `domains/` 或 `axioms/`(`/axiom-create` 本地模式的產物),也是合法驗證目標;報告標明來源 `[plugin]` / `[local]`。這讓 create → validate 的接力在本地模式也走得通。 + +## 觸發方式 + +- `/axiom-validate ` — 驗證單一領域 +- `/axiom-validate --cross` — 只做跨領域一致性 +- `/axiom-validate --all` — 兩者都做 +- 無參數 → Step 1 詢問 ## 流程 -### Step 1: 選擇驗證範圍 +### Step 1: 解析參數/選擇驗證範圍 -問使用者: +有參數時依「觸發方式」直接決定範圍,**不再詢問**(讓 axiom-create 等 caller 可無人值守串接)。無參數才問使用者: - **單一領域** — 驗證某個 domain 的結構完整性 - **跨領域一致性** — 檢查所有 domain 之間是否有矛盾 - **全部** — 兩者都做 @@ -25,14 +34,30 @@ user_invocable: true 每個 domain 根目錄有 `domain.yaml` manifest(schema 見 `${CLAUDE_PLUGIN_ROOT}/templates/domain-manifest.yaml`)。**先讀 manifest 再驗證** — 不同 format/maturity 適用的檢查不同,對 legacy domain 硬套 YAML schema 檢查會產生大量誤報 ERROR: -| `format` | `maturity` | 檢查行為 | -|----------|------------|----------| -| `yaml` | `bootstrapped` | 完整 A1–A5 欄位級檢查,嚴重度照下表(ERROR 級生效)| -| `markdown` | `legacy` | A1–A5 改為**結構性掃描**:缺欄位報 WARNING(遷移缺口),不報 ERROR | -| `freeform` | `legacy` | 跳過欄位級檢查,只做 Step 3 跨域一致性掃描 + 一行說明 | +**兩條正交規則**(涵蓋全部 format × maturity 組合,不是列舉表): + +| 軸 | 規則 | +|----|------| +| `format` → **檢查方式** | `yaml`:A1–A5 欄位級檢查;`markdown`:結構性掃描(在段落/標題層級找 A1–A5 的對應概念);`freeform`:跳過欄位級,僅做 Step 3 跨域掃描 + 一行說明(單一領域範圍時改為**提議**跨域掃描,不逕自執行) | +| `maturity` → **嚴重度上限** | `bootstrapped`:依下表原級(ERROR 生效);`legacy`:一律降一級(ERROR→WARNING、WARNING→INFO) | + +例:`yaml/legacy`(遷移中最常見的中間態)→ 欄位級檢查、只報 WARNING;`markdown/bootstrapped` → 結構性掃描、缺漏可達 ERROR 級。 manifest 缺失(使用者本地自建的舊 domain)→ 視同 `markdown/legacy`,並建議補 manifest。 +**驗證檔案集**:manifest `entry_points` 所列檔案+其同層兄弟公理檔(如 `01_core_axioms/*.yaml`)。一律排除 `archive/`、`archived/`、`06_reference/` 等參考資料目錄與 dotdirs — archive 內是被取代的舊公理,納入會產生假重複/假矛盾誤報。`entry_points` 指向不存在的檔案 → WARNING。 + +**檔案集內的異質檔案**:欄位級 A1–A5 檢查只套用於含 `axioms:`/`theorems:` 區塊的 YAML 檔;檔案集中的其他檔案(markdown 入口文件、轉換規則等輔助 YAML)只作 context,**不做欄位級檢查、不因缺 ASBE 欄位報錯** — yaml domain 的 entry_points 本來就可能混入非公理檔。 + +### Step 1.6: 錯誤處理(進 Step 2 前先過一遍) + +| 情況 | 行為 | +|------|------| +| `domain.yaml` 格式壞損/`format`、`maturity` 值不在 enum | 視同 manifest 缺失(`markdown/legacy`)+ WARNING 註明 parse 問題 | +| 空 domain(驗證檔案集內找不到任何公理) | WARNING: no axioms found — 建議檢查 `entry_points` | +| 指定的 domain 不存在 | 列出 INDEX 中可用領域(含本地來源)後停止 | +| `entry_points` 指向不存在的檔案 | WARNING(同「驗證檔案集」規則) | + ### Step 2: 結構驗證(Domain 內) 讀取 `${CLAUDE_PLUGIN_ROOT}/foundations/asbe-methodology.md` 中的 ASBE 5 條公理作為檢查標準。 @@ -47,41 +72,52 @@ manifest 缺失(使用者本地自建的舊 domain)→ 視同 `markdown/lega | A4 最小公理集 | 公理之間是否獨立?有無冗餘? | WARNING | | A5 語意等價 | natural 和 formal 表達同一件事? | WARNING | -另外檢查: -- ID 命名慣例(A/T/C/R prefix) -- `meta` 欄位完整性(domain, version, author) -- SCD2 合規:與上一版本相比,有無修改或刪除既有公理 +另外檢查(**僅 `format: yaml` 的 domain**;嚴重度同樣受 maturity 上限規則約束): +- ID 命名慣例(A/T/C/R prefix)— WARNING。freeform 域的自訂 ID 體系(如 japanese-narrative 的 J/M prefix)依 cross-domain principle 6(Meta-Language Consistency)豁免,不是違規 +- `meta` 欄位完整性(domain, version, author)— WARNING;legacy 域本就無 meta 區塊,跳過 +- SCD2 合規(**git-conditional**):目標域所在目錄是 git repo 時,用 `git log -p -- ` 檢查既有公理是否曾被修改/刪除(只增不改);**不是 git repo(如 plugin cache)→ 輸出「ℹ️ SCD2 不可驗證(無版本歷史),略過」**。絕不在沒有 baseline 的情況下報 pass/fail — 捏造的合規結論比沒有檢查更糟 -輸出格式: +輸出格式 — **bootstrapped 級**(欄位級檢查,ERROR 生效): ``` -📋 Domain: statistics - ✅ A1 Dual Expression: 12/12 pass - ❌ A2 Example Grounding: 10/12 pass — A7, T3 missing violations +📋 Domain: mathematical-writing [yaml/bootstrapped] + ✅ A1 Dual Expression: 1/1 pass + ❌ A2 Example Grounding: 0/1 — A1_altitude_placement missing compliant example ✅ A3 Hierarchical Derivation: OK - ⚠️ A4 Minimal Axiom Set: A3 may be derivable from A1+A2 + ✅ A4 Minimal Axiom Set: OK ✅ A5 Semantic Equivalence: OK ``` +**legacy 級**(結構性掃描,缺欄位是遷移缺口不是錯誤): +``` +📋 Domain: statistics [markdown/legacy] + ⚠️ A1/A2 structural scan: 散文公理無 statement_formal / violations 欄位 — 遷移缺口(legacy 預期) + ℹ️ 升級路徑:可用 /axiom-create 協助 bootstrap 為 YAML schema +``` + +圖示紀律:`❌` = ERROR、`⚠️` = WARNING、`ℹ️` = INFO — 三個 Step 統一使用,Step 4 的彙總計數依此分類。 + ### Step 3: 跨領域一致性檢查 1. 讀取 `${CLAUDE_PLUGIN_ROOT}/foundations/cross-domain-principles.md` -2. 掃描所有 `${CLAUDE_PLUGIN_ROOT}/domains/` 中每個領域的公理摘要 -3. 識別**重疊概念** — 不同領域涉及相同概念的公理(例如 statistics 和 decision-making 都涉及 probability) +2. 掃描每個領域的公理摘要。**掃描單位**(控制成本,不整檔全讀):`yaml` 域 → `id` + `name` + `one_liner`;`markdown`/`freeform` 域 → 第一個 entry_point 檔案的標題列表 +3. 識別**重疊概念** — 不同領域涉及相同概念的公理(例如 statistics 和 decision-making 都涉及 probability);只對被 flag 的配對才展開讀完整內容 4. 對重疊的公理對,分析是否存在矛盾 5. Flag 潛在衝突,附上理由,讓使用者 review +**範圍規則**:驗證範圍是「全部」時做全域配對;範圍是「單一領域」而後接跨域檢查時,只比對 target ↔ 其他域,不做全對全。 + 輸出格式: ``` 🔗 Cross-Domain Consistency Check - Scanned: 12 domains, 87 axioms total + Scanned: 14 domains(實際數字以 INDEX 列數為準,勿照抄範例) - ⚠️ Potential overlap: + ℹ️ Potential overlap(相容性觀察 = INFO): - statistics/A3 (probability interpretation) ↔ decision-making/A2 (subjective probability) Analysis: Compatible — statistics uses frequentist framing, decision-making uses Bayesian framing. No contradiction, but consider adding cross-reference annotation. - ✅ No contradictions detected. + ✅ No contradictions detected.(真矛盾才用 ⚠️/❌) ``` ### Step 4: 報告