# 公司 AI 知识库 · 唯一机器可读契约 (Single Source of Truth) # ───────────────────────────────────────────────────────────── # 这是 type 集 / 字段必填矩阵 / enum 的唯一真相源。 # kb-lint-fm.py 运行时读取本文件判定,绝不硬编码。 # CONVENTIONS.md / CLAUDE.md 只引用本文件,不复述内容。 # 扩展 type = 修改本文件 (active: true) + 一次 PR。 version: "1.0" # ── Type 体系 ── # active=true 的 type 进入 lint 白名单(激活即放行)。 # reserved 的 type 首次真实需要时改 active: true 并建目录。 types: # 核心 4 type(Day-1 激活) - name: project active: true dir: projects/<代号>/_index.md desc: 一个在跑项目的门户/概览页 - name: decision active: true dir: projects/<代号>/decisions/ desc: 一条明确决策及其背景、依据、参与人 - name: conversation active: true dir: projects/<代号>/conversations/ desc: 聊天记录的结构化沉淀(摘录+要点) - name: doc active: true dir: projects/<代号>/docs/ desc: 从外部汇入的正式文档(需求/方案/合同) # 预留 type(已登记,未激活;lint 暂不放行) - name: entity active: false dir: entities/ desc: 一个实体(人/公司/客户/产品/供应商) - name: concept active: false dir: concepts/ desc: 一个概念/术语/内部黑话 - name: question active: false dir: questions/ desc: 查询回写的问答对 - name: runbook active: false dir: runbooks/ desc: 可重复执行的操作步骤/流程 - name: metric active: false dir: metrics/ desc: 一个指标及其口径、来源 # ── 字段定义 ── # required: always(硬必填)| conditional(派生规则见 derived_rules)| optional # auto: AI 可自动补齐的字段(人无需手写) fields: type: { required: always, type: string, note: "唯一硬必填,缺失只报不猜" } status: { required: always, type: enum, auto: true, default: seed } created: { required: always, type: date, auto: true, note: "内容产生时间,AI 从源推导或填今天" } ingested: { required: always, type: date, auto: true, note: "汇入时间,AI 自动=今天" } source: { required: conditional, type: enum, auto: true } source_link: { required: conditional, type: string, auto: true } title: { required: optional, type: string, auto: true, note: "AI 自动=H1 或文件名回填" } description: { required: optional, type: string } tags: { required: optional, type: list, note: "kebab-case" } timestamp: { required: optional, type: date, note: "信息最后有效期" } author: { required: optional, type: string } related: { required: optional, type: list, note: "[[slug]] wikilink 强边" } resource: { required: conditional, type: string, note: "metric 型必填:底层资源稳定链接" } # ── enum 取值 ── enums: status: [seed, developing, mature] source: [飞书文档, 飞书群, 微信群, 本地, NAS, 会议, 人工沉淀, AI编译] # ── 派生必填规则(lint 据此判定,各处不再复述)── derived_rules: # 外部渠道摄入的 doc/decision/conversation 页,溯源字段升为必填 - when: type_in: [doc, decision, conversation] source_in: [飞书文档, 飞书群, 微信群, NAS, 会议] require: [source, source_link] # metric 型必须带底层资源链接 - when: type_in: [metric] require: [resource] # ── 豁免(免 frontmatter,仓库脚手架而非知识页)── # lint 跳过这些路径 frontmatter_exempt: - README.md - CONVENTIONS.md - CLAUDE.md - AI-CONTEXT.md # 全架构蒸馏入口:顶层脚手架,非 OKF 知识页 - docs/** - meta/** - tools/** # 脚本与其 README:工具脚手架,非 OKF 知识页 - .claude/** # CC 命令/配置:工具脚手架,非 OKF 知识页 - "**/assets/**" - "**/.gitkeep" # type: project 的 _index.md 豁免溯源字段(非外部摄入) source_exempt_types: [project]