Files
kbdb-graph-plugin/.claude/wiki/decisions-summary.md
T
Leo 3a1faf19f4 docs(wiki): /wiki-capture — 修正過時決策 + 新增 API-as-Wall ADR
- decisions-summary.md:新增「KBDB 鐵律 + API-as-Wall」「安裝契約」;
  修正過時兩條(「共用 D1 掛載」改 API;「萬物皆 Block v3」標已淘汰/違規殘留已刪)
- 新增 ADR docs/2-architecture/decisions/0001-api-as-wall.md

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 21:25:46 +08:00

50 lines
3.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 架構決策摘要
> 遇到設計判斷時查這裡。
> 完整脈絡在 docs/2-architecture/decisions/。
---
## KBDB-graph 定位 — 2026-06-13
**結論**:本目錄 = KBDB 的 graph 插件(triplet 採集 + graph 查詢),獨立成 repo,類比 Apache AGE 之於 Postgres。
**原因**:graph 能力較龐大、非基本儲存功能、leo 產權、較複雜 → 不留 arcrun。基本盤(block CRUDD1 三表)= `arcrun/kbdb`,不在本目錄。
**詳細**`docs/HANDOFF-kbdb-plugin.md`;來源 InkStoneCo 頂層 `matrix-rearrange` Phase 2 (R2)。
## 🔒 KBDB 鐵律 + 插件 API-as-Wall 形態 — 2026-06-14(最高原則)
**結論**:插件【絕不碰表、零 SQL、零 migration】,讀寫全走基本盤 arcrun/kbdb HTTP API。新資料類型=建 template+填 slot,永不建表(連插件自建獨立 D1 都不行)。任何人不准動表(CREATE/ALTER/DROP)。embedding/語意搜尋屬基本盤 optional embed 模組,非插件職責。
**原因**:比 AGE-on-Postgres 更嚴——AGE 能讀 Postgres 表,KBDB 插件連表都不許碰。真正的 API-as-Wall。鐵律已 hook 化(`.claude/hooks/pre-{write,bash}-guard-no-table.sh`,違反 exit 2)。
**詳細**`InkStoneCo/docs/3-specs/matrix-rearrange/DECISION-kbdb-v3-baseplane.md` + ADR `docs/2-architecture/decisions/0001-api-as-wall.md`
## 獨立 repo 名 — 2026-06-14
**結論**:獨立 repo = **public `uncle6me-web/kbdb-graph-plugin`**(leo 拍板,沿用目錄名)。無 .github/workflows(不開 Actions)。
**原因**:插件與基本盤 action 層零耦合,抽出乾淨。
**詳細**`docs/3-specs/kbdb-graph-extraction/design.md`
## 掛載介面 = 基本盤 API(非共用 D1)— 2026-06-14(推翻原判斷)
**結論**:插件掛載 = HTTP API`KBDB_BASE_URL`),**不共用 D1、不直接 SQL、不建 VIEW**。圖在插件層記憶體從 records 組裝。
**原因**:⚠️ 原版「AGE-on-Postgres 共用 D1 + DB 掛載介面」是**讀違規現狀(插件直接 SQL 讀 blocks/entry_values)推出來的錯判斷**——那些直接 SQL 是違規歷史產物,不是設計依據。鐵律 > 現狀。
**詳細**design.md「掛載介面 = 基本盤 API」節 + mistakes.md「讀違規現狀推翻鐵律」。
## 安裝契約:KBDB_BASE_URL 安裝時 AI 填 — 2026-06-14
**結論**`KBDB_BASE_URL` 不寫死 toml、不叫人填。安裝時 AI 查 CF subdomain 拼 `https://arcrun-kbdb.<subdomain>.workers.dev``wrangler secret put` + `wrangler deploy`。本地整合測試用 `.dev.vars`(非 .env)。
**原因**:因部署而異(每個 self-hosted 用戶 subdomain 不同),但確定性可算(能 deploy 就能查 subdomain,同套 CF 憑證)。
**詳細**`scripts/install.sh`;參考 arcrun `docs/3-specs/arcrun/sdk-and-website/self-hosted-init.md`
## ~~萬物皆 BlockKBDB v3~~ — 2026-02-28(已淘汰,2026-06-14 修正)
**結論**:⚠️ 本目錄那套帶獨立 `blocks` 表 + 0001/0005 CREATE TABLE 的「v3」是**長歪的違規殘留,已刪**。基本盤真身 = `arcrun/kbdb` 3 表(`entries/templates/entry_values``entry_type='block'` 表達 block,不需獨立 blocks 表)。
**原因**:「萬物皆 Block」獨立 blocks 表違反「不建表」鐵律。基本盤規範歸 arcrun/kbdb,本 repo CLAUDE.md 已裁剪。
**詳細**DECISION-kbdb-v3-baseplane.md 一節「原提問的前提是錯的」。
## 避免再被 GitHub flag(上游鐵律)— 沿用
**結論**:禁跨 repo 自動同步 Actions;部署繞開 GitHubwrangler / scp);新 repo 預設不開 Actions。
**原因**:當初 monorepo→多 worker 的 Actions 自動同步 + 高頻 API 害帳號被 flag。
**詳細**InkStoneCo 頂層 CLAUDE.md。
---
格式:
## [主題] — [YYYY-MM-DD]
**結論**[一句話]
**原因**[簡短說明]
**詳細**docs/2-architecture/decisions/[對應檔案]