@kunlv/atdc 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +58 -0
- package/GO.md +245 -0
- package/bin/add-command.py +144 -0
- package/bin/atdc.js +460 -0
- package/bin/cls.js +98 -0
- package/central/link.sh +60 -0
- package/central/ticket_center_server/.handoffs/TASK-238389_QYinVipLimit.md +128 -0
- package/central/ticket_center_server/.test_plans/TASK-227254-SupportMembership-self-test-plan.md +566 -0
- package/central/ticket_center_server/.test_plans/task-238389-qyin-vip-limit-self-test-plan.md +210 -0
- package/commands/claude/atd.md +3 -0
- package/commands/claude/atdc/1-spec.md +5 -0
- package/commands/claude/atdc/1-update.md +5 -0
- package/commands/claude/atdc/2-qa.md +3 -0
- package/commands/claude/atdc/3-impl-skip-spec.md +5 -0
- package/commands/claude/atdc/3-impl.md +3 -0
- package/commands/claude/atdc/4-verify.md +3 -0
- package/commands/claude/atdc/5-done.md +3 -0
- package/commands/claude/atdc/add-command.md +4 -0
- package/commands/claude/atdc/add-to-hc.md +3 -0
- package/commands/claude/atdc/analysis-cls-log.md +4 -0
- package/commands/claude/atdc/article.md +6 -0
- package/commands/claude/atdc/bugfix.md +4 -0
- package/commands/claude/atdc/code-simplifier.md +8 -0
- package/commands/claude/atdc/commit.md +4 -0
- package/commands/claude/atdc/compound.md +5 -0
- package/commands/claude/atdc/context.md +3 -0
- package/commands/claude/atdc/diagnose.md +8 -0
- package/commands/claude/atdc/git-guardrails.md +18 -0
- package/commands/claude/atdc/grill-with-docs.md +8 -0
- package/commands/claude/atdc/handoff.md +8 -0
- package/commands/claude/atdc/health.md +3 -0
- package/commands/claude/atdc/learn.md +4 -0
- package/commands/claude/atdc/review.md +10 -0
- package/commands/claude/atdc/search.md +4 -0
- package/commands/claude/atdc/strategy.md +3 -0
- package/commands/claude/atdc/table2xlsx.md +4 -0
- package/commands/claude/atdc/test-plan.md +5 -0
- package/commands/claude/atdc/travel-planner.md +4 -0
- package/commands/claude/atdc/xlsx2sql-insert.md +4 -0
- package/commands/claude/atdc/xlsx2sql-update.md +4 -0
- package/commands/claude/atdc/zoom-out.md +8 -0
- package/commands/codex/atdc/SKILL.md +8 -0
- package/commands/codex/atdc-1-spec/SKILL.md +8 -0
- package/commands/codex/atdc-1-update/SKILL.md +8 -0
- package/commands/codex/atdc-2-qa/SKILL.md +8 -0
- package/commands/codex/atdc-3-impl/SKILL.md +8 -0
- package/commands/codex/atdc-3-impl-skip-spec/SKILL.md +8 -0
- package/commands/codex/atdc-4-verify/SKILL.md +8 -0
- package/commands/codex/atdc-5-done/SKILL.md +8 -0
- package/commands/codex/atdc-add-command/SKILL.md +7 -0
- package/commands/codex/atdc-add-to-hc/SKILL.md +8 -0
- package/commands/codex/atdc-analysis-cls-log/SKILL.md +5 -0
- package/commands/codex/atdc-article/SKILL.md +8 -0
- package/commands/codex/atdc-bugfix/SKILL.md +5 -0
- package/commands/codex/atdc-code-simplifier/SKILL.md +7 -0
- package/commands/codex/atdc-commit/SKILL.md +7 -0
- package/commands/codex/atdc-compound/SKILL.md +8 -0
- package/commands/codex/atdc-context/SKILL.md +8 -0
- package/commands/codex/atdc-diagnose/SKILL.md +9 -0
- package/commands/codex/atdc-git-guardrails/SKILL.md +19 -0
- package/commands/codex/atdc-grill-with-docs/SKILL.md +9 -0
- package/commands/codex/atdc-handoff/SKILL.md +9 -0
- package/commands/codex/atdc-health/SKILL.md +8 -0
- package/commands/codex/atdc-learn/SKILL.md +7 -0
- package/commands/codex/atdc-review/SKILL.md +49 -0
- package/commands/codex/atdc-search/SKILL.md +5 -0
- package/commands/codex/atdc-strategy/SKILL.md +8 -0
- package/commands/codex/atdc-table2xlsx/SKILL.md +8 -0
- package/commands/codex/atdc-test-plan/SKILL.md +13 -0
- package/commands/codex/atdc-travel-planner/SKILL.md +7 -0
- package/commands/codex/atdc-xlsx2sql-insert/SKILL.md +8 -0
- package/commands/codex/atdc-xlsx2sql-update/SKILL.md +8 -0
- package/commands/codex/atdc-zoom-out/SKILL.md +9 -0
- package/commands/cursor/atdc/SKILL.md +8 -0
- package/commands/cursor/atdc-1-spec/SKILL.md +8 -0
- package/commands/cursor/atdc-1-update/SKILL.md +8 -0
- package/commands/cursor/atdc-2-qa/SKILL.md +8 -0
- package/commands/cursor/atdc-3-impl/SKILL.md +8 -0
- package/commands/cursor/atdc-3-impl-skip-spec/SKILL.md +8 -0
- package/commands/cursor/atdc-4-verify/SKILL.md +8 -0
- package/commands/cursor/atdc-5-done/SKILL.md +8 -0
- package/commands/cursor/atdc-add-command/SKILL.md +7 -0
- package/commands/cursor/atdc-add-to-hc/SKILL.md +8 -0
- package/commands/cursor/atdc-analysis-cls-log/SKILL.md +5 -0
- package/commands/cursor/atdc-article/SKILL.md +8 -0
- package/commands/cursor/atdc-bugfix/SKILL.md +5 -0
- package/commands/cursor/atdc-code-simplifier/SKILL.md +7 -0
- package/commands/cursor/atdc-commit/SKILL.md +7 -0
- package/commands/cursor/atdc-compound/SKILL.md +8 -0
- package/commands/cursor/atdc-context/SKILL.md +8 -0
- package/commands/cursor/atdc-diagnose/SKILL.md +8 -0
- package/commands/cursor/atdc-git-guardrails/SKILL.md +18 -0
- package/commands/cursor/atdc-grill-with-docs/SKILL.md +8 -0
- package/commands/cursor/atdc-handoff/SKILL.md +8 -0
- package/commands/cursor/atdc-health/SKILL.md +8 -0
- package/commands/cursor/atdc-learn/SKILL.md +7 -0
- package/commands/cursor/atdc-review/SKILL.md +49 -0
- package/commands/cursor/atdc-search/SKILL.md +5 -0
- package/commands/cursor/atdc-strategy/SKILL.md +8 -0
- package/commands/cursor/atdc-table2xlsx/SKILL.md +8 -0
- package/commands/cursor/atdc-test-plan/SKILL.md +7 -0
- package/commands/cursor/atdc-travel-planner/SKILL.md +7 -0
- package/commands/cursor/atdc-xlsx2sql-insert/SKILL.md +8 -0
- package/commands/cursor/atdc-xlsx2sql-update/SKILL.md +8 -0
- package/commands/cursor/atdc-zoom-out/SKILL.md +8 -0
- package/commands/opencode/atd.md +6 -0
- package/commands/opencode/atdc/1-spec.md +8 -0
- package/commands/opencode/atdc/1-update.md +8 -0
- package/commands/opencode/atdc/2-qa.md +6 -0
- package/commands/opencode/atdc/3-impl-skip-spec.md +8 -0
- package/commands/opencode/atdc/3-impl.md +6 -0
- package/commands/opencode/atdc/4-verify.md +6 -0
- package/commands/opencode/atdc/5-done.md +6 -0
- package/commands/opencode/atdc/add-command.md +6 -0
- package/commands/opencode/atdc/add-to-hc.md +6 -0
- package/commands/opencode/atdc/analysis-cls-log.md +6 -0
- package/commands/opencode/atdc/article.md +6 -0
- package/commands/opencode/atdc/bugfix.md +6 -0
- package/commands/opencode/atdc/code-simplifier.md +8 -0
- package/commands/opencode/atdc/commit.md +6 -0
- package/commands/opencode/atdc/compound.md +8 -0
- package/commands/opencode/atdc/context.md +6 -0
- package/commands/opencode/atdc/diagnose.md +8 -0
- package/commands/opencode/atdc/git-guardrails.md +18 -0
- package/commands/opencode/atdc/grill-with-docs.md +8 -0
- package/commands/opencode/atdc/handoff.md +8 -0
- package/commands/opencode/atdc/health.md +6 -0
- package/commands/opencode/atdc/learn.md +6 -0
- package/commands/opencode/atdc/review.md +7 -0
- package/commands/opencode/atdc/search.md +6 -0
- package/commands/opencode/atdc/strategy.md +6 -0
- package/commands/opencode/atdc/table2xlsx.md +6 -0
- package/commands/opencode/atdc/test-plan.md +6 -0
- package/commands/opencode/atdc/travel-planner.md +6 -0
- package/commands/opencode/atdc/xlsx2sql-insert.md +6 -0
- package/commands/opencode/atdc/xlsx2sql-update.md +6 -0
- package/commands/opencode/atdc/zoom-out.md +8 -0
- package/config/cls-defaults.json +19 -0
- package/hooks/atd-archive.sh +86 -0
- package/hooks/atd-state.sh +165 -0
- package/hooks/evidence-hook.sh +88 -0
- package/hooks/evidence-log.sh +54 -0
- package/hooks/guardrails.sh +65 -0
- package/hooks/handoff-compress.sh +104 -0
- package/hooks/phase-guard.sh +134 -0
- package/hooks/phase-write-guard.sh +96 -0
- package/hooks/ponytail-fix.sh +179 -0
- package/hooks/ponytail-guard.sh +66 -0
- package/hooks/ponytail-scan.sh +62 -0
- package/install.sh +276 -0
- package/package.json +20 -0
- package/packages/cls/bin/cls.js +146 -0
- package/packages/cls/config/defaults.json +17 -0
- package/packages/cls/mcp/server.js +142 -0
- package/packages/cls/package.json +29 -0
- package/packages/cls/scripts/postinstall.js +19 -0
- package/packages/cls/src/client.js +262 -0
- package/prompts/1-spec.md +271 -0
- package/prompts/1-update.md +198 -0
- package/prompts/2-qa.md +164 -0
- package/prompts/3-impl-bugfix.md +271 -0
- package/prompts/3-impl.md +419 -0
- package/prompts/4-verify.md +160 -0
- package/prompts/5-done.md +227 -0
- package/prompts/6-article.md +571 -0
- package/prompts/X-add-command.md +60 -0
- package/prompts/X-add-to-hc.md +178 -0
- package/prompts/X-analysis-cls-log.md +68 -0
- package/prompts/X-bugfix.md +10 -0
- package/prompts/X-code-simplifier.md +38 -0
- package/prompts/X-commit.md +116 -0
- package/prompts/X-compound.md +188 -0
- package/prompts/X-context-scan.md +101 -0
- package/prompts/X-diagnose.md +116 -0
- package/prompts/X-grill-with-docs.md +120 -0
- package/prompts/X-handoff.md +80 -0
- package/prompts/X-health.md +78 -0
- package/prompts/X-learn.md +151 -0
- package/prompts/X-review.md +417 -0
- package/prompts/X-search.md +74 -0
- package/prompts/X-strategy.md +95 -0
- package/prompts/X-table2xlsx.md +46 -0
- package/prompts/X-test-plan.md +436 -0
- package/prompts/X-travel-planner.md +22 -0
- package/prompts/X-xlsx2sql-insert.md +34 -0
- package/prompts/X-xlsx2sql-update.md +40 -0
- package/prompts/X-zoom-out.md +119 -0
- package/reference/diagnose-loop.md +66 -0
- package/reference/gates.md +90 -0
- package/reference/git-guardrails.md +71 -0
- package/reference/guards.md +275 -0
- package/reference/learn.md +100 -0
- package/reference/memory.md +190 -0
- package/reference/risk.md +74 -0
- package/reference/tdd.md +40 -0
- package/scripts/svg2png.js +46 -0
- package/src/cls/client.js +244 -0
- package/src/constants.js +49 -0
- package/src/evidence/ai-draft-metrics.js +157 -0
- package/src/evidence/canvas.js +184 -0
- package/src/evidence/index.js +98 -0
- package/src/evidence/sink-events.js +165 -0
- package/src/evidence/stage-timing.js +112 -0
- package/src/installers/claude.js +79 -0
- package/src/installers/codex.js +62 -0
- package/src/installers/opencode.js +72 -0
- package/src/manifest/ponytail-patterns.json +185 -0
- package/src/mcp/cls-mcp-server.js +142 -0
- package/src/utils.js +79 -0
- package/src/validators/state-validate.js +123 -0
- package/templates/.phase-state.json +13 -0
- package/templates/adr.md +62 -0
- package/templates/changelog.md +21 -0
- package/templates/concepts.md +35 -0
- package/templates/design.md +47 -0
- package/templates/handoff.md +64 -0
- package/templates/learn-skill.md +43 -0
- package/templates/progress.json +17 -0
- package/templates/proposal.md +29 -0
- package/templates/solution.md +36 -0
- package/templates/strategy.md +39 -0
- package/templates/tasks.md +41 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# prompts/5-done · 归档 + 写记忆
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## 🔴 Step -1:规则加载
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Read @atdc/reference/memory.md → 跨 session 记忆协议(Step 3 写入格式所需)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Step 0.5:Learn Checkpoint — promotion rule 终检
|
|
14
|
+
|
|
15
|
+
> 此时 change 已完成,所有测试已通过,操作路径已完整验证——正是晋升 golden path 的最佳时机。
|
|
16
|
+
|
|
17
|
+
检查当前 change 是否在 4-verify.md Step 3.5 中触发了 `/atdc:learn --auto`:
|
|
18
|
+
- 已触发 → 确认 learn 结果已写入(skill 或 memory),继续 Step 0.6
|
|
19
|
+
- 未触发 → 执行以下终检:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# 检查 .progress.json 中是否有失败记录
|
|
23
|
+
python3 -c "
|
|
24
|
+
import json
|
|
25
|
+
with open('openspec/changes/<name>/.progress.json') as f:
|
|
26
|
+
d = json.load(f)
|
|
27
|
+
if d.get('failedAt') or d.get('failedReason'):
|
|
28
|
+
print('HAS_FAILURES')
|
|
29
|
+
else:
|
|
30
|
+
print('CLEAN')
|
|
31
|
+
"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- `HAS_FAILURES` → 自动触发 `/atdc:learn --auto`(静默),沉淀失败模式到 `.errors-log.md`
|
|
35
|
+
- `CLEAN` → 静默跳过
|
|
36
|
+
|
|
37
|
+
### 0.6:Harness 门禁 + Ponytail 收尾
|
|
38
|
+
|
|
39
|
+
> **🔒 Harness 加固**:若项目已安装 harness 层(存在 `hooks/flow-archive.sh`),
|
|
40
|
+
> 推荐使用 `atdc archive <name>` 一键完成 sync + move + state update。
|
|
41
|
+
> 该命令自动调用 phase guard 验证前置条件,失败则 `[HARD STOP]`。
|
|
42
|
+
>
|
|
43
|
+
> 若未安装 harness,则手动执行以下 Step 1-2。
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Ponytail 收尾扫描 — 归档前看看整个项目还剩多少可优化模式
|
|
47
|
+
atdc ponytail scan --warn 2>/dev/null || echo "[Ponytail scan skipped]"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
> 扫描结果写入本次 change 的记忆条目,供下次 session 恢复时参考。
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Step 1:Sync delta specs
|
|
55
|
+
|
|
56
|
+
> **💡 省钱提示**:归档阶段涉及 spec 合并和记忆写入,输出约 1-3K token。输出量不大,可跳过切模型。
|
|
57
|
+
|
|
58
|
+
### Step 1a:记录完成事件 + 采集 AI Draft 指标
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
atdc evidence record <name> done --phase=archive
|
|
62
|
+
atdc evidence metrics <name> --commit
|
|
63
|
+
atdc evidence canvas <name>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
> 这会在 `.evidence/` 下记录 final metrics snapshot、生成 Canvas HTML,标记 done 事件。
|
|
67
|
+
> Canvas 路径:`openspec/changes/<name>/.evidence/canvas.html`
|
|
68
|
+
|
|
69
|
+
将 `openspec/changes/<name>/specs/` 下的变更合并到主 spec:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# 对每个 openspec/changes/<name>/specs/<module>/spec.md
|
|
73
|
+
# 检查 openspec/specs/<module>/spec.md 是否存在:
|
|
74
|
+
# 存在 → 将 delta 内容追加合并(保留原有内容,追加新增需求)
|
|
75
|
+
# 不存在 → 直接复制:cp openspec/changes/<name>/specs/<module>/spec.md openspec/specs/<module>/spec.md
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
无 delta specs 则跳过。
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Step 2:标记完成并归档目录
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# 将 .progress.json 的 status 更新为 completed
|
|
86
|
+
if [ -f "openspec/changes/<name>/.progress.json" ]; then
|
|
87
|
+
python3 -c "
|
|
88
|
+
import json, sys
|
|
89
|
+
with open('openspec/changes/<name>/.progress.json') as f: d = json.load(f)
|
|
90
|
+
d['status'] = 'completed'
|
|
91
|
+
d['currentStep'] = 'archived'
|
|
92
|
+
with open('openspec/changes/<name>/.progress.json', 'w') as f: json.dump(d, f, indent=2)
|
|
93
|
+
"
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
# 🔴 更新 phase 为 archive(触发 evidence PostToolUse hook)
|
|
97
|
+
python3 -c "
|
|
98
|
+
import json
|
|
99
|
+
with open('openspec/changes/<name>/.phase-state.json') as f: d = json.load(f)
|
|
100
|
+
d['phase'] = 'archive'
|
|
101
|
+
d['archived'] = True
|
|
102
|
+
with open('openspec/changes/<name>/.phase-state.json','w') as f: json.dump(d,f,indent=2)
|
|
103
|
+
"
|
|
104
|
+
|
|
105
|
+
mkdir -p openspec/changes/archive
|
|
106
|
+
mv openspec/changes/<name> openspec/changes/archive/<name>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**归档命名规则**:保持 change 名称原样,不加日期前缀。
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Step 3:写入跨 session 记忆(不得跳过)
|
|
114
|
+
|
|
115
|
+
从归档目录读取 proposal.md 和 design.md,提取关键决策,用**压缩格式**写入(控制在 5-8 行以内)。
|
|
116
|
+
|
|
117
|
+
**类型图标选择**:从以下选一个最匹配的,放在 header 前缀:
|
|
118
|
+
- 🟢 feature(新功能)| 🔴 bugfix(修 bug)| 🟤 decision(架构决策,默认)| 🟡 refactor(重构)| ⚖️ tradeoff(明确取舍)| ⚠️ gotcha(发现坑)| 🧠 learned-skill(self-learning 自动沉淀)
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
_PROJ=$(basename "$(git worktree list 2>/dev/null | head -1 | awk '{print $1}')" 2>/dev/null || basename "$PWD")
|
|
122
|
+
MEMORY_DIR="$HOME/.atdc/memory/$_PROJ"
|
|
123
|
+
mkdir -p "$MEMORY_DIR"
|
|
124
|
+
cat >> "$MEMORY_DIR/.memory.md" << EOF
|
|
125
|
+
|
|
126
|
+
## 🟤 [$(date +%Y-%m-%d)] <change-name> | ~150t
|
|
127
|
+
done: <一句话描述完成的内容>
|
|
128
|
+
decided: <核心技术决策,关键词即可>
|
|
129
|
+
rejected: <排除的方案及原因,无则删此行>
|
|
130
|
+
open: <未解决假设,无则删此行>
|
|
131
|
+
EOF
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**格式说明**:
|
|
135
|
+
- `🟤` 替换为对应类型图标
|
|
136
|
+
- `~150t` 为 token 估算(按内容约 100-200)
|
|
137
|
+
- `rejected:` 和 `open:` 如无内容则删除整行(不留空行)
|
|
138
|
+
- 总行数控制在 5-8 行(含 header)
|
|
139
|
+
|
|
140
|
+
写完输出:`✓ 已写入项目记忆 ~/.atdc/memory/<项目名>/.memory.md`
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Step 3.5(可选):生成交接文档
|
|
145
|
+
|
|
146
|
+
压缩记忆适合 AI 快速恢复上下文,但人类接手者可能需要更多细节。
|
|
147
|
+
|
|
148
|
+
> 是否需要生成完整交接文档(包含决策上下文、关键文件路径、未解决问题)?
|
|
149
|
+
> - 说 `handoff` → 生成 `docs/handoffs/<change-name>.md`:
|
|
150
|
+
> 格式参考 `templates/handoff.md`:
|
|
151
|
+
> - 做了什么(Why + What,不是 How)
|
|
152
|
+
> - 关键决策 + 排除方案
|
|
153
|
+
> - 受影响模块清单
|
|
154
|
+
> - 未解决的假设 / 技术债
|
|
155
|
+
> - 下次从哪里继续
|
|
156
|
+
> - 说 `继续` → 跳过,继续归档
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Step 4:自动裁剪记忆(超过 20 条时)
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
MEMORY_FILE="$MEMORY_DIR/.memory.md"
|
|
164
|
+
ARCHIVE_FILE="$MEMORY_DIR/.memory-archive.md"
|
|
165
|
+
|
|
166
|
+
COUNT=$(grep -c "^## " "$MEMORY_FILE" 2>/dev/null || echo 0)
|
|
167
|
+
|
|
168
|
+
if [ "$COUNT" -gt 20 ]; then
|
|
169
|
+
OVERFLOW=$((COUNT - 20))
|
|
170
|
+
|
|
171
|
+
# 找到第 OVERFLOW+1 条记录的起始行号(即保留部分的开头)
|
|
172
|
+
KEEP_FROM=$(grep -n "^## " "$MEMORY_FILE" | awk -F: "NR==$((OVERFLOW + 1)) {print \$1}")
|
|
173
|
+
|
|
174
|
+
# 将最旧的 OVERFLOW 条追加到归档文件(时间倒序:新内容在前)
|
|
175
|
+
OVERFLOW_CONTENT=$(head -n $((KEEP_FROM - 1)) "$MEMORY_FILE")
|
|
176
|
+
if [ -f "$ARCHIVE_FILE" ]; then
|
|
177
|
+
# 追加到归档文件头部(最新归档在最前)
|
|
178
|
+
echo -e "$OVERFLOW_CONTENT\n$(cat $ARCHIVE_FILE)" > "$ARCHIVE_FILE"
|
|
179
|
+
else
|
|
180
|
+
echo "$OVERFLOW_CONTENT" > "$ARCHIVE_FILE"
|
|
181
|
+
fi
|
|
182
|
+
|
|
183
|
+
# 只保留最新 20 条
|
|
184
|
+
tail -n +$KEEP_FROM "$MEMORY_FILE" > "$MEMORY_FILE.tmp"
|
|
185
|
+
mv "$MEMORY_FILE.tmp" "$MEMORY_FILE"
|
|
186
|
+
|
|
187
|
+
echo "✓ 记忆裁剪完成:移出 $OVERFLOW 条到 .memory-archive.md,保留最新 20 条"
|
|
188
|
+
fi
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Step 5:可选知识沉淀
|
|
194
|
+
|
|
195
|
+
检查本次 change 是否涉及值得沉淀的知识(复杂 bug 修复、架构决策、新领域概念):
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# 检查 docs/solutions/ 是否已存在
|
|
199
|
+
ls docs/solutions/ 2>/dev/null || echo "[docs/solutions/ 不存在]"
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
如果本次 change 涉及以下任一情况,提示用户:
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
💡 本次 change 涉及 <复杂问题解决/架构决策/新领域概念>,
|
|
206
|
+
建议运行 /atd compound 将知识沉淀到 docs/solutions/。
|
|
207
|
+
|
|
208
|
+
说"沉淀"立即执行,或跳过继续。
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
不涉及则跳过此步。
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Step 6:归档完成
|
|
216
|
+
|
|
217
|
+
输出:
|
|
218
|
+
```
|
|
219
|
+
✅ change <name> 归档完成
|
|
220
|
+
|
|
221
|
+
归档位置:openspec/changes/archive/<name>/
|
|
222
|
+
记忆更新:~/.atdc/memory/<项目名>/.memory.md
|
|
223
|
+
|
|
224
|
+
下一个 change 可直接说需求,@atdc/GO.md 会自动路由。
|
|
225
|
+
|
|
226
|
+
📝 本次 change 已归档。是否生成技术分享文章?输入 `/atdc:article` 即可。
|
|
227
|
+
```
|