feat: 支持工程决策看板与构建体系

This commit is contained in:
czm
2026-09-08 13:34:49 +08:00
parent 9420c100bc
commit bed64d8a3f
52 changed files with 126596 additions and 191 deletions
+45
View File
@@ -0,0 +1,45 @@
name: Deploy GitHub Pages
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Prepare Pages Directory
run: |
mkdir -p _site
cp index.html _site/
cp demo.html _site/ 2>/dev/null || true
cp -r assets _site/ 2>/dev/null || true
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: _site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
+2
View File
@@ -1,3 +1,5 @@
node_modules/
.DS_Store
docs/
# 本 skill 的 self-dogfood 笔记不随包发布
.agents/notes/
+175 -90
View File
@@ -1,10 +1,18 @@
# write-notes-like-deepseek
> 像 DeepSeek 团队一样,把"为什么这样改"写下来——半年后打开还能懂。
> **像 DeepSeek 团队一样沉淀 Agent Notes**:为代码库建立面向 AI Agent 的「架构决策治理与防撞护栏」。每一次重要变更,将「为什么做」与「放弃了什么」同代码原子提交,终结 Agent 跨会话失忆与破坏性重构。
为每一次重要改动留下一篇可检索、可校验的笔记:为什么要改、考虑过哪些备选、最终为何这样取舍。让半年后的自己或同事不用翻聊天记录,打开仓库就能看懂。
[![Agent Skills](https://img.shields.io/badge/Agent%20Skills-Standard-blue)](https://agentskills.io)
[![Live Demo](https://img.shields.io/badge/Live%20Demo-GitHub%20Pages-success)](https://czm15053.github.io/write-notes-like-deepseek/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
来自 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 两个月 740+ 篇笔记的实践提炼,装进任何项目都能用,不改你现有的工作流。
<p align="center">
<img src="assets/hero.png" alt="下一个 AI 先看见「为什么」,再动手改" width="100%" />
</p>
[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 在两个月内演进了 1,700+ 篇 Notes。其核心不是写事后总结,而是**将代码无法承载的「为什么」与「放弃了什么」固化为仓库活资产**。
本项目把这套实践拆成开箱即用的 4 件套:Agent Skill、填空模板、CI 门禁、单文件看板。
```bash
npx skills add czm15053/write-notes-like-deepseek
@@ -12,146 +20,223 @@ npx skills add czm15053/write-notes-like-deepseek
---
## 解决什么问题
## 为什么 Agent 时代必须这么做?
代码会变,记忆会忘。改了一处架构,两个月后没人记得为什么这么选、放弃了哪条路、代价是什么——只能重新踩坑。
<p align="center">
<img src="assets/01-scenario-guardrail.png" alt="三个月前踩过的坑,新 AI 为什么又踩一遍?" width="100%" />
</p>
这个 Skill 只做一件事:**做决定时就写,最晚和代码同一次提交**(有 PR 以 PR 为单位,没有就以 commit 为单位)。路径即分类,文件即契约,门禁保证格式不腐烂。
在纯人工开发时代,我们写 Wiki、写 ADR(架构决策记录),最后大多变成**代码已重构、文档未更新**的陈年摆设。
而在 **AI Agent 密集编码**时代,这个问题会引发致命故障:
1. **Agent 的跨会话失忆(Stateless Amnesia)**:每个新 Agent 会话都是一张白纸,它只能看到当前代码(What)。面对复杂的妥协设计,Agent 很容易自作聪明地用直觉方案进行“破坏性重构”。
2. **反复踩进同一个坑(Bikeshedding)**:缺乏被否决方案的显式记录,Agent 会一次次重新提议那些早在三个月前就被证明会导致死锁或内存溢出的错误路线。
3. **推导残余污染代码库(CoT Slop)**:Agent 写的文档经常充斥会话痕迹(“经讨论…”、“后续 PR 将…”),缺乏工程可验证性。
**Agent Notes 的角色,就是给未来的 Agent 树立的「防撞护栏」**:
通过入口处的一行注释(`// Note: 见 .agents/notes/...`),强制接手代码的 Agent 先读决策边界再动手。
---
## 一篇笔记长什么样
## 交付了什么
放在 `.agents/notes/implemented/feature/2026-08-23-xxx.md`:
<p align="center">
<img src="assets/00-product-overview.png" alt="write-notes-like-deepseek 交付的 4 件套:Skill、模板、CI、看板" width="100%" />
</p>
1. **Agent Skill**:装进 Cursor / Claude Code,动手前先看封条,改老代码时原地改笔记。
2. **填空模板**:`proposed` / `implemented` / `rejected`,一篇约 200 字、4 个空。
3. **CI 脚本**:校验目录、时态、备选方案和死链;方案被取代时一键归档。
4. **单文件看板**:双击 HTML 就能看承重墙、避坑智库和演进时间线。
---
## 五大核心工程纪律
| 维度 | 传统文档 / ADR | DeepSeek 体系的 Agent Note |
|---|---|---|
| **更新时序** | 事后补写或独立立项,容易滞后 | **决策与代码原子提交**,同一 Commit/PR 生效 |
| **时态与维护** | 归档后即冻结,随代码演进腐烂 | **现行法律(Living Law)**:代码改名/移路径,Note 同步就地修改 |
| **备选方案** | 选填,或仅罗列名字 | **强制反稻草人(Anti-Strawman)**:必须先写对手最强论据再否定,必含「不做/复用」 |
| **目录机制** | 依赖全局 `INDEX.md` 索引 | **路径即状态,无中心索引**:根除多 PR 并行时的 Git Merge 冲突 |
| **质量保障** | 人工自觉,无约束 | **机械门禁 + 语义自检**:CI 强校验骨架时态,去 CoT 思维链残留 |
---
## 一篇标准 Note 的形态
路径:`.agents/notes/implemented/feature/2026-08-23-sqlite-session-store.md`
```markdown
# Agent Note: 用 SQLite 存会话,为什么不用 JSONL
# Agent Note: 为什么用 SQLite 代替 JSONL 存储会话
Status: implemented
## Problem 为什么要改?不看方案也能懂
## Decision 最终怎么做的?现在时
## Alternatives considered 认真考虑过哪 2–3 种做法,为什么没选
## Consequences 代价和收益各是什么
## Problem
现有 JSONL 存储在多进程并发写入时极易锁冲突,且按时间倒序扫描导致端到端延迟常态化突破 800ms。该问题无法通过应用层内存缓存彻底解决,崩溃时存在丢数据风险。
## Decision
会话存储改用 SQLite。启用 WAL 模式保证读写并发,核心表建立 `session_id + timestamp` 联合索引。关键入口由 `StorageEngine` 接口统一定义。
## Alternatives considered
- **维持 JSONL + 内存倒排索引**:改动成本最低。但异常断电与进程被杀时存在索引与数据文件撕裂风险,且跨进程共享内存机制过于脆弱。
- **引入外部 PostgreSQL**:查询生态成熟。但本系统为本地 CLI 工具,强制用户安装外部守护进程严重破坏了零配置开箱体验。
- **不做任何优化(仅截断历史会话)**:无法解决并发锁死问题,且破坏了长会话追溯的核心需求。
## Consequences
- **收益**:多进程读写不再争抢,历史记录定位延迟降至 10ms 以内(实测 P99 < 15ms)。
- **代价与上限**:引入了 native C 绑定,跨平台发布包体积增加约 15MB;单库并发写上限受限于 SQLite 串行写入锁,若未来单节点写 QPS > 500 需重访。
```
四段写完,一次改动的来龙去脉就钉住了。`Alternatives considered` 是必填项——不记录打败了什么,决定迟早被重审。格式不对,门禁直接报错。
> **禁令规则**:在 `implemented` 状态下,CI 门禁会自动拦截任何 `## Proposal`、`## Plan`、`## Acceptance criteria` 等未来时提案口吻,只允许以现在时描述已落地的客观事实。
<p align="center">
<img src="assets/03-note-anatomy.png" alt="DSH 真实 Note 解剖:毅然删除 SQLite,首方纯 JSONL 架构瘦身" width="100%" />
</p>
---
## 什么时候写
## 目录结构与状态机
| 要写 | 不用写 |
|---|---|
| 改了运行时行为或 UI 表现 | 只改空格、格式、导入顺序 |
| 改了架构、模块边界、跨文件契约 | 无歧义重命名、错别字 |
| 改了流程、门禁、测试策略 | 注释里加一句说明 |
| 改了落盘 / 网络 / 配置格式 | 文档里改个标点 |
<p align="center">
<img src="assets/06-concurrency-clash.png" alt="Git 真实合并对决:为什么严禁全局 INDEX.md?" width="100%" />
</p>
一句话判断:**"半年后有人回来看,会想知道为什么这样改吗?"** 会,就写一篇。
> 不确定就按要写处理。别用"以后再补 / 代码即文档 / 改动小"跳过。
---
## 放在哪
路径即分类:
```
.agents/notes/{状态}/{种类}/2026-08-23-主题.md
# 例:.agents/notes/implemented/feature/2026-08-23-xxx.md
```
完整目录(轻量项目只建 `implemented/<class>/` 即可,空目录可直接删):
路径格式严格遵循:`{生命周期}/{类别}/yyyy-mm-dd-主题.md`
```
.agents/notes/
├── implemented/
│ ├── feature/
│ ├── bug-fix/
│ ├── architecture/
│ ├── process/
│ ├── testing/
│ └── simplification/
├── proposed/ # 同上 6 类,按需创建
├── rejected/ # 同上
└── archived/ # 同上,冻结不可改
├── proposed/ # 动手前:写清背景、备选方案与验收标准,经评审后施工
├── implemented/ # 施工完:改用现在时描述已落地事实,随代码原子合入
├── rejected/ # 被否决:方案被拒时冻结在此,必须写清原因,防止后人重新翻案
└── archived/ # 已归档:功能已完全落地且未来指导价值较低的记录,永久冻结
```
- **状态**:`proposed` 提议中 → `implemented` 已上线 → `rejected` 已否掉 → `archived` 归档冻结
- **种类**(6 选 1,写错会报错):`feature` / `bug-fix` / `architecture` / `process` / `testing` / `simplification`
### 6 大封闭类别(Class)
`refactor` 不单列——用 `simplification` 的标准判断:可观察行为变了吗?没变就是简化。
<p align="center">
<img src="assets/02-six-classes.png" alt="DSH 真实的 6 大封闭兵种大地图" width="100%" />
</p>
分类经由 TS 脚本机械拦截,严禁私自扩充:
- `feature`:用户或下游 Agent 可见的外部能力与非显然产品选择。
- `bug-fix`:缺陷修复,或复盘事故(Postmortem)补上的架构缺口。
- `architecture`:交付源码的结构性决策、模块边界、包依赖关系。
- `process`:围着代码转的工具链、门禁、构建发布规范(非运行时行为)。
- `testing`:测试基建、测试分层与验收策略。
- `simplification`:**只删不增**。清理废弃逻辑、收敛对外暴露面。(注:行为不变的普通重构归此类,不单独设 `refactor`)。
---
## 怎么用
## 什么时候需要写?
<p align="center">
<img src="assets/04-decision-flowchart.png" alt="DSH 真实场景三档分流看板" width="100%" />
</p>
黄金判据:**半年后回来看这段代码,如果产生「为什么不直接用更简单的方案」的疑问,就必须写。**
---
## 真实任务流闭环
<p align="center">
<img src="assets/05-swimlane-workflow.png" alt="DSH 源码闭环回路:代码与 Note 是怎么自我维持的?" width="100%" />
</p>
---
## 快速上手
### 1. 安装 Skill
```bash
# 1. 安装
npx skills add czm15053/write-notes-like-deepseek
# 2. 做决定时就写:有想法先写 proposed,做完最晚与代码同一次提交更新为 implemented
# 已有归属的决定 → 更新那篇;全新决定 → 新建一篇
```
校验(可选接 CI):
<p align="center">
<img src="assets/07-skill-live-action.png" alt="装上 Skill 后:意思靠人点头,结构靠脚本代劳" width="100%" />
</p>
```bash
npx tsx scripts/verify-agent-note-tree.ts # 路径、状态、种类、文件名
npx tsx scripts/verify-agent-note-format.ts # 开头三行、必备章节、Alternatives
```
### 2. 绑定到 Agent 行为规范
---
## 让 Agent 自动执行
在项目的 `AGENTS.md` / `CLAUDE.md` 加一句钩子,Agent 就会在重要改动时自动按本 Skill 走:
将以下规则加入项目根目录的 `AGENTS.md` 或 `CLAUDE.md`,约束 AI 自动遵守:
```markdown
## 决策留痕
## 架构决策留痕规范
重要改动或重要决定(行为 / 架构 / 契约 / 流程 / 落盘格式,或动手前的选型与否决)执行
[write-notes-like-deepseek](.agents/skills/write-notes-like-deepseek/SKILL.md):
有想法先写 `proposed`,落地后最晚与代码同一次提交更新为 `implemented`;被否决的写 `rejected`;
每篇必含 `## Alternatives considered`。
只改格式 / 无歧义重命名 / 错别字标 `not applicable`。
在进行任何非平凡变更(行为、架构、协议、跨模块约定、测试策略)前:
1. 必须遵循 [write-notes-like-deepseek](.agents/skills/write-notes-like-deepseek/SKILL.md)。
2. 有新构想先立 `proposed/`;落地时随同一次代码提交转为 `implemented/`。
3. 必须包含 `## Alternatives considered`,且必须包含「不做/复用」选项与对手最强论据。
4. 代码核心入口处保留反向追溯注释:`// Note: <理由> — 见 .agents/notes/...`。
```
团队项目可在 `CONTRIBUTING.md` 或 PR 模板再加一句:"非平凡改动必带 Note",与 CI 门禁闭环:
### 3. 本地与 CI 门禁检查
本项目附带确定性校验与归档脚本:
```bash
# 1. 校验文件树规范与相对 Markdown 链接有效性
npx tsx scripts/verify-agent-note-tree.ts
# 2. 校验文件内部格式(头块三行、时态骨架、必选备选方案、禁用提案词)
npx tsx scripts/verify-agent-note-format.ts
# 3. 归档已完全落地的决策并封印入 manifest.json(自动检测入站死链)
npx tsx scripts/archive-agent-note.ts .agents/notes/implemented/<class>/<filename>.md
```
配置进 `package.json` 与 CI 流水线:
```json
{
"scripts": {
"verify-agent-note-tree": "tsx .agents/skills/write-notes-like-deepseek/scripts/agent-note-tree.ts",
"verify-agent-note-format": "tsx .agents/skills/write-notes-like-deepseek/scripts/verify-agent-note-format.ts",
"doc-sync": "npm run verify-agent-note-tree && npm run verify-agent-note-format"
"verify-notes": "tsx scripts/verify-agent-note-tree.ts && tsx scripts/verify-agent-note-format.ts",
"archive-note": "tsx scripts/archive-agent-note.ts"
}
}
```
### 4. 通用决策全景看板 (Agent Notes Board)
无需搭建任何后端服务或数据库,直接用浏览器双击打开 `assets/agent-notes-board.html`,即可查看全景可视化大屏:
<p align="center">
<img src="assets/08-board-dashboard.png" alt="把笔记变成全景大屏:Agent Notes Board" width="100%" />
</p>
- **🏛️ 架构基线**:自动计算相对引用网络,高亮标出全系统的“承重墙”核心决策。
- **🛡️ 避坑智库**:一键聚合全库所有被否决的备选方案,排雷禁区一览无余。
- **⏱️ 演进史诗**:按月份生成架构演进里程碑时间流。
- **⚡ 本地热更新**:点击右上角「连接本地目录」授权后,在编辑器修改/新建 Note,切回浏览器即时自动刷新!
---
## 包含什么
## 资产库导览
```
.
├── SKILL.md # Agent 执行的主流程(每次必读)
├── templates/ # 三态模板:proposed / implemented / rejected
├── references/ # 按需加载:格式 / 分类 / 归档 / 行文 / 简化 / 校验
└── scripts/ # 校验脚本
```
本项目不仅提供模板,还完整萃取了 DeepSeek 内部的高质量文档约束:
## 参考
- [`SKILL.md`](SKILL.md):Agent 执行的主流程契约。
- [`templates/`](templates/):`proposed`、`implemented`、`rejected` 极简规范模板。
- [`references/quality-gate.md`](references/quality-gate.md):**语义自检清单**。指导 Agent 审查动机独立性、反稻草人备选、已知代价上限、可验证实测基线。
- [`references/prose-checklist.md`](references/prose-checklist.md):**行文与去思维链泄露(Anti-CoT)规范**。剔除会话残余、死引用与过程叙事,确保 HEAD 视角独立可验证。
- [`references/archiving.md`](references/archiving.md):状态机流转、决策完全取代合并规则与冻结归档机制。
- [`references/classification.md`](references/classification.md):6 种 Class 的精确判定边界与常见困惑裁决。
- 来源:[deepseek-ai/deepseek-harness](https://github.com/deepseek-ai/deepseek-harness) 的 `.agents/notes/README.md`、`.agents/skills/dsh-archive-agent-notes`、`scripts/agent-note-tree.ts`、`scripts/verify-agent-note-format.ts`
- 规范:[Agent Skills](https://agentskills.io)
---
## 友链
## 参考与致敬
- [LinuxDo](https://linux.do) — 真诚、友善、团结、专业的新生代 AI 社区
- 源自 [deepseek-ai/deepseek-harness](https://github.com/deepseek-ai/deepseek-harness) 的 `.agents/notes/` 架构与验证门禁体系
- 遵循 [Agent Skills](https://agentskills.io) 开放标准
## 许可
## 许可证
MIT
[MIT](LICENSE)
+79 -26
View File
@@ -1,50 +1,57 @@
---
name: write-notes-like-deepseek
description: 像 DeepSeek 团队一样沉淀 Agent Notes——决策、取舍与验证一处留痕,半年后仍可追溯。Use when making a non-trivial change or decision worth revisiting. 适用于任何仓库
description: 像 DeepSeek 团队一样写 Agent Notes:为什么、放弃了什么,和这次改动放在一起。Use when making a non-trivial change, technical selection, architectural refactoring, bug postmortem, or simplification worth revisiting. 触发时机:涉及技术选型、重大架构重构、修复非直觉缺陷/踩坑复盘、或裁撤冗余特性时调用。适用于任何仓库
---
# Write Notes Like DeepSeek
> 从 DeepSeek Harness 提炼的决策沉淀纪律。宿主负责拆任务、排计划;本 Skill 只解决一件事:**为什么这样改、放弃了什么、怎么证明改对了**,都留在一处可检索、可校验的地方。
> 从 DeepSeek Harness 抄来。聊天里的 Agent 负责拆任务、排计划;本 Skill 只做一件事:为什么这样改、放弃了什么、怎么证明改对了,都留在一处,给下一个改这段代码的人用。
## 定位
这不是文档生成器,也不是 ADR 模板合集。它的定位是**决策留痕层**——当涉及行为、架构、契约、流程或落盘格式这类半年后会有人回头问"为什么"的地方,用一篇 Agent Note 把 rationale 钉住。包括动手前的选型与被否决的方案——无代码的决定也值得留。
这不是文档生成器,也不是模板合集。代码和普通文档扛不住的「为什么」和「放弃了什么」,写进仓库,跟这次改动同一批走。下一个改这段代码的人(包括 Agent)先读它。动手前的选型、被否掉的方案——没代码也写。
- 只改格式 / 无歧义重命名 / 错别字 → 标 `not applicable`,不写。
- 不确定是否算重要改动 → 按要写处理。
- 别用"以后再补 / 代码即文档 / 改动小"给自己开绿灯。
- **优先就地同步,非必要不新建**:DeepSeek 实践中 80% 的 Note 变更是原地修改现有 Note 的事实(路径、类名、默认参数),而不是开新文件。已有归属的改动直接更新那篇!
- **代码入口反向绑定**:每篇落地 Note 必须在核心代码入口留一行反向注释(`// Note: ... 见 .agents/notes/...`),为下一个接手的 Agent 建立物理索引。
- 只改格式 / 无歧义重命名 / 错别字 / 发布打标(RC/Release tag) → 标 `not applicable`,不写。
- 不确定要不要写 → 按要写处理。
- 别用「以后再补 / 代码即文档 / 改动小」给自己开绿灯。
一句话判断:**"半年后有人回来看,会想知道为什么这样改吗?"** 会,就写。
要不要写,问一句:「以后还有人会问为什么这样改吗?」会,就写。
> "决策"不重——个人项目里就是"为什么选 A 没选 B"。选型、取舍、踩过的坑,都值得钉住。
> 「决定」不重——个人项目里就是「为什么选 A 没选 B」。选型、取舍、踩过的坑,都值得写下。
## 0. 先探测,再落地
别一上来建全套目录。按宿主现状选型:
别一上来建全套目录。按这个仓库现在的样子选:
1. 有 `AGENTS.md` / `CLAUDE.md` / 贡献指南 → 读它;有 `docs/adr/`、`docs/decisions/`、Issue 模板等既有决策记录 → 沿用,语义映射到本 Skill 的 lifecycle / class 即可。
2. 没有决策记录 → 建最小 Note 树:**轻量项目只建 `.agents/notes/implemented/<class>/`**,用到 `proposed` / `rejected` / `archived` 再建;空目录可直接删。
1. 有 `AGENTS.md` / `CLAUDE.md` / 贡献指南 → 读它;有 `docs/adr/`、`docs/decisions/`、Issue 模板等现成的决定记录 → 沿用,状态和种类按本 Skill 的文件夹来即可。
2. 没有现成的决定记录 → 建最小笔记树:轻量项目只建 `.agents/notes/implemented/<class>/`,用到 `proposed` / `rejected` / `archived` 再建;空目录可直接删。
3. 团队长期仓库 → 建全套 `proposed / implemented / rejected / archived × 6 class`。
## 1. 路径即分类
每条 Note 的路径就是身份:`{lifecycle}/{class}/yyyy-mm-dd-topic.md`
**Lifecycle(状态):**
**Lifecycle(一层文件夹,这篇走到哪一步):**
- `proposed` — 想法阶段,有了方案但还没落地
- `implemented` — 已落地,与代码同一次提交保持同步
- `rejected` — 审慎否掉的提案,仅当能防止重犯时保留,否则删整组
- `archived` — 已完成且未来参考价值低的 implemented 记录,冻结不可改
**Class(种类,封闭集,新增需改门禁):**
**Class(二层文件夹,种类,就这 6 个;再加要改检查脚本):**
`feature` / `bug-fix` / `simplification` / `architecture` / `process` / `testing`
- `feature` 新能力 — 用户或模型看得见的选择(不显然的行为也算)
- `bug-fix` 修缺陷 — 修好了什么,或补上复盘里暴露的缺口
- `simplification` 只删不增 — 不增加能力,只删代码、行为或表面
- `architecture` 结构怎么搭 — 发出去的源码怎么组织、包怎么连
- `process` 工具和流程 — 检查、发布、怎么协作(围着代码转,不是运行时行为)
- `testing` 测试怎么写 — 测试策略和基建
> 详见 `references/classification.md`;`refactor` 不单列——用 `simplification` 的判据"可观察行为变了吗"区分。不建集中 `INDEX.md`,用目录与搜索发现。
> `refactor` 不单列:能看见的行为变了,归到对应类;没变就是 `simplification`。不建 `INDEX.md`。细判据见 `references/classification.md`。
## 2. 文件格式(门禁强制)
## 2. 文件格式(检查脚本会核对)
前三行固定:
@@ -74,13 +81,20 @@ Status: <状态>
## 3. 什么时候写、什么时候改
跟着**做决定的时机**写,不只是提交时补。新建前先搜现有归属——同决定的改动更新那一篇,不另起新篇:
优先查现有归属——**80% 的日常维护是「原地更新老 Note 的事实」,而不是盲目建新篇**:
- **有想法、还没动手** → 先写 `proposed`(为什么想这么做、考虑过哪几条路),评审完再动手。纯调研/选型没有代码时,Note 本身就是交付物。
- **动手时 / 刚做完** → 写或更新 `implemented`,**最晚与代码同一次提交**,避免遗漏。有 PR 以 PR 为单位,没有就以 commit / 推送批次为单位。
- **改的是已有 Note 对应的决定** → 更新那一篇(事实、路径、验证变了就同步),不另起一篇。
- **决定没被完全取代** → 新旧两篇都留并互链。
- **决定被完全取代** → 新 Note 接管,旧 Note 按归档规则冻结,或按合并规则删除(需保留所有独特 rationale 并修复入链)。
- 拍板新路线:"就选 X"、"决定用 X"、"我们先用 X 顶着" → 触发 Note
- 比较中:"X 和 Y 怎么选"、"为什么倾向 X" → 触发备选记录
- 同一段理由被人解释了第二遍 → 该写下来了
**判定与操作流:**
- **既有架构重构 / 路径迁移 / 参数改动** → **【首选原地同步】**:直接在持有该决定的老 Note 里修正事实(代码路径、方法签名、默认值),不另起新篇,也不要在正文追加流水账历史。
- **有新想法、还没动手** → 先写 `proposed`(为什么想这么做、考虑过哪几条路),评审完再动手。交互纪律:一次最多问 3 个问题;落笔前先复述一遍"这是否准确反映了决定",人点头再写。
- **动手施工完** → 改为 `implemented`,随代码同一次提交(同 PR / commit),并在关键源码入口留反向注释。
- **方案被新决策部分取代** → 新旧两篇都保留,在双方正文添加相对链接互相引用。
- **方案被新决策完全取代(Supersession)** → 新 Note 接管并承接所有仍有价值的旧理由;旧 Note 移入 `archived/` 冻结,并全局检查修复入站相对链接。
- **免写场景**:版本发布打标(RC/Release Tag)、依赖补丁(不改行为)、纯排版格式化 → 直接提交代码,无需 Note。
> 判定与流转见 `references/when-to-write.md`,归档与删除见 `references/archiving.md`。
@@ -89,16 +103,54 @@ Status: <状态>
- `## Consequences` 同时写**代价和收益**,不是只写"放弃了什么"。
- 自由节(package 拓扑、wire 契约、schema 等)放在 `Decision` 与 `Alternatives` 之间,保持可检索的机制名与 `must / may / never` 时序强调。
- 跨 Note 引用用相对 Markdown 链接 `[topic](../../implemented/architecture/2026-…-….md)`,不要裸数字,以便机械可校验。
- 实现点在核心入口(优先选公开接口/类型定义、模块顶层导出或核心状态机入口)留一行注释指回这篇:`// Note: 用 SQLite 存会话,为何不用 JSONL — 见 .agents/notes/implemented/feature/2026-08-23-xxx.md`,不逐行标。决定被取代时,这些注释就是要同步的代码清单。
- 文风与去推导痕迹见 `references/prose-checklist.md`;简化机会见 `references/simplification-checklist.md`。
- 写完后过一遍 `references/quality-gate.md` 的语义自检,只向用户报**缺口和写得好的地方**(≤5 行),缺口给具体修法。结构靠脚本,意思靠人点头。
## 5. 校验
## 5. 校验与运维命令
在仓库根目录直接运行(已配置 npm script 时):
```sh
npx tsx <skill目录>/scripts/verify-agent-note-tree.ts # 路径、lifecycle、class、文件名
npx tsx <skill目录>/scripts/verify-agent-note-format.ts # 头块、骨架、Alternatives、禁用词
npm run verify-agent-note-tree # 校验目录合法性、分类、文件名及相对 Markdown 链接有效性
npm run verify-agent-note-format # 校验头块、状态、必选节(Alternatives)与现在时禁令
npm run archive-agent-note <path> # 方案被取代时一键归档并提示修复入站相对死链
npm run init-board # [日常开发] 生成 ~69KB 轻量直连看板 index.html(推荐)
npm run bundle-board # [脱机打包] 生成内嵌全量数据的自包含演示看板 demo.html
```
每个校验都是独立 tsx 脚本,串进 `doc-sync` 即成门禁。团队项目可在 `CONTRIBUTING.md` / PR 模板加一句"非平凡改动必带 Note",并把上面两个脚本接进 CI 形成闭环。详见 `references/verification.md`。
若直接通过 tsx 执行脚本(脚本位于当前仓库 `scripts/` 或 `<skill安装目录>/scripts/`):
```sh
npx tsx scripts/verify-agent-note-tree.ts
npx tsx scripts/verify-agent-note-format.ts
npx tsx scripts/archive-agent-note.ts <note-path>
# 日常开发(轻量直连,推荐):在工作目录快速生成轻量看板 index.html (仅 ~69KB)
npx tsx scripts/build-board.ts --init [targetPath] [projectName]
# 静态打包(脱机大单体):生成包含全量内嵌笔记数据的单文件 demo.html (供脱机分发或 GitHub Pages)
npx tsx scripts/build-board.ts --bundle [notesDir] [outputPath] [projectName]
```
### 💡 工程决策看板运行机制 (Agent Notes Board)
**1. 日常开发模式(推荐):**
- 运行 `npx tsx <skill路径>/scripts/build-board.ts --init index.html "项目决策看板"` 生成约 69KB 的纯模板文件;
- 用浏览器打开后,点击右上角 **「连接本地目录」** 授权选择 `.agents/notes`,浏览器通过 File System Access API 直读本地;
- **零构建、零大单体冗余**:开发或 Agent 增删改 Note 后,只要切回浏览器窗口立刻自动静默热更新!
**2. 离线演示与静态分发模式:**
- 运行 `npx tsx <skill路径>/scripts/build-board.ts --bundle .agents/notes demo.html "项目决策看板"`;
- 脚本会将全部笔记数据编译内嵌为单文件,可直接作为离线 Demo 分发或部署至 GitHub Pages。
**3. 看板四大核心能力:**
- **🏛️ 架构基线**:自动基于入度计算系统承重墙(Core Pillars)、按分类聚合活跃领域事实;
- **⏱️ 演进时间线**:精确日期标牌 + 月份与分类双维正交切片;
- **🛡️ 避坑智库**:检索技术选型中「为什么放弃方案 B」与被否决提案(`rejected`);
- **📋 决策清单**:全量检索、分类状态快速筛选与即时搜索下拉直达。
每个校验都是独立 tsx 脚本,可串进 `doc-sync` 与 CI 流水线。团队项目可在 `CONTRIBUTING.md` / PR 模板加一句「重要改动必带一篇笔记」,并把上面校验脚本接进 CI。详见 `references/verification.md`。
## References
@@ -110,4 +162,5 @@ npx tsx <skill目录>/scripts/verify-agent-note-format.ts # 头块、骨架、
- `references/archiving.md` — 归档与合并删除(含"未来参考价值"判定与新增即审计)
- `references/prose-checklist.md` — 行文与去泄露自检
- `references/simplification-checklist.md` — 简化机会自检
- `references/quality-gate.md` — 写后语义自检:Problem / Alternatives / Consequences / Verification 判定 + 汇报形态
- `references/verification.md` — 校验脚本说明
Binary file not shown.

After

Width:  |  Height:  |  Size: 309 KiB

+128
View File
@@ -0,0 +1,128 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 860" width="100%" height="100%">
<defs>
<pattern id="light-grid" width="32" height="32" patternUnits="userSpaceOnUse">
<path d="M 32 0 L 0 0 0 32" fill="none" stroke="#e2e8f0" stroke-width="0.75"/>
</pattern>
<filter id="soft-shadow" x="-5%" y="-5%" width="110%" height="110%">
<feDropShadow dx="0" dy="8" stdDeviation="12" flood-color="#0f172a" flood-opacity="0.05"/>
</filter>
</defs>
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700;800&amp;display=swap');
text {
font-family: -apple-system, 'PingFang SC', 'Noto Sans SC', 'Segoe UI', 'JetBrains Mono', sans-serif;
}
.code { font-family: 'JetBrains Mono', monospace; }
</style>
<!-- Clean Off-white Background -->
<rect width="100%" height="100%" fill="#f8fafc"/>
<rect width="100%" height="100%" fill="url(#light-grid)"/>
<!-- HEADER -->
<g transform="translate(80, 50)">
<rect x="0" y="0" width="150" height="28" rx="14" fill="#e0f2fe" stroke="#0284c7" stroke-width="1.2"/>
<text x="75" y="19" fill="#0369a1" font-size="12" font-weight="800" text-anchor="middle" letter-spacing="0.5">开箱即用 4 件套</text>
<text x="0" y="70" fill="#0f172a" font-size="32" font-weight="800">write-notes-like-deepseek 交付了什么?</text>
</g>
<!-- 4 MINIMAL BENTO BOXES (LARGE TEXT, ZERO BULLET POINTS, MAXIMUM BREATHING SPACE) -->
<!-- BOX 1: SKILL -->
<g transform="translate(80, 150)">
<rect x="0" y="0" width="590" height="310" rx="20" fill="#ffffff" stroke="#bae6fd" stroke-width="2" filter="url(#soft-shadow)"/>
<path d="M 0 20 Q 0 0 20 0 L 570 0 Q 590 0 590 20 L 590 64 L 0 64 Z" fill="#f0f9ff"/>
<circle cx="36" cy="32" r="15" fill="#0284c7"/>
<text x="36" y="38" fill="#ffffff" font-size="14" font-weight="800" text-anchor="middle">1</text>
<text x="64" y="39" fill="#0369a1" font-size="20" font-weight="800">AI 一键装配(Agent Skill)</text>
<g transform="translate(28, 90)">
<!-- Command Box -->
<rect x="0" y="0" width="534" height="64" rx="12" fill="#0f172a"/>
<text x="20" y="38" fill="#38bdf8" font-size="13.5" font-weight="700" class="code">$ npx skills add czm15053/write-notes-like-deepseek</text>
<!-- Single Bold Message -->
<g transform="translate(0, 95)">
<text x="0" y="24" fill="#0f172a" font-size="18" font-weight="800">让 Cursor / Claude 动手前必须先看封条,</text>
<text x="0" y="56" fill="#0284c7" font-size="18" font-weight="800">绝不自作聪明盲目乱改代码!</text>
</g>
</g>
</g>
<!-- BOX 2: TEMPLATES -->
<g transform="translate(730, 150)">
<rect x="0" y="0" width="590" height="310" rx="20" fill="#ffffff" stroke="#fde68a" stroke-width="2" filter="url(#soft-shadow)"/>
<path d="M 0 20 Q 0 0 20 0 L 570 0 Q 590 0 590 20 L 590 64 L 0 64 Z" fill="#fffbeb"/>
<circle cx="36" cy="32" r="15" fill="#d97706"/>
<text x="36" y="38" fill="#ffffff" font-size="14" font-weight="800" text-anchor="middle">2</text>
<text x="64" y="39" fill="#92400e" font-size="20" font-weight="800">200 字填空模板(填空即用)</text>
<g transform="translate(28, 90)">
<!-- 3 Pills -->
<rect x="0" y="0" width="165" height="64" rx="12" fill="#fef3c7" stroke="#fde68a" stroke-width="1.4"/>
<text x="82" y="28" fill="#b45309" font-size="11" font-weight="700" text-anchor="middle">动手前立项</text>
<text x="82" y="50" fill="#78350f" font-size="13" font-weight="800" text-anchor="middle" class="code">proposed.md</text>
<rect x="184" y="0" width="175" height="64" rx="12" fill="#dcfce7" stroke="#a7f3d0" stroke-width="1.4"/>
<text x="271" y="28" fill="#047857" font-size="11" font-weight="700" text-anchor="middle">已落地法律</text>
<text x="271" y="50" fill="#065f46" font-size="13" font-weight="800" text-anchor="middle" class="code">implemented.md</text>
<rect x="378" y="0" width="156" height="64" rx="12" fill="#ffe4e6" stroke="#fecdd3" stroke-width="1.4"/>
<text x="456" y="28" fill="#9f1239" font-size="11" font-weight="700" text-anchor="middle">被否决方案</text>
<text x="456" y="50" fill="#be123c" font-size="13" font-weight="800" text-anchor="middle" class="code">rejected.md</text>
<!-- Single Bold Message -->
<g transform="translate(0, 95)">
<text x="0" y="24" fill="#0f172a" font-size="18" font-weight="800">只有 4 个填空题,单篇仅 200 字,</text>
<text x="0" y="56" fill="#d97706" font-size="18" font-weight="800">就像发朋友圈一样轻松,3 分钟搞定!</text>
</g>
</g>
</g>
<!-- BOX 3: CI GATES -->
<g transform="translate(80, 500)">
<rect x="0" y="0" width="590" height="310" rx="20" fill="#ffffff" stroke="#ddd6fe" stroke-width="2" filter="url(#soft-shadow)"/>
<path d="M 0 20 Q 0 0 20 0 L 570 0 Q 590 0 590 20 L 590 64 L 0 64 Z" fill="#faf5ff"/>
<circle cx="36" cy="32" r="15" fill="#7c3aed"/>
<text x="36" y="38" fill="#ffffff" font-size="14" font-weight="800" text-anchor="middle">3</text>
<text x="64" y="39" fill="#5b21b6" font-size="20" font-weight="800">机器铁面保安(CI 质检门禁)</text>
<g transform="translate(28, 90)">
<!-- Command Box -->
<rect x="0" y="0" width="534" height="64" rx="12" fill="#0f172a"/>
<text x="20" y="38" fill="#c084fc" font-size="13.5" font-weight="700" class="code">$ npm run verify-agent-note-tree &amp;&amp; npm run verify-format</text>
<!-- Single Bold Message -->
<g transform="translate(0, 95)">
<text x="0" y="24" fill="#0f172a" font-size="18" font-weight="800">敢吹牛画大饼?有断头死链?</text>
<text x="0" y="56" fill="#7c3aed" font-size="18" font-weight="800">提交代码时机器人直接打回,不靠人的自觉!</text>
</g>
</g>
</g>
<!-- BOX 4: BOARD -->
<g transform="translate(730, 500)">
<rect x="0" y="0" width="590" height="310" rx="20" fill="#ffffff" stroke="#a7f3d0" stroke-width="2.2" filter="url(#soft-shadow)"/>
<path d="M 0 20 Q 0 0 20 0 L 570 0 Q 590 0 590 20 L 590 64 L 0 64 Z" fill="#f0fdf4"/>
<circle cx="36" cy="32" r="15" fill="#059669"/>
<text x="36" y="38" fill="#ffffff" font-size="14" font-weight="800" text-anchor="middle">4</text>
<text x="64" y="39" fill="#065f46" font-size="20" font-weight="800">免部署离线看板(全景大屏)</text>
<g transform="translate(28, 90)">
<!-- Command Box -->
<rect x="0" y="0" width="534" height="64" rx="12" fill="#f0fdf4" stroke="#a7f3d0" stroke-width="1.5"/>
<text x="20" y="38" fill="#047857" font-size="14" font-weight="700" class="code">双击 assets/agent-notes-board.html 直接打开</text>
<!-- Single Bold Message -->
<g transform="translate(0, 95)">
<text x="0" y="24" fill="#0f172a" font-size="18" font-weight="800">不用装 Node / 不用后端,纯本地大屏,</text>
<text x="0" y="56" fill="#059669" font-size="18" font-weight="800">避坑智库 + 演进史诗,向上汇报看它就行!</text>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 KiB

+113
View File
@@ -0,0 +1,113 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 860" width="100%" height="100%">
<defs>
<pattern id="light-grid" width="32" height="32" patternUnits="userSpaceOnUse">
<path d="M 32 0 L 0 0 0 32" fill="none" stroke="#e2e8f0" stroke-width="0.75"/>
</pattern>
<filter id="soft-shadow" x="-5%" y="-5%" width="110%" height="110%">
<feDropShadow dx="0" dy="6" stdDeviation="10" flood-color="#0f172a" flood-opacity="0.06"/>
</filter>
<marker id="arr-rose" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#e11d48"/>
</marker>
<marker id="arr-emerald" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#059669"/>
</marker>
</defs>
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700;800&amp;display=swap');
text {
font-family: -apple-system, 'PingFang SC', 'Noto Sans SC', 'Segoe UI', 'JetBrains Mono', sans-serif;
}
.code { font-family: 'JetBrains Mono', monospace; }
</style>
<rect width="100%" height="100%" fill="#f8fafc"/>
<rect width="100%" height="100%" fill="url(#light-grid)"/>
<!-- HEADER -->
<g transform="translate(80, 42)">
<rect x="0" y="0" width="150" height="28" rx="14" fill="#e0f2fe" stroke="#0284c7" stroke-width="1.2"/>
<text x="75" y="19" fill="#0369a1" font-size="12" font-weight="800" text-anchor="middle" letter-spacing="0.5">图 1 · 真实故事</text>
<text x="0" y="68" fill="#0f172a" font-size="30" font-weight="800">三个月前踩过的坑,新 AI 为什么又踩一遍?</text>
<text x="0" y="100" fill="#64748b" font-size="15">代码只记下「怎么跑」,没记下「为什么不能用更简单的写法」</text>
</g>
<!-- LEFT: NO NOTE -->
<g transform="translate(80, 155)">
<rect x="0" y="0" width="590" height="645" rx="20" fill="#ffffff" stroke="#fecdd3" stroke-width="2" filter="url(#soft-shadow)"/>
<path d="M 0 20 Q 0 0 20 0 L 570 0 Q 590 0 590 20 L 590 60 L 0 60 Z" fill="#fff1f2"/>
<circle cx="28" cy="30" r="10" fill="#e11d48"/>
<text x="48" y="36" fill="#be123c" font-size="17" font-weight="800">没有 Note:三个月后,新 AI 把坑重新踩一遍</text>
<!-- Step 1 -->
<g transform="translate(24, 84)">
<rect x="0" y="0" width="542" height="128" rx="12" fill="#f8fafc" stroke="#e2e8f0" stroke-width="1.2"/>
<text x="16" y="26" fill="#0f172a" font-size="14" font-weight="800">① 三个月前:工程师踩完坑,代码合进去了</text>
<rect x="16" y="40" width="510" height="72" rx="8" fill="#f1f5f9" stroke="#cbd5e1" stroke-width="1"/>
<text x="28" y="64" fill="#64748b" font-size="12">当时没写笔记。代码看起来很绕,但线上跑得稳。</text>
<text x="28" y="90" fill="#0f172a" font-size="12" class="code">while (!tryAcquireWithBackoff(lockKey, 50)) { yield(); }</text>
</g>
<line x1="295" y1="226" x2="295" y2="252" stroke="#e11d48" stroke-width="2.5" marker-end="url(#arr-rose)"/>
<!-- Step 2 -->
<g transform="translate(24, 266)">
<rect x="0" y="0" width="542" height="128" rx="12" fill="#f8fafc" stroke="#fecdd3" stroke-width="1.2"/>
<text x="16" y="26" fill="#e11d48" font-size="14" font-weight="800">② 今天:新开的 AI 会话看到这段代码</text>
<rect x="16" y="40" width="510" height="72" rx="8" fill="#f1f5f9" stroke="#cbd5e1" stroke-width="1"/>
<text x="28" y="64" fill="#dc2626" font-size="12" class="code">- while (!tryAcquireWithBackoff(...)) { yield(); }</text>
<text x="28" y="90" fill="#16a34a" font-size="12" class="code">+ await mutex.lock(lockKey); // 「太丑了,我来优雅重构」</text>
</g>
<line x1="295" y1="408" x2="295" y2="434" stroke="#e11d48" stroke-width="2.5" marker-end="url(#arr-rose)"/>
<!-- Step 3 -->
<g transform="translate(24, 448)">
<rect x="0" y="0" width="542" height="168" rx="12" fill="#fff1f2" stroke="#fda4af" stroke-width="1.5"/>
<text x="18" y="30" fill="#be123c" font-size="15" font-weight="800">③ 线上死锁。三个月前试过的「优雅写法」又崩了</text>
<text x="18" y="64" fill="#9f1239" font-size="13.5">代码只记下 What,没记下 Why Not。</text>
<text x="18" y="94" fill="#9f1239" font-size="13.5">新 AI 是一张白纸,飞书 / Wiki 它也不会主动去翻。</text>
<text x="18" y="128" fill="#64748b" font-size="13">👉 坑还在,记忆没了。这就是不写 Note 的代价。</text>
</g>
</g>
<!-- RIGHT: WITH NOTE -->
<g transform="translate(730, 155)">
<rect x="0" y="0" width="590" height="645" rx="20" fill="#ffffff" stroke="#a7f3d0" stroke-width="2" filter="url(#soft-shadow)"/>
<path d="M 0 20 Q 0 0 20 0 L 570 0 Q 590 0 590 20 L 590 60 L 0 60 Z" fill="#f0fdf4"/>
<circle cx="28" cy="30" r="10" fill="#059669"/>
<text x="48" y="36" fill="#065f46" font-size="17" font-weight="800">有 Note:代码入口贴封条,新 AI 先读再动手</text>
<!-- Step 1 -->
<g transform="translate(24, 84)">
<rect x="0" y="0" width="542" height="128" rx="12" fill="#f8fafc" stroke="#e2e8f0" stroke-width="1.2"/>
<text x="16" y="26" fill="#0f172a" font-size="14" font-weight="800">① 当时合代码时,顺手在入口留了一行指针</text>
<rect x="16" y="40" width="510" height="72" rx="8" fill="#f0f9ff" stroke="#bae6fd" stroke-width="1"/>
<text x="28" y="64" fill="#0284c7" font-size="11.5" class="code">// Note: 为什么不用普通锁 — 见 .agents/notes/.../lock.md</text>
<text x="28" y="90" fill="#0f172a" font-size="12" class="code">export function acquireLock() { while (!tryAcquire...) { ... } }</text>
</g>
<line x1="295" y1="226" x2="295" y2="252" stroke="#059669" stroke-width="2.5" marker-end="url(#arr-emerald)"/>
<!-- Step 2 -->
<g transform="translate(24, 266)">
<rect x="0" y="0" width="542" height="128" rx="12" fill="#f8fafc" stroke="#a7f3d0" stroke-width="1.2"/>
<text x="16" y="26" fill="#059669" font-size="14" font-weight="800">② 今天新 AI 读到封条,先打开那篇笔记</text>
<rect x="16" y="40" width="510" height="72" rx="8" fill="#fffbeb" stroke="#fde68a" stroke-width="1"/>
<text x="28" y="64" fill="#b45309" font-size="12" font-weight="700">## Alternatives considered</text>
<text x="28" y="90" fill="#78350f" font-size="12">普通互斥锁写法简洁,但并发实测会死锁,不能用。</text>
</g>
<line x1="295" y1="408" x2="295" y2="434" stroke="#059669" stroke-width="2.5" marker-end="url(#arr-emerald)"/>
<!-- Step 3 -->
<g transform="translate(24, 448)">
<rect x="0" y="0" width="542" height="168" rx="12" fill="#f0fdf4" stroke="#86efac" stroke-width="1.5"/>
<text x="18" y="30" fill="#065f46" font-size="15" font-weight="800">③ 新 AI 收回手,在已知边界里改,线上不崩</text>
<text x="18" y="64" fill="#047857" font-size="13.5">封条 100% 进上下文,不靠 AI 自觉去搜文档。</text>
<text x="18" y="94" fill="#047857" font-size="13.5">笔记跟代码同一批提交,三个月后仍然对得上。</text>
<text x="18" y="128" fill="#059669" font-size="13" font-weight="800">★ 换谁来接手,都先看见这条红线。</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 KiB

+161
View File
@@ -0,0 +1,161 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 860" width="100%" height="100%">
<defs>
<pattern id="light-grid" width="32" height="32" patternUnits="userSpaceOnUse">
<path d="M 32 0 L 0 0 0 32" fill="none" stroke="#e2e8f0" stroke-width="0.75"/>
</pattern>
<filter id="soft-shadow" x="-5%" y="-5%" width="110%" height="110%">
<feDropShadow dx="0" dy="6" stdDeviation="10" flood-color="#0f172a" flood-opacity="0.06"/>
</filter>
</defs>
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700;800&amp;display=swap');
text {
font-family: -apple-system, 'PingFang SC', 'Noto Sans SC', 'Segoe UI', 'JetBrains Mono', sans-serif;
}
.code { font-family: 'JetBrains Mono', monospace; }
</style>
<!-- Background -->
<rect width="100%" height="100%" fill="#f8fafc"/>
<rect width="100%" height="100%" fill="url(#light-grid)"/>
<!-- HEADER -->
<g transform="translate(80, 50)">
<rect x="0" y="0" width="150" height="28" rx="14" fill="#e0f2fe" stroke="#0284c7" stroke-width="1.2"/>
<text x="75" y="19" fill="#0369a1" font-size="12" font-weight="800" text-anchor="middle" letter-spacing="0.5">图 2 · 分类大地图</text>
<text x="0" y="70" fill="#0f172a" font-size="32" font-weight="800">到底哪些改动要写笔记?就这 6 种情况!</text>
<text x="0" y="104" fill="#64748b" font-size="16">路径格式:{状态}/{种类}/日期-主题.md · 就这 6 个固定文件夹,多建一个 CI 都会打回</text>
</g>
<!-- 6 BENTO CARDS (2 ROWS x 3 COLS) - ULTRA LEAN -->
<!-- ROW 1 -->
<!-- 1. feature -->
<g transform="translate(80, 160)">
<rect x="0" y="0" width="380" height="260" rx="16" fill="#ffffff" stroke="#bae6fd" stroke-width="1.8" filter="url(#soft-shadow)"/>
<path d="M 0 16 Q 0 0 16 0 L 364 0 Q 380 0 380 16 L 380 56 L 0 56 Z" fill="#f0f9ff"/>
<rect x="18" y="16" width="76" height="24" rx="5" fill="#e0f2fe"/>
<text x="56" y="32" fill="#0284c7" font-size="12" font-weight="800" text-anchor="middle" class="code">feature</text>
<text x="106" y="35" fill="#0369a1" font-size="17" font-weight="800">🌟 加了新功能</text>
<g transform="translate(20, 80)">
<text x="0" y="18" fill="#0f172a" font-size="15" font-weight="800">用户看得见的新能力与非显然选择:</text>
<rect x="0" y="36" width="340" height="115" rx="10" fill="#f8fafc" stroke="#e2e8f0" stroke-width="1.2"/>
<g transform="translate(16, 24)">
<text x="0" y="18" fill="#0284c7" font-size="13" font-weight="700">DSH 真实案例:</text>
<text x="0" y="44" fill="#334155" font-size="12.5">• 存储层从文本换成 SQLite</text>
<text x="0" y="68" fill="#334155" font-size="12.5">• 多 Agent 组队与共享任务认领</text>
</g>
</g>
</g>
<!-- 2. bug-fix -->
<g transform="translate(510, 160)">
<rect x="0" y="0" width="380" height="260" rx="16" fill="#ffffff" stroke="#fecdd3" stroke-width="1.8" filter="url(#soft-shadow)"/>
<path d="M 0 16 Q 0 0 16 0 L 364 0 Q 380 0 380 16 L 380 56 L 0 56 Z" fill="#fff1f2"/>
<rect x="18" y="16" width="76" height="24" rx="5" fill="#ffe4e6"/>
<text x="56" y="32" fill="#e11d48" font-size="12" font-weight="800" text-anchor="middle" class="code">bug-fix</text>
<text x="106" y="35" fill="#be123c" font-size="17" font-weight="800">🐛 踩坑大修复</text>
<g transform="translate(20, 80)">
<text x="0" y="18" fill="#0f172a" font-size="15" font-weight="800">解决隐蔽故障,复盘把教训焊死:</text>
<rect x="0" y="36" width="340" height="115" rx="10" fill="#f8fafc" stroke="#fecdd3" stroke-width="1.2"/>
<g transform="translate(16, 24)">
<text x="0" y="18" fill="#e11d48" font-size="13" font-weight="700">DSH 真实案例:</text>
<text x="0" y="44" fill="#334155" font-size="12.5">• 修复多进程退火竞争导致的死锁</text>
<text x="0" y="68" fill="#334155" font-size="12.5">• 修复 Python 进程结算隔离崩溃</text>
</g>
</g>
</g>
<!-- 3. simplification -->
<g transform="translate(940, 160)">
<rect x="0" y="0" width="380" height="260" rx="16" fill="#ffffff" stroke="#a7f3d0" stroke-width="1.8" filter="url(#soft-shadow)"/>
<path d="M 0 16 Q 0 0 16 0 L 364 0 Q 380 0 380 16 L 380 56 L 0 56 Z" fill="#f0fdf4"/>
<rect x="18" y="16" width="108" height="24" rx="5" fill="#dcfce7"/>
<text x="72" y="32" fill="#059669" font-size="11" font-weight="800" text-anchor="middle" class="code">simplification</text>
<text x="136" y="35" fill="#065f46" font-size="17" font-weight="800">✂️ 删繁就简</text>
<g transform="translate(20, 80)">
<text x="0" y="18" fill="#0f172a" font-size="15" font-weight="800">只删不增!裁撤历史多余包袱:</text>
<rect x="0" y="36" width="340" height="115" rx="10" fill="#f8fafc" stroke="#a7f3d0" stroke-width="1.2"/>
<g transform="translate(16, 24)">
<text x="0" y="18" fill="#059669" font-size="13" font-weight="700">DSH 真实案例:</text>
<text x="0" y="44" fill="#334155" font-size="12.5">• 删掉 SQLite 存储层,全量瘦身成 JSONL</text>
<text x="0" y="68" fill="#334155" font-size="12.5">• 删掉手写工具,直接复用系统命令</text>
</g>
</g>
</g>
<!-- ROW 2 -->
<!-- 4. architecture -->
<g transform="translate(80, 455)">
<rect x="0" y="0" width="380" height="260" rx="16" fill="#ffffff" stroke="#ddd6fe" stroke-width="1.8" filter="url(#soft-shadow)"/>
<path d="M 0 16 Q 0 0 16 0 L 364 0 Q 380 0 380 16 L 380 56 L 0 56 Z" fill="#faf5ff"/>
<rect x="18" y="16" width="94" height="24" rx="5" fill="#f3e8ff"/>
<text x="65" y="32" fill="#7c3aed" font-size="11" font-weight="800" text-anchor="middle" class="code">architecture</text>
<text x="122" y="35" fill="#5b21b6" font-size="17" font-weight="800">🏛️ 骨架与分家</text>
<g transform="translate(20, 80)">
<text x="0" y="18" fill="#0f172a" font-size="15" font-weight="800">模块物理切分、包之间的边界:</text>
<rect x="0" y="36" width="340" height="115" rx="10" fill="#f8fafc" stroke="#ddd6fe" stroke-width="1.2"/>
<g transform="translate(16, 24)">
<text x="0" y="18" fill="#7c3aed" font-size="13" font-weight="700">DSH 真实案例:</text>
<text x="0" y="44" fill="#334155" font-size="12.5">• 规定插件只准调接口,绝不碰实现</text>
<text x="0" y="68" fill="#334155" font-size="12.5">• 网页端功能拆成独立包单独发布</text>
</g>
</g>
</g>
<!-- 5. process -->
<g transform="translate(510, 455)">
<rect x="0" y="0" width="380" height="260" rx="16" fill="#ffffff" stroke="#fde68a" stroke-width="1.8" filter="url(#soft-shadow)"/>
<path d="M 0 16 Q 0 0 16 0 L 364 0 Q 380 0 380 16 L 380 56 L 0 56 Z" fill="#fffbeb"/>
<rect x="18" y="16" width="76" height="24" rx="5" fill="#fef3c7"/>
<text x="56" y="32" fill="#d97706" font-size="12" font-weight="800" text-anchor="middle" class="code">process</text>
<text x="106" y="35" fill="#92400e" font-size="17" font-weight="800">⚙️ 协作与工具</text>
<g transform="translate(20, 80)">
<text x="0" y="18" fill="#0f172a" font-size="15" font-weight="800">围绕代码运转的检查、发布规矩:</text>
<rect x="0" y="36" width="340" height="115" rx="10" fill="#f8fafc" stroke="#fde68a" stroke-width="1.2"/>
<g transform="translate(16, 24)">
<text x="0" y="18" fill="#d97706" font-size="13" font-weight="700">DSH 真实案例:</text>
<text x="0" y="44" fill="#334155" font-size="12.5">• 强制每个包 README 必须写缺陷限制</text>
<text x="0" y="68" fill="#334155" font-size="12.5">• 制定多个堆叠 PR 顺序合并的规矩</text>
</g>
</g>
</g>
<!-- 6. testing -->
<g transform="translate(940, 455)">
<rect x="0" y="0" width="380" height="260" rx="16" fill="#ffffff" stroke="#bfdbfe" stroke-width="1.8" filter="url(#soft-shadow)"/>
<path d="M 0 16 Q 0 0 16 0 L 364 0 Q 380 0 380 16 L 380 56 L 0 56 Z" fill="#eff6ff"/>
<rect x="18" y="16" width="76" height="24" rx="5" fill="#dbeafe"/>
<text x="56" y="32" fill="#2563eb" font-size="12" font-weight="800" text-anchor="middle" class="code">testing</text>
<text x="106" y="35" fill="#1e40af" font-size="17" font-weight="800">🧪 测试写稳妥</text>
<g transform="translate(20, 80)">
<text x="0" y="18" fill="#0f172a" font-size="15" font-weight="800">专门消灭偶发报错的假警报用例:</text>
<rect x="0" y="36" width="340" height="115" rx="10" fill="#f8fafc" stroke="#bfdbfe" stroke-width="1.2"/>
<g transform="translate(16, 24)">
<text x="0" y="18" fill="#2563eb" font-size="13" font-weight="700">DSH 真实案例:</text>
<text x="0" y="44" fill="#334155" font-size="12.5">• 随机分配空闲端口,防并发冲突</text>
<text x="0" y="68" fill="#334155" font-size="12.5">• 解决苹果/Windows时间戳精度大坑</text>
</g>
</g>
</g>
<!-- BOTTOM STRIP -->
<g transform="translate(80, 740)">
<rect x="0" y="0" width="1240" height="75" rx="12" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.5" filter="url(#soft-shadow)"/>
<text x="24" y="30" fill="#d97706" font-size="14" font-weight="800">💡 为什么没有 refactor(重构)目录?</text>
<text x="24" y="54" fill="#334155" font-size="13">对外表现出来的功能变了?归入 <tspan fill="#0284c7" font-weight="700">feature / bug-fix</tspan>;功能完全没变、纯粹删繁就简?直接归入 <tspan fill="#059669" font-weight="700">simplification</tspan>!</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 KiB

+134
View File
@@ -0,0 +1,134 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 860" width="100%" height="100%">
<defs>
<pattern id="light-grid" width="32" height="32" patternUnits="userSpaceOnUse">
<path d="M 32 0 L 0 0 0 32" fill="none" stroke="#e2e8f0" stroke-width="0.75"/>
</pattern>
<filter id="soft-shadow" x="-5%" y="-5%" width="110%" height="110%">
<feDropShadow dx="0" dy="6" stdDeviation="12" flood-color="#0f172a" flood-opacity="0.06"/>
</filter>
</defs>
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700;800&amp;display=swap');
text {
font-family: -apple-system, 'PingFang SC', 'Noto Sans SC', 'Segoe UI', 'JetBrains Mono', sans-serif;
}
.code { font-family: 'JetBrains Mono', monospace; }
</style>
<!-- Background -->
<rect width="100%" height="100%" fill="#f8fafc"/>
<rect width="100%" height="100%" fill="url(#light-grid)"/>
<!-- HEADER -->
<g transform="translate(80, 50)">
<rect x="0" y="0" width="150" height="28" rx="14" fill="#f3e8ff" stroke="#7c3aed" stroke-width="1.2"/>
<text x="75" y="19" fill="#6d28d9" font-size="12" font-weight="800" text-anchor="middle" letter-spacing="0.5">图 3 · 真实笔记解剖</text>
<text x="0" y="70" fill="#0f172a" font-size="32" font-weight="800">一篇合格的 Note 到底长啥样?只填 4 个空!</text>
</g>
<!-- MAIN BODY -->
<!-- LEFT: DOCUMENT MOCKUP (740px) -->
<g transform="translate(80, 150)">
<rect x="0" y="0" width="750" height="660" rx="20" fill="#ffffff" stroke="#bae6fd" stroke-width="2" filter="url(#soft-shadow)"/>
<path d="M 0 20 Q 0 0 20 0 L 730 0 Q 750 0 750 20 L 750 56 L 0 56 Z" fill="#f0f9ff"/>
<circle cx="28" cy="28" r="7" fill="#0284c7"/>
<text x="46" y="34" fill="#0369a1" font-size="14.5" font-weight="800">DSH 真实笔记:.agents/notes/implemented/simplification/2026-08-30-jsonl-only.md</text>
<g transform="translate(26, 75)">
<rect x="0" y="0" width="698" height="555" rx="12" fill="#f8fafc" stroke="#cbd5e1" stroke-width="1.2"/>
<g transform="translate(24, 25)">
<!-- Headers -->
<text x="0" y="18" fill="#059669" font-size="14.5" font-weight="800" class="code"># Agent Note: JSONL-only first-party Session persistence</text>
<text x="0" y="44" fill="#0284c7" font-size="13" font-weight="700" class="code">Status: implemented</text>
<line x1="0" y1="58" x2="650" y2="58" stroke="#e2e8f0" stroke-width="1.5"/>
<!-- Section 1 -->
<g transform="translate(0, 75)">
<text x="0" y="16" fill="#b45309" font-size="13.5" font-weight="800" class="code">## Problem (遇到的棘手问题)</text>
<text x="0" y="42" fill="#334155" font-size="12.5">同时维护 JSONL 和 SQLite 导致跨平台测试和迁移规则全部翻倍,包袱过重。</text>
</g>
<!-- Section 2 -->
<g transform="translate(0, 150)">
<text x="0" y="16" fill="#059669" font-size="13.5" font-weight="800" class="code">## Decision (现在时客观事实)</text>
<text x="0" y="42" fill="#334155" font-size="12.5">首方存储全量瘦身为纯 JSONL。彻底删除 SQLite 存储包,坚决只留一种单物理格式!</text>
</g>
<!-- Section 3 -->
<g transform="translate(0, 225)">
<rect x="-8" y="0" width="666" height="135" rx="8" fill="#fffbeb" stroke="#fde68a" stroke-width="1.4"/>
<g transform="translate(14, 20)">
<text x="0" y="14" fill="#b45309" font-size="13.5" font-weight="800" class="code">## Alternatives considered (被否决的备选方案)</text>
<text x="0" y="40" fill="#78350f" font-size="12">• <tspan font-weight="700">保留 SQLite 作为可选后端</tspan>:看似灵活,但会让 CI 矩阵无限膨胀,否决!</text>
<text x="0" y="66" fill="#78350f" font-size="12">• <tspan font-weight="700">保留只读 SQLite 导入包</tspan>:没有实际部署需求,纯属过度设计,否决!</text>
<text x="0" y="92" fill="#78350f" font-size="12">• <tspan font-weight="700">把搜索数据库拿来当主存储</tspan>:将可丢弃的缓存与持久化混为一谈,否决!</text>
</g>
</g>
<!-- Section 4 -->
<g transform="translate(0, 385)">
<text x="0" y="16" fill="#7c3aed" font-size="13.5" font-weight="800" class="code">## Consequences (收益与真实代价)</text>
<text x="0" y="42" fill="#334155" font-size="12.5">• <tspan fill="#059669" font-weight="700">收益</tspan>:首方架构大幅简化,格式迁移无需跨库事务,削减海量测试成本。</text>
<text x="0" y="68" fill="#e11d48" font-size="12.5">• <tspan fill="#e11d48" font-weight="700">代价</tspan>:不再开箱兼容老旧的 SQLite 文件,需要用户在升级前手动导出。</text>
</g>
</g>
</g>
</g>
<!-- RIGHT: SUPER LEAN RULES (470px) -->
<g transform="translate(860, 150)">
<!-- Box 1: 4 Core Sections -->
<g transform="translate(0, 0)">
<rect x="0" y="0" width="460" height="315" rx="20" fill="#ffffff" stroke="#a7f3d0" stroke-width="2" filter="url(#soft-shadow)"/>
<path d="M 0 20 Q 0 0 20 0 L 440 0 Q 460 0 460 20 L 460 56 L 0 56 Z" fill="#f0fdf4"/>
<circle cx="28" cy="28" r="12" fill="#059669"/>
<text x="28" y="33" fill="#ffffff" font-size="12" font-weight="800" text-anchor="middle">✓</text>
<text x="50" y="34" fill="#065f46" font-size="17" font-weight="800">4 个填空分别回答什么?</text>
<g transform="translate(24, 80)">
<text x="0" y="18" fill="#b45309" font-size="14" font-weight="800">1. Problem</text>
<text x="145" y="18" fill="#334155" font-size="14">当时遇到了什么大麻烦?</text>
<text x="0" y="58" fill="#059669" font-size="14" font-weight="800">2. Decision</text>
<text x="145" y="58" fill="#334155" font-size="14">现在用什么方案彻底解决?</text>
<text x="0" y="98" fill="#d97706" font-size="14" font-weight="800">3. Alternatives</text>
<text x="145" y="98" fill="#334155" font-size="14">毙掉了谁?为啥不要它?</text>
<text x="0" y="138" fill="#7c3aed" font-size="14" font-weight="800">4. Consequences</text>
<text x="145" y="138" fill="#334155" font-size="14">得了啥好处?有啥坏处?</text>
<rect x="0" y="170" width="412" height="42" rx="8" fill="#f0fdf4"/>
<text x="206" y="196" fill="#047857" font-size="13" font-weight="800" text-anchor="middle">⏱ 就像填空题一样,200字搞定!</text>
</g>
</g>
<!-- Box 2: CI Red Flags -->
<g transform="translate(0, 345)">
<rect x="0" y="0" width="460" height="315" rx="20" fill="#ffffff" stroke="#fecdd3" stroke-width="2" filter="url(#soft-shadow)"/>
<path d="M 0 20 Q 0 0 20 0 L 440 0 Q 460 0 460 20 L 460 56 L 0 56 Z" fill="#fff1f2"/>
<circle cx="28" cy="28" r="12" fill="#e11d48"/>
<text x="28" y="33" fill="#ffffff" font-size="12" font-weight="800" text-anchor="middle">!</text>
<text x="50" y="34" fill="#be123c" font-size="17" font-weight="800">CI 门禁打回两张红牌:</text>
<g transform="translate(24, 85)">
<rect x="0" y="0" width="412" height="60" rx="10" fill="#fff1f2"/>
<text x="16" y="24" fill="#e11d48" font-size="14" font-weight="800">🚫 红牌 1:严禁吹牛画大饼</text>
<text x="16" y="46" fill="#9f1239" font-size="12">已落地笔记敢写“后续计划支持”?直接报错!</text>
<g transform="translate(0, 75)">
<rect x="0" y="0" width="412" height="60" rx="10" fill="#fff1f2"/>
<text x="16" y="24" fill="#e11d48" font-size="14" font-weight="800">🚫 红牌 2:严禁偷懒不写备选</text>
<text x="16" y="46" fill="#9f1239" font-size="12">不写放弃了谁、没有对比?判定为敷衍打回!</text>
</g>
<g transform="translate(0, 150)">
<rect x="0" y="0" width="412" height="42" rx="8" fill="#faf5ff"/>
<text x="206" y="26" fill="#7c3aed" font-size="13" font-weight="800" text-anchor="middle">🛡 机器人严格验货,只收硬核事实!</text>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 KiB

+161
View File
@@ -0,0 +1,161 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 880" width="100%" height="100%">
<defs>
<pattern id="light-grid" width="32" height="32" patternUnits="userSpaceOnUse">
<path d="M 32 0 L 0 0 0 32" fill="none" stroke="#e2e8f0" stroke-width="0.75"/>
</pattern>
<filter id="soft-shadow" x="-5%" y="-5%" width="110%" height="110%">
<feDropShadow dx="0" dy="6" stdDeviation="10" flood-color="#0f172a" flood-opacity="0.06"/>
</filter>
</defs>
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&amp;display=swap');
text {
font-family: -apple-system, 'PingFang SC', 'Noto Sans SC', 'Segoe UI', 'JetBrains Mono', sans-serif;
}
.code { font-family: 'JetBrains Mono', monospace; }
</style>
<!-- Background -->
<rect width="100%" height="100%" fill="#f8fafc"/>
<rect width="100%" height="100%" fill="url(#light-grid)"/>
<!-- HEADER -->
<g transform="translate(60, 45)">
<rect x="0" y="0" width="220" height="28" rx="14" fill="#e0f2fe" stroke="#0284c7" stroke-width="1.2"/>
<text x="110" y="19" fill="#0369a1" font-size="12" font-weight="700" text-anchor="middle" letter-spacing="0.5">图 4 · DSH 真实分流实战</text>
<text x="0" y="68" fill="#0f172a" font-size="28" font-weight="800">DSH 真实场景三档分流:我这次改动到底属于哪一档?</text>
<text x="0" y="98" fill="#475569" font-size="14.5">结合 DSH 真实提交记录 ➔ 本项目提供模板与 verify-agent-note-* 脚本自动化核对</text>
</g>
<!-- 3 CARDS -->
<!-- TIER 1: 80% IN PLACE -->
<g transform="translate(60, 145)">
<rect x="0" y="0" width="390" height="680" rx="16" fill="#ffffff" stroke="#059669" stroke-width="2.2" filter="url(#soft-shadow)"/>
<path d="M 0 16 Q 0 0 16 0 L 374 0 Q 390 0 390 16 L 390 56 L 0 56 Z" fill="#f0fdf4"/>
<rect x="18" y="16" width="110" height="24" rx="5" fill="#dcfce7"/>
<text x="73" y="32" fill="#065f46" font-size="11.5" font-weight="800" text-anchor="middle">DSH 占 80% 大头</text>
<text x="140" y="34" fill="#047857" font-size="15.5" font-weight="800">第 1 档:原地改两行</text>
<g transform="translate(24, 76)">
<text x="0" y="18" fill="#0f172a" font-size="14" font-weight="800">【DSH 真实场景】:</text>
<text x="0" y="44" fill="#334155" font-size="12.5">既有功能的内部优化、接口签名改动、</text>
<text x="0" y="68" fill="#334155" font-size="12.5">文件挪动路径,或者调整默认配置。</text>
<text x="0" y="92" fill="#047857" font-size="12.5" font-weight="700">这块功能此前已经有一篇成熟的 Note。</text>
<!-- Realistic DSH example box -->
<g transform="translate(0, 115)">
<rect x="0" y="0" width="342" height="110" rx="8" fill="#f0fdf4" stroke="#a7f3d0" stroke-width="1.2"/>
<text x="14" y="24" fill="#059669" font-size="12" font-weight="800">📜 DSH 真实案例:</text>
<text x="14" y="48" fill="#065f46" font-size="11">在重构 `ui-conversation` 输入框时,</text>
<text x="14" y="70" fill="#065f46" font-size="11">DSH 工程师直接就地修改已有的</text>
<text x="14" y="92" fill="#0369a1" font-size="10" class="code">2026-07-25-web-input-machine.md</text>
</g>
<!-- Action Box -->
<g transform="translate(0, 245)">
<text x="0" y="18" fill="#0f172a" font-size="14" font-weight="800">你只需要做:</text>
<g transform="translate(0, 32)">
<rect x="0" y="0" width="342" height="205" rx="8" fill="#f8fafc" stroke="#cbd5e1" stroke-width="1.2"/>
<text x="16" y="30" fill="#059669" font-size="14" font-weight="800">打开老笔记,直接就地修改!</text>
<text x="16" y="60" fill="#334155" font-size="12">• 修正事实(类名、路径、默认参数)</text>
<text x="16" y="86" fill="#be123c" font-size="12" font-weight="700">• 严禁开新文件!(绝不开新篇稀释注意力)</text>
<text x="16" y="112" fill="#be123c" font-size="12" font-weight="700">• 严禁记流水账!(别写几月几号改了啥)</text>
<text x="16" y="138" fill="#334155" font-size="12">• 笔记永远代表系统“现行的法律”!</text>
<rect x="16" y="158" width="310" height="30" rx="5" fill="#dcfce7"/>
<text x="171" y="178" fill="#15803d" font-size="11.5" font-weight="800" text-anchor="middle">⏱ 耗时:30 秒改两行,老笔记永久保鲜!</text>
</g>
</g>
</g>
</g>
<!-- TIER 2: EXEMPT (RED) -->
<g transform="translate(485, 145)">
<rect x="0" y="0" width="390" height="680" rx="16" fill="#ffffff" stroke="#e11d48" stroke-width="1.8" filter="url(#soft-shadow)"/>
<path d="M 0 16 Q 0 0 16 0 L 374 0 Q 390 0 390 16 L 390 56 L 0 56 Z" fill="#fff1f2"/>
<rect x="18" y="16" width="100" height="24" rx="5" fill="#ffe4e6"/>
<text x="68" y="32" fill="#be123c" font-size="11.5" font-weight="800" text-anchor="middle">一律不写</text>
<text x="130" y="34" fill="#be123c" font-size="15.5" font-weight="800">第 2 档:纯提交,别找事</text>
<g transform="translate(24, 76)">
<text x="0" y="18" fill="#0f172a" font-size="14" font-weight="800">【DSH 真实场景】:</text>
<text x="0" y="44" fill="#334155" font-size="12.5">代码逻辑毫无改变的小改动,</text>
<text x="0" y="68" fill="#334155" font-size="12.5">半年后绝对没有任何人会问</text>
<text x="0" y="92" fill="#334155" font-size="12.5">“当时为什么这么选”。</text>
<!-- Realistic DSH example box -->
<g transform="translate(0, 115)">
<rect x="0" y="0" width="342" height="110" rx="8" fill="#fff1f2" stroke="#fecdd3" stroke-width="1.2"/>
<text x="14" y="24" fill="#e11d48" font-size="12" font-weight="800">📜 DSH 真实案例:</text>
<text x="14" y="48" fill="#9f1239" font-size="10.5" class="code">commit: caf386f59c (修复测试命名)</text>
<text x="14" y="70" fill="#9f1239" font-size="11">• 纯代码格式化 / Prettier 换行缩进</text>
<text x="14" y="92" fill="#9f1239" font-size="11">• 给 Git 打 Release Tag / 依赖包小升级</text>
</g>
<!-- Action Box -->
<g transform="translate(0, 245)">
<text x="0" y="18" fill="#0f172a" font-size="14" font-weight="800">你只需要做:</text>
<g transform="translate(0, 32)">
<rect x="0" y="0" width="342" height="205" rx="8" fill="#f8fafc" stroke="#cbd5e1" stroke-width="1.2"/>
<text x="16" y="30" fill="#be123c" font-size="14" font-weight="800">直接提交代码,严禁写笔记!</text>
<text x="16" y="60" fill="#334155" font-size="12">• 不要给自己强行加戏</text>
<text x="16" y="86" fill="#be123c" font-size="12" font-weight="700">• 为这种小事写 Note 只会污染仓库!</text>
<text x="16" y="112" fill="#334155" font-size="12">• 保持目录树的绝对纯净</text>
<text x="16" y="138" fill="#334155" font-size="12">• 直接 git commit 推代码!</text>
<rect x="16" y="158" width="310" height="30" rx="5" fill="#ffe4e6"/>
<text x="171" y="178" fill="#be123c" font-size="11.5" font-weight="800" text-anchor="middle">⏱ 耗时:0 秒,直接提交!</text>
</g>
</g>
</g>
</g>
<!-- TIER 3: MAJOR (AMBER) -->
<g transform="translate(910, 145)">
<rect x="0" y="0" width="430" height="680" rx="16" fill="#ffffff" stroke="#d97706" stroke-width="1.8" filter="url(#shadow)"/>
<path d="M 0 16 Q 0 0 16 0 L 414 0 Q 430 0 430 16 L 430 56 L 0 56 Z" fill="#fffbeb"/>
<rect x="18" y="16" width="110" height="24" rx="5" fill="#fef3c7"/>
<text x="73" y="32" fill="#92400e" font-size="11.5" font-weight="800" text-anchor="middle">重大技术选型</text>
<text x="140" y="34" fill="#92400e" font-size="15.5" font-weight="800">第 3 档:新开一篇留痕</text>
<g transform="translate(24, 76)">
<text x="0" y="18" fill="#0f172a" font-size="14" font-weight="800">【DSH 真实场景】:</text>
<text x="0" y="44" fill="#334155" font-size="12.5">做了全新架构设计,选了 A 淘汰了 B、C。</text>
<text x="0" y="68" fill="#334155" font-size="12.5">半年后新来的 AI 看到代码,</text>
<text x="0" y="92" fill="#334155" font-size="12.5">必定会好奇“当初为啥不用更简单的 B 呢?”</text>
<!-- Realistic DSH example box -->
<g transform="translate(0, 115)">
<rect x="0" y="0" width="382" height="110" rx="8" fill="#fffbeb" stroke="#fde68a" stroke-width="1.2"/>
<text x="14" y="24" fill="#d97706" font-size="12" font-weight="800">📜 DSH 真实案例:</text>
<text x="14" y="48" fill="#78350f" font-size="10.5" class="code">2026-08-05-agent-teams.md</text>
<text x="14" y="68" fill="#78350f" font-size="11">设计全新的 Agent 组队、邮箱与任务认领机制</text>
<text x="14" y="90" fill="#0284c7" font-size="11" font-weight="700">★ 套用本项目 templates/implemented.md 模板</text>
</g>
<!-- Action Box -->
<g transform="translate(0, 245)">
<text x="0" y="18" fill="#0f172a" font-size="14" font-weight="800">你只需要做:</text>
<g transform="translate(0, 32)">
<rect x="0" y="0" width="382" height="205" rx="8" fill="#f8fafc" stroke="#cbd5e1" stroke-width="1.2"/>
<text x="16" y="30" fill="#d97706" font-size="14" font-weight="800">按模板填 4 个空(总共200字)</text>
<text x="16" y="58" fill="#334155" font-size="12">1. 遇到啥问题? 2. 拍板了啥方案?</text>
<text x="16" y="82" fill="#334155" font-size="12">3. 毙掉了谁、为啥不要它? 4. 有啥代价?</text>
<text x="16" y="108" fill="#0284c7" font-size="12" font-weight="700">★ 在代码入口贴一行 // Note: 见笔记...</text>
<text x="16" y="132" fill="#059669" font-size="11.5" font-weight="700">跑 verify-agent-note-* 校验并随代码提交!</text>
<rect x="16" y="158" width="350" height="30" rx="5" fill="#fef3c7"/>
<text x="191" y="178" fill="#92400e" font-size="11.5" font-weight="800" text-anchor="middle">⏱ 耗时:3 分钟写完,给代码装上护栏!</text>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 KiB

+146
View File
@@ -0,0 +1,146 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 880" width="100%" height="100%">
<defs>
<pattern id="light-grid" width="32" height="32" patternUnits="userSpaceOnUse">
<path d="M 32 0 L 0 0 0 32" fill="none" stroke="#e2e8f0" stroke-width="0.75"/>
</pattern>
<filter id="soft-shadow" x="-5%" y="-5%" width="110%" height="110%">
<feDropShadow dx="0" dy="6" stdDeviation="10" flood-color="#0f172a" flood-opacity="0.06"/>
</filter>
<marker id="loop-blue" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#0284c7"/>
</marker>
<marker id="loop-green" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#059669"/>
</marker>
<marker id="loop-purple" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#7c3aed"/>
</marker>
</defs>
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&amp;display=swap');
text {
font-family: -apple-system, 'PingFang SC', 'Noto Sans SC', 'Segoe UI', 'JetBrains Mono', sans-serif;
}
.code { font-family: 'JetBrains Mono', monospace; }
</style>
<!-- Background -->
<rect width="100%" height="100%" fill="#f8fafc"/>
<rect width="100%" height="100%" fill="url(#light-grid)"/>
<!-- HEADER -->
<g transform="translate(60, 45)">
<rect x="0" y="0" width="190" height="28" rx="14" fill="#f3e8ff" stroke="#7c3aed" stroke-width="1.2"/>
<text x="95" y="19" fill="#6d28d9" font-size="12" font-weight="700" text-anchor="middle" letter-spacing="0.5">图 5 · 真实工程闭环</text>
<text x="0" y="68" fill="#0f172a" font-size="28" font-weight="800">DSH 源码闭环回路:代码与 Note 是怎么自我维持的?</text>
<text x="0" y="98" fill="#475569" font-size="14.5">挂指针 ➔ 咬合上下文 ➔ 双轨提交 ➔ CI 机械验货 ➔ 合入主干成为下一代 AI 的基线</text>
</g>
<!-- MAIN CIRCULAR LOOP CONTAINER -->
<g transform="translate(60, 150)">
<rect x="0" y="0" width="1280" height="660" rx="16" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.6" filter="url(#soft-shadow)"/>
<!-- STEP 1 (TOP-LEFT): IN-CODE ANCHOR -->
<g transform="translate(50, 40)">
<rect x="0" y="0" width="540" height="220" rx="12" fill="#ffffff" stroke="#bae6fd" stroke-width="2" filter="url(#soft-shadow)"/>
<path d="M 0 12 Q 0 0 12 0 L 528 0 Q 540 0 540 12 L 540 44 L 0 44 Z" fill="#f0f9ff"/>
<circle cx="22" cy="22" r="10" fill="#0284c7"/>
<text x="22" y="26" fill="#ffffff" font-size="11" font-weight="800" text-anchor="middle">1</text>
<text x="42" y="27" fill="#0369a1" font-size="14" font-weight="800">代码挂物理指针(In-Code Pointer)</text>
<g transform="translate(20, 60)">
<text x="0" y="16" fill="#0f172a" font-size="12.5" font-weight="700">DSH 源码真实写法(全库共 816 处):</text>
<rect x="0" y="26" width="500" height="64" rx="6" fill="#f8fafc" stroke="#cbd5e1" stroke-width="1"/>
<text x="12" y="48" fill="#0284c7" font-size="11" class="code">/** ui-conversation/src/client/input/decorations.ts:3 */</text>
<text x="12" y="68" fill="#0369a1" font-size="11" class="code">* see .agents/notes/implemented/.../web-input-machine.md</text>
<text x="0" y="112" fill="#475569" font-size="12">💡 作用:任何 AI 只要来读这个函数,这行注释就 100% 强行灌入 Context,</text>
<text x="0" y="132" fill="#0284c7" font-size="12" font-weight="700">不靠 AI 自觉、不用向量检索,物理级确定性拦截!</text>
</g>
</g>
<!-- ARROW 1 -> 2 (TOP HORIZONTAL) -->
<path d="M 600 150 L 680 150" stroke="#0284c7" stroke-width="3" marker-end="url(#loop-blue)"/>
<rect x="612" y="125" width="60" height="22" rx="4" fill="#e0f2fe"/>
<text x="642" y="140" fill="#0369a1" font-size="10.5" font-weight="700" text-anchor="middle">顺藤摸瓜</text>
<!-- STEP 2 (TOP-RIGHT): CONTEXT INGESTION -->
<g transform="translate(690, 40)">
<rect x="0" y="0" width="540" height="220" rx="12" fill="#ffffff" stroke="#fde68a" stroke-width="2" filter="url(#soft-shadow)"/>
<path d="M 0 12 Q 0 0 12 0 L 528 0 Q 540 0 540 12 L 540 44 L 0 44 Z" fill="#fffbeb"/>
<circle cx="22" cy="22" r="10" fill="#d97706"/>
<text x="22" y="26" fill="#ffffff" font-size="11" font-weight="800" text-anchor="middle">2</text>
<text x="42" y="27" fill="#92400e" font-size="14" font-weight="800">AI 上下文自动咬合(Learn Constraints)</text>
<g transform="translate(20, 60)">
<text x="0" y="16" fill="#0f172a" font-size="12.5" font-weight="700">AI 读取对应 Note,立刻获知“历史排雷记录”:</text>
<rect x="0" y="26" width="500" height="64" rx="6" fill="#fffbeb" stroke="#fde68a" stroke-width="1"/>
<text x="12" y="46" fill="#b45309" font-size="11" font-weight="700">## Alternatives considered (被否决方案):</text>
<text x="12" y="68" fill="#78350f" font-size="10.5">• contenteditable: 兼容性极差,中文拼音输入法吞字卡死,严禁乱改!</text>
<text x="0" y="112" fill="#475569" font-size="12">💡 作用:彻底消除 AI 的无状态失忆!新 AI 即使没有历史记忆,</text>
<text x="0" y="132" fill="#b45309" font-size="12" font-weight="700">读完也立刻收回想盲目重构的手,老实遵守已落地的架构法案!</text>
</g>
</g>
<!-- ARROW 2 -> 3 (RIGHT VERTICAL DOWN) -->
<path d="M 960 270 L 960 340" stroke="#059669" stroke-width="3" marker-end="url(#loop-green)"/>
<rect x="925" y="295" width="70" height="22" rx="4" fill="#dcfce7"/>
<text x="960" y="310" fill="#065f46" font-size="10.5" font-weight="700" text-anchor="middle">规范施工</text>
<!-- STEP 3 (BOTTOM-RIGHT): ATOMIC COMMIT -->
<g transform="translate(690, 350)">
<rect x="0" y="0" width="540" height="230" rx="12" fill="#ffffff" stroke="#a7f3d0" stroke-width="2" filter="url(#soft-shadow)"/>
<path d="M 0 12 Q 0 0 12 0 L 528 0 Q 540 0 540 12 L 540 44 L 0 44 Z" fill="#f0fdf4"/>
<circle cx="22" cy="22" r="10" fill="#059669"/>
<text x="22" y="26" fill="#ffffff" font-size="11" font-weight="800" text-anchor="middle">3</text>
<text x="42" y="27" fill="#065f46" font-size="14" font-weight="800">双轨原子提交(Atomic Commit)</text>
<g transform="translate(20, 60)">
<text x="0" y="16" fill="#0f172a" font-size="12.5" font-weight="700">业务代码改动与 Note 事实同步更新:</text>
<rect x="0" y="26" width="500" height="74" rx="6" fill="#f0fdf4" stroke="#a7f3d0" stroke-width="1"/>
<text x="12" y="46" fill="#14532d" font-size="11">• 修改业务代码:例如 `decorations.ts` 更新方法逻辑</text>
<text x="12" y="66" fill="#059669" font-size="11" font-weight="700">• 同步更新对应 Note:事实变了就地更新,不留两本账!</text>
<text x="12" y="86" fill="#14532d" font-size="11">• 必须打入同一个 Git PR / Commit,一步到位生效!</text>
<text x="0" y="122" fill="#475569" font-size="12">💡 作用:代码与文档同生共死,彻底粉碎“代码改了三版、文档停在半年前”</text>
<text x="0" y="142" fill="#059669" font-size="12" font-weight="700">的陈年腐烂恶疾!</text>
</g>
</g>
<!-- ARROW 3 -> 4 (BOTTOM HORIZONTAL LEFT) -->
<path d="M 680 460 L 600 460" stroke="#7c3aed" stroke-width="3" marker-end="url(#loop-purple)"/>
<rect x="612" y="435" width="60" height="22" rx="4" fill="#f3e8ff"/>
<text x="642" y="450" fill="#6d28d9" font-size="10.5" font-weight="700" text-anchor="middle">机器安检</text>
<!-- STEP 4 (BOTTOM-LEFT): CI GATES -->
<g transform="translate(50, 350)">
<rect x="0" y="0" width="540" height="230" rx="12" fill="#ffffff" stroke="#ddd6fe" stroke-width="2" filter="url(#soft-shadow)"/>
<path d="M 0 12 Q 0 0 12 0 L 528 0 Q 540 0 540 12 L 540 44 L 0 44 Z" fill="#faf5ff"/>
<circle cx="22" cy="22" r="10" fill="#7c3aed"/>
<text x="22" y="26" fill="#ffffff" font-size="11" font-weight="800" text-anchor="middle">4</text>
<text x="42" y="27" fill="#5b21b6" font-size="14" font-weight="800">CI 门禁机械把关(verify-agent-note-*)</text>
<g transform="translate(20, 60)">
<text x="0" y="16" fill="#0f172a" font-size="12.5" font-weight="700">提交代码时,脚本自动把关每一项契约:</text>
<rect x="0" y="26" width="500" height="74" rx="6" fill="#faf5ff" stroke="#ddd6fe" stroke-width="1"/>
<text x="12" y="44" fill="#5b21b6" font-size="11" class="code">verify-agent-note-tree</text>
<text x="210" y="44" fill="#059669" font-size="11">✔ 6大分类正确 · 链接全通无死链</text>
<text x="12" y="64" fill="#5b21b6" font-size="11" class="code">verify-agent-note-format</text>
<text x="210" y="64" fill="#059669" font-size="11">✔ 严禁未来时(Plan) · 必填Alternatives</text>
<text x="12" y="84" fill="#5b21b6" font-size="11" class="code">prose-checklist</text>
<text x="210" y="84" fill="#059669" font-size="11">✔ 剔除会话废话 · 保持纯硬核事实</text>
<text x="0" y="122" fill="#475569" font-size="12">💡 作用:机器严格守门,偷懒敷衍或画大饼直接挂掉拒绝合并,</text>
<text x="0" y="142" fill="#7c3aed" font-size="12" font-weight="700">确保合入主干的代码与 Note 资产 100% 真实可用!</text>
</g>
</g>
<!-- ARROW 4 -> 1 (LEFT VERTICAL UP: CLOSING THE LOOP!) -->
<path d="M 320 340 L 320 270" stroke="#0284c7" stroke-width="3" marker-end="url(#loop-blue)"/>
<rect x="265" y="295" width="110" height="22" rx="4" fill="#e0f2fe"/>
<text x="320" y="310" fill="#0369a1" font-size="10.5" font-weight="700" text-anchor="middle">合入主干,成为新基线</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 KiB

+147
View File
@@ -0,0 +1,147 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 880" width="100%" height="100%">
<defs>
<pattern id="light-grid" width="32" height="32" patternUnits="userSpaceOnUse">
<path d="M 32 0 L 0 0 0 32" fill="none" stroke="#e2e8f0" stroke-width="0.75"/>
</pattern>
<filter id="soft-shadow" x="-5%" y="-5%" width="110%" height="110%">
<feDropShadow dx="0" dy="6" stdDeviation="10" flood-color="#0f172a" flood-opacity="0.06"/>
</filter>
<marker id="arr-rose" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#e11d48"/>
</marker>
<marker id="arr-emerald" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#059669"/>
</marker>
</defs>
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&amp;display=swap');
text {
font-family: -apple-system, 'PingFang SC', 'Noto Sans SC', 'Segoe UI', 'JetBrains Mono', sans-serif;
}
.code { font-family: 'JetBrains Mono', monospace; }
</style>
<!-- Background -->
<rect width="100%" height="100%" fill="#f8fafc"/>
<rect width="100%" height="100%" fill="url(#light-grid)"/>
<!-- HEADER -->
<g transform="translate(60, 45)">
<rect x="0" y="0" width="220" height="28" rx="14" fill="#ffe4e6" stroke="#e11d48" stroke-width="1.2"/>
<text x="110" y="19" fill="#be123c" font-size="12" font-weight="700" text-anchor="middle" letter-spacing="0.5">图 6 · Git 并发合并对决</text>
<text x="0" y="68" fill="#0f172a" font-size="28" font-weight="800">Git 真实合并对决:为什么 DSH 源码里严禁 INDEX.md?</text>
<text x="0" y="98" fill="#475569" font-size="14.5">左边看传统 ADR 为什么在多 Agent 时代必然卡死 ➔ 右边看 DeepSeek 纯路径设计如何做到 0 冲突自动合入</text>
</g>
<!-- LEFT: TRADITIONAL ADR (INDEX CONFLICT) -->
<g transform="translate(60, 155)">
<rect x="0" y="0" width="610" height="660" rx="16" fill="#ffffff" stroke="#fecdd3" stroke-width="2" filter="url(#soft-shadow)"/>
<path d="M 0 16 Q 0 0 16 0 L 594 0 Q 610 0 610 16 L 610 52 L 0 52 Z" fill="#fff1f2"/>
<circle cx="26" cy="26" r="7" fill="#e11d48"/>
<text x="44" y="32" fill="#be123c" font-size="16.5" font-weight="800">❌ 传统 ADR 做法:大家争抢修改同一个 INDEX.md</text>
<g transform="translate(24, 76)">
<!-- Git Branch Visualization (Traditional) -->
<g transform="translate(0, 0)">
<rect x="0" y="0" width="562" height="150" rx="10" fill="#f8fafc" stroke="#cbd5e1" stroke-width="1.2"/>
<text x="16" y="24" fill="#0f172a" font-size="12" font-weight="800">Git 分支合并现场:</text>
<!-- Main commit -->
<circle cx="50" cy="80" r="14" fill="#0f172a"/>
<text x="50" y="85" fill="#ffffff" font-size="10" font-weight="700" text-anchor="middle">main</text>
<!-- Branch A -->
<path d="M 64 72 Q 130 40 180 40" fill="none" stroke="#64748b" stroke-width="2"/>
<circle cx="190" cy="40" r="12" fill="#f1f5f9" stroke="#0284c7" stroke-width="2"/>
<text x="210" y="44" fill="#0284c7" font-size="11" font-weight="700">Agent A:在 INDEX.md 底部追加 042 号</text>
<!-- Branch B -->
<path d="M 64 88 Q 130 120 180 120" fill="none" stroke="#64748b" stroke-width="2"/>
<circle cx="190" cy="120" r="12" fill="#f1f5f9" stroke="#d97706" stroke-width="2"/>
<text x="210" y="124" fill="#d97706" font-size="11" font-weight="700">Agent B:也在 INDEX.md 底部追加 042 号</text>
<!-- Merge collision arrow -->
<path d="M 440 40 Q 480 80 500 80" fill="none" stroke="#e11d48" stroke-width="2"/>
<path d="M 440 120 Q 480 80 500 80" fill="none" stroke="#e11d48" stroke-width="2" marker-end="url(#arr-rose)"/>
</g>
<!-- Conflict Code Box -->
<g transform="translate(0, 168)">
<rect x="0" y="0" width="562" height="155" rx="10" fill="#fff1f2" stroke="#e11d48" stroke-width="1.8"/>
<text x="16" y="24" fill="#be123c" font-size="12" font-weight="800">💥 合并到 main 时爆发灾难性冲突:</text>
<text x="16" y="46" fill="#be123c" font-size="11" class="code">&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD (Agent A 分支已合入)</text>
<text x="16" y="68" fill="#1e293b" font-size="10.5" class="code">| 042 | 2026-09-01 | Web输入机重构方案 |</text>
<text x="16" y="90" fill="#be123c" font-size="11" class="code">======= (Agent B 试图合入相同行)</text>
<text x="16" y="112" fill="#1e293b" font-size="10.5" class="code">| 042 | 2026-09-01 | JSONL 会话持久化方案 |</text>
<text x="16" y="136" fill="#be123c" font-size="11.5" font-weight="800" class="code">&gt;&gt;&gt;&gt;&gt;&gt;&gt; CONFLICT (content): Merge conflict in docs/INDEX.md</text>
</g>
<!-- Pain Summary Box -->
<g transform="translate(0, 340)">
<rect x="0" y="0" width="562" height="225" rx="10" fill="#fff1f2" stroke="#fda4af" stroke-width="1.4"/>
<text x="18" y="30" fill="#be123c" font-size="14.5" font-weight="800">致命瓶颈:自动化流水线当场瘫痪!</text>
<text x="18" y="58" fill="#9f1239" font-size="12">• 两个独立的 AI 本来改的代码毫无关系,却因为这个总表在 Git 锁死。</text>
<text x="18" y="86" fill="#9f1239" font-size="12">• 自动化多 Agent 流水线无法自动合并,必须人工介入手动解冲突!</text>
<text x="18" y="114" fill="#9f1239" font-size="12">• 如果每天跑几十个 Agent 任务,人类工程师将被无休止的合并冲突逼疯。</text>
<text x="18" y="152" fill="#be123c" font-size="13" font-weight="800">👉 结局:全局索引文件直接抹杀了多 Agent 并行开发的最大红利!</text>
</g>
</g>
</g>
<!-- RIGHT: DEEPSEEK PATH-AS-STATE (CLEAN AUTO MERGE) -->
<g transform="translate(730, 155)">
<rect x="0" y="0" width="610" height="660" rx="16" fill="#ffffff" stroke="#a7f3d0" stroke-width="2" filter="url(#soft-shadow)"/>
<path d="M 0 16 Q 0 0 16 0 L 594 0 Q 610 0 610 16 L 610 52 L 0 52 Z" fill="#f0fdf4"/>
<circle cx="26" cy="26" r="7" fill="#059669"/>
<text x="44" y="32" fill="#065f46" font-size="16.5" font-weight="800">✔ DeepSeek 纯路径设计:每个人创建自己的独立叶子</text>
<g transform="translate(24, 76)">
<!-- Git Branch Visualization (DeepSeek) -->
<g transform="translate(0, 0)">
<rect x="0" y="0" width="562" height="150" rx="10" fill="#f8fafc" stroke="#a7f3d0" stroke-width="1.4"/>
<text x="16" y="24" fill="#065f46" font-size="12" font-weight="800">Git 干净无冲突自动合并现场:</text>
<!-- Main commit -->
<circle cx="50" cy="80" r="14" fill="#0f172a"/>
<text x="50" y="85" fill="#ffffff" font-size="10" font-weight="700" text-anchor="middle">main</text>
<!-- Branch A -->
<path d="M 64 72 Q 130 40 180 40" fill="none" stroke="#059669" stroke-width="2"/>
<circle cx="190" cy="40" r="12" fill="#f0fdf4" stroke="#059669" stroke-width="2"/>
<text x="210" y="44" fill="#065f46" font-size="11" font-weight="700">Agent A:只创建自己的 `architecture/...-web.md`</text>
<!-- Branch B -->
<path d="M 64 88 Q 130 120 180 120" fill="none" stroke="#059669" stroke-width="2"/>
<circle cx="190" cy="120" r="12" fill="#f0fdf4" stroke="#059669" stroke-width="2"/>
<text x="210" y="124" fill="#065f46" font-size="11" font-weight="700">Agent B:只创建自己的 `simplification/...-jsonl.md`</text>
<!-- Auto Merge arrow to Main -->
<path d="M 460 40 Q 490 80 520 80" fill="none" stroke="#059669" stroke-width="2"/>
<path d="M 460 120 Q 490 80 520 80" fill="none" stroke="#059669" stroke-width="2" marker-end="url(#arr-emerald)"/>
</g>
<!-- Clean Merge Output Box -->
<g transform="translate(0, 168)">
<rect x="0" y="0" width="562" height="155" rx="10" fill="#f0fdf4" stroke="#059669" stroke-width="1.8"/>
<text x="16" y="24" fill="#065f46" font-size="12" font-weight="800">✔ Git 自动三向合并(Clean Auto-Merge):</text>
<text x="16" y="50" fill="#14532d" font-size="11" class="code">$ git merge branch-b</text>
<text x="16" y="72" fill="#047857" font-size="11" class="code">Auto-merging .agents/notes/</text>
<text x="16" y="94" fill="#047857" font-size="11" class="code">Merge made by the 'ort' strategy.</text>
<text x="16" y="116" fill="#059669" font-size="11.5" font-weight="700" class="code"> 1 file changed, 45 insertions(+) ➔ 0 CONFLICTS!</text>
<text x="16" y="138" fill="#15803d" font-size="11" font-weight="700">⚡ 秒级自动合入 master,完全不需要人类插手!</text>
</g>
<!-- Benefit Summary Box -->
<g transform="translate(0, 340)">
<rect x="0" y="0" width="562" height="225" rx="10" fill="#f0fdf4" stroke="#86efac" stroke-width="1.4"/>
<text x="18" y="28" fill="#065f46" font-size="14.5" font-weight="800">🚀 DSH 源码铁证:这就是为什么写死禁止 INDEX.md</text>
<text x="18" y="56" fill="#047857" font-size="11.5">• DSH 脚本第 40 行写死:<tspan class="code" font-weight="700">INDEX.md — centralized indexes are forbidden!</tspan></text>
<text x="18" y="80" fill="#047857" font-size="11.5">• <tspan font-weight="700">物理绝对正交</tspan>:路径就是分类,每个 Note 是独立文件,合并互不相交。</text>
<text x="18" y="104" fill="#047857" font-size="11.5">• <tspan font-weight="700">海量并行战绩</tspan>:DSH 跑了 1,742 篇 Note,流水线 0 次因为索引冲突阻塞!</text>
<text x="18" y="142" fill="#065f46" font-size="12.5" font-weight="800">👉 找笔记怎么找?直接用代码搜索,或双击打开本项目的 build-board 看板!</text>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 KiB

+121
View File
@@ -0,0 +1,121 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 920" width="100%" height="100%">
<defs>
<pattern id="light-grid" width="32" height="32" patternUnits="userSpaceOnUse">
<path d="M 32 0 L 0 0 0 32" fill="none" stroke="#e2e8f0" stroke-width="0.75"/>
</pattern>
<filter id="soft-shadow" x="-5%" y="-5%" width="110%" height="110%">
<feDropShadow dx="0" dy="8" stdDeviation="12" flood-color="#0f172a" flood-opacity="0.06"/>
</filter>
</defs>
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700;800&amp;display=swap');
text {
font-family: -apple-system, 'PingFang SC', 'Noto Sans SC', 'Segoe UI', 'JetBrains Mono', sans-serif;
}
.code { font-family: 'JetBrains Mono', monospace; }
</style>
<!-- Background -->
<rect width="100%" height="100%" fill="#f8fafc"/>
<rect width="100%" height="100%" fill="url(#light-grid)"/>
<!-- HEADER -->
<g transform="translate(80, 40)">
<rect x="0" y="0" width="180" height="28" rx="14" fill="#e0f2fe" stroke="#0284c7" stroke-width="1.2"/>
<text x="90" y="19" fill="#0369a1" font-size="12" font-weight="800" text-anchor="middle" letter-spacing="0.5">AI 工作实录现场</text>
<text x="0" y="68" fill="#0f172a" font-size="30" font-weight="800">装上 Skill 后:AI 怎么帮你立护栏?</text>
<text x="0" y="100" fill="#64748b" font-size="15">核心原则:意思靠人点头,结构靠脚本代劳(一次最多问 3 句,绝不打扰节奏)</text>
</g>
<!-- IDE WINDOW CONTAINER -->
<g transform="translate(80, 180)">
<rect x="0" y="0" width="1240" height="680" rx="20" fill="#ffffff" stroke="#cbd5e1" stroke-width="2" filter="url(#soft-shadow)"/>
<!-- IDE Title Bar -->
<path d="M 0 20 Q 0 0 20 0 L 1220 0 Q 1240 0 1240 20 L 1240 46 L 0 46 Z" fill="#f1f5f9"/>
<circle cx="24" cy="23" r="6" fill="#ef4444"/>
<circle cx="44" cy="23" r="6" fill="#f59e0b"/>
<circle cx="64" cy="23" r="6" fill="#10b981"/>
<text x="620" y="28" fill="#475569" font-size="13" font-weight="700" text-anchor="middle" class="code">Cursor / Claude Code · 对话工作区</text>
<!-- LEFT: USER MESSAGE (360px) -->
<g transform="translate(30, 75)">
<rect x="0" y="0" width="380" height="150" rx="14" fill="#0f172a" filter="url(#soft-shadow)"/>
<g transform="translate(20, 24)">
<circle cx="16" cy="16" r="14" fill="#38bdf8"/>
<text x="16" y="21" fill="#0f172a" font-size="12" font-weight="800" text-anchor="middle">你</text>
<text x="42" y="22" fill="#94a3b8" font-size="13" font-weight="700">开发者说了一句话:</text>
<text x="0" y="66" fill="#f8fafc" font-size="15" font-weight="700">“把会话存储改用 SQLite,”</text>
<text x="0" y="94" fill="#f8fafc" font-size="15" font-weight="700">“顺便把读写接口重新理一下。”</text>
</g>
<!-- Human-in-the-loop Box -->
<g transform="translate(10, 175)">
<rect x="0" y="0" width="360" height="155" rx="12" fill="#fffbeb" stroke="#fde68a" stroke-width="1.5"/>
<text x="16" y="28" fill="#b45309" font-size="14" font-weight="800">💡 关键交互:意思必须靠人点头</text>
<text x="16" y="56" fill="#78350f" font-size="12.5">AI 不会擅自拍板定案。它会先向你复述:</text>
<text x="16" y="80" fill="#92400e" font-size="12.5">“选 SQLite 是因为并发锁死,</text>
<text x="16" y="104" fill="#92400e" font-size="12.5">并否决内存缓存(断电风险),对吗?”</text>
<text x="16" y="132" fill="#d97706" font-size="13" font-weight="800">👉 你点头确认后,才开始写代码和笔记!</text>
</g>
</g>
<!-- RIGHT: AI AUTOMATED ACTIONS (760px) -->
<g transform="translate(440, 75)">
<rect x="0" y="0" width="770" height="540" rx="14" fill="#f8fafc" stroke="#e2e8f0" stroke-width="1.5"/>
<!-- AI Header -->
<g transform="translate(24, 20)">
<circle cx="16" cy="16" r="14" fill="#7c3aed"/>
<text x="16" y="21" fill="#ffffff" font-size="12" font-weight="800" text-anchor="middle">AI</text>
<text x="42" y="22" fill="#0f172a" font-size="15" font-weight="800">懂规矩的 AI 助手(已加载 Skill):</text>
<text x="42" y="44" fill="#059669" font-size="12" font-weight="700">“意图已获确认,正在自动实施机械护栏动作与代码施工...”</text>
</g>
<!-- 4 AUTOMATED ACTION CARDS -->
<!-- Action 1 -->
<g transform="translate(24, 80)">
<rect x="0" y="0" width="722" height="90" rx="10" fill="#ffffff" stroke="#bae6fd" stroke-width="1.2"/>
<circle cx="24" cy="24" r="10" fill="#0284c7"/>
<text x="24" y="28" fill="#ffffff" font-size="11" font-weight="800" text-anchor="middle">1</text>
<text x="44" y="29" fill="#0369a1" font-size="14" font-weight="800">在代码入口自动打桩贴封条(In-Code Anchor)</text>
<rect x="20" y="44" width="682" height="34" rx="6" fill="#f0f9ff"/>
<text x="32" y="66" fill="#0284c7" font-size="11.5" class="code">// Note: 为什么选 SQLite 代替 JSONL 见 .agents/notes/implemented/feature/...sqlite.md</text>
</g>
<!-- Action 2 -->
<g transform="translate(24, 185)">
<rect x="0" y="0" width="722" height="115" rx="10" fill="#ffffff" stroke="#fde68a" stroke-width="1.2"/>
<circle cx="24" cy="24" r="10" fill="#d97706"/>
<text x="24" y="28" fill="#ffffff" font-size="11" font-weight="800" text-anchor="middle">2</text>
<text x="44" y="29" fill="#92400e" font-size="14" font-weight="800">自动填好 200 字标准笔记(绝不漏写被否决方案)</text>
<rect x="20" y="44" width="682" height="58" rx="6" fill="#fffbeb"/>
<text x="32" y="64" fill="#b45309" font-size="11" font-weight="700">## Alternatives considered (AI 自动写强对手论据):</text>
<text x="32" y="84" fill="#78350f" font-size="11">• 否决内存缓存:断电丢失索引存在数据撕裂风险; • 否决外部PG:破坏本地CLI开箱体验</text>
</g>
<!-- Action 3 -->
<g transform="translate(24, 315)">
<rect x="0" y="0" width="722" height="90" rx="10" fill="#ffffff" stroke="#ddd6fe" stroke-width="1.2"/>
<circle cx="24" cy="24" r="10" fill="#7c3aed"/>
<text x="24" y="28" fill="#ffffff" font-size="11" font-weight="800" text-anchor="middle">3</text>
<text x="44" y="29" fill="#5b21b6" font-size="14" font-weight="800">本地自动跑 CI 门禁(verify-agent-note-*)</text>
<rect x="20" y="44" width="682" height="34" rx="6" fill="#faf5ff"/>
<text x="32" y="66" fill="#7c3aed" font-size="11.5" class="code">$ verify-agent-note-tree &amp;&amp; verify-format ➔ ok: 0 死链,0 未来时口吻,格式完全合格!</text>
</g>
<!-- Action 4 -->
<g transform="translate(24, 420)">
<rect x="0" y="0" width="722" height="95" rx="10" fill="#f0fdf4" stroke="#a7f3d0" stroke-width="1.5"/>
<circle cx="24" cy="24" r="10" fill="#059669"/>
<text x="24" y="28" fill="#ffffff" font-size="11" font-weight="800" text-anchor="middle">4</text>
<text x="44" y="29" fill="#065f46" font-size="14" font-weight="800">代码与 Note 同一个 Git Commit 一起提交!</text>
<text x="44" y="58" fill="#047857" font-size="12">✔ 业务代码已写好 ✔ 入口封条已加上 ✔ 笔记已生成 ✔ 门禁已通过</text>
<text x="44" y="80" fill="#15803d" font-size="12.5" font-weight="700">🎉 “主人,改动已就绪,永久防撞护栏已立好,请直接审核合入!”</text>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 KiB

File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 377 KiB

+153
View File
@@ -0,0 +1,153 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 720" width="100%" height="100%">
<defs>
<pattern id="light-grid" width="32" height="32" patternUnits="userSpaceOnUse">
<path d="M 32 0 L 0 0 0 32" fill="none" stroke="#e2e8f0" stroke-width="0.75"/>
</pattern>
<filter id="soft-shadow" x="-5%" y="-5%" width="110%" height="110%">
<feDropShadow dx="0" dy="8" stdDeviation="12" flood-color="#0f172a" flood-opacity="0.06"/>
</filter>
<marker id="arr-blue" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
<polygon points="0 0, 8 3, 0 6" fill="#0284c7"/>
</marker>
</defs>
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700;800&amp;display=swap');
text {
font-family: -apple-system, 'PingFang SC', 'Noto Sans SC', 'Segoe UI', 'JetBrains Mono', sans-serif;
}
.code { font-family: 'JetBrains Mono', monospace; }
</style>
<!-- Clean Off-white Background -->
<rect width="100%" height="100%" fill="#f8fafc"/>
<rect width="100%" height="100%" fill="url(#light-grid)"/>
<!-- HEADER -->
<g transform="translate(80, 42)">
<rect x="0" y="0" width="200" height="28" rx="14" fill="#e0f2fe" stroke="#0284c7" stroke-width="1.2"/>
<text x="100" y="19" fill="#0369a1" font-size="12" font-weight="800" text-anchor="middle" letter-spacing="0.5">目录结构 · 架构全貌</text>
<text x="0" y="70" fill="#0f172a" font-size="32" font-weight="800">路径即状态:像 DeepSeek 一样沉淀决策目录树</text>
<text x="0" y="100" fill="#64748b" font-size="15">全库不搞任何全局 INDEX.md · 源码入口一行反向注释 · 笔记与代码同批原子提交</text>
</g>
<!-- MAIN CONTAINER (SPLIT: LEFT TREE 480px, RIGHT CODE/NOTE 680px) -->
<!-- LEFT: VS CODE STYLE EXPLORER TREE (480px) -->
<g transform="translate(80, 150)">
<rect x="0" y="0" width="480" height="525" rx="18" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.8" filter="url(#soft-shadow)"/>
<!-- Title Bar -->
<path d="M 0 18 Q 0 0 18 0 L 462 0 Q 480 0 480 18 L 480 50 L 0 50 Z" fill="#f1f5f9"/>
<circle cx="24" cy="25" r="5.5" fill="#ef4444"/>
<circle cx="42" cy="25" r="5.5" fill="#f59e0b"/>
<circle cx="60" cy="25" r="5.5" fill="#10b981"/>
<text x="80" y="30" fill="#334155" font-size="13" font-weight="800">PROJECT EXPLORER</text>
<text x="455" y="30" fill="#0284c7" font-size="11" font-weight="700" text-anchor="end">无锁无冲突</text>
<!-- Tree Content -->
<g transform="translate(24, 75)">
<!-- Root -->
<text x="0" y="18" fill="#0f172a" font-size="14" font-weight="800" class="code">📁 .agents/notes/</text>
<!-- Level 1: Lifecycles -->
<g transform="translate(18, 26)">
<!-- proposed -->
<text x="0" y="24" fill="#d97706" font-size="13" font-weight="700" class="code">├── 📁 proposed/</text>
<text x="175" y="24" fill="#b45309" font-size="11">(想法立项阶段)</text>
<!-- implemented (Active Highlight) -->
<g transform="translate(0, 36)">
<rect x="-8" y="0" width="426" height="235" rx="8" fill="#f0fdf4" stroke="#a7f3d0" stroke-width="1.2"/>
<text x="0" y="24" fill="#059669" font-size="13.5" font-weight="800" class="code">├── 📁 implemented/</text>
<text x="190" y="24" fill="#047857" font-size="11.5" font-weight="700">(已落地事实·现行法律)</text>
<!-- Level 2: Classes inside implemented -->
<g transform="translate(18, 32)">
<text x="0" y="20" fill="#0284c7" font-size="12" font-weight="700" class="code">├── 📁 feature/</text>
<text x="24" y="42" fill="#475569" font-size="11" class="code">└── 2026-08-05-agent-teams.md</text>
<text x="0" y="70" fill="#e11d48" font-size="12" font-weight="700" class="code">├── 📁 bug-fix/</text>
<text x="24" y="92" fill="#475569" font-size="11" class="code">└── 2026-07-31-python-settlement.md</text>
<text x="0" y="120" fill="#7c3aed" font-size="12" font-weight="700" class="code">├── 📁 architecture/</text>
<text x="24" y="142" fill="#475569" font-size="11" class="code">└── 2026-07-25-web-input-machine.md</text>
<text x="0" y="170" fill="#059669" font-size="12" font-weight="800" class="code">└── 📁 simplification/</text>
<text x="24" y="192" fill="#047857" font-size="11" font-weight="700" class="code">└── 2026-08-30-jsonl-only.md</text>
</g>
</g>
<!-- rejected & archived -->
<g transform="translate(0, 282)">
<text x="0" y="22" fill="#be123c" font-size="13" font-weight="700" class="code">├── 📁 rejected/</text>
<text x="175" y="22" fill="#9f1239" font-size="11">(被否决方案·防翻案)</text>
<text x="0" y="50" fill="#64748b" font-size="13" font-weight="700" class="code">└── 📁 archived/</text>
<text x="175" y="50" fill="#64748b" font-size="11">(被新决策完全取代冻结)</text>
</g>
</g>
</g>
<!-- Bottom Tip -->
<g transform="translate(24, 465)">
<rect x="0" y="0" width="432" height="42" rx="8" fill="#f8fafc" stroke="#cbd5e1" stroke-width="1"/>
<text x="216" y="26" fill="#0f172a" font-size="12" font-weight="700" text-anchor="middle">⚡ 纯路径即状态,天然杜绝 Git Merge 冲突!</text>
</g>
</g>
<!-- RIGHT: REAL CODE ANCHOR & NOTE PREVIEW (660px) -->
<g transform="translate(590, 150)">
<!-- CARD 1: IN-CODE ANCHOR (TOP 240px) -->
<g transform="translate(0, 0)">
<rect x="0" y="0" width="670" height="245" rx="18" fill="#ffffff" stroke="#bae6fd" stroke-width="1.8" filter="url(#soft-shadow)"/>
<path d="M 0 18 Q 0 0 18 0 L 652 0 Q 670 0 670 18 L 670 48 L 0 48 Z" fill="#f0f9ff"/>
<circle cx="24" cy="24" r="6" fill="#0284c7"/>
<text x="40" y="29" fill="#0369a1" font-size="14" font-weight="800">1. 源码关键入口:一行黄色封条注释</text>
<g transform="translate(24, 66)">
<text x="0" y="18" fill="#475569" font-size="12.5">在核心接口或关键函数上方打桩,AI 读代码时 100% 被迫先读此行:</text>
<g transform="translate(0, 32)">
<rect x="0" y="0" width="622" height="96" rx="10" fill="#0f172a"/>
<text x="20" y="28" fill="#38bdf8" font-size="12" font-weight="700" class="code">// Note: 为什么选 SQLite 代替 JSONL</text>
<text x="20" y="50" fill="#38bdf8" font-size="12" class="code">// 见 .agents/notes/implemented/feature/2026-08-23-sqlite.md</text>
<text x="20" y="78" fill="#e2e8f0" font-size="12.5" class="code">export class <tspan fill="#facc15">SessionStore</tspan> { ... }</text>
</g>
</g>
</g>
<!-- ARROW CONNECTING CODE TO NOTE -->
<g transform="translate(310, 245)">
<line x1="25" y1="0" x2="25" y2="30" stroke="#0284c7" stroke-width="2.5" marker-end="url(#arr-blue)"/>
</g>
<!-- CARD 2: NOTE 4-SECTION PREVIEW (BOTTOM 250px) -->
<g transform="translate(0, 280)">
<rect x="0" y="0" width="670" height="245" rx="18" fill="#ffffff" stroke="#a7f3d0" stroke-width="1.8" filter="url(#soft-shadow)"/>
<path d="M 0 18 Q 0 0 18 0 L 652 0 Q 670 0 670 18 L 670 48 L 0 48 Z" fill="#f0fdf4"/>
<circle cx="24" cy="24" r="6" fill="#059669"/>
<text x="40" y="29" fill="#065f46" font-size="14" font-weight="800">2. 对应 Note 正文:极其精简,只填 4 个空(约200字)</text>
<g transform="translate(24, 65)">
<rect x="0" y="0" width="622" height="155" rx="10" fill="#f8fafc" stroke="#cbd5e1" stroke-width="1"/>
<g transform="translate(20, 22)">
<text x="0" y="16" fill="#b45309" font-size="12" font-weight="800" class="code">## Problem</text>
<text x="110" y="16" fill="#334155" font-size="12">多进程并发写 JSONL 严重死锁,全量扫描延迟 &gt;800ms</text>
<text x="0" y="44" fill="#059669" font-size="12" font-weight="800" class="code">## Decision</text>
<text x="110" y="44" fill="#334155" font-size="12">改用 SQLite WAL 模式,核心表建联合索引(强制现在时客观事实)</text>
<text x="0" y="72" fill="#d97706" font-size="12" font-weight="800" class="code">## Alternatives</text>
<text x="110" y="72" fill="#b45309" font-size="12" font-weight="700">★ 必填:写清为什么放弃内存缓存与外部 Postgres</text>
<text x="0" y="100" fill="#7c3aed" font-size="12" font-weight="800" class="code">## Consequences</text>
<text x="110" y="100" fill="#334155" font-size="12">收益:延迟降至 10ms 以内; 代价:包体积增加 15MB</text>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.7 KiB

File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+193
View File
@@ -0,0 +1,193 @@
{
"schema_version": 2,
"diagram_type": "workflow",
"meta": {
"title": "Write Notes Like DeepSeek: Agent-Human Collaboration",
"visual_preset": "classic",
"quality_profile": "showcase"
},
"lanes": [
{
"id": "human",
"label": "人类开发者 (Human)"
},
{
"id": "agent",
"label": "AI 编程助手 (Agent)"
},
{
"id": "notes",
"label": "现行决策留痕 (.agents/notes/)"
},
{
"id": "ci",
"label": "CI 自动化门禁 (Quality Gate)"
}
],
"phases": [
{
"id": "p1",
"label": "1. 意图与探测",
"fromCol": 0,
"toCol": 1
},
{
"id": "p2",
"label": "2. 编码与留痕",
"fromCol": 2,
"toCol": 3,
"variant": "emphasis"
},
{
"id": "p3",
"label": "3. 门禁与合入",
"fromCol": 4,
"toCol": 5,
"variant": "dashed"
}
],
"nodes": [
{
"id": "dev_intent",
"lane": "human",
"col": 0,
"type": "frontend",
"label": "发起改动需求",
"sublabel": "业务重构 / 选型 / 修Bug",
"width": 140
},
{
"id": "agent_check",
"lane": "agent",
"col": 1,
"type": "backend",
"label": "检索既有 Notes",
"sublabel": "读取被否决路线与已知上限",
"tag": "命中防撞护栏",
"width": 140
},
{
"id": "agent_code",
"lane": "agent",
"col": 2,
"type": "backend",
"label": "实施代码改动",
"sublabel": "按现行约束编写实现",
"width": 140
},
{
"id": "note_sync",
"lane": "notes",
"col": 2,
"type": "database",
"label": "80% 原地事实同步",
"sublabel": "更新路径/参数,非必要不新建",
"tag": "In-place Sync",
"width": 140
},
{
"id": "code_comment",
"lane": "agent",
"col": 3,
"type": "backend",
"label": "源码入口加注",
"sublabel": "// Note: 见 .agents/notes/...",
"tag": "物理可寻址",
"width": 140
},
{
"id": "dev_review",
"lane": "human",
"col": 4,
"type": "frontend",
"label": "审查 PR 与决策",
"sublabel": "核对反稻草人备选方案",
"width": 140
},
{
"id": "ci_gates",
"lane": "ci",
"col": 4,
"type": "security",
"label": "CI 双机械门禁",
"sublabel": "tree 查死链 + format 查时态",
"width": 140
},
{
"id": "main_repo",
"lane": "ci",
"col": 5,
"type": "cloud",
"label": "主干原子合入",
"sublabel": "代码与决策同 Commit/PR 生效",
"tag": "永不失忆",
"width": 140
}
],
"edges": [
{
"id": "e1",
"from": "dev_intent",
"to": "agent_check",
"variant": "emphasis"
},
{
"id": "e2",
"from": "agent_check",
"to": "agent_code",
"label": "遵守前人约束",
"variant": "default"
},
{
"id": "e3",
"from": "agent_code",
"to": "note_sync",
"label": "同步事实",
"variant": "emphasis"
},
{
"id": "e4",
"from": "agent_code",
"to": "code_comment",
"variant": "default"
},
{
"id": "e5",
"from": "code_comment",
"to": "dev_review",
"variant": "default"
},
{
"id": "e6",
"from": "dev_review",
"to": "ci_gates",
"label": "提交 PR",
"variant": "emphasis"
},
{
"id": "e7",
"from": "ci_gates",
"to": "main_repo",
"label": "双门禁绿灯",
"variant": "emphasis"
}
],
"cards": [
{
"dot": "emerald",
"title": "DeepSeek 核心心智",
"items": [
"80% 的日常改动是在老 Note 原地更新事实,不随手开新文件",
"代码改动与决策记录必须同一 PR 原子合入,拒绝事后补写"
]
},
{
"dot": "cyan",
"title": "Agent 防撞护栏",
"items": [
"源码入口留注释,下任 Agent 看到代码先读 Note,不搞破坏性重构",
"机械脚本在 CI 拦截语法和死链,确保决策资产永不腐烂"
]
}
]
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+187
View File
@@ -0,0 +1,187 @@
{
"schema_version": 2,
"diagram_type": "workflow",
"meta": {
"title": "Agent Note Lifecycle: State Machine & Archival Contract",
"visual_preset": "classic",
"quality_profile": "showcase"
},
"lanes": [
{
"id": "draft",
"label": "提案与立项 (Draft & Proposed)"
},
{
"id": "active",
"label": "活跃现行法律 (Living Law)"
},
{
"id": "sync_lane",
"label": "日常迭代维护 (Daily Evolution)"
},
{
"id": "frozen",
"label": "冻结封存记录 (Frozen Archive)"
}
],
"phases": [
{
"id": "p1",
"label": "1. 提案与评审",
"fromCol": 0,
"toCol": 1
},
{
"id": "p2",
"label": "2. 交付与现行演进",
"fromCol": 2,
"toCol": 3,
"variant": "emphasis"
},
{
"id": "p3",
"label": "3. 取代与封存",
"fromCol": 4,
"toCol": 4,
"variant": "dashed"
}
],
"nodes": [
{
"id": "idea",
"lane": "draft",
"col": 0,
"type": "frontend",
"label": "架构构想产生",
"sublabel": "技术选型 / 模块重构",
"width": 140
},
{
"id": "proposed",
"lane": "draft",
"col": 1,
"type": "backend",
"label": "proposed/ 提案",
"sublabel": "写清背景与强制反稻草人备选",
"width": 140
},
{
"id": "rejected",
"lane": "frozen",
"col": 1,
"type": "security",
"label": "rejected/ 否决",
"sublabel": "一句话原因留痕,防后人重犯",
"tag": "防反复翻案",
"width": 140
},
{
"id": "implemented",
"lane": "active",
"col": 2,
"type": "backend",
"label": "implemented/ 现行",
"sublabel": "现在时 Decision,与代码原子提交",
"tag": "现行法律",
"width": 140
},
{
"id": "sync",
"lane": "sync_lane",
"col": 2,
"type": "database",
"label": "80% 原地事实同步",
"sublabel": "改名移包同批直接改 Note 事实",
"tag": "In-place Sync",
"width": 140
},
{
"id": "superseded",
"lane": "active",
"col": 3,
"type": "backend",
"label": "被新方案取代",
"sublabel": "将独特理由搬入新代 Note",
"tag": "Supersession",
"width": 140
},
{
"id": "archived",
"lane": "frozen",
"col": 4,
"type": "cloud",
"label": "archived/ 封存",
"sublabel": "永久封印入 manifest.json",
"tag": "SHA-256 锁定",
"width": 140
}
],
"edges": [
{
"id": "e1",
"from": "idea",
"to": "proposed",
"variant": "emphasis"
},
{
"id": "e2",
"from": "proposed",
"to": "implemented",
"label": "评审通过交付",
"variant": "emphasis"
},
{
"id": "e3",
"from": "proposed",
"to": "rejected",
"label": "方案被否决",
"variant": "security"
},
{
"id": "e4",
"from": "implemented",
"to": "sync",
"label": "代码小幅重构",
"variant": "default"
},
{
"id": "e5",
"from": "sync",
"to": "implemented",
"label": "就地更新事实",
"variant": "default"
},
{
"id": "e6",
"from": "implemented",
"to": "superseded",
"label": "新架构出现",
"variant": "emphasis"
},
{
"id": "e7",
"from": "superseded",
"to": "archived",
"label": "归档封存",
"variant": "security"
}
],
"cards": [
{
"dot": "emerald",
"title": "状态机铁律",
"items": [
"implemented 状态严禁出现 Plan/Proposal 词汇,全篇必须是现在时事实",
"rejected 仅当其理由能避免重蹈覆辙时保留,否则彻底删除"
]
},
{
"dot": "rose",
"title": "冻结与防腐",
"items": [
"进入 archived/ 的文件永久计算 SHA-256 封印在 manifest.json",
"归档文件跳过日常 CI 语法扫描,释放团队日常维护心智负担"
]
}
]
}
File diff suppressed because one or more lines are too long
+14785
View File
File diff suppressed because one or more lines are too long
+1709
View File
File diff suppressed because one or more lines are too long
+1709
View File
File diff suppressed because it is too large Load Diff
+8 -3
View File
@@ -3,9 +3,14 @@
"version": "0.1.0",
"private": true,
"type": "module",
"description": "像 DeepSeek 团队一样沉淀 Agent Notes",
"description": "像 DeepSeek 团队一样沉淀 Agent Notes:面向 AI Agent 的架构决策治理与防撞护栏规范",
"scripts": {
"verify-agent-note-tree": "tsx scripts/verify-agent-note-tree.ts",
"verify-agent-note-format": "tsx scripts/verify-agent-note-format.ts"
"verify-agent-note-tree": "npx tsx scripts/verify-agent-note-tree.ts",
"verify-agent-note-format": "npx tsx scripts/verify-agent-note-format.ts",
"archive-agent-note": "npx tsx scripts/archive-agent-note.ts",
"init-board": "npx tsx scripts/build-board.ts --init index.html '工程决策看板'",
"bundle-board": "npx tsx scripts/build-board.ts --bundle .agents/notes demo.html '工程决策看板'",
"build-board": "npx tsx scripts/build-board.ts --init index.html '工程决策看板'",
"import-dsh-notes": "npx tsx scripts/import-dsh-notes.ts"
}
}
+42 -14
View File
@@ -1,25 +1,53 @@
# 按需阅读:归档与合并删除
# 按需阅读:归档、冻结与 manifest 封印机制
> 提炼自 `dsh-archive-agent-notes` 与 `.agents/notes/README.md`。收尾或复盘时对照;日常改动跳过。
> 提炼自 `deepseek-harness` 的 `dsh-archive-agent-notes` 与 `verify-archived-agent-notes`。收尾、复盘或大版本跃迁时对照;日常改动跳过。
## 何时归档(implemented → archived)
---
按“未来参考价值”语义判定,而非字数/年龄/配额:
## 1. 何时归档(implemented → archived)
- **保留 active**:rationale、alternatives、negative guarantee、持久化/wire 语义、ownership 边界、安全规则、重引入条件仍可能指导未来改动。
- **移入 archived**:已完成且上述价值已低;冻结为 `archived/{class}/yyyy-mm-dd-topic.md`。
严格依据**「未来指导价值」**语义判定,而非单纯以时间长短或行数评判:
每新增一条 Note 即触发同域已落地 Note 的 supersession 审计:同改动内归档被完全取代者,保留并互链部分取代者。
- **保留在活跃树(`implemented/`)**:
只要该决策的决策依据、被否决路线、边界假设、持久化/wire 格式、安全规则或重新引入条件,对未来的代码重构与维护仍有指导价值,就继续保留在 `implemented/` 中,并随代码重构一同就地维护。
- **移入归档树(`archived/`)**:
已彻底落地、逻辑已深度稳定,且未来重构基本不会再推翻或重审该决定的记录;或者被后续大版本架构完全取代(Superseded)的历史 Note。
## 怎么归档
> ⚠️ 严禁归档 `proposed/` 记录:过时或放弃的提案直接移入 `rejected/` 或物理删除。
- 移动单文件 `archived/{class}/yyyy-mm-dd-topic.md`,保留 `Status: implemented`,在状态行下方插入 `Archived: YYYY-MM-DD`,修复或删除入链;除此之外不改内容。
- 归档后永久冻结:不编辑、不重排、不移动、不作为现行权威;文档门禁跳过 archived 的出链;主动引用历史时可链入。
---
## 合并删除(完全取代)
## 2. 归档的标准操作流
仅当旧 Note 被新 Note **完全取代**时可删除;部分取代两者都留并互链。
归档动作将单文件从 `implemented/{class}/...` 移动到 `archived/{class}/...`(注意:省略 `implemented` 目录层级):
删除前必须:保留旧 Note 的所有独特 rationale/alternative/consequence/验证要求/覆盖缺口到新 Note;修复所有入链。禁止把旧文件改写成对立面,也禁止“只留 git 历史”。
1. **移动文件**:
```bash
git mv .agents/notes/implemented/architecture/2026-08-18-xxx.md .agents/notes/archived/architecture/2026-08-18-xxx.md
```
2. **插入归档日期标记**:
保留 `Status: implemented` 行,紧随其后插入一行 `Archived: YYYY-MM-DD`,前后保留空行:
```markdown
# Agent Note: xxx
- `feature` 的新增 Note 只有在能力已从生产代码/配置/schema/持久化/wire/迁移/兼容行为中完全消失、文档不再宣称可用、测试不再以其为可用行为时,才可被后续 removal Note 合并。
Status: implemented
Archived: 2026-08-31
## Problem
...
```
除该标记外,**禁止修改归档正文的任何其他字符**。
3. **修复入站链接**:
全局搜索引用了该 Note 旧路径的 Markdown 相对链接,修改为新归档路径或新取代 Note 路径。
4. **计算哈希并封印入 `manifest.json`(可选进阶)**:
在 `.agents/notes/archived/manifest.json` 中记录该归档文件的 SHA-256 哈希值。一旦封印,后续任何对归档内容的篡改都会在门禁中报警。
---
## 3. 永久冻结契约(Frozen Immutable Contract)
一旦进入 `archived/`:
- **永久只读**:严禁编辑、格式化、更新或移动。
- **免除日常扫描**:门禁脚本(`verify-agent-note-tree` 和 `verify-agent-note-format`)默认跳过 `archived/` 目录,归档文件的出站链接失效不会阻塞日常 CI 构建。
- **不可作为当前行为依据**:代码冲突或架构评审时,以 `implemented/` 为现行法律,`archived/` 仅作为历史考据参考。
+10 -3
View File
@@ -2,7 +2,7 @@
> SKILL §1 的展开。新建 Note 选 class 时对照。
## 封闭集(6 个,新增需改门禁)
## 封闭集(6 个,再加要改检查脚本)
| Class | 覆盖范围 |
|---|---|
@@ -17,10 +17,17 @@
- `architecture` vs `process`:前者是"发出去的源码长什么样",后者是"围绕源码的工具链与工作流"。
- `refactor` 不单列——用 `simplification` 的判据"可观察行为变了吗"区分;行为不变即 simplification,行为变了归对应 feature/bug-fix/architecture。
- `feature` 不只在"新增能力"时用——**用户/模型可见、不显然的行为或产品选择,changes 够不上架构,也归 `feature`**。判据是"行为是否可被用户或下游观察",而不是"改动了多少代码"。只有局部实现细节、普通重构、行为不变的依赖补丁才不写任何 Note。
- 拿不准时看这条 Note 以后会被谁检索:找能力演进看 `feature`,找结构决策看 `architecture`,找门禁/发布看 `process`。
## 门禁
每条 Note 必带的语义要求(检查脚本管不了的):
`scripts/agent-note-tree.ts` 定义 `AGENT_NOTE_CLASSES` 常量;`verify-agent-note-classification` 拒绝未知 class 文件夹与 lifecycle 根下的散落 `.md`。新增 class 必须同时改常量与本文档,否则门禁直接红。
- **Alternatives 里有"不做/复用"一档**:把"宁可不动、复用已有/标准库/平台能力"也列出来,说明为何最终取舍。被否项要写它的最强论据再否——只写弱处的拒绝是稻草人。
- **简化必写代价上限**:`simplification` 的 `## Consequences` 要写明"这个取舍的已知上限是什么、什么信号发生时该重访"。没有升级触发条件的简化会悄悄变永久。
- **验证要可确认**:写"改对了"时落到可被检查的表面(记"哪条路径、什么量级、跑什么命令确认"),没有基线就不要用相对量词——"提升了/更快了"在没有对比基线时是未验证断言,比不写更糟。
## 检查脚本
`scripts/agent-note-tree.ts` 定义 `AGENT_NOTE_CLASSES` 常量;未知 class 文件夹、lifecycle 根下的散落 `.md` 都会报错。新增 class 必须同时改常量和本文档,否则检查直接红。
详见 Harness 原文:`implemented/process/2026-06-20-agent-note-classification.md`。
+4 -4
View File
@@ -2,7 +2,7 @@
> SKILL §2 的展开。写/改 Note 时对照;只改代码不动 Note 时跳过。
## 头块(前三行,门禁强制)
## 头块(前三行,检查脚本会核对)
```markdown
# Agent Note: <标题>
@@ -14,7 +14,7 @@ Status: <状态>
- `implemented` → `Status: implemented`
- `rejected` → `Status: rejected — <一句话原因>`
标题前必须带 `Agent Note: ` 前缀;状态不含日期与括号;必须与所在 lifecycle 文件夹一致(门禁交叉校验)。文件名日期是首次提出日,git 承载其余时间信息。
标题前必须带 `Agent Note: ` 前缀;状态不含日期与括号;必须与所在 lifecycle 文件夹一致(脚本会交叉核对)。文件名日期是首次提出日,git 承载其余时间信息。
## Body 骨架
@@ -43,7 +43,7 @@ Status: <状态>
## Consequences
```
`Decision` 用现在时描述已落地事实;禁止出现 `## Proposal` / `## Plan` / `## Migration plan` / `## Acceptance criteria` 等提案口吻(门禁直接拦);用 `## Consequences` 同时记录代价与收益;可按需加 `## Testing` / `## Verification` 等现在时事实节。
`Decision` 用现在时描述已落地事实;禁止出现 `## Proposal` / `## Plan` / `## Migration plan` / `## Acceptance criteria` 等提案口吻(检查会直接报错);用 `## Consequences` 同时记录代价与收益;可按需加 `## Testing` / `## Verification` 等现在时事实节。
**`rejected/`**
@@ -66,4 +66,4 @@ Status: <状态>
- 保留可检索的机制名与 `must`/`may`/`never` 时序强调;一个事实只在一处讲透,其余链过去。
- 跨 Note 引用用相对 Markdown 链接 `[topic](../../implemented/architecture/2026-…-….md)`,不要裸数字。
来源:Harness `.agents/notes/README.md#the-file-format` 与 `implemented/process/2026-07-05-uniform-agent-note-format.md`(本项目中文单语,头块 `Agent Note:` 与 `Status:` 保持英文原文以便门禁校验,正文用中文)。
来源:Harness `.agents/notes/README.md#the-file-format` 与 `implemented/process/2026-07-05-uniform-agent-note-format.md`(本项目中文单语,头块 `Agent Note:` 与 `Status:` 保持英文原文以便脚本核对,正文用中文)。
+12 -3
View File
@@ -4,10 +4,10 @@
## 原则
- 只写代码表达不了的契约:行为、失败、时序、所有权、后果与取舍。别复述代码或推导过程。
- 只写代码说不清的:行为、失败、时序、所有权、后果与取舍。别复述代码或推导过程。
- 说人话,点名谁做了什么、在什么条件下、会怎样;少用“契约/边界/形态”等抽象词,除非指的就是该技术主体。
- 一个事实只在一处讲透,其余链过去;别把同一规则抄得到处都是。
- 写完自问:这段话不看实现能独立成立吗?半年后的读者能验证吗?
- 写完自问:这段话不看实现能独立成立吗?不看当时聊天,现在的读者能验证吗?
## 写前自检(来自 prose-standard)
@@ -25,7 +25,7 @@
## 去泄露自检(来自 trim-cot-leakage)
对每段可疑文字问:**只有当时的会话/PR/草稿可见吗?HEAD 的读者能独立验证吗?** 不能则重述为仓库视角,删去会话痕迹。
对每段可疑文字问:**只有当时的会话/PR/草稿可见吗?HEAD 的读者能独立验证吗?** 不能则重述为仓库视角,删去会话痕迹。能解析也≠安全——可验证只代表过了去泄露这一关,README/文档等当前状态面上,可解析的变更叙事仍是变更叙事,按第 3 类路由。
常见泄露(命中即改):
@@ -39,3 +39,12 @@
8. 语言串台:中英混杂的工作语言片段 — 翻译或删除。
**不算泄露(保留):** issue 引用 `#1470`/`TODO(name):`、Agent Note 与 postmortem 内的已合并 PR 引用、suppression 理由、现在时反事实、带实测值的边界、运行时 old/new 状态、已提交文档的 `§` 编号。
## 删过头警示(overcorrection traps,来自 trim-cot-leakage)
删之前先把段落里的命题列全,再对照四个"删过头"的坑:
- 把必须/禁止的义务删成"可以这样"的背书——约束变可选。
- 把"计划中/考虑过"的假设删成已落地事实——proposed 当 implemented。
- 删掉一句真事实,只因为它读起来像过程叙述。
- 丢掉承重溯源:`实测:512 嵌套 ≈ 0.15s` 里的 `实测`、来源标注与编号删掉,结论就没根了。
+46
View File
@@ -0,0 +1,46 @@
# 按需阅读:语义自检(写完笔记后过一遍)
> 脚本管结构,这张清单管意思。写完后自检,只向用户报缺口和写得好的地方,不逐条背诵。
> 定位:这是给 Agent 的自检,不是给脚本的规则——下列检查点全部是语义判断,永不进 verify 脚本。
## Problem
- [ ] 动机脱离方案也能独立成立——删掉 Decision 再读一遍,还是同一个问题吗?
- [ ] 触发清楚:什么破了、什么要变、不做会怎样。
## Decision / Proposal
- [ ] 具体到能行动,不是"用更好的数据库"而是"为会话存储用 SQLite"。
- [ ] 理由是被"vs"逼出来的——写"决定用 X"就补一句"X vs Y 为何选 X"。
## Alternatives considered
- [ ] ≥2 个真备选;排除"做了 vs 不做"的稻草人("不做/复用"本身就可以是一档)。
- [ ] 每个被否项先写它最强的论据,再写为何否——只写弱处的拒绝是稻草人。
- [ ] 否掉的理由落到具体驱动条件,不是"经验上不行"。
## Consequences
- [ ] 代价和收益都写。自问"什么变难了?维护成本是什么?"——只有收益的后果是挑选过的。
- [ ] 简化注明已知上限与何时该重访。没有升级触发条件的简化会悄悄变永久。
- [ ] 没有基线就不写相对量词——"提升了/更快了"说不清基线时,降级为事实陈述。
## Verification / Testing(implemented)
- [ ] 落到可确认表面:哪条路径、什么量级、跑什么命令。
- [ ] 不写"看起来能用"——验收标准要么可勾选,要么明确留给后续。
## 汇报形态
写完自检后,这样汇报(一行一缺口,没缺口就收口):
```markdown
**语义自检:<filename>**
✅ 稳定:动机独立成立 / 有 2 个真备选 / 后果代价收益兼备
⚠️ 缺口:
- Alternatives — 有"做了 vs 不做"稻草人,补一个与现行方案平行的真实选项
- Consequences — "性能提升"要落到哪条路径、什么量级
建议:修以上 2 处后落盘 / 可接受缺口,直接放行
```
用户接受缺口即放行;不接受就修再落盘。意思上的判断不是脚本,别把它撑成另一道检查。
+1 -1
View File
@@ -21,6 +21,6 @@
## 与 Notes 的衔接
- 符合信号且需 durable 决策 → 写 `proposed/simplification` Note(Problem/Proposal/Alternatives/Acceptance/Risks)。
- 符合信号且这个取舍需要留下来 → 写 `proposed/simplification` Note(Problem/Proposal/Alternatives/Acceptance/Risks)。
- 已落地的 simplification → `implemented/simplification`,Consequences 同时写删掉的成本与省下的负担。
- 触发 Note 树膨胀时,用 `archiving.md` 的“未来参考价值”判定是否归档,而非字数/年龄。
+1 -1
View File
@@ -2,7 +2,7 @@
> SKILL §5 的展开。接入 CI 时对照;本地轻量使用时跳过。
## 门禁(均为 tsx,零新增依赖)
## 检查脚本(均为 tsx,零新增依赖)
1. **`verify-agent-note-tree`**(`scripts/agent-note-tree.ts` + `scripts/verify-agent-note-tree.ts`)
- 校验 lifecycle 封闭集 `proposed/implemented/rejected` + `archived`、class 封闭集 6 个、路径深度 `{lifecycle}/{class}/file.md`、文件名 `yyyy-mm-dd-topic.md`、禁止 `INDEX.md`。
+53 -17
View File
@@ -1,28 +1,64 @@
# 按需阅读:何时写、何时改
# 按需阅读:何时写、何时改与决策流转
> SKILL §3 的展开。每个非平凡改动对照一次。
> SKILL §3 的深度展开。每个重要改动或评审时对照一次。
## 何时必须写
## 核心心智:原地同步为主,谨慎新建(1 : 4 法则)
按做决定的时机写:动手前写 `proposed`,实现时最晚与代码同一次提交新增或更新 `implemented`(有 PR 以 PR 为单位,没有就以 commit 为单位)。非平凡 = 改了行为、架构、跨文件契约、流程/门禁/测试策略、落盘/网络/配置格式,或其他会被后人合理追问"为什么"的决定。
DeepSeek 官方数据表明:近 5 个版本中,Note 新增 48 篇,但发生现有 Note 的**就地事实修正高达 207 次**。
**不要把 Note 当做一次性发表的博客或流水账。它是与代码共存亡的「现行法律」。**
- 纯机械/局部且无行为与契约变化 → 豁免,不写。
- 不确定 → 按非平凡处理,写一条。
---
## 新建前先搜
## 1. 场景判定矩阵
新建前用目录浏览或 `rg` 搜现有归属;同决定的改动更新那一张,不另起一篇。
| 场景 | 操作动作 | 典型范式 |
|---|---|---|
| **代码重构、改名、移包、改默认参数** | **原地更新现有 Note 事实** | 保持 Decision 核心理由不变,直接更新涉及的文件路径、类名或默认值(不追加变更流水账) |
| **提出全新的架构尝试或技术选型** | **新建 `proposed/`** | 动手编码前写清动机、≥2 个备选与验收指标 |
| **完成开发并准备合入主干** | **转为 `implemented/`** | 改为现在时描述,与代码原子提交(同 PR/commit),并在源码入口留反向注释 |
| **方案在评审中被否决** | **移入 `rejected/` 或删除** | 仅当其理由能避免未来重蹈覆辙时保留并写清原因;否则彻底删除 |
| **新架构完全取代了旧架构** | **执行 Supersession(完全取代)** | 将旧 Note 的核心价值搬迁至新 Note,归档旧 Note 并修复全部入站链接 |
| **版本封版打标、依赖小补丁、排版** | **免除(Not Applicable)** | 直接提交代码,无需任何 Note |
## 新建 vs 更新
---
- 已有归属的决定(文件名/路径能对应上)→ **更新那一条**,不另起一篇。事实、路径、默认值、验证变了就在同一改动内同步到 Note(facts only),不改 decision 本身。
- 无归属的新决定 / 能防止重犯的否决 / 可复用复盘 → 新建。
- 一条 Note 永远不会被改写成另一个决定;被取代用新 Note 接管,旧 Note 按归档/合并规则处理。
## 2. 原地同步法则(In-place Fact Sync)
## Lifecycle 流转
当现有 Note 所守护的模块发生演进,但核心决策并未被推翻时:
- `proposed/` → `implemented/`:重写 `Status:`,把 `## Proposal` 改为现在时的 `## Decision`,把 `## Acceptance criteria` / `## Risks` 收敛进 `## Consequences` 或 `## Testing`/`## Verification`,去掉计划口吻。
- `proposed/` → `rejected/`:仅在 `Status:` 行追加 `— <原因>` 并冻结文件。
- `implemented/` 内更新:保持现在时;与代码同一次提交保持同步(有 PR 以 PR 为单位,没有就以 commit 为单位)。
1. **直接修改,不记流水账**:
- ❌ 错误:在文末追加 `### 2026-09-02 更新:类名重命名为 X`
- ✅ 正确:直接在正文中将旧类名替换为新类名,保证任何时候打开这篇 Note,它反映的都是 HEAD 分支的绝对事实。
2. **时态永保现在时**:
- 始终使用现在时(`系统使用 SQLite 作为持久化引擎`),严禁使用变更叙事(`系统不再使用 JSONL,现在使用 SQLite`)。
来源:Harness `.agents/notes/README.md#when-to-write-one` 与 `implemented/AGENTS.md`。
---
## 3. 决策完全取代收割协议(Supersession Protocol)
当全新的技术方案(如 0.1.3 的句柄持久化)彻底淘汰了旧方案(如 0.1.2 的协调器持久化)时:
1. **审计旧 Note 资产**:
- 检查旧 Note 中是否有独有的安全边界、否定性保证、失败场景或重新引入条件。
2. **搬迁与吸收**:
- 将上述独特信息搬迁合并到新 Note 的 `## Decision` 或 `## Alternatives considered` 中。
3. **旧 Note 归档或删除**:
- 使用归档流程移入 `archived/{class}/` 并追加归档日期行,或执行物理合并删除。
4. **修复入站死链接**:
- 全局检索引用了旧 Note 的相对路径(`[topic](../../implemented/...)`),统一修改为指向新 Note。
---
## 4. 源码入口反向注释规范
每篇 `implemented` 状态的 Note,都必须在源码物理层面具备反向追溯点:
```typescript
// Note: 会话持久化采用文件句柄管理,避免并发写冲突 — 见 .agents/notes/implemented/architecture/2026-08-27-handle-based-session-persistence.md
export class SessionFileHandlePool {
// ...
}
```
**为什么这至关重要?**
未来的 AI Agent 在重构该类时,首先读到的是这段注释。它会沿着路径读取 Note,从而立即获知该类的不可侵犯约束与被否决备选方案,彻底阻断盲目优化。
+106
View File
@@ -0,0 +1,106 @@
/**
* CLI tool to archive an implemented Agent Note with frozen manifest sealing.
* Usage: npx tsx scripts/archive-agent-note.ts .agents/notes/implemented/<class>/<filename>.md
*/
import { createHash } from "node:crypto";
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
import { basename, dirname, join, relative, resolve } from "node:path";
import { agentNoteRoot, AGENT_NOTE_CLASSES, walkAgentNoteTree } from "./agent-note-tree.ts";
const targetArg = process.argv[2];
if (!targetArg) {
console.error("Usage: npx tsx scripts/archive-agent-note.ts <path-to-note>");
process.exit(1);
}
const targetPath = resolve(process.cwd(), targetArg);
if (!existsSync(targetPath)) {
console.error(`Error: target note not found at ${targetPath}`);
process.exit(1);
}
const relToRoot = relative(agentNoteRoot, targetPath).replace(/\\/g, "/");
const segs = relToRoot.split("/");
if (segs[0] !== "implemented" || segs.length !== 3) {
console.error(`Error: only notes in .agents/notes/implemented/<class>/ can be archived (got: ${relToRoot})`);
process.exit(1);
}
const [, cls, filename] = segs;
if (!AGENT_NOTE_CLASSES.includes(cls as any)) {
console.error(`Error: unknown class "${cls}"`);
process.exit(1);
}
// 1. Read and update content with Archived line
const raw = readFileSync(targetPath, "utf8");
const lines = raw.split("\n");
const statusIdx = lines.findIndex((l) => l === "Status: implemented");
if (statusIdx === -1) {
console.error("Error: note must contain `Status: implemented` to be archived");
process.exit(1);
}
const today = new Date().toISOString().slice(0, 10);
// Insert Archived line after Status line if not present
if (!lines.some((l) => l.startsWith("Archived:"))) {
lines.splice(statusIdx + 1, 0, "", `Archived: ${today}`);
}
const updatedContent = lines.join("\n");
// 2. Determine archived destination
const archivedDir = join(agentNoteRoot, "archived", cls);
mkdirSync(archivedDir, { recursive: true });
const archivedPath = join(archivedDir, filename);
writeFileSync(targetPath, updatedContent, "utf8");
renameSync(targetPath, archivedPath);
console.log(`Moved: ${relToRoot} -> archived/${cls}/${filename}`);
// 3. Update archived/manifest.json with SHA-256 seal
const manifestPath = join(agentNoteRoot, "archived", "manifest.json");
interface Manifest {
version: 1;
files: Record<string, string>;
}
let manifest: Manifest = { version: 1, files: {} };
if (existsSync(manifestPath)) {
try {
manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
} catch (e) {
console.warn("Warning: existing manifest.json was invalid, creating fresh");
}
}
const newArchivedRel = `archived/${cls}/${filename}`;
const sha256 = `sha256:${createHash("sha256").update(readFileSync(archivedPath)).digest("hex")}`;
manifest.files[newArchivedRel] = sha256;
// Deterministic sort keys
const sortedFiles = Object.fromEntries(
Object.entries(manifest.files).sort(([a], [b]) => a.localeCompare(b))
);
writeFileSync(manifestPath, JSON.stringify({ version: 1, files: sortedFiles }, null, 2) + "\n", "utf8");
console.log(`Sealed in archived/manifest.json with hash ${sha256.slice(0, 16)}...`);
// 4. Scan inbound links in active notes
const { notes } = walkAgentNoteTree();
const inboundFound: string[] = [];
for (const note of notes) {
const noteFullPath = resolve(agentNoteRoot, note.rel);
const content = readFileSync(noteFullPath, "utf8");
if (content.includes(filename)) {
inboundFound.push(note.rel);
}
}
if (inboundFound.length > 0) {
console.log("\n[Notice] The following active notes reference the archived note:");
for (const rel of inboundFound) {
console.log(` - ${rel}`);
}
console.log("Please review and update their relative markdown links if necessary.");
} else {
console.log("\nNo active notes reference this archived note.");
}
+185
View File
@@ -0,0 +1,185 @@
#!/usr/bin/env node
import { readFileSync, writeFileSync, readdirSync, existsSync } from 'node:fs';
import { join, resolve, relative, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const templatePath = resolve(__dirname, '../assets/agent-notes-board.html');
const args = process.argv.slice(2);
if (!existsSync(templatePath)) {
console.error(`❌ Template not found at: ${templatePath}`);
process.exit(1);
}
// 检查是否为 --init 模式(日常开发:生成 69KB 轻量模板,不内联数据,直连本地目录)
const isInitMode = args.includes('--init');
const cleanArgs = args.filter((a: string) => a !== '--init' && a !== '--bundle');
if (isInitMode) {
const targetPath = cleanArgs[0] ? resolve(cleanArgs[0]) : resolve(process.cwd(), 'index.html');
const projectName = cleanArgs[1] || '工程决策看板';
let template = readFileSync(templatePath, 'utf8');
template = template.replace('id="brand-project-title">工程决策看板<', () => `id="brand-project-title">${projectName}<`);
writeFileSync(targetPath, template, 'utf8');
console.log(`✅ [日常开发模式] 轻量看板已生成 (仅 ~69KB): ${targetPath}`);
console.log(`💡 用浏览器打开后,点击右上角「连接本地目录」选择 .agents/notes,后续新建/修改笔记切回浏览器即可自动热刷新!`);
process.exit(0);
}
// 打包模式(生成内联完整数据的单文件,如 demo.html)
const notesDir = cleanArgs[0] ? resolve(cleanArgs[0]) : resolve(process.cwd(), '.agents/notes');
const outputPath = cleanArgs[1] ? resolve(cleanArgs[1]) : resolve(process.cwd(), 'demo.html');
const projectName = cleanArgs[2] || '工程决策看板';
const LIFECYCLES = ['implemented', 'proposed', 'rejected', 'archived'];
if (!existsSync(notesDir)) {
console.error(`❌ Notes directory not found at: ${notesDir}`);
process.exit(1);
}
function parseNoteContent(raw: string, relPath: string, slugToId: Map<string, string>) {
const slug = relPath.split('/').pop()!.replace(/\.md$/, '');
const parts = relPath.split('/');
const lifecycle = parts[0];
const cls = parts[1] || 'architecture';
let title = slug;
let status = lifecycle;
let date = '';
const dMatch = /^(\d{4}-\d{2}-\d{2})/.exec(slug);
if (dMatch) date = dMatch[1];
const h1Match = /^# Agent Note[^::]*[::]\s*(.*)$/m.exec(raw);
if (h1Match) title = h1Match[1].trim();
function extractSection(secNamePattern: string) {
const re = new RegExp(`^## (?:${secNamePattern})\\s*\\n+([\\s\\S]*?)(?=^## |\\s*$)`, 'm');
const m = re.exec(raw);
return m ? m[1].trim() : '';
}
const problem = extractSection('Problem|问题');
const decision = extractSection('Decision|Proposal|决策|提案');
const alternatives = extractSection('Alternatives considered|曾考虑的替代方案|曾考虑的备选');
const consequences = extractSection('Consequences|后果');
const links: string[] = [];
for (const m of raw.matchAll(/\]\(([^)]+\.md)\)/g)) {
let targetHref = m[1].split('#')[0].trim();
if (targetHref.includes('://')) continue;
targetHref = targetHref.replace(/\.zh\.md$/, '.md');
const segs = `${lifecycle}/${cls}/${targetHref}`.split('/');
const resolved: string[] = [];
for (const s of segs) {
if (!s || s === '.') continue;
if (s === '..') resolved.pop();
else resolved.push(s);
}
const cleanTarget = resolved.join('/');
let finalTarget = '';
if (slugToId.has(cleanTarget)) {
finalTarget = slugToId.get(cleanTarget)!;
} else {
const targetSlug = targetHref.split('/').pop()!.replace(/\.md$/, '');
if (slugToId.has(targetSlug)) {
finalTarget = slugToId.get(targetSlug)!;
}
}
if (finalTarget && finalTarget !== relPath) {
links.push(finalTarget);
}
}
return {
id: relPath,
slug,
lifecycle,
cls,
date,
title,
status,
problem,
decision,
alternatives,
consequences,
outLinks: [...new Set(links)],
rawBody: raw,
};
}
function walk(dir: string, baseDir: string = dir): any[] {
const noteFiles = new Map<string, string>(); // relPath -> fullPath
function scan(currentDir: string) {
const items = readdirSync(currentDir, { withFileTypes: true });
for (const entry of items) {
if (entry.name.startsWith('.')) continue;
const fullPath = join(currentDir, entry.name);
if (entry.isDirectory()) {
scan(fullPath);
} else if (entry.isFile() && entry.name.endsWith('.md')) {
const isZh = entry.name.endsWith('.zh.md');
const relPath = relative(baseDir, fullPath).replace(/\\/g, '/');
const cleanRel = isZh ? relPath.replace(/\.zh\.md$/, '.md') : relPath;
const parts = cleanRel.split('/');
if (parts.length >= 3 && LIFECYCLES.includes(parts[0])) {
if (!noteFiles.has(cleanRel) || isZh) {
noteFiles.set(cleanRel, fullPath);
}
}
}
}
}
scan(dir);
const slugToId = new Map<string, string>();
for (const relPath of noteFiles.keys()) {
const slug = relPath.split('/').pop()!.replace(/\.md$/, '');
slugToId.set(slug, relPath);
slugToId.set(relPath, relPath);
}
const results: any[] = [];
for (const [relPath, fullPath] of noteFiles.entries()) {
try {
const raw = readFileSync(fullPath, 'utf8');
results.push(parseNoteContent(raw, relPath, slugToId));
} catch (err) {
console.warn(`⚠️ Error reading ${relPath}:`, err);
}
}
return results;
}
console.log(`🔍 [打包模式] 正在扫描笔记目录: ${notesDir}`);
const notes = walk(notesDir);
console.log(`✅ 解析完成,共发现 ${notes.length} 篇有效 Agent Notes。`);
let template = readFileSync(templatePath, 'utf8');
// 注入项目名
template = template.replace('id="brand-project-title">工程决策看板<', () => `id="brand-project-title">${projectName}<`);
// 注入数据
const jsonSafe = JSON.stringify(notes).replace(/</g, '\\u003c');
template = template.replace(
'window.__INLINE_DATA__ = null;',
() => `window.__INLINE_DATA__ = ${jsonSafe};`
);
writeFileSync(outputPath, template, 'utf8');
console.log(`🎉 [打包完成] 自包含大单体看板已生成: ${outputPath}`);
console.log(`💡 该文件内置了全部 ${notes.length} 篇笔记数据,可脱机分发、离线演示或部署至 GitHub Pages。`);
+80
View File
@@ -0,0 +1,80 @@
#!/usr/bin/env node
import { readdirSync, readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
import { join, resolve, relative, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const args = process.argv.slice(2);
const dshNotesDir = args[0] ? resolve(args[0]) : resolve(process.cwd(), '../deepseek-harness/.agents/notes');
const targetNotesDir = args[1] ? resolve(args[1]) : resolve(__dirname, '../.agents/notes');
const LIFECYCLES = ['implemented', 'proposed', 'rejected', 'archived'];
if (!existsSync(dshNotesDir)) {
console.error(`❌ Source dsh notes not found at: ${dshNotesDir}`);
process.exit(1);
}
console.log(`📦 正在从 ${dshNotesDir} 提取并标准化中文 Note...`);
// 扫描所有文件并配对:优先取 .zh.md
const noteMap = new Map<string, string>(); // cleanRelPath -> sourceFilePath
function scan(currentDir: string) {
const entries = readdirSync(currentDir, { withFileTypes: true });
for (const entry of entries) {
if (entry.name.startsWith('.')) continue;
const fullPath = join(currentDir, entry.name);
if (entry.isDirectory()) {
scan(fullPath);
} else if (entry.isFile() && entry.name.endsWith('.md')) {
const rel = relative(dshNotesDir, fullPath).replace(/\\/g, '/');
const isZh = entry.name.endsWith('.zh.md');
const cleanRel = isZh ? rel.replace(/\.zh\.md$/, '.md') : rel;
const parts = cleanRel.split('/');
if (parts.length >= 3 && LIFECYCLES.includes(parts[0])) {
if (!noteMap.has(cleanRel) || isZh) {
noteMap.set(cleanRel, fullPath);
}
}
}
}
}
scan(dshNotesDir);
console.log(`🔍 扫描完毕,发现 ${noteMap.size} 篇唯一 Note 待迁移。`);
let copied = 0;
for (const [cleanRel, sourcePath] of noteMap.entries()) {
const destPath = join(targetNotesDir, cleanRel);
mkdirSync(dirname(destPath), { recursive: true });
let content = readFileSync(sourcePath, 'utf8');
// 1. 去除多余的双语切换条目,例如 `[English](xxx.md) | 中文` 或 `English | [中文](xxx.zh.md)`
content = content.replace(/^\[English\]\([^)]+\)\s*\|\s*中文\s*\n+/m, '');
content = content.replace(/^English\s*\|\s*\[中文\]\([^)]+\)\s*\n+/m, '');
content = content.replace(/^\[English\]\([^)]+\)\s*\n+/m, '');
// 2. 将文内所有的 `.zh.md` 相对链接归一化为标准的 `.md`(包括带有 #anchor 的链接)
content = content.replace(/\]\(([^)#]+)\.zh\.md([#)])/g, ']($1.md$2');
writeFileSync(destPath, content, 'utf8');
copied++;
}
// 拷贝 README.md 和 AGENTS.md 到 .agents/notes 根目录供相对跳转
for (const topDoc of ['README.zh.md', 'README.md', 'AGENTS.md']) {
const p = join(dshNotesDir, topDoc);
if (existsSync(p)) {
let topContent = readFileSync(p, 'utf8').replace(/\]\(([^)#]+)\.zh\.md([#)])/g, ']($1.md$2');
writeFileSync(join(targetNotesDir, topDoc === 'README.zh.md' ? 'README.md' : topDoc), topContent, 'utf8');
}
}
console.log(`✅ 成功将 ${copied} 篇中文 Note 标准化写入到: ${targetNotesDir}`);
+62 -17
View File
@@ -9,43 +9,88 @@ import { agentNoteRoot, walkAgentNoteTree } from "./agent-note-tree.ts";
const FORMAT_ADOPTED = "2026-07-05";
const GRANDFATHER = "<!-- agent-note-format: alternatives-not-recorded (pre-format Agent Note) -->";
const LEGACY_MARKERS = ["XXX: legacy ADR/RFC body format", "XXX: legacy ADR/Agent Note body format"];
const STATUS: Record<string, RegExp> = {
proposed: /^Status: proposed$/,
implemented: /^Status: implemented$/,
rejected: /^Status: rejected — .+$/,
};
const REQUIRED: Record<string, string[]> = {
proposed: ["## Proposal", "## Acceptance criteria", "## Risks"],
implemented: ["## Decision", "## Consequences"],
rejected: ["## Proposal"],
const REQUIRED: Record<string, string[][]> = {
proposed: [
["## Proposal", "## 提议", "## 方案", "## 提案"],
["## Acceptance criteria", "## 验收标准", "## 验收条件", "## 接受标准"],
["## Risks", "## 风险"],
],
implemented: [
["## Decision", "## 决定", "## 决策"],
["## Consequences", "## 后果", "## 影响", "## 结果"],
],
rejected: [
["## Proposal", "## 提议", "## 方案", "## 提案"],
],
};
const BANNED_IMPLEMENTED = /^## (?:Proposal\b|Plan\b|Migration plan\b|Acceptance criteria\b)/i;
const BANNED_IMPLEMENTED = /^## (?:Proposal\b|Plan\b|Migration plan\b|Acceptance criteria\b|计划\b|规划\b)/i;
const { notes, errors } = walkAgentNoteTree();
for (const note of notes) {
const fail = (msg: string) => { errors.push(`format: ${note.rel} — ${msg}`); };
const raw = readFileSync(resolve(agentNoteRoot, note.rel), "utf8");
const lines = raw.split("\n");
let inFence = false;
const prose = lines.filter((l) => { if (l.startsWith("```")) { inFence = !inFence; return false; } return !inFence; });
const prose = lines.filter((l: string) => {
if (l.startsWith("```")) { inFence = !inFence; return false; }
return !inFence;
});
if (!/^# Agent Note: \S/.test(lines[0] ?? "")) fail("line 1 must be `# Agent Note: <title>`");
if (lines[1] !== "") fail("line 2 must be blank");
const re = STATUS[note.lifecycle];
if (re && !re.test(lines[2] ?? "")) fail(`line 3 must match ${note.lifecycle} status grammar (${String(re)})`);
if (lines[3] !== "") fail("line 4 must be blank");
// single Status line
const statusCount = prose.filter((l) => l.startsWith("Status:")).length;
const statusCount = prose.filter((l: string) => l.startsWith("Status:")).length;
if (statusCount !== 1) fail("Status: line must appear exactly once");
const h2s = prose.filter((l) => l.startsWith("## ")).map((l) => l.trimEnd());
if (h2s[0] !== "## Problem") fail(`first section must be ## Problem (got ${JSON.stringify(h2s[0] ?? "<none>")})`);
for (const h of REQUIRED[note.lifecycle] ?? []) if (!h2s.includes(h)) fail(`missing ${h}`);
if (note.lifecycle === "implemented") for (const h of h2s.filter((x) => BANNED_IMPLEMENTED.test(x))) fail(`banned in implemented: ${h}`);
const hasAlt = h2s.includes("## Alternatives considered");
const h2s = prose.filter((l: string) => l.startsWith("## ")).map((l: string) => l.trimEnd());
if (h2s[0] !== "## Problem" && h2s[0] !== "## 问题") {
fail(`first section must be ## Problem or ## 问题 (got ${JSON.stringify(h2s[0] ?? "<none>")})`);
}
for (const group of REQUIRED[note.lifecycle] ?? []) {
const matched = group.some((h: string) => h2s.some((item: string) => item.startsWith(h)));
if (!matched) fail(`missing one of ${JSON.stringify(group)}`);
}
if (note.lifecycle === "implemented") {
for (const h of h2s.filter((x: string) => BANNED_IMPLEMENTED.test(x))) {
fail(`banned in implemented: ${h}`);
}
}
const hasAlt = h2s.some((h: string) =>
h.includes("Alternatives") ||
h.includes("备选") ||
h.includes("替代") ||
h.includes("取舍")
);
const hasGrandfather = prose.includes(GRANDFATHER);
if (hasAlt && hasGrandfather) fail("has both ## Alternatives considered and grandfather comment — drop the comment");
if (!hasAlt && !hasGrandfather) fail("missing ## Alternatives considered");
if (hasGrandfather && note.date >= FORMAT_ADOPTED) fail("grandfather comment only valid before " + FORMAT_ADOPTED);
if (prose.some((l) => LEGACY_MARKERS.some((m) => l.includes(m)))) fail("retired legacy-format debt marker");
if (hasAlt && hasGrandfather) fail("has both Alternatives section and grandfather comment — drop the comment");
if (!hasAlt && !hasGrandfather && note.date >= FORMAT_ADOPTED) {
fail("missing ## Alternatives considered / ## 考虑过的备选方案");
}
if (prose.some((l: string) => LEGACY_MARKERS.some((m: string) => l.includes(m)))) {
fail("retired legacy-format debt marker");
}
}
if (errors.length) { for (const e of errors) console.error(e); process.exit(1); }
if (errors.length) {
for (const e of errors) console.error(e);
process.exit(1);
}
console.log(`ok: ${notes.length} note(s) verified`);
+49 -4
View File
@@ -1,5 +1,50 @@
/** Verify tree: lifecycle/class/filename/INDEX. Run: npx tsx scripts/verify-agent-note-tree.ts */
import { walkAgentNoteTree } from "./agent-note-tree.ts";
/**
* Verify tree: lifecycle/class/filename/INDEX and internal relative markdown links.
* Run: npx tsx scripts/verify-agent-note-tree.ts
*/
import { existsSync, readFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { agentNoteRoot, walkAgentNoteTree } from "./agent-note-tree.ts";
const { notes, errors } = walkAgentNoteTree();
if (errors.length) { for (const e of errors) console.error(e); process.exit(1); }
console.log(`ok: ${notes.length} note(s) tree verified`);
// Check relative markdown links inside active notes
const LINK_REGEX = /\[([^\]]+)\]\(([^)]+)\)/g;
for (const note of notes) {
const noteFullPath = resolve(agentNoteRoot, note.rel);
const content = readFileSync(noteFullPath, "utf8");
let match: RegExpExecArray | null;
while ((match = LINK_REGEX.exec(content)) !== null) {
const rawTarget = match[2]?.trim();
if (!rawTarget) continue;
// Ignore web links, intra-page anchors and ellipsis placeholders
if (rawTarget.startsWith("http://") || rawTarget.startsWith("https://") || rawTarget.startsWith("#") || rawTarget.startsWith("mailto:") || rawTarget.includes("…")) {
continue;
}
// Strip anchor fragment if present
const fileTarget = rawTarget.split("#")[0];
if (!fileTarget) continue;
const resolvedTarget = resolve(dirname(noteFullPath), fileTarget);
// Only verify internal links within agentNoteRoot
if (!resolvedTarget.startsWith(agentNoteRoot)) {
continue;
}
if (!existsSync(resolvedTarget)) {
errors.push(`link: ${note.rel} -> "${rawTarget}" target file does not exist`);
}
}
}
if (errors.length) {
for (const e of errors) console.error(e);
process.exit(1);
}
console.log(`ok: ${notes.length} note(s) tree and relative links verified`);
+16 -7
View File
@@ -1,24 +1,33 @@
<!--
【维护提醒】
1. 现行法律契约:此文件在代码重构、改名或路径变更时,必须同批原子就地更新事实。
2. 源码物理绑定:请在受此决定保护的核心代码入口处标注:
// Note: <简述> — 见 .agents/notes/implemented/<class>/<filename>.md
3. 时态门禁:严禁出现 ## Proposal、## Plan、## Acceptance criteria 等计划态标题。
-->
# Agent Note: <标题>
Status: implemented
## Problem
<动机,脱离方案也能独立成立>
<动机:脱离方案也能独立成立。说明触发原因:什么破了、什么要变、不做会怎样>
## Decision
<已落地事实,用现在时;含 package 拓扑 / wire 契约 / schema 等自由节>
<已落地事实,全篇使用现在时描述。可插入 Package 拓扑 / 契约 / Schema 等业务自由小节>
## Alternatives considered
- **<备选 A>** — <为何没选>
- **<备选 B>** — <为何没选>
- **<备选 A>** — <先写其最强论据,再写为何被否>
- **<备选 B>** — <反稻草人设计,必须包含“不做/复用已有/标准库”考量>
## Consequences
<代价与收益同时写;含取舍、边界与后续影响>
- **收益**:<带来了什么确定性提升,无基线不写相对量词>
- **代价与已知上限**:<牺牲了什么,什么信号发生时必须重访该决定>
## Testing
## Verification
<可选,现在时事实:如何验证、覆盖哪些表面>
<可选,现在时事实:如何证明该决定在当前代码库中依然生效。落到可确认表面——路径、量级、执行命令>
+9 -1
View File
@@ -12,9 +12,17 @@ Status: proposed
## Alternatives considered
- **<备选 A>** — <为何没选,一段一备选;或用 ### Why not <X>? 子节>
必填。先确认"不做/复用"这一档(若可行,解释为何最终仍要新建):
- 不建 / YAGNI——留给现有实现的取舍
- 复用仓库已有 helper/pattern、标准库、平台原生、已装依赖
每档一个候选,或 `### Why not <X>?` 子节:
- **<备选 A>** — <为何没选,先写它的最强论据再写否掉理由,一段一备选>
- **<备选 B>** — <同上>
需要结构化对比多个选项时,用标准 × 选项矩阵(Fit / 运维复杂度 / 团队技能 / 成本 / 锁定风险 / 实施时间)逐格打 ✓/⚠️/✗。被否项必带"为何否"。
## Acceptance criteria
<什么可观察状态算完成;含验证表面与门禁>