概念 — 綱要即契約 (Schema as Contract)

來自 gist 評論區的深化觀點:schema 層不該只是散文指令,而該是 typed + validated 的契約。

問題(評論區提出)

原始 gist 建議用 CLAUDE.md / AGENTS.md 這類散文檔當 schema。但散文是「指令」——Agent 未必遵守,違反時也無人抓。這是該模式被指出的 under-specified 處。

提議:typed + validated schema

與其敘事,不如把 schema 層做成可被機器執行驗證。評論舉例(SIGN spec)的形狀:

@doc WIKI-001 [std, active, agents] v1
@links WIKI-002,WIKI-003
@vocab
  derived_from  | page's claim traces to this raw source; required on every page
  supersedes    | source or page replaces an earlier one; asymmetric
  contradicts   | two claims cannot both hold; symmetric, never auto-resolved
  about         | page's subject entity; stamped at write time, not inferred at read
@def LAYERS
  raw    | immutable source documents; the only grounding authority
  wiki   | agent-written pages; derivative, never self-grounding
  schema | this document; the contract the agent operates under

重點:

  • vocab 定義關係型別(derived_from / supersedes / contradicts / about),讓 claim 的根 (grounding) 可被驗證。
  • claim 必帶 grounding:每個 wiki 主張都有 derived_from 邊回 raw,並標寫入日期;無根的 claim 不被允許。
  • contradicts 對稱、不自動解決:兩個 claim 不能同真,標出但不替你決定哪個對。
  • 這不是 RDF/OWL(嚴謹但採用不友善、LLM 訓練資料幾乎沒有所以模型不擅長),是輕量 typed 契約。

本 wiki 的立場

本 wiki 的 AGENTS 目前採散文契約 + frontmatter 慣例(每頁標 derived_from、觸發詞「幫我加入 wiki」)。這對個人規模已可用,但記下此觀點作為未來演進方向:若要更強的保證,可把 derived_from / supersedes / contradicts / about 提升為 lint 可驗證的結構。

相關