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>
This commit is contained in:
4
meta/ingest-manifest.json
Executable file
4
meta/ingest-manifest.json
Executable file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"_comment": "摄入 hash 台账:去重用。P2+ 自动化后由单一执行者维护。key=内容 sha256, value=目标页相对路径。",
|
||||
"entries": {}
|
||||
}
|
||||
101
meta/kb-contract.yaml
Executable file
101
meta/kb-contract.yaml
Executable file
@@ -0,0 +1,101 @@
|
||||
# 公司 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]
|
||||
14
meta/stats.md
Executable file
14
meta/stats.md
Executable file
@@ -0,0 +1,14 @@
|
||||
# 源计数 / 页数 —— 红线观察点(手动或简单脚本更新)
|
||||
#
|
||||
# P5 向量库红线:~100 源 / 几百页 + index 首读定位失效 + 摄入悖论。
|
||||
# 到线前「要不要上 RAG」默认答案=「不」。
|
||||
#
|
||||
# 用 `bash tools/kb-init.sh --stats` 或手动更新下表。
|
||||
|
||||
| 指标 | 当前值 | 红线 | 说明 |
|
||||
|------|-------|------|------|
|
||||
| 项目数 | 0 | — | projects/ 下非 _example 目录数 |
|
||||
| 知识页数 | 0 | ~几百页 | 全库带 frontmatter 的 .md 数 |
|
||||
| 外部源数 | 0 | ~100 | 去重后的 source_link 数 |
|
||||
|
||||
> 最后更新:手动维护,见 git log。
|
||||
Reference in New Issue
Block a user