Files
company-kb/meta/kb-contract.yaml
yangqianqian 84f7950589 Initial commit: company-kb framework
- 完整的知识库框架(P0-P5 路线图)
- 12篇治理文档
- 工具脚本(kb-init.sh, kb-lint-fm.py, feishu-sync.py, kb-bot)
- 7个 Claude 命令
- 示例项目和测试项目(wanniu-l1)
- 契约文件(meta/kb-contract.yaml)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 18:24:39 +08:00

102 lines
4.3 KiB
YAML
Executable File
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.
# 公司 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 typeDay-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]