yongle-dadian 1.1.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/README.md +667 -0
- package/YONGLE.md +232 -0
- package/bin/install.js +430 -0
- package/commands/config-export.md +17 -0
- package/commands/config-import.md +18 -0
- package/commands/confirm.md +17 -0
- package/commands/postmortem.md +17 -0
- package/commands/recall.md +18 -0
- package/commands/reindex.md +18 -0
- package/commands/search.md +18 -0
- package/commands/sync-config.md +19 -0
- package/commands/sync.md +38 -0
- package/commands/tag.md +18 -0
- package/commands/update.md +19 -0
- package/package.json +42 -0
- package/scripts/install-to-antigravity2.js +69 -0
- package/scripts/reindex.js +146 -0
- package/scripts/run-tests.cjs +34 -0
- package/scripts/yongle-agent-api.js +195 -0
- package/scripts/yongle-auto-archive-hook.js +34 -0
- package/scripts/yongle-auto-search-hook.js +95 -0
- package/scripts/yongle-bg-archiver.js +150 -0
- package/scripts/yongle-chat.js +73 -0
- package/scripts/yongle-config-export.js +19 -0
- package/scripts/yongle-config-import.js +105 -0
- package/scripts/yongle-config-sanitizer.js +64 -0
- package/scripts/yongle-config.js +129 -0
- package/scripts/yongle-db.js +126 -0
- package/scripts/yongle-dreamer.js +297 -0
- package/scripts/yongle-embed-all.js +115 -0
- package/scripts/yongle-embed.js +196 -0
- package/scripts/yongle-hybrid-search.js +247 -0
- package/scripts/yongle-lancedb.js +162 -0
- package/scripts/yongle-request.js +150 -0
- package/scripts/yongle-sync-config.js +100 -0
- package/scripts/yongle-sync-hook.js +64 -0
- package/scripts/yongle-sync-knowledge.js +199 -0
- package/scripts/yongle-update.js +375 -0
- package/skills/yongle-config-export/SKILL.md +16 -0
- package/skills/yongle-config-import/SKILL.md +16 -0
- package/skills/yongle-confirm/SKILL.md +18 -0
- package/skills/yongle-postmortem/SKILL.md +18 -0
- package/skills/yongle-recall/SKILL.md +16 -0
- package/skills/yongle-reindex/SKILL.md +15 -0
- package/skills/yongle-search/SKILL.md +21 -0
- package/skills/yongle-sync/SKILL.md +18 -0
- package/skills/yongle-tag/SKILL.md +16 -0
- package/skills/yongle-update/SKILL.md +26 -0
- package/workflows/yongle-check-dream.md +58 -0
- package/workflows/yongle-config-export.md +18 -0
- package/workflows/yongle-config-import.md +23 -0
- package/workflows/yongle-confirm.md +109 -0
- package/workflows/yongle-postmortem.md +230 -0
- package/workflows/yongle-recall.md +48 -0
- package/workflows/yongle-reindex.md +39 -0
- package/workflows/yongle-search.md +27 -0
- package/workflows/yongle-sync-config.md +23 -0
- package/workflows/yongle-tag.md +87 -0
package/README.md
ADDED
|
@@ -0,0 +1,667 @@
|
|
|
1
|
+
# 永乐大典 (Yongle Dadian) — AI Agent Long-term Memory & Hybrid Search Engine
|
|
2
|
+
|
|
3
|
+
[🇨🇳 中文版](#-yongle-dadian--ai-agent-%E9%95%BF%E6%9C%9F%E8%AE%B0%E5%BF%86%E4%B8%8E%E6%B7%B7%E5%90%88%E6%A3%80%E7%B4%A2%E5%BC%95%E6%93%8E) | [🇬🇧 English Version](#-yongle-dadian--ai-agent-long-term-memory--hybrid-search-engine)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🇨🇳 永乐大典 — AI Agent 长期记忆与混合检索引擎
|
|
8
|
+
|
|
9
|
+
> **“知识就是力量,但只有能被迅速找回的知识才是生产力。”**
|
|
10
|
+
|
|
11
|
+
在人类开发者与 AI Agent(如 Antigravity, Claude Code, Gemini CLI, Cursor, Trae 等)进行结对编程(Pair Programming)的过程中,最常见的痛点是:
|
|
12
|
+
1. **重复踩坑**:相同的 Bug、环境配置问题、甚至代码库的设计局限性,在多次 Reset 会话或开启新对话后被 AI 一犯再犯。
|
|
13
|
+
2. **上下文流失**:长对话中沉淀下来的“完美解决方案”和“关键决策(Key Decisions)”随着会话归档或 Token 限制而丢失,无法跨越会话继承。
|
|
14
|
+
3. **传统的检索无能**:基于简单的关键词搜索(Grepping/FTS5)很容易因为语义表达不同(如输入“乱码”却搜不到带有“encoding”的笔记)而完美错过正确经验。
|
|
15
|
+
|
|
16
|
+
**永乐大典**正是为了解决这一痛点而生的**本地优先(Local-First)、AI 伴生的长期记忆与检索引擎**。它能够将 AI 的调试历程与解决方案自动凝练成标准化 Markdown 经验,并通过**“SQLite 全文检索 + LanceDB 本地向量语义检索”双引擎**与 RRF 算法进行融合排序,实现毫秒级、强语义相关的知识召回,彻底终结 AI 的“健忘症”。
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
### 🗺️ 目录
|
|
21
|
+
|
|
22
|
+
- [🇨🇳 永乐大典 — AI Agent 长期记忆与混合检索引擎](#-yongle-dadian--ai-agent-长期记忆与混合检索引擎)
|
|
23
|
+
- [🗺️ 目录](#️-目录)
|
|
24
|
+
- [1. 核心价值与应用场景](#1-核心价值与应用场景)
|
|
25
|
+
- [2. 技术栈与系统架构](#2-技术栈与系统架构)
|
|
26
|
+
- [3. 安装与配置说明](#3-安装与配置说明)
|
|
27
|
+
- [4. 快速上手指南](#4-快速上手指南)
|
|
28
|
+
- [5. 详细命令手册](#5-详细命令手册)
|
|
29
|
+
- [6. 与交付框架 GSD (Get Shit Done) 协同工作](#6-与交付框架-gsd-get-shit-done-协同工作)
|
|
30
|
+
- [🇬🇧 Yongle Dadian — AI Agent Long-term Memory & Hybrid Search Engine](#-yongle-dadian--ai-agent-long-term-memory--hybrid-search-engine-1)
|
|
31
|
+
- [🗺️ Table of Contents](#️-table-of-contents)
|
|
32
|
+
- [1. Core Value & Scenarios](#1-core-value--scenarios)
|
|
33
|
+
- [2. Tech Stack & Architecture](#2-tech-stack--architecture)
|
|
34
|
+
- [3. Installation & Configuration](#3-installation--configuration)
|
|
35
|
+
- [4. Quick Start](#4-quick-start)
|
|
36
|
+
- [5. Command Details](#5-command-details)
|
|
37
|
+
- [6. Synergy with Harness Framework GSD (Get Shit Done)](#6-synergy-with-harness-framework-gsd-get-shit-done)
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### 1. 核心价值与应用场景
|
|
42
|
+
|
|
43
|
+
#### 💡 为什么有这个项目?
|
|
44
|
+
人类开发者的精力和记忆是有限的,而 AI 代理在会话切换后的记忆甚至是“零”。永乐大典通过一套非阻塞的、AI 自主驱动的复盘和搜索流水线,在开发流程的后台自动捕获错误,生成带有标准 Frontmatter 元数据的高质量经验库,并对每一次新检索提供最强力的语义检索支持。
|
|
45
|
+
|
|
46
|
+
#### 🎯 典型应用场景
|
|
47
|
+
- **AI 自动复盘**:当开发过程中遭遇严重的 Bug,AI 调试成功后,直接触发复盘。AI 会自动识别刚才的尝试和痛点,写成标准化草稿。
|
|
48
|
+
- **混合高准确度召回**:输入模糊的意图描述,系统即刻在 0.1 秒内流式输出 SQLite 倒排匹配,并在后台并行提取向量,在 LanceDB 语义空间进行匹配,最终使用 RRF 算法将两者交融,提供最佳匹配。
|
|
49
|
+
- **跨平台一致性**:无论你在 Windows(Powershell/CMD)、macOS 还是 Linux 下,整个套件均表现出完美的命令行长度溢出兼容与无阻塞多线程体验。
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### 2. 技术栈与系统架构
|
|
54
|
+
|
|
55
|
+
永乐大典采用**完全去中心化、无服务器依赖(Serverless / Local-first)**的极致精简架构。
|
|
56
|
+
|
|
57
|
+
#### 🛠️ 技术栈
|
|
58
|
+
- **核心逻辑**:Node.js(>= 18.0.0)。
|
|
59
|
+
- **全文检索**:SQLite3 本地关系型数据库(Metadata & Fast FTS)。
|
|
60
|
+
- **向量数据库**:LanceDB(利用 `vectordb` 驱动实现高性能内嵌式向量存储)。
|
|
61
|
+
- **Embedding 引擎**:支持全模型自适应。内置对 **Gemini (gemini-embedding-001)**, **DeepSeek**, **Ollama (nomic-embed-text)**, **OpenAI (text-embedding-3-small)** 以及任何 **OpenAI-Compatible** 自定义端点(vLLM, OpenRouter, LiteLLM 等)的开箱即用支持。
|
|
62
|
+
- **同步引擎**:基于 Git/GitHub 的自动增量同步与多机冲突合并逻辑。
|
|
63
|
+
|
|
64
|
+
#### 🏗️ 架构设计图
|
|
65
|
+
```mermaid
|
|
66
|
+
graph TD
|
|
67
|
+
UserInput[用户或AI命令行输入] -->|Trigger| CLI[Yongle CLI Wrapper]
|
|
68
|
+
|
|
69
|
+
subgraph "自动复盘与存储 (Ingestion)"
|
|
70
|
+
CLI -->|/yongle-postmortem| Draft[生成 Markdown 草稿]
|
|
71
|
+
Draft -->|/yongle-confirm| Clean[元数据清洗 & 写入物理 Markdown]
|
|
72
|
+
Clean -->|1. 数据库写入| SQLite[(SQLite Metadata DB)]
|
|
73
|
+
Clean -->|2. 异步触发| ProgrammaticUpsert[内存级程序化 Upsert]
|
|
74
|
+
ProgrammaticUpsert -->|3. Embedding API| Models[Gemini / DeepSeek / Ollama / OpenAI]
|
|
75
|
+
Models -->|4. 高维特征返回| LanceDB[(LanceDB Embed Vector Store)]
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
subgraph "混合召回与融合 (Retrieval)"
|
|
79
|
+
CLI -->|/yongle-search| HybridSearcher[yongle-hybrid-search.js]
|
|
80
|
+
HybridSearcher -->|1. 瞬时查询| SQLite
|
|
81
|
+
SQLite -->|2. TTY流式渲染打底| Term[终端展示]
|
|
82
|
+
HybridSearcher -->|3. 并发 Embedding 提取| Models
|
|
83
|
+
Models -->|4. 语义向量匹配| LanceDB
|
|
84
|
+
LanceDB -->|5. 结果重汇聚| RRF[Reciprocal Rank Fusion 融合算法 + 1.5x FTS 提权]
|
|
85
|
+
RRF -->|6. 光标退回重绘| Term
|
|
86
|
+
end
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
#### 🪟 Windows 平台深度优化与防错设计
|
|
90
|
+
|
|
91
|
+
针对 Windows 环境下的特殊系统限制,永乐大典进行了专项的健壮性加固设计:
|
|
92
|
+
|
|
93
|
+
1. **突破命令行长度溢出限制 (ENAMETOOLONG)**
|
|
94
|
+
- **痛点**:Windows `cmd.exe` 命令行具有最大 8191 字符的长度限制。在灌入高维向量(如 Gemini 768维、OpenAI 1536维)的 JSON 字符串时,直接通过子进程命令行传参必然触发 `ENAMETOOLONG` 错误,导致灌库失败。
|
|
95
|
+
- **优化**:废除通过 CLI 传参数方式,重构了 `yongle-lancedb.js` 的模块化调用,全部升级为 **内存级函数内嵌式异步加载**,彻底消除了 Shell 限制。
|
|
96
|
+
2. **解决 SQLite 命令行参数 GBK 乱码转译**
|
|
97
|
+
- **痛点**:Windows 系统在跨进程传递命令行参数时,会将参数强行转换为控制台当前的 ANSI 代码页(如中文 Windows 的 `GBK / CP936`),直接传 SQL 语句给 `sqlite3` 会导致入库中文乱码。
|
|
98
|
+
- **优化**:彻底重构了 `yongle-db.js` 的子进程通信,弃用命令行 args 传参,改用 **Stdin 标准输入管道流** 灌入 SQL 指令,确保 100% 纯净的 UTF-8 中文字符录入与索引。
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
### 3. 安装与配置说明
|
|
104
|
+
|
|
105
|
+
提供两种安装与配置途径:
|
|
106
|
+
|
|
107
|
+
#### 📦 途径 A:通过 npm 全局安装(推荐)
|
|
108
|
+
```powershell
|
|
109
|
+
npx yongle-dadian --global --antigravity
|
|
110
|
+
```
|
|
111
|
+
*这会自动将永乐大典注册到你的系统环境变量及宿主 Agent 工作流中。*
|
|
112
|
+
|
|
113
|
+
#### 🔧 途径 B:本地源码安装(适合定制开发)
|
|
114
|
+
1. 克隆仓库:
|
|
115
|
+
```powershell
|
|
116
|
+
git clone https://github.com/Lemony/yongle-dadian.git
|
|
117
|
+
cd yongle-dadian
|
|
118
|
+
```
|
|
119
|
+
2. 安装依赖:
|
|
120
|
+
```powershell
|
|
121
|
+
npm install
|
|
122
|
+
```
|
|
123
|
+
3. 注册到全局:
|
|
124
|
+
```powershell
|
|
125
|
+
node bin/install.js --global --antigravity
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### 🔄 如何更新
|
|
129
|
+
|
|
130
|
+
更新永乐大典非常简单,它与你的安装途径一一对应:
|
|
131
|
+
|
|
132
|
+
- **自动化升级(推荐)**:直接在支持技能的 AI Agent 终端中运行:
|
|
133
|
+
```markdown
|
|
134
|
+
@[/yongle-update]
|
|
135
|
+
```
|
|
136
|
+
该命令会自动识别安装模式(npm 全局 / Git 源码克隆),拉取最新版本,执行必要的依赖更新,并自动对所有已激活的 AI 运行时重注入技能。
|
|
137
|
+
|
|
138
|
+
- **手动升级**:
|
|
139
|
+
- **途径 A(npm 全局)**:直接再次运行 `npx` 即可拉取最新版:
|
|
140
|
+
```powershell
|
|
141
|
+
npx yongle-dadian --global --antigravity
|
|
142
|
+
```
|
|
143
|
+
- **途径 B(源码克隆)**:拉取最新代码并重新运行安装器:
|
|
144
|
+
```powershell
|
|
145
|
+
git pull
|
|
146
|
+
npm install
|
|
147
|
+
node bin/install.js --global --antigravity
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
#### 🗑️ 如何卸载
|
|
151
|
+
|
|
152
|
+
如果你需要完全移除永乐大典及其技能插件:
|
|
153
|
+
|
|
154
|
+
1. **卸载技能插件**:运行安装器的 `--uninstall` 标志,从宿主 Agent 中移除技能绑定:
|
|
155
|
+
```powershell
|
|
156
|
+
node bin/install.js --uninstall --global --antigravity
|
|
157
|
+
```
|
|
158
|
+
2. **(可选)清理本地知识库**:若你想彻底销毁已沉淀的本地数据库和 Markdown 条目(数据无法找回,请谨慎操作):
|
|
159
|
+
```powershell
|
|
160
|
+
# Windows PowerShell
|
|
161
|
+
Remove-Item -Path "$HOME\.yongle_knowledge" -Recurse -Force
|
|
162
|
+
|
|
163
|
+
# macOS / Linux Bash
|
|
164
|
+
rm -rf ~/.yongle_knowledge
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### ⚙️ 配置文件说明 (`~/.yongle_knowledge/config.json`)
|
|
168
|
+
永乐大典在初始化时会在用户家目录下生成 `.yongle_knowledge` 目录。你可以通过修改其中的 `config.json` 来配置首选的 Embedding(向量检索)与 Agent(对话总结)提供商:
|
|
169
|
+
|
|
170
|
+
> [!TIP]
|
|
171
|
+
> **快捷起步**:我们在项目根目录下提供了一个 [config.json.example](file:///d:/Computers/AIDevelop/Tools/Skills/yongle-dadian/config.json.example) 示例文件,您可以直接将其复制到全局路径 `~/.yongle_knowledge/config.json` 并填写您的 API Key。
|
|
172
|
+
>
|
|
173
|
+
> **智能继承机制**:若省略 `agent` 节点配置,系统在需要使用大语言模型交互(例如后台自动做梦总结、命令行独立复盘)时,会**自动继承** `embedding` 的密钥和提供商,并智能分配最佳轻量对话模型(如 Gemini 会默认匹配 `gemini-1.5-flash`)。
|
|
174
|
+
|
|
175
|
+
##### 配置网络代理 (HTTP/HTTPS Proxy)
|
|
176
|
+
如果您的网络处于受限环境(例如在国内调用 Gemini/OpenAI),可以配置网络代理:
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"yongle": {
|
|
180
|
+
"proxy": "http://127.0.0.1:7890",
|
|
181
|
+
"proxyEnabled": true
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
> **代理优先级**:配置项 `yongle.proxy` > 环境变量 `HTTPS_PROXY` > `HTTP_PROXY` > 直连。
|
|
186
|
+
> 临时停用代理仅需将 `proxyEnabled` 改为 `false`。
|
|
187
|
+
|
|
188
|
+
##### 后台自动同步与调度配置 (Sync & Scheduler)
|
|
189
|
+
支持自定义后台同步与梦境守护设置。**特别注意**:定时调度器配置专为 Antigravity 这类持久化 Agent 宿主环境设计,并且**在启动时支持智能跨会话去重检测**:
|
|
190
|
+
```json
|
|
191
|
+
{
|
|
192
|
+
"yongle": {
|
|
193
|
+
"sync": {
|
|
194
|
+
"interval": 3600000,
|
|
195
|
+
"global_repo_url": "https://github.com/yourname/Yongle-Sync"
|
|
196
|
+
},
|
|
197
|
+
"scheduler": {
|
|
198
|
+
"sync": {
|
|
199
|
+
"enabled": true,
|
|
200
|
+
"cron": "0 */2 * * *"
|
|
201
|
+
},
|
|
202
|
+
"dreamer": {
|
|
203
|
+
"enabled": true,
|
|
204
|
+
"cron": "*/15 * * * *",
|
|
205
|
+
"quick_idle_ms": 300000,
|
|
206
|
+
"long_idle_ms": 1800000,
|
|
207
|
+
"provider": "ollama",
|
|
208
|
+
"model": "llama3",
|
|
209
|
+
"apiKey": "Optional",
|
|
210
|
+
"baseUrl": "http://localhost:11434"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
> - `interval` 为普通终端(Node 进程内)环境下的自动同步毫秒间隔(默认 1 小时)。
|
|
217
|
+
> - `global_repo_url` 为全局个人知识库的远程 GitHub 仓库备份路径。
|
|
218
|
+
> - `cron` 为 **Antigravity 智能体专属**的持久化任务调度表达式。系统检测到处于智能体环境时,会调用系统级调度工具确保持久运行,并在首次启动时**执行 `manage_task(Action='list')` 去重检测**,确保全局有且仅有一个活动任务,防止多窗口并发导致任务重复。
|
|
219
|
+
> - 梦境守护(`dreamer`)配置下允许指定专属的 LLM 模型及接口地址(如 `provider`, `model`, `baseUrl`),若不指定则会自动继承全局 `agent` 大模型配置。
|
|
220
|
+
|
|
221
|
+
##### 配置 Gemini (推荐)
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"embedding": {
|
|
225
|
+
"enabled": true,
|
|
226
|
+
"provider": "gemini",
|
|
227
|
+
"model": "gemini-embedding-001",
|
|
228
|
+
"apiKey": "YOUR_GEMINI_API_KEY"
|
|
229
|
+
},
|
|
230
|
+
"agent": {
|
|
231
|
+
"enabled": true,
|
|
232
|
+
"provider": "gemini",
|
|
233
|
+
"model": "gemini-1.5-flash",
|
|
234
|
+
"apiKey": "YOUR_GEMINI_API_KEY"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
##### 配置 DeepSeek
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"embedding": {
|
|
243
|
+
"enabled": true,
|
|
244
|
+
"provider": "deepseek",
|
|
245
|
+
"model": "deepseek-embedding",
|
|
246
|
+
"apiKey": "YOUR_DEEPSEEK_API_KEY"
|
|
247
|
+
},
|
|
248
|
+
"agent": {
|
|
249
|
+
"enabled": true,
|
|
250
|
+
"provider": "deepseek",
|
|
251
|
+
"model": "deepseek-chat",
|
|
252
|
+
"apiKey": "YOUR_DEEPSEEK_API_KEY"
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
##### 配置 Ollama (本地私有化)
|
|
258
|
+
```json
|
|
259
|
+
{
|
|
260
|
+
"embedding": {
|
|
261
|
+
"enabled": true,
|
|
262
|
+
"provider": "ollama",
|
|
263
|
+
"model": "nomic-embed-text",
|
|
264
|
+
"baseUrl": "http://localhost:11434"
|
|
265
|
+
},
|
|
266
|
+
"agent": {
|
|
267
|
+
"enabled": true,
|
|
268
|
+
"provider": "ollama",
|
|
269
|
+
"model": "llama3",
|
|
270
|
+
"baseUrl": "http://localhost:11434"
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
##### 关于启用开关 (enabled) 💡
|
|
276
|
+
- **`embedding.enabled`**:若设为 `false`,则会停用高维向量生成与语义检索,搜索(`/yongle-search`)时将**自动优雅降级**为纯本地的 SQLite FTS 检索,落盘(`/yongle-confirm`)时也将跳过特征向量提取以节省资源。
|
|
277
|
+
- **`agent.enabled`**:若设为 `false`,将彻底关闭大模型对话模块,防止对外部 LLM 发起任何调用(在调用复盘 `/yongle-postmortem` 等操作时会直接中断并友好提示)。
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
### 4. 快速上手指南
|
|
283
|
+
|
|
284
|
+
只需三步,即可让 AI 记住并检索你的全部开发经验:
|
|
285
|
+
|
|
286
|
+
1. **第一步:回填历史存量文档(Backfill)**
|
|
287
|
+
如果你已经有一些存量 Markdown 文件,运行以下命令让系统生成向量并灌库:
|
|
288
|
+
```powershell
|
|
289
|
+
npm run embed:all
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
2. **第二步:遇到 Bug 解决后,一键复盘**
|
|
293
|
+
在 AI 帮你修复了一个编码或乱码问题后,对它输入:
|
|
294
|
+
```markdown
|
|
295
|
+
@[/yongle-postmortem]
|
|
296
|
+
```
|
|
297
|
+
AI 将自动捕获整个调试周期(包括你失败的尝试和最终成功方案),并在终端输出预览。选择 `✅ 确认并正式归档`,它将被安全地写入物理 Markdown 并瞬间生成向量和 SQLite 倒排索引。
|
|
298
|
+
|
|
299
|
+
3. **第三步:智能检索**
|
|
300
|
+
在全新的会话中,模糊检索你的意图:
|
|
301
|
+
```powershell
|
|
302
|
+
node scripts/yongle-hybrid-search.js global "怎么搞定乱码问题"
|
|
303
|
+
```
|
|
304
|
+
或者直接限制纯语义搜索(不依赖特定关键词匹配):
|
|
305
|
+
```powershell
|
|
306
|
+
node scripts/yongle-hybrid-search.js global "搞定乱码" --semantic-only
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
### 5. 详细命令手册
|
|
312
|
+
|
|
313
|
+
| 命令 / 脚本 | 主要参数 | 功能详述 |
|
|
314
|
+
|-------------|----------|----------|
|
|
315
|
+
| `/yongle-postmortem` | `--global` / `--local` | **事后自动复盘**。向上回溯当前会话的上下文,智能识别第一报错信息、失败的尝试路径、最终正确代码、防复发建议,生成标准化元数据的 Markdown 草稿。 |
|
|
316
|
+
| `/yongle-confirm` | `<draft-path>` | **升级草稿归档**。移除草稿标记,写入物理索引 `INDEX.md`,并在 SQLite 写入条目,同时非阻塞式派生后台异步向量化进程。 |
|
|
317
|
+
| `scripts/yongle-hybrid-search.js` | `<scope> <query> [--semantic-only]` | **混合检索器**。在 TTY 终端下启动流式更新:即刻打印 SQLite FTS 匹配 -> 后台并发获取 Embedding 并计算 LanceDB 语义相似度 -> RRF 融合计算并擦除终端,重绘终榜结果。 |
|
|
318
|
+
| `/yongle-tag` | 无 | **过程探针**。在当前会话中置入一个“眼”(Active Watch),持续记录调试步骤,提供给后期复盘时最高优先级的上下文。 |
|
|
319
|
+
| `/yongle-recall` | 无 | **记忆召回**。秒级搜索已沉淀的项目风格决策、架构建议等全局/局部思维模式(Thoughts/Styles)。 |
|
|
320
|
+
| `/yongle-reindex` | 无 | **重建 SQLite**。全量重新扫描指定 scope 的 Markdown 目录并无损重建 SQLite 主库的 Entries 关联。 |
|
|
321
|
+
| `npm run embed:all` | 无 | **并发向量灌库**。以最多 5 的并发连接池安全、快速地把所有存量文件进行 Semantic Chunking 分块,并通过防 ENAMETOOLONG 的内存模块方式录入 LanceDB。 |
|
|
322
|
+
| `/yongle-sync` | 无 | **增量云同步**。在后台非阻塞式将本地库推送到绑定的 GitHub 团队/个人仓库。 |
|
|
323
|
+
| `/yongle-config-export` | 无 | **配置导出**。将全局配置以 JSON 格式输出到终端,所有 `apiKey` 字段已自动排除。输出可直接用于 `/yongle-config-import`。 |
|
|
324
|
+
| `/yongle-config-import` | `<file>` | **配置导入**。从指定 JSON 文件导入配置,显示 dry-run 预览并需 `[y/N]` 确认,自动排除并警告 `apiKey` 字段。 |
|
|
325
|
+
| `/yongle-sync-config` | `[--pull]` | 配置同步。默认 Push:自动剥离 apiKey,推送到远端后恢复本地。加 `--pull` 则从远端拉取并通过导入预览合并。 |
|
|
326
|
+
| `/yongle-update` | 无 | **自动升级**。检测最新代码,升级依赖(如有 package-lock 变更),并自动重新注入技能到所有激活的智能体环境。 |
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
### 6. 与交付框架 GSD (Get Shit Done) 协同工作
|
|
331
|
+
|
|
332
|
+
永乐大典与 AI 交付框架 **Get Shit Done (GSD)** 构成了完美的结对编程闭环关系:
|
|
333
|
+
|
|
334
|
+
- **GSD**:是一个专注于“短期交付与过程控制”的结构化 CLI 框架。它定义了开发流程的规范(SPECs、PLANs、CHECKLISTs、TESTs),保证 AI **“把事情做完” (Get Shit Done)**。
|
|
335
|
+
- **永乐大典**:是一个专注于“长期记忆与防踩坑”的检索库。它沉淀了所有的开发事故和最佳架构设计,保证 AI **“不会让烂事再次发生” (Prevent Shit Happening Again)**。
|
|
336
|
+
|
|
337
|
+
#### 🔗 GitHub 协同项目
|
|
338
|
+
- [Get Shit Done (GSD) Harness Framework](https://github.com/gsd-build/get-shit-done) (提供精密的 AI 阶段规范管控、Nyquist 验证审计与自动化测试流)。
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## 🇬🇧 Yongle Dadian — AI Agent Long-term Memory & Hybrid Search Engine
|
|
343
|
+
|
|
344
|
+
> **"Knowledge is power, but only knowledge that can be quickly retrieved is productivity."**
|
|
345
|
+
|
|
346
|
+
When human developers pair-program with AI Agents (such as Antigravity, Claude Code, Gemini CLI, Cursor, Trae, etc.), the most common pain points are:
|
|
347
|
+
1. **Repeating Bugs**: The same environment configurations, API quirks, or codebase design limits are repeatedly forgotten and re-violated by AI whenever a session is reset or a new chat begins.
|
|
348
|
+
2. **Context Loss**: Great solutions and key decisions synthesized during long sessions are eventually lost due to archival or context token window limits, never inherited across chats.
|
|
349
|
+
3. **Keyword-search Inefficiency**: Traditional FTS (Full-Text Search) fails to return relevant matches when the semantic expression differs (e.g., searching for "encoding issue" misses a document containing only "garbled characters").
|
|
350
|
+
|
|
351
|
+
**Yongle Dadian** is a **local-first, AI-companion long-term memory and retrieval engine** specifically built to solve these exact problems. It automatically structures the AI's debugging history and final code solutions into standardized Markdown documents, indexing them via a **"SQLite FTS + LanceDB Embedded Vector Database" dual-engine** merged by the Reciprocal Rank Fusion (RRF) algorithm to achieve millisecond-level semantic recall.
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
### 🗺️ Table of Contents
|
|
356
|
+
|
|
357
|
+
- [1. Core Value & Scenarios](#1-core-value--scenarios)
|
|
358
|
+
- [2. Tech Stack & Architecture](#2-tech-stack--architecture)
|
|
359
|
+
- [3. Installation & Configuration](#3-installation--configuration)
|
|
360
|
+
- [4. Quick Start](#4-quick-start)
|
|
361
|
+
- [5. Command Details](#5-command-details)
|
|
362
|
+
- [6. Synergy with Harness Framework GSD (Get Shit Done)](#6-synergy-with-harness-framework-gsd-get-shit-done)
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
### 1. Core Value & Scenarios
|
|
367
|
+
|
|
368
|
+
#### 💡 Why This Project?
|
|
369
|
+
Human developers have finite memories, and AI agents have "zero memory" across session resets. Yongle Dadian uses a non-blocking, AI-driven postmortem extraction pipeline to capture errors in the background, compile them into rich Markdown entries with standardized YAML metadata, and supply future queries with highly accurate hybrid semantic results.
|
|
370
|
+
|
|
371
|
+
#### 🎯 Ideal Scenarios
|
|
372
|
+
- **Automated Postmortem**: When a critical bug is solved, trigger a postmortem. The AI summarizes what failed, what was attempted, and what succeeded into a standardized draft.
|
|
373
|
+
- **Hybrid Search**: Query a concept, and get instant SQLite matches, followed by a background semantic matching in LanceDB, merged together instantly via RRF.
|
|
374
|
+
- **Cross-Platform Safety**: Provides maximum compatibility with Windows (bypassing CMD 8191 command-line length limits programmatically) and handles non-TTY environments cleanly.
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
### 2. Tech Stack & Architecture
|
|
379
|
+
|
|
380
|
+
Yongle Dadian features a **decentralized, local-first, serverless** design.
|
|
381
|
+
|
|
382
|
+
#### 🛠️ Tech Stack
|
|
383
|
+
- **Core Engine**: Node.js (>= 18.0.0).
|
|
384
|
+
- **Relational FTS**: SQLite3 local database (for metadata and instant queries).
|
|
385
|
+
- **Vector Storage**: LanceDB (embedded engine via `vectordb` package, no extra system server required).
|
|
386
|
+
- **Embedding Adapters**: Auto-adapts to major models including **Gemini (gemini-embedding-001)**, **DeepSeek**, **Ollama (nomic-embed-text)**, **OpenAI (text-embedding-3-small)**, and any **OpenAI-Compatible** endpoints.
|
|
387
|
+
- **Sync System**: Git-based secure hybrid merging for cloud syncing.
|
|
388
|
+
|
|
389
|
+
#### 🏗️ Architecture Flow
|
|
390
|
+
```mermaid
|
|
391
|
+
graph TD
|
|
392
|
+
UserInput[User/AI CLI Input] -->|Trigger| CLI[Yongle CLI Wrapper]
|
|
393
|
+
|
|
394
|
+
subgraph Ingestion
|
|
395
|
+
CLI -->|/yongle-postmortem| Draft[Generate Markdown Draft]
|
|
396
|
+
Draft -->|/yongle-confirm| Clean[Clean Metadata & Write Markdown]
|
|
397
|
+
Clean -->|1. Write Meta| SQLite[(SQLite Metadata DB)]
|
|
398
|
+
Clean -->|2. Trigger Async| ProgrammaticUpsert[In-memory Programmatic Upsert]
|
|
399
|
+
ProgrammaticUpsert -->|3. Embedding API| Models[Gemini / DeepSeek / Ollama / OpenAI]
|
|
400
|
+
Models -->|4. High-dim Vectors| LanceDB[(LanceDB Embed Vector Store)]
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
subgraph Retrieval
|
|
404
|
+
CLI -->|/yongle-search| HybridSearcher[yongle-hybrid-search.js]
|
|
405
|
+
HybridSearcher -->|1. Instant Query| SQLite
|
|
406
|
+
SQLite -->|2. Stream TTY Render| Term[Terminal Screen]
|
|
407
|
+
HybridSearcher -->|3. Parallel Embedding| Models
|
|
408
|
+
Models -->|4. Query LanceDB| LanceDB
|
|
409
|
+
LanceDB -->|5. Recalculate| RRF[Reciprocal Rank Fusion + 1.5x FTS Boost]
|
|
410
|
+
RRF -->|6. ANSI Repaint Screen| Term
|
|
411
|
+
end
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
#### 🪟 Windows Platform Robustness & Hardening
|
|
415
|
+
|
|
416
|
+
Yongle Dadian implements deep platform-specific hardening for Windows to guarantee high availability:
|
|
417
|
+
|
|
418
|
+
1. **Bypassing CommandLine Length Limits (ENAMETOOLONG)**
|
|
419
|
+
- **Pain Point**: Windows `cmd.exe` enforces a strict 8191-character command limit. Serialized high-dimensional embedding JSON strings (e.g. 1536-dim OpenAI, 768-dim Gemini) easily exceed 10,000 characters, failing immediately with `ENAMETOOLONG` under child_process CLI arguments.
|
|
420
|
+
- **Fix**: Refactored the core embedding pipeline to utilize **in-memory module calls** (`require` imports of `yongle-lancedb.js` methods) instead of spawning subprocess command lines, entirely bypassing the Shell constraints.
|
|
421
|
+
2. **Preventing SQLite Argument GBK Transcoding Garbled Text**
|
|
422
|
+
- **Pain Point**: Windows OS automatically transcodes command line arguments into the active console ANSI codepage (typically `GBK / CP936` on Chinese systems) before executing child processes, corrupting UTF-8 SQL query parameters passed to `sqlite3.exe`.
|
|
423
|
+
- **Fix**: Re-engineered `yongle-db.js` child process IPC to send queries directly through the **Stdin stream pipe** instead of argv array, guaranteeing raw, clean UTF-8 string storage and query execution.
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
### 3. Installation & Configuration
|
|
429
|
+
|
|
430
|
+
Two installation pathways are supported:
|
|
431
|
+
|
|
432
|
+
#### 📦 Approach A: Global CLI Installation via npm (Recommended)
|
|
433
|
+
```powershell
|
|
434
|
+
npx yongle-dadian --global --antigravity
|
|
435
|
+
```
|
|
436
|
+
*This registers all workflows and environments to your system globally.*
|
|
437
|
+
|
|
438
|
+
#### 🔧 Approach B: Local Source Installation (For Custom Hacking)
|
|
439
|
+
1. Clone the repository:
|
|
440
|
+
```powershell
|
|
441
|
+
git clone https://github.com/Lemony/yongle-dadian.git
|
|
442
|
+
cd yongle-dadian
|
|
443
|
+
```
|
|
444
|
+
2. Install npm dependencies:
|
|
445
|
+
```powershell
|
|
446
|
+
npm install
|
|
447
|
+
```
|
|
448
|
+
3. Link globally:
|
|
449
|
+
```powershell
|
|
450
|
+
node bin/install.js --global --antigravity
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
#### ⚙️ Configuration File (`~/.yongle_knowledge/config.json`)
|
|
454
|
+
Customize your preferred embedding (semantic retrieval) and agent (completions/summaries) engines in the configuration file generated in your home directory:
|
|
455
|
+
|
|
456
|
+
> [!TIP]
|
|
457
|
+
> **Quick Start**: We provide a [config.json.example](file:///d:/Computers/AIDevelop/Tools/Skills/yongle-dadian/config.json.example) template file in the project root directory. You can copy it directly to `~/.yongle_knowledge/config.json` and fill in your API keys.
|
|
458
|
+
>
|
|
459
|
+
> **Smart Inheritance**: If you omit the `agent` config block, system operations requiring LLM chat completions (such as background dreaming summaries, or standalone terminal postmortems) will **automatically inherit** the API keys and provider configured under `embedding`, defaulting to their respective lightweight chat models (e.g. Gemini will automatically map to `gemini-1.5-flash`).
|
|
460
|
+
|
|
461
|
+
##### Configure Network Proxy (HTTP/HTTPS Proxy)
|
|
462
|
+
If you operate in restricted network environments, you can configure an outbound network proxy:
|
|
463
|
+
```json
|
|
464
|
+
{
|
|
465
|
+
"yongle": {
|
|
466
|
+
"proxy": "http://127.0.0.1:7890",
|
|
467
|
+
"proxyEnabled": true
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
```
|
|
471
|
+
> **Proxy Priority**: configuration property `yongle.proxy` > environment variable `HTTPS_PROXY` > `HTTP_PROXY` > direct connection.
|
|
472
|
+
> Toggle the proxy off instantly by setting `proxyEnabled` to `false`.
|
|
473
|
+
|
|
474
|
+
##### Background Sync & Scheduler Config
|
|
475
|
+
Customize background sync and dreamer options. **Note**: The cron scheduler configuration is exclusively designed for persistent agent host environments like Antigravity, and it **supports smart cross-session deduplication** on startup:
|
|
476
|
+
```json
|
|
477
|
+
{
|
|
478
|
+
"yongle": {
|
|
479
|
+
"sync": {
|
|
480
|
+
"interval": 3600000,
|
|
481
|
+
"global_repo_url": "https://github.com/yourname/Yongle-Sync"
|
|
482
|
+
},
|
|
483
|
+
"scheduler": {
|
|
484
|
+
"sync": {
|
|
485
|
+
"enabled": true,
|
|
486
|
+
"cron": "0 */2 * * *"
|
|
487
|
+
},
|
|
488
|
+
"dreamer": {
|
|
489
|
+
"enabled": true,
|
|
490
|
+
"cron": "*/15 * * * *",
|
|
491
|
+
"quick_idle_ms": 300000,
|
|
492
|
+
"long_idle_ms": 1800000,
|
|
493
|
+
"provider": "ollama",
|
|
494
|
+
"model": "llama3",
|
|
495
|
+
"apiKey": "Optional",
|
|
496
|
+
"baseUrl": "http://localhost:11434"
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
```
|
|
502
|
+
> - `interval` sets the background pull timer in milliseconds for standard terminal execution (defaults to 1 hour, dies when process exits).
|
|
503
|
+
> - `global_repo_url` specifies the remote GitHub repository backup path for your global knowledge base.
|
|
504
|
+
> - `cron` is **exclusive to Antigravity Agent environments** to provision persistent cron tasks. When the agent launches a new session, it performs a **`manage_task(Action='list')` check** to ensure only one active task runs globally, preventing duplicates across multiple open chat windows.
|
|
505
|
+
> - Under the `dreamer` node, you can override LLM configurations (e.g. `provider`, `model`, `baseUrl`) to decouple background postmortem extraction from your daily chat model, saving costs. If left unconfigured, it automatically inherits from the global `agent` node.
|
|
506
|
+
|
|
507
|
+
##### Config Gemini (Recommended)
|
|
508
|
+
```json
|
|
509
|
+
{
|
|
510
|
+
"embedding": {
|
|
511
|
+
"enabled": true,
|
|
512
|
+
"provider": "gemini",
|
|
513
|
+
"model": "gemini-embedding-001",
|
|
514
|
+
"apiKey": "YOUR_GEMINI_API_KEY"
|
|
515
|
+
},
|
|
516
|
+
"agent": {
|
|
517
|
+
"enabled": true,
|
|
518
|
+
"provider": "gemini",
|
|
519
|
+
"model": "gemini-1.5-flash",
|
|
520
|
+
"apiKey": "YOUR_GEMINI_API_KEY"
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
##### Config DeepSeek
|
|
526
|
+
```json
|
|
527
|
+
{
|
|
528
|
+
"embedding": {
|
|
529
|
+
"enabled": true,
|
|
530
|
+
"provider": "deepseek",
|
|
531
|
+
"model": "deepseek-embedding",
|
|
532
|
+
"apiKey": "YOUR_DEEPSEEK_API_KEY"
|
|
533
|
+
},
|
|
534
|
+
"agent": {
|
|
535
|
+
"enabled": true,
|
|
536
|
+
"provider": "deepseek",
|
|
537
|
+
"model": "deepseek-chat",
|
|
538
|
+
"apiKey": "YOUR_DEEPSEEK_API_KEY"
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
##### Config Ollama (Self-hosted Local)
|
|
544
|
+
```json
|
|
545
|
+
{
|
|
546
|
+
"embedding": {
|
|
547
|
+
"enabled": true,
|
|
548
|
+
"provider": "ollama",
|
|
549
|
+
"model": "nomic-embed-text",
|
|
550
|
+
"baseUrl": "http://localhost:11434"
|
|
551
|
+
},
|
|
552
|
+
"agent": {
|
|
553
|
+
"enabled": true,
|
|
554
|
+
"provider": "ollama",
|
|
555
|
+
"model": "llama3",
|
|
556
|
+
"baseUrl": "http://localhost:11434"
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
##### About Enabled Flags (enabled) 💡
|
|
562
|
+
- **`embedding.enabled`**: If set to `false`, it disables embedding generation and vector search. Queries (`/yongle-search`) will **gracefully fallback** to local-only SQLite FTS5 keyword matching, and postmortem confirmation (`/yongle-confirm`) will bypass vector processing to save resources.
|
|
563
|
+
- **`agent.enabled`**: If set to `false`, it completely disables external LLM call requests. Features requiring chat completions (like `/yongle-postmortem`) will abort immediately with friendly warning logs.
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
#### 🔄 How to Update
|
|
567
|
+
|
|
568
|
+
Updating Yongle Dadian is as simple as re-running the installation steps:
|
|
569
|
+
|
|
570
|
+
- **Automated Update (Recommended)**: Run the following command in any agent session equipped with Yongle skills:
|
|
571
|
+
```markdown
|
|
572
|
+
@[/yongle-update]
|
|
573
|
+
```
|
|
574
|
+
This command auto-detects your installation pathway (npm global or Git source clone), pulls the latest code, resolves dependencies, and re-injects all active agent runtimes with updated skills automatically.
|
|
575
|
+
|
|
576
|
+
- **Manual Update**:
|
|
577
|
+
- **Approach A (npm Global)**: Just run the `npx` command again to fetch and link the latest version:
|
|
578
|
+
```powershell
|
|
579
|
+
npx yongle-dadian --global --antigravity
|
|
580
|
+
```
|
|
581
|
+
- **Approach B (Source Clone)**: Pull latest git changes and re-run installer:
|
|
582
|
+
```powershell
|
|
583
|
+
git pull
|
|
584
|
+
npm install
|
|
585
|
+
node bin/install.js --global --antigravity
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
#### 🗑️ How to Uninstall
|
|
589
|
+
|
|
590
|
+
To cleanly remove all yongle integration and files:
|
|
591
|
+
|
|
592
|
+
1. **Uninstall Agent Skills**: Use the `--uninstall` flag in the installer to unbind skills from the host Agent:
|
|
593
|
+
```powershell
|
|
594
|
+
node bin/install.js --uninstall --global --antigravity
|
|
595
|
+
```
|
|
596
|
+
2. **(Optional) Wipe Knowledge Base**: If you want to permanently erase the local databases and Markdown notes (Caution: this is irreversible!):
|
|
597
|
+
```powershell
|
|
598
|
+
# Windows PowerShell
|
|
599
|
+
Remove-Item -Path "$HOME\.yongle_knowledge" -Recurse -Force
|
|
600
|
+
|
|
601
|
+
# macOS / Linux Bash
|
|
602
|
+
rm -rf ~/.yongle_knowledge
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
---
|
|
606
|
+
|
|
607
|
+
### 4. Quick Start
|
|
608
|
+
|
|
609
|
+
Three steps to run semantic search in your daily coding workflows:
|
|
610
|
+
|
|
611
|
+
1. **Step 1: Backfill Existing Markdown Notes**
|
|
612
|
+
If you have old markdown notes in your repository, run the batch script to generate vectors:
|
|
613
|
+
```powershell
|
|
614
|
+
npm run embed:all
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
2. **Step 2: Archive an AI Debugging Experience**
|
|
618
|
+
Once a bug is solved, type:
|
|
619
|
+
```markdown
|
|
620
|
+
@[/yongle-postmortem]
|
|
621
|
+
```
|
|
622
|
+
The AI reviews the chat context and structures a markdown postmortem draft. Choose `✅ Confirm and Archive` to save and auto-index the entry.
|
|
623
|
+
|
|
624
|
+
3. **Step 3: Perform Hybrid Query**
|
|
625
|
+
Run the search script:
|
|
626
|
+
```powershell
|
|
627
|
+
node scripts/yongle-hybrid-search.js global "how to solve character encoding bugs"
|
|
628
|
+
```
|
|
629
|
+
Or restrict queries to vector semantic-only (bypassing exact keyword matches):
|
|
630
|
+
```powershell
|
|
631
|
+
node scripts/yongle-hybrid-search.js global "char coding bugs" --semantic-only
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
---
|
|
635
|
+
|
|
636
|
+
### 5. Command Details
|
|
637
|
+
|
|
638
|
+
| Command / Script | Arguments | Description |
|
|
639
|
+
|------------------|-----------|-------------|
|
|
640
|
+
| `/yongle-postmortem` | `--global` / `--local` | **Context Postmortem Analyzer**. Scans active conversation context, extracts root causes, debug paths, and resolutions, generating a rich metadata markdown draft. |
|
|
641
|
+
| `/yongle-confirm` | `<draft-path>` | **Draft Archiver**. Upgrades a draft to a final postmortem entry, registers metadata in SQLite, and asynchronously kicks off background vector processing. |
|
|
642
|
+
| `scripts/yongle-hybrid-search.js` | `<scope> <query> [--semantic-only]` | **Hybrid Searcher CLI**. Prints SQLite results instantly on TTY, performs vector embeddings in the background, fuses them via RRF with 1.5x FTS Boost, and redraws the final list using ANSI screen controls. |
|
|
643
|
+
| `/yongle-tag` | None | **Process Tracker Probe**. Seeds an active debugger checkpoint in the chat context to capture step-by-step logic, prior to postmortem synthesis. |
|
|
644
|
+
| `/yongle-recall` | None | **Mind Recall**. Instantly searches structured styles, architecture plans, and thinking patterns (Thoughts/Styles). |
|
|
645
|
+
| `/yongle-reindex` | None | **Reindex Database**. Rescans specified markdown directories to reconstruct a fresh SQLite main database schema. |
|
|
646
|
+
| `npm run embed:all` | None | **Batch Vector Backfiller**. Implements concurrent processing (pool size 5) with custom memory-upsert wrappers to bypass Windows shell length limits. |
|
|
647
|
+
| `/yongle-sync` | None | **Sync Cloud Push**. Merges local memory stores to a target GitHub repository in the background. |
|
|
648
|
+
| `/yongle-config-export` | None | **Config Export**. Outputs the global config as JSON to terminal with all `apiKey` fields automatically excluded. Output can be directly used with `/yongle-config-import`. |
|
|
649
|
+
| `/yongle-config-import` | `<file>` | **Config Import**. Imports config from a JSON file with dry-run preview and `[y/N]` confirmation. `apiKey` fields are automatically excluded with a warning. |
|
|
650
|
+
| `/yongle-sync-config` | `[--pull]` | **Config Sync**. Default Push: strips `apiKey`, pushes to remote, restores local. With `--pull`: fetches remote and merges via interactive import preview. |
|
|
651
|
+
| `/yongle-update` | None | **Self-update CLI**. Detects latest changes, upgrades package dependencies if lockfile changes, and programmatically re-injects updated skills. |
|
|
652
|
+
|
|
653
|
+
---
|
|
654
|
+
|
|
655
|
+
### 6. Synergy with Harness Framework GSD (Get Shit Done)
|
|
656
|
+
|
|
657
|
+
Yongle Dadian and the AI engineering delivery harness **Get Shit Done (GSD)** form the ultimate pair-programming cycle:
|
|
658
|
+
|
|
659
|
+
- **GSD**: A structured CLI framework focused on "short-term delivery and quality control". It structures phases (Specs, Plans, Checklists, Tests) ensuring the AI **"Gets Shit Done"**.
|
|
660
|
+
- **Yongle Dadian**: A search and memory engine focused on "long-term memory and bug prevention". It acts as the brain, ensuring the AI **"Prevents Shit Happening Again"**.
|
|
661
|
+
|
|
662
|
+
#### 🔗 GitHub Harness Repository
|
|
663
|
+
- [Get Shit Done (GSD) Harness Framework](https://github.com/gsd-build/get-shit-done) (Providing rigorous AI phase governance, Nyquist audits, and automated verification loops).
|
|
664
|
+
|
|
665
|
+
---
|
|
666
|
+
|
|
667
|
+
*Copyright © 2026 Lemony. Licensed under the MIT License.*
|