Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 使用說明
Expand Down
2 changes: 1 addition & 1 deletion plugins/che-axiom-systems/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

## 核心原則

Expand Down
4 changes: 2 additions & 2 deletions plugins/che-axiom-systems/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Plugin 自帶 **14 個**已公理化的領域,安裝後可直接 `/axiom-looku

## 寫入位置(axiom-create)

- 若你在 `che-axiom-systems` repo 的 clone 內跑 `/axiom-create` → 寫到 cwd 的 `domains/<new>/`(maintainer 模式,方便後續 commit/PR
- 若在其他 cwd → 寫到 cwd 的 `axioms/<new>/`(本地模式,私有領域)
- **Maintainer 模式**(結構偵測:repo root 存在 `plugins/che-axiom-systems/.claude-plugin/plugin.json`)→ 寫到 `<repo-root>/plugins/che-axiom-systems/domains/<new>/`,方便後續 commit/PR
- **本地模式**(其他 cwd;偵測失敗一律 fail-closed 到此)→ 寫到 cwd 的 `axioms/<new>/`(私有領域);擴充 plugin 內建域時寫 `axioms/<domain>/extensions.*` overlay,絕不寫入 plugin cache

## 核心原則

Expand Down
2 changes: 2 additions & 0 deletions plugins/che-axiom-systems/domains/apa7-style/domain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
44 changes: 22 additions & 22 deletions plugins/che-axiom-systems/skills/axiom-create/SKILL.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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/<new-domain>/`,使用者後續可 commit/PR |
| **使用者本地模式** | cwd 不是 maintainer repo | 寫入 cwd 的 `axioms/<new-domain>/`(使用者私有目錄),並在最後提示「想 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/<new-domain>/`,使用者後續可 commit/PR |
| **使用者本地模式** | maintainer repo;偵測失敗(含非 git cwd)一律 **fail-closed** 到此模式 | 寫入 cwd 的 `axioms/<new-domain>/`(使用者私有目錄),並在最後提示「想 contribute 回 plugin,請 fork repo 後重跑」|

skill 開始前先檢查 cwd 判斷模式,並告知使用者目前是哪個模式。

Expand All @@ -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. 引導使用者定義:
Expand All @@ -40,30 +39,31 @@ skill 開始前先檢查 cwd 判斷模式,並告知使用者目前是哪個模
- 每條公理要有 `statement_natural` + `statement_formal` (A1)
- 每條公理要有 `violations` + `compliant` 範例 (A2)
- 公理之間要獨立、一致、充分 (A4)
5. 依「資料路徑與寫入策略」判斷寫入位置:maintainer 模式寫 `<cwd>/domains/<domain-name>/`、使用者本地模式寫 `<cwd>/axioms/<domain-name>/`
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/<domain-name>/`、使用者本地模式寫 `<cwd>/axioms/<domain-name>/`
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/<domain>/`;**非 maintainer 模式擴充 plugin 內建域** → 寫 `<cwd>/axioms/<domain>/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 <files>`,確認對既有公理只有新增行;發現修改/刪除 → 還原,改為新增澄清條目
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 約束的是已發布公理)

## 完成後提示

Expand Down
62 changes: 44 additions & 18 deletions plugins/che-axiom-systems/skills/axiom-lookup/SKILL.md
Original file line number Diff line number Diff line change
@@ -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 <name> [query] | --list"
---

# axiom-lookup
Expand All @@ -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: 搜尋

Expand All @@ -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 "<query>"` + 建議:放寬關鍵字/`--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
Expand Down
Loading
Loading