spec 1.0 · 规范性
Leji 决策记录 frontmatter
AI 智能体辅助翻译。如有出入,以英文页面为准。如果你发现文本有任何问题,欢迎提交议题或发起拉取请求。
校验一份决策记录的 YAML frontmatter。markdown 正文以散文承载背景、决策和后果。
字段
- #
idstring必填 本决策的稳定标识符,例如 "adopt-leji"。
匹配模式
^[a-z0-9]+(-[a-z0-9]+)*$- #
titlestring必填 决策的简短标题。
- #
status"proposed" · "accepted" · "superseded" · "deprecated" · "rejected"必填 决策的生命周期状态。
- #
datestring必填 作出该决策的 ISO 8601 日期;一经发布即不可变,后续的状态变化也不会改动它。
匹配模式
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$- #
deciders字符串数组 作出该决策的人。
- #
supersedesstring 本决策所取代的那份记录的 id。
- #
supersededBystring 取代了本记录的那份记录的 id。当 status 为 "superseded" 时必须声明:被取代的记录必须指向它的继任者,使取代关系的链接在两个方向上都可导航。
- #
affectedPaths字符串数组 本决策影响到的路径,相对仓库根目录。
- #
affectedCategories由 "domain" · "system" · "practice" · "governance" · "decisions" 构成的数组 本决策影响到的内容类别。
- #
links字符串数组 可选的外向引用,例如指向相关的决策或议题。
Schema 与示例
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://leji.org/schemas/v1.0/decision-record.schema.json",
"title": "Leji decision record frontmatter",
"description": "Validates the YAML frontmatter of a decision record. The markdown body carries context, decision, and consequences in prose.",
"type": "object",
"required": [
"id",
"title",
"status",
"date"
],
"additionalProperties": false,
"properties": {
"id": {
"description": "Stable identifier for this decision, e.g. \"adopt-leji\".",
"type": "string",
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
},
"title": {
"description": "Short title of the decision.",
"type": "string",
"minLength": 1
},
"status": {
"description": "Lifecycle status of the decision.",
"enum": [
"proposed",
"accepted",
"superseded",
"deprecated",
"rejected"
]
},
"date": {
"description": "ISO 8601 date the decision was made; it is immutable once published, and a later status change does not move it.",
"type": "string",
"pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"
},
"deciders": {
"description": "People who made the decision.",
"type": "array",
"items": {
"type": "string"
}
},
"supersedes": {
"type": "string",
"description": "id of the record this decision replaces."
},
"supersededBy": {
"type": "string",
"description": "id of the record that replaced this one. REQUIRED when status is \"superseded\": a superseded record must point to its successor so the supersession link is navigable in both directions."
},
"affectedPaths": {
"description": "Repository-root-relative paths the decision affects.",
"type": "array",
"items": {
"type": "string",
"pattern": "^(?!/)(?!\\./)(?!.*(^|/)\\.\\.(/|$))(?!.*\\\\).+$"
}
},
"affectedCategories": {
"description": "Content categories the decision affects.",
"type": "array",
"items": {
"enum": [
"domain",
"system",
"practice",
"governance",
"decisions"
]
}
},
"links": {
"description": "Optional outbound references, e.g. to related decisions or issues.",
"type": "array",
"items": {
"type": "string"
}
}
},
"if": {
"properties": {
"status": {
"const": "superseded"
}
},
"required": [
"status"
]
},
"then": {
"required": [
"supersededBy"
]
}
}一份符合规范的决策记录。本 schema 校验的是 YAML frontmatter;markdown 正文承载背景、决策和后果。
---
id: adopt-leji
title: 接入 Leji 上下文层
status: accepted
date: 2026-06-10
deciders:
- Jo Lee
affectedCategories:
- governance
---
# 接入 Leji 上下文层
## Context
工程知识散落在人的脑子里、聊天记录里,以及三份越来越不一致的工具配置文件里。智能体产出的代码与我们的不变量不符,因为那些不变量根本没有写在任何工具读得到的地方。
## Decision
在 `indexed` 级别接入 Leji:清单、引导配置、domain 与 system 内容、决策记录、生成的索引、机器可读的变更日志。
## Consequences
厂商配置文件变成一行重定向。上下文的修正与暴露出问题的那些 PR 一同提交。Jo 负责这个上下文层。