memory-eternal 0.1.0 → 0.1.2
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.en.md +7 -1
- package/README.md +7 -1
- package/index.js +2 -3
- package/lib/vault.js +3 -3
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -8,13 +8,19 @@
|
|
|
8
8
|
<a href="https://dsh.market/"><img src="https://raw.githubusercontent.com/2BingLing/dsh-market/master/assets/readme/badge-listed.svg" alt="DSH Market listed" /></a>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
|
+
<p align="center">
|
|
12
|
+
<img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/memory-eternal.gif" width="880" alt="Auto-capture + visual library + knowledge graph (demo)" />
|
|
13
|
+
</p>
|
|
14
|
+
|
|
11
15
|
> **Auto-captures knowledge after every conversation and survives across sessions; recall fetches only the relevant chunks — saves tokens, less noise.**
|
|
12
16
|
> Fully self-built, zero third-party memory framework, no DSH source changes, one vault shared by every Agent, plain Markdown & git-manageable.
|
|
13
17
|
|
|
14
18
|
<p align="center"><strong>⭐ Star it if you like it!</strong> <br/><sub>DSH one-liner: <code>dsh plugin --profile web add memory-eternal</code></sub></p>
|
|
15
19
|
|
|
16
20
|
<p align="center">
|
|
17
|
-
<img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/memory-
|
|
21
|
+
<img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/memory-popup.png" width="32%" alt="Memory popup: knowledge cards / search / knowledge graph" />
|
|
22
|
+
<img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/memory-settings.png" width="32%" alt="DSH Settings → Memory: all options" />
|
|
23
|
+
<img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/memory-sidebar.png" width="32%" alt="Sidebar quick entry" />
|
|
18
24
|
</p>
|
|
19
25
|
|
|
20
26
|
---
|
package/README.md
CHANGED
|
@@ -8,13 +8,19 @@
|
|
|
8
8
|
<a href="https://dsh.market/"><img src="https://raw.githubusercontent.com/2BingLing/dsh-market/master/assets/readme/badge-listed-zh.svg" alt="DSH Market 收录" /></a>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
|
+
<p align="center">
|
|
12
|
+
<img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/memory-eternal.gif" width="880" alt="对话自动沉淀 + 图形化知识库 + 知识图谱(演示)" />
|
|
13
|
+
</p>
|
|
14
|
+
|
|
11
15
|
> **对话结束自动沉淀,跨会话不失忆;召回只取相关小块,省 token 少噪音。**
|
|
12
16
|
> 全自研、零第三方记忆框架、不改 DSH 源码、一个记忆库所有 Agent 共享,纯 Markdown 可 git 管理。
|
|
13
17
|
|
|
14
18
|
<p align="center"><strong>⭐ 觉得好用就点个 Star</strong>! <br/><sub>DSH 一条命令:<code>dsh plugin --profile web add memory-eternal</code></sub></p>
|
|
15
19
|
|
|
16
20
|
<p align="center">
|
|
17
|
-
<img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/memory-
|
|
21
|
+
<img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/memory-popup.png" width="32%" alt="记忆库弹窗:知识卡 / 检索 / 知识图谱" />
|
|
22
|
+
<img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/memory-settings.png" width="32%" alt="DSH 设置 → 记忆:全部配置项" />
|
|
23
|
+
<img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/memory-sidebar.png" width="32%" alt="侧边栏一键入口" />
|
|
18
24
|
</p>
|
|
19
25
|
|
|
20
26
|
---
|
package/index.js
CHANGED
|
@@ -310,9 +310,8 @@ export function apply(ctx, config) {
|
|
|
310
310
|
if (hits.length === 0) return `记忆库中没有与「${query}」相关的内容。`
|
|
311
311
|
const lines = hits.map((h, i) => {
|
|
312
312
|
const tags = h.tags.length ? ` [${h.tags.join(', ')}]` : ''
|
|
313
|
-
const snippet = String(
|
|
314
|
-
|
|
315
|
-
const body = includeBody ? `\n${String(h.excerpt || '')}` : ''
|
|
313
|
+
const snippet = String(h.summary || '').replace(/\s+/g, ' ').trim().slice(0, defLen)
|
|
314
|
+
const body = includeBody ? `\n${String(h.excerpt || '').slice(0, 800)}` : ''
|
|
316
315
|
return `### ${i + 1}. ${h.title}${tags}\n路径:${h.path}\n${snippet}${body}`
|
|
317
316
|
})
|
|
318
317
|
return `从记忆核心检索到 ${hits.length} 条相关卡片:\n\n${lines.join('\n\n')}`
|
package/lib/vault.js
CHANGED
|
@@ -262,7 +262,7 @@ export async function mergeCards(root, paths) {
|
|
|
262
262
|
combined += (i ? '\n\n---\n\n' : '') + body.trim()
|
|
263
263
|
})
|
|
264
264
|
const title = (first.meta.title || '合并记忆') + '(合并)'
|
|
265
|
-
const r = await writeCard(root, { kind: first.meta.kind || 'knowledge', title, tags: [...tags], body: combined, source: 'merge', status: '
|
|
265
|
+
const r = await writeCard(root, { kind: first.meta.kind || 'knowledge', title, tags: [...tags], body: combined, source: 'merge', status: 'pending', submittedBy: 'merge', reason: '多卡合并' }, { dedup: false })
|
|
266
266
|
if (!r.ok) return { ok: false, error: '写入失败' }
|
|
267
267
|
for (const t of texts) { try { await deleteCard(root, t.path, { permanent: true }) } catch { /* 尽力删除 */ } }
|
|
268
268
|
return { ok: true, path: r.path, merged: texts.length }
|
|
@@ -364,7 +364,7 @@ export async function setCardStatus(root, rel, status) {
|
|
|
364
364
|
}
|
|
365
365
|
|
|
366
366
|
/** 原子写卡;先去重(target 目录内),命中返回 {duplicate}。 */
|
|
367
|
-
export async function writeCard(root, { kind, title, tags = [], body, source = '', status = '
|
|
367
|
+
export async function writeCard(root, { kind, title, tags = [], body, source = '', status = 'pending', submittedBy = '', severity = 'info', reason = '', deletedAt = '' }, { threshold = 0.62, dedup = true } = {}) {
|
|
368
368
|
const kindRoot = KIND_ROOTS[kind] || KIND_ROOTS.knowledge
|
|
369
369
|
const dir = path.join(root, kindRoot)
|
|
370
370
|
await fs.mkdir(dir, { recursive: true })
|
|
@@ -467,7 +467,7 @@ export async function search(root, query, { limit = 30, minScore = 0, semantic =
|
|
|
467
467
|
// 本地语义加分:Jaccard bigram 相似度(无 embedding 依赖),覆盖「同义改写/片段命中」
|
|
468
468
|
if (semantic) score += Math.round(textSimilarity(q, `${card.title} ${card.summary}`) * 6)
|
|
469
469
|
if (score > 0 && score >= minScore) {
|
|
470
|
-
out.push({ ...card, score })
|
|
470
|
+
out.push({ ...card, score, excerpt: text.replace(/^---[\s\S]*?---\r?\n?/, '').trim() })
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
// 反馈反哺排序:对该查询「有用」的卡加分、「无关」的减分;query 与本次有词交集即生效。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memory-eternal",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "记忆核心(Memory Eternal):自研的 DeepSeek Harness 记忆插件,不移植任何既有记忆框架——对话结束后自动沉淀知识卡到本地 Markdown Vault(自研去重、自研 CJK 检索、可 git 管理),设置页提供图形化知识库(统计 / 搜索 / 知识图谱 + 侧边栏一键弹窗),Agent 通过 memory_recall 工具按需召回历史上下文。零人工干预。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|