@sparkelf/dsh-knowledge-base 0.6.2 → 0.6.4
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 +21 -7
- package/SKILL.md +24 -8
- package/lib/client.js +972 -1180
- package/lib/client.js.map +1 -1
- package/lib/index.js +1872 -1732
- package/lib/types/client/locales.d.ts +1 -1
- package/lib/types/guardianSession.d.ts +1 -1
- package/lib/types/index.d.ts +12 -47
- package/lib/types/knowledgeTools.d.ts +1 -1
- package/lib/types/memoryContext.d.ts +19 -1
- package/lib/types/memoryShared.d.ts +57 -0
- package/lib/types/memoryTools.d.ts +8 -0
- package/lib/types/outlineGuard.d.ts +1 -1
- package/package.json +6 -3
- package/{skills/knowledge-graph/SKILL.md → references/graph.md} +0 -5
- package/{skills/kb-organize/SKILL.md → references/organize.md} +2 -14
- package/{skills/kb-summarize/SKILL.md → references/summarize.md} +2 -7
- package/{skills/kb-vectorize/SKILL.md → references/vectorize.md} +1 -6
- package/skills/memory/SKILL.md +50 -0
- package/skills/memory/i18n/zh.json +10 -0
- package/skills/{memory-extract/SKILL.md → memory/references/extract.md} +0 -5
- package/skills/{memory-guardian/SKILL.md → memory/references/guardian.md} +3 -8
- package/skills/{memory-sop-evaluate/SKILL.md → memory/references/sop-evaluate.md} +1 -6
- package/skills/memory-extract/i18n/zh.json +10 -0
- package/skills/memory-guardian/i18n/zh.json +10 -0
- package/skills/memory-sop-evaluate/i18n/zh.json +10 -0
- package/skills/kb-organize/i18n/zh.json +0 -10
- package/skills/kb-summarize/i18n/zh.json +0 -10
- package/skills/kb-vectorize/i18n/zh.json +0 -10
|
@@ -578,7 +578,7 @@ export declare const en: {
|
|
|
578
578
|
readonly vectorCoverage: "Embedded {embedded} / {total} chunks; failed {failed}.";
|
|
579
579
|
readonly vectorProgress: "Vectorizing {done} / {total} documents...";
|
|
580
580
|
readonly vectorRebuild: "Rebuild vector index";
|
|
581
|
-
readonly vectorRebuildHint: "Whole-library rebuild; asks for confirmation. Use
|
|
581
|
+
readonly vectorRebuildHint: "Whole-library rebuild; asks for confirmation. Use the knowledge-base skill vectorize flow for one document or directory.";
|
|
582
582
|
readonly vectorRebuildConfirm: "Rebuild vectors for the whole knowledge base? This calls the embedding provider for every current chunk.";
|
|
583
583
|
readonly vectorBadNumber: "Vector settings contain an invalid number.";
|
|
584
584
|
readonly settingsMineruExplicit: "Currently using the address above.";
|
|
@@ -108,7 +108,7 @@ export declare class GuardianTimeoutError extends Error {
|
|
|
108
108
|
/** Title is display-only but stable, so an operator can recognize the session. */
|
|
109
109
|
export declare const GUARDIAN_SESSION_TITLE = "\u8BB0\u5FC6\u5B88\u62A4\u4F1A\u8BDD";
|
|
110
110
|
/** Skill the guardian must load before doing anything else. */
|
|
111
|
-
export declare const GUARDIAN_SKILL_NAME = "memory
|
|
111
|
+
export declare const GUARDIAN_SKILL_NAME = "memory";
|
|
112
112
|
/**
|
|
113
113
|
* The preset first message. It intentionally stays product-level: read the
|
|
114
114
|
* skill, check memory state, ensure the daily dream task exists.
|
package/lib/types/index.d.ts
CHANGED
|
@@ -186,7 +186,7 @@ export interface Config {
|
|
|
186
186
|
* Outline generation policy.
|
|
187
187
|
*
|
|
188
188
|
* `autoGenerate: false` (the default) means upload/extraction build only the TOC and
|
|
189
|
-
* section structure. Summaries are written later by the
|
|
189
|
+
* section structure. Summaries are written later by the knowledge-base summarize flow through
|
|
190
190
|
* `kb_outline_save`. `true` restores the legacy deterministic extractive summaries.
|
|
191
191
|
*/
|
|
192
192
|
outline: {
|
|
@@ -1193,12 +1193,11 @@ export interface StepRun {
|
|
|
1193
1193
|
export declare const KNOWLEDGE_SKILL_PROVIDER = "dsh-knowledge-base";
|
|
1194
1194
|
/** Name the model sees in the skill catalog. */
|
|
1195
1195
|
export declare const KNOWLEDGE_SKILL_NAME = "knowledge-base";
|
|
1196
|
-
/**
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
export declare const
|
|
1201
|
-
export declare const KNOWLEDGE_GRAPH_SKILL_DESCRIPTION = "\u8BFB\u5199\u56E2\u961F\u77E5\u8BC6\u5E93\u91CC\u7684\u77E5\u8BC6\u56FE\u8C31\uFF1A\u4E3B\u9898\u5361\u3001\u5173\u7CFB\u6587\u6863\u4E0E\u56DB\u4E2A\u52A8\u4F5C\u3002";
|
|
1196
|
+
/**
|
|
1197
|
+
* One bundled memory skill: the guardian, extraction subagent, and SOP evaluation
|
|
1198
|
+
* subagent rules moved into `references/` under this single catalog entry.
|
|
1199
|
+
*/
|
|
1200
|
+
export declare const MEMORY_SKILL_NAME = "memory";
|
|
1202
1201
|
/**
|
|
1203
1202
|
* Short description shown in the skill list.
|
|
1204
1203
|
*
|
|
@@ -1207,17 +1206,6 @@ export declare const KNOWLEDGE_GRAPH_SKILL_DESCRIPTION = "\u8BFB\u5199\u56E2\u96
|
|
|
1207
1206
|
* be available before the file is opened.
|
|
1208
1207
|
*/
|
|
1209
1208
|
export declare const KNOWLEDGE_SKILL_DESCRIPTION: string;
|
|
1210
|
-
/**
|
|
1211
|
-
* Short description of the explicit summary skill.
|
|
1212
|
-
*
|
|
1213
|
-
* Upload and extraction never write summaries. This skill is the only documented way to
|
|
1214
|
-
* turn source chunks into document/section summaries and key facts, and it does so through
|
|
1215
|
-
* the model's own reading plus `kb_outline_save` -- never through a hidden LLM call inside
|
|
1216
|
-
* the plugin.
|
|
1217
|
-
*/
|
|
1218
|
-
export declare const KB_SUMMARIZE_SKILL_DESCRIPTION: string;
|
|
1219
|
-
/** Short description of the explicit vectorization skill. */
|
|
1220
|
-
export declare const KB_VECTORIZE_SKILL_DESCRIPTION: string;
|
|
1221
1209
|
/**
|
|
1222
1210
|
* Where this package's SKILL.md lives, from either build layout.
|
|
1223
1211
|
*
|
|
@@ -1228,31 +1216,10 @@ export declare const KB_VECTORIZE_SKILL_DESCRIPTION: string;
|
|
|
1228
1216
|
* @returns absolute path of the SKILL.md this plugin ships.
|
|
1229
1217
|
*/
|
|
1230
1218
|
export declare function knowledgeSkillPath(): string;
|
|
1231
|
-
/**
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
* run from `src/` sit one level below the package root.
|
|
1236
|
-
*
|
|
1237
|
-
* @returns absolute path of the kb-summarize SKILL.md.
|
|
1238
|
-
*/
|
|
1239
|
-
export declare function kbSummarizeSkillPath(): string;
|
|
1240
|
-
/** Where the bundled `kb-vectorize` skill lives. */
|
|
1241
|
-
export declare function kbVectorizeSkillPath(): string;
|
|
1242
|
-
/** Where the bundled `knowledge-graph` skill lives. */
|
|
1243
|
-
export declare function knowledgeGraphSkillPath(): string;
|
|
1244
|
-
/** The guardian's own operating skill. */
|
|
1245
|
-
export declare const MEMORY_GUARDIAN_SKILL_NAME = "memory-guardian";
|
|
1246
|
-
/** The extraction subagent's skill. */
|
|
1247
|
-
export declare const MEMORY_EXTRACT_SKILL_NAME = "memory-extract";
|
|
1248
|
-
/** The SOP evaluation subagent's skill. */
|
|
1249
|
-
export declare const MEMORY_SOP_EVALUATE_SKILL_NAME = "memory-sop-evaluate";
|
|
1250
|
-
/** Where the bundled `memory-guardian` skill lives. */
|
|
1251
|
-
export declare function memoryGuardianSkillPath(): string;
|
|
1252
|
-
/** Where the bundled `memory-extract` skill lives. */
|
|
1253
|
-
export declare function memoryExtractSkillPath(): string;
|
|
1254
|
-
/** Where the bundled `memory-sop-evaluate` skill lives. */
|
|
1255
|
-
export declare function memorySopEvaluateSkillPath(): string;
|
|
1219
|
+
/** Where the bundled one-entry `memory` skill lives. */
|
|
1220
|
+
export declare function memorySkillPath(): string;
|
|
1221
|
+
/** Short description of the unified memory skill. */
|
|
1222
|
+
export declare const MEMORY_SKILL_DESCRIPTION = "\u4E2A\u4EBA\u8BB0\u5FC6\u7CFB\u7EDF\u7684\u7EDF\u4E00\u5165\u53E3\uFF1A\u8BB0\u5FC6\u5B88\u62A4\u4F1A\u8BDD\u3001\u8BB0\u5FC6\u62BD\u53D6\u5B50\u4EE3\u7406\u4E0E SOP \u8BC4\u4F30\u5B50\u4EE3\u7406\u90FD\u5148\u8BFB\u5B83\uFF0C\u518D\u6309\u89D2\u8272\u52A0\u8F7D references \u4E2D\u7684\u5BF9\u5E94\u51C6\u5219\u3002";
|
|
1256
1223
|
/**
|
|
1257
1224
|
* Where this package's tutorial document lives, from either build layout.
|
|
1258
1225
|
*
|
|
@@ -1274,10 +1241,8 @@ export declare function tutorialTemplatePath(): string;
|
|
|
1274
1241
|
* @returns a provider the skill registry can list and read.
|
|
1275
1242
|
*/
|
|
1276
1243
|
export declare const KNOWLEDGE_SKILL_RANK = 640;
|
|
1277
|
-
/** The
|
|
1278
|
-
export declare const
|
|
1279
|
-
/** Vectorization is another explicit, specialised action. */
|
|
1280
|
-
export declare const KB_VECTORIZE_SKILL_RANK = 660;
|
|
1244
|
+
/** The memory skill is a specialised role bundle, so it sorts after the general KB skill. */
|
|
1245
|
+
export declare const MEMORY_SKILL_RANK = 670;
|
|
1281
1246
|
/** Both a human and the model may invoke this skill. */
|
|
1282
1247
|
export declare const KNOWLEDGE_SKILL_INVOCATION: {
|
|
1283
1248
|
readonly modelInvocable: true;
|
|
@@ -79,7 +79,7 @@ export interface KnowledgeOutline {
|
|
|
79
79
|
summary: string;
|
|
80
80
|
/** How the current summary was produced. */
|
|
81
81
|
summaryKind?: OutlineSummaryKind;
|
|
82
|
-
/** `missing` until
|
|
82
|
+
/** `missing` until the knowledge-base summarize flow saves a model-authored summary. */
|
|
83
83
|
summaryStatus?: 'ready' | 'missing';
|
|
84
84
|
/** Actionable next step when the summary is missing. */
|
|
85
85
|
hint?: string;
|
|
@@ -12,8 +12,13 @@ export declare const SYSTEM_POLICY_MARKER = "system policy overrides personal me
|
|
|
12
12
|
* `personal` is the user's own `MemoryStore` snapshot (`偏好.md`, `踩坑.md`,
|
|
13
13
|
* `事实.md`, `SOP/`, daily logs). It has no binding and no graph-side authority:
|
|
14
14
|
* it is always advisory, so it can never outrank a department/global redline.
|
|
15
|
+
*
|
|
16
|
+
* `shared` is an approved department/global promotion read from the scope's
|
|
17
|
+
* `记忆共享/` graph. It needs no binding either, but unlike personal memory it is
|
|
18
|
+
* published policy-shaped content: still advisory, still below redline/canonical,
|
|
19
|
+
* yet kept when the user pauses personal memory.
|
|
15
20
|
*/
|
|
16
|
-
export type MemoryContextMode = 'subscribe' | 'internalize' | 'personal';
|
|
21
|
+
export type MemoryContextMode = 'subscribe' | 'internalize' | 'personal' | 'shared';
|
|
17
22
|
/** Where one resolved context entry came from. */
|
|
18
23
|
export type MemoryContextSourceType = BindingSourceType | 'entry';
|
|
19
24
|
/** One resolved node/edge/memory the runtime may inject. */
|
|
@@ -42,6 +47,8 @@ export interface MemoryContextEntry {
|
|
|
42
47
|
to?: string;
|
|
43
48
|
/** Personal-memory privacy label; absent on graph bindings. */
|
|
44
49
|
privacy?: Privacy;
|
|
50
|
+
/** `global` or `department:<code>` for a shared-memory document. */
|
|
51
|
+
scope?: string;
|
|
45
52
|
/** Last update of a personal entry; absent on graph bindings. */
|
|
46
53
|
updatedAt?: string;
|
|
47
54
|
body: string;
|
|
@@ -67,6 +74,8 @@ export interface MemoryContextResult {
|
|
|
67
74
|
redlineCount: number;
|
|
68
75
|
/** Number of selected entries that came from the caller's own `MemoryStore`. */
|
|
69
76
|
personalCount: number;
|
|
77
|
+
/** Number of selected entries read from a department/global `记忆共享/` graph. */
|
|
78
|
+
sharedCount: number;
|
|
70
79
|
/** Non-empty when at least one redline is present. */
|
|
71
80
|
systemPolicy: string;
|
|
72
81
|
}
|
|
@@ -87,6 +96,15 @@ export interface MemoryContextInput {
|
|
|
87
96
|
* example a paused memory setting).
|
|
88
97
|
*/
|
|
89
98
|
personalMemoryRoot?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Personal memory is paused for this caller.
|
|
101
|
+
*
|
|
102
|
+
* Design §22.2: pausing stops personal memory from influencing answers, but
|
|
103
|
+
* department/global policy — and every redline — still applies. The resolver
|
|
104
|
+
* therefore skips the caller's internalized branches and personal store while
|
|
105
|
+
* keeping department/global subscriptions and shared memory.
|
|
106
|
+
*/
|
|
107
|
+
paused?: boolean;
|
|
90
108
|
/** Prompt budget; defaults to {@link DEFAULT_MEMORY_CONTEXT_MAX_CHARS}. */
|
|
91
109
|
maxChars?: number;
|
|
92
110
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { LoadedGraph, MemoryAuthority, MemoryOrigin, MemoryReviewStatus } from './graphModel.ts';
|
|
2
|
+
import { type Privacy } from './memoryTypes.ts';
|
|
3
|
+
/** The caller fields the shared scope roots are derived from. */
|
|
4
|
+
export interface SharedMemoryCaller {
|
|
5
|
+
departmentCode?: string;
|
|
6
|
+
departmentPathCodes?: readonly string[];
|
|
7
|
+
}
|
|
8
|
+
/** One scope root that may hold a shared-memory graph. */
|
|
9
|
+
export interface SharedMemoryScopeRoot {
|
|
10
|
+
scope: 'global' | 'department';
|
|
11
|
+
/** Scope-relative root without a trailing slash (`global`, `department/A/B`). */
|
|
12
|
+
relPath: string;
|
|
13
|
+
/** Leaf department code for a department root. */
|
|
14
|
+
departmentCode?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The shared-memory scope roots a caller may own content under.
|
|
18
|
+
*
|
|
19
|
+
* `global` is always a candidate (subject to `canRead`); the department root is
|
|
20
|
+
* the caller's own organization chain, never a sibling. Order is global first,
|
|
21
|
+
* then department, so the rendered context is deterministic.
|
|
22
|
+
*
|
|
23
|
+
* @param caller - the authenticated caller's department projection.
|
|
24
|
+
* @returns Scope roots in a stable order.
|
|
25
|
+
*/
|
|
26
|
+
export declare function sharedMemoryScopeRoots(caller: SharedMemoryCaller): SharedMemoryScopeRoot[];
|
|
27
|
+
/** One shared document a caller may inject, before context-level dedupe/sort. */
|
|
28
|
+
export interface SharedMemoryCandidate {
|
|
29
|
+
/** Node id (`mem-mp-…`); also the dedupe key against a subscription binding. */
|
|
30
|
+
id: string;
|
|
31
|
+
title: string;
|
|
32
|
+
/** Graph node type (`topic`, `fact`, `case`, `procedure`, `policy`, `skill`). */
|
|
33
|
+
type: string;
|
|
34
|
+
authority: MemoryAuthority;
|
|
35
|
+
origin: MemoryOrigin;
|
|
36
|
+
reviewStatus: MemoryReviewStatus;
|
|
37
|
+
privacy: Privacy;
|
|
38
|
+
/** Scope-relative document path (`记忆共享/<id>.md`). */
|
|
39
|
+
path: string;
|
|
40
|
+
/** `global` or `department:<code>` from the manifest. */
|
|
41
|
+
scope: string;
|
|
42
|
+
status: 'active';
|
|
43
|
+
version: number;
|
|
44
|
+
body: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Read every injectable node of one shared-memory graph.
|
|
48
|
+
*
|
|
49
|
+
* A missing or unreadable document is skipped (fail soft): one broken promotion
|
|
50
|
+
* must not hide a redline or fail the whole context. A graph that is not the
|
|
51
|
+
* shared-memory graph, or whose manifest scope is neither `global` nor
|
|
52
|
+
* `department:<code>`, contributes nothing.
|
|
53
|
+
*
|
|
54
|
+
* @param graph - the loaded graph; its `root` must be the scope root.
|
|
55
|
+
* @returns Candidates in manifest node order, already privacy-filtered.
|
|
56
|
+
*/
|
|
57
|
+
export declare function readSharedMemoryCandidates(graph: LoadedGraph): Promise<SharedMemoryCandidate[]>;
|
|
@@ -42,6 +42,14 @@ export interface MemoryToolHost {
|
|
|
42
42
|
personalMemoryRoot?(viewer: GraphViewer): string;
|
|
43
43
|
/** Every graph the caller may read. Implementations must not return a denied graph. */
|
|
44
44
|
loadGraphs(viewer: GraphViewer): Promise<LoadedGraph[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Department/global shared-memory graphs the caller may read (`shared-memory`
|
|
47
|
+
* under the caller's own department chain and the global scope).
|
|
48
|
+
*
|
|
49
|
+
* This is a separate seam from {@link loadGraphs} so the guardian pass keeps its
|
|
50
|
+
* existing graph scope: shared memory is runtime context, not a graph to bind.
|
|
51
|
+
*/
|
|
52
|
+
loadSharedGraphs?(viewer: GraphViewer): Promise<LoadedGraph[]>;
|
|
45
53
|
/** Whether the caller holds the memory-management capability (`kb:config:manage`). */
|
|
46
54
|
canManage(viewer: GraphViewer): Promise<boolean> | boolean;
|
|
47
55
|
/** Whether personal memory is enabled for this caller; a paused user gets no personal entries. */
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Grounding checks for model-written document summaries.
|
|
3
3
|
*
|
|
4
4
|
* Uploading and extraction never create prose. A summary only enters the index when the
|
|
5
|
-
*
|
|
5
|
+
* knowledge-base summarize flow has read the original chunks and the model submits it through
|
|
6
6
|
* `kb_outline_save`; this module is the gate between that submission and the database.
|
|
7
7
|
*
|
|
8
8
|
* The gate is deliberately mechanical. It does not judge whether a sentence is a good
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sparkelf/dsh-knowledge-base",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "DataOps-backed knowledge base for DeepSeek Harness: a left-sidebar destination, Settings configuration, and index tooling over a mounted NAS view.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -46,7 +46,9 @@
|
|
|
46
46
|
"万相AI使用教程.html",
|
|
47
47
|
"i18n/*.json",
|
|
48
48
|
"skills/**/SKILL.md",
|
|
49
|
-
"skills/**/i18n/*.json"
|
|
49
|
+
"skills/**/i18n/*.json",
|
|
50
|
+
"skills/**/references/**/*",
|
|
51
|
+
"references/**/*"
|
|
50
52
|
],
|
|
51
53
|
"scripts": {
|
|
52
54
|
"build": "rm -rf lib && tsc -p tsconfig.build.json && tsdown",
|
|
@@ -94,6 +96,7 @@
|
|
|
94
96
|
"@deepseek-ai/dsh-credentials": "0.1.7-rc.2",
|
|
95
97
|
"@deepseek-ai/dsh-tools": "0.1.7-rc.2",
|
|
96
98
|
"@types/react": "~18.3.1",
|
|
99
|
+
"clsx": "^2.1.1",
|
|
97
100
|
"jsdom": "^26.1.0",
|
|
98
101
|
"lightningcss": "^1.32.0",
|
|
99
102
|
"react": "^18.2.0",
|
|
@@ -101,7 +104,7 @@
|
|
|
101
104
|
"tsdown": "^0.22.2",
|
|
102
105
|
"@deepseek-ai/dsh-client-ui-sidebar": "0.2.1-alpha.2",
|
|
103
106
|
"@deepseek-ai/dsh-client-ui-layout": "0.2.1-alpha.2",
|
|
104
|
-
"dsh-better-sidebar": "0.
|
|
107
|
+
"dsh-better-sidebar": "0.33.0",
|
|
105
108
|
"@deepseek-ai/dsh-client-ui-session": "0.2.1-alpha.2"
|
|
106
109
|
},
|
|
107
110
|
"peerDependenciesMeta": {
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: kb-organize
|
|
3
|
-
description: 整理知识库、归档文档、生成索引、按内容分类归类时使用。适用于「整理一下知识库」「帮我归档」「把这些文档分类归并」「生成目录索引」「建个知识体系」等请求:先读整理偏好,再逐篇读内容理解,按主题建分层文件夹并移动文档,最后为每层写一份层索引 md。缺 md 文本副本的文档会先补索引。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
1
|
# 知识库整理 — 分层归类与层索引
|
|
7
2
|
|
|
8
3
|
把一个知识库目录从「一堆平铺的文件」整理成「按主题分层的文件夹 + 每层一份索引 md」。核心是三件事:**读懂每篇文档在讲什么**、**按内容而不是文件名分层**、**每层留一份能被人和模型直接用的索引**。
|
|
@@ -353,13 +348,6 @@ curl -sS -X POST http://127.0.0.1:3080/knowledge-base/api/read \
|
|
|
353
348
|
- **大库分批。** 超过 50 篇时按类目分批处理,每批结束汇报进度,不要静默跑很久
|
|
354
349
|
- **整理前先确认范围。** 「整理知识库」可能指整个库,也可能只指某个目录。范围不明时先 `list` 根层,把看到的结构给用户,让他指定范围
|
|
355
350
|
|
|
356
|
-
##
|
|
357
|
-
|
|
358
|
-
这份技能住在 `packages/knowledge-base/skills/kb-organize/`,通过 **工作区根 `~/.agents/skills/kb-organize` 的软链接**被技能中心发现。走这条路径的原因:本仓库的 `knowledge-base` 技能是在 `src/index.ts` 里以 **code-registered provider** 注册的,而技能中心只扫描固定的几类根目录(工作区根 `.agents/skills`、`$DSH_HOME/skills` 等),不会扫描包内的 `skills/` 子目录。
|
|
359
|
-
|
|
360
|
-
若要让这个技能**随 npm 包一起发布**(而不是只在本机工作区可见),需要两处改动,缺一不可:
|
|
361
|
-
|
|
362
|
-
1. `packages/knowledge-base/package.json` 的 `files` 数组加入 `"skills/**"`(当前只列了 `lib/**`、`cordis.patch.yml`、`README.md`、`LICENSE`,技能文件不会进包);
|
|
363
|
-
2. `packages/knowledge-base/src/index.ts` 增加**第二个** skill provider(现有 `knowledgeBaseSkillProvider()` 只注册 `knowledge-base` 一个),并在 `apply()` 的 `inject(['skills'], …)` 回调里与现有 provider 一起注册。
|
|
351
|
+
## 九、本参考的安装位置(维护者读)
|
|
364
352
|
|
|
365
|
-
|
|
353
|
+
本文件是 `knowledge-base` 技能的整理流程参考,随 `@sparkelf/dsh-knowledge-base` 包发布:`knowledgeBaseSkillProvider()` 注册 `knowledge-base` 主技能,主技能用 `references/organize.md` 链接到这里。不要再单独创建 `kb-organize` 技能或软链接,也不要在 profile 的 `cordis.patch.yml` 里手工挂载。
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: kb-summarize
|
|
3
|
-
description: "为知识库中的一篇文档显式生成摘要与关键事实。适用于「生成摘要」「总结这篇文档」「提炼要点」「给这篇制度做索引」「更新文档摘要」「kb-summarize」等请求:先用 kb_outline 拿目录,再逐章读原文 chunk,由当前 agent 生成 doc/section summary 与 keyFacts,最后用 kb_outline_save 落库。上传/抽取不会自动生成摘要;摘要只作导航,引用仍用原文 chunk token。"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
1
|
# 知识库文档摘要 — 显式生成、原文校验、落库
|
|
7
2
|
|
|
8
|
-
|
|
3
|
+
本参考只做一件事:**把一篇已入库文档的原文,变成可导航的文档摘要 + 章节摘要 + 关键事实,并写回知识库索引。**
|
|
9
4
|
|
|
10
|
-
它**不是**上传/抽取的一部分。上传、MinerU 解析、FTS 建索引都只建立目录(TOC)和章节结构,`summary`
|
|
5
|
+
它**不是**上传/抽取的一部分。上传、MinerU 解析、FTS 建索引都只建立目录(TOC)和章节结构,`summary` 保持为空。只有用户明确要求摘要,或你在回答广泛/比较类问题前判断需要摘要时,才执行本流程。
|
|
11
6
|
|
|
12
7
|
> **摘要不是引用来源。** 回答里引用事实时,仍必须使用 `kb_search` / `kb_chunk_get` 返回的原文 `kb://doc/<docId>/chunk/<key>` token。`INDEX.md`、`summary`、`sectionSummary`、`keyFacts` 都不能当 citation。
|
|
13
8
|
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: kb-vectorize
|
|
3
|
-
description: "为知识库中的指定文档或指定目录显式建立/补齐向量索引。适用于「给这个文档做向量化」「给这个目录建向量索引」「补齐向量」「kb-vectorize」等请求:先用 kb_vectorize dryRun 预估,再按需执行;不要自动对全库执行。向量只影响召回,不改变 citation/token/摘要/outline。"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
1
|
# 知识库向量化 — 定向、可预估、不改变引用
|
|
7
2
|
|
|
8
|
-
|
|
3
|
+
本参考只做一件事:**对用户明确指定的一篇文档或一个目录下的文档,建立或补齐向量索引。**
|
|
9
4
|
|
|
10
5
|
它**不是**默认检索行为。`retrieval.vector.enabled` 关闭时 `kb_vectorize` 会明确报错,不会静默降级;设置页的“重建向量索引”是对全库的显式操作,需要管理员确认。
|
|
11
6
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: memory
|
|
3
|
+
description: 个人记忆系统的统一入口。记忆守护会话、记忆抽取子代理、SOP 评估子代理,以及任何需要判断“什么值得长期记住、怎么合并纠偏、SOP 是否该晋升”的任务都先读本技能,再按角色加载 references 中的对应准则。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Memory
|
|
7
|
+
|
|
8
|
+
个人记忆只有一套写入链路:普通会话留下消息和工具轨迹,**记忆守护会话**是唯一写入者;抽取与 SOP 评估子代理只产出带证据的判断,不直接写记忆。三条角色准则放在 `references/`,按当前角色只读一份,不要一次全读。
|
|
9
|
+
|
|
10
|
+
## 什么时候用
|
|
11
|
+
|
|
12
|
+
- 当前会话是记忆守护会话,收到 idle / compaction / dream 消息;
|
|
13
|
+
- 被派为记忆抽取子代理,要从会话轨迹里提长期候选;
|
|
14
|
+
- 被派为 SOP 评估子代理,要判断活跃 SOP 是否被使用、是否有效、下一步怎么办;
|
|
15
|
+
- 用户问记忆规则、隐私分级、SOP 晋升标准,或要求整理/遗忘某条记忆。
|
|
16
|
+
|
|
17
|
+
## 先选角色
|
|
18
|
+
|
|
19
|
+
| 你的角色 | 读哪份参考 | 产出 |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| 记忆守护会话(唯一写入者) | [references/guardian.md](references/guardian.md) | 合并、纠偏、遗忘、日文档、SOP 晋升与审计 |
|
|
22
|
+
| 记忆抽取子代理 | [references/extract.md](references/extract.md) | 五类候选 + 证据,不改写记忆 |
|
|
23
|
+
| SOP 评估子代理 | [references/sop-evaluate.md](references/sop-evaluate.md) | 每份 SOP 的用量/效果判断与修订/晋升/保留/淘汰建议 |
|
|
24
|
+
|
|
25
|
+
守护会话派子代理时,明确告诉它读哪份参考;子代理不要把详细报告当成交付,只回一段结论,详细证据留在临时报告里由守护会话读取后删除。
|
|
26
|
+
|
|
27
|
+
## 通用硬规则
|
|
28
|
+
|
|
29
|
+
- **只留会改变下次行为的内容**:偏好、踩坑、情景、事实、SOP 五类;闲聊、一次性查询、公共制度不进入个人记忆。
|
|
30
|
+
- **每条都要有证据**:能定位到原消息或工具结果;没有证据的候选不提。
|
|
31
|
+
- **不保存秘密**:密钥、Token、密码只记“哪份凭据、什么用途、用于哪个系统”,实际值归凭据管理器。
|
|
32
|
+
- **隐私分级**:`normal` / `private` / `sensitive` / `secret`;拿不准按 `private` 处理。`private` 与 `sensitive` 不进部门提炼、不进共享摘要、不导出。
|
|
33
|
+
- **部门 canonical 与红线优先**:个人记忆与部门制度冲突时标记冲突,不要悄悄覆盖。
|
|
34
|
+
- **串行处理**:守护会话按消息到达顺序一轮一轮处理;上一轮没收尾,不开始下一轮。一个用户只有一个守护会话。
|
|
35
|
+
- **不做机械计数**:SOP 评估靠轨迹与原文证据做整体判断,不数使用次数、不设评分阈值。
|
|
36
|
+
- **删除是真遗忘**:用户要求删除、偏好过期或长期低价值时,真正删除并写清原因;删除不是隐藏。
|
|
37
|
+
|
|
38
|
+
## 标准一轮(守护会话)
|
|
39
|
+
|
|
40
|
+
1. 确定今天真正活跃的会话范围(上次 dream 之后有新增消息或工具事件);
|
|
41
|
+
2. 并行派抽取子代理和 SOP 评估子代理,各自按对应参考工作;
|
|
42
|
+
3. 合并五类记忆,去重、纠偏、遗忘,更新日文档与当前有效快照;
|
|
43
|
+
4. 评估并晋升 SOP:有效且可复用才沉淀为技能,技能写成功后再删除 SOP;
|
|
44
|
+
5. 写审计,并用个人 scope 的 Git 提交作为 dream 前后恢复点。
|
|
45
|
+
|
|
46
|
+
细节(读什么、怎么合并、怎么写标题、隐私边界、Git 恢复点命令)见 [references/guardian.md](references/guardian.md)。
|
|
47
|
+
|
|
48
|
+
## 相关技能
|
|
49
|
+
|
|
50
|
+
- `knowledge-base`:记忆文档、主题卡与知识图谱的读写入口;图谱流程见该技能的 `references/graph.md`。
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_meta": {
|
|
3
|
+
"sourceHash": "e7be2b8404a463399fffd06fbf4a1d91c1c199a7",
|
|
4
|
+
"model": "manual-zh",
|
|
5
|
+
"translatedAt": "2026-11-23T10:28:00+08:00"
|
|
6
|
+
},
|
|
7
|
+
"title": "记忆",
|
|
8
|
+
"description": "个人记忆系统的统一入口:记忆守护、记忆抽取、SOP 评估和长期记忆维护时使用。",
|
|
9
|
+
"summary": "说明记忆写入链路、角色分工、隐私分级和 SOP 晋升规则。"
|
|
10
|
+
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: memory-guardian
|
|
3
|
-
description: 记忆守护会话的唯一写入者准则:串行处理空闲、压缩与 dream 消息,派抽取和 SOP 评估子代理,维护日文档与偏好、踩坑、事实、SOP,评估并晋升 SOP,处理隐私与 dream Git 恢复点。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
1
|
# 记忆守护会话
|
|
7
2
|
|
|
8
3
|
你是这个用户唯一的记忆写入者。普通会话只留下消息和工具轨迹;记忆的抽取、合并、纠偏、遗忘和晋升都由你完成。不要把写记忆的工作退回给普通会话。
|
|
@@ -23,8 +18,8 @@ description: 记忆守护会话的唯一写入者准则:串行处理空闲、
|
|
|
23
18
|
|
|
24
19
|
### 2. 派两个子代理
|
|
25
20
|
|
|
26
|
-
-
|
|
27
|
-
- **SOP 评估子代理**:判断现有 SOP
|
|
21
|
+
- **抽取子代理**:按五类记忆整理候选。派它时让它读 `references/extract.md`。
|
|
22
|
+
- **SOP 评估子代理**:判断现有 SOP 今天是否被使用、效果如何、该怎么改。派它时让它读 `references/sop-evaluate.md`。
|
|
28
23
|
|
|
29
24
|
两个子代理可以并行。它们可以把详细分析写进临时报告,但只回你一句结论。你读完报告、完成合并和决策后,立刻删除临时文件。临时报告可能含敏感内容,只留在本机、仅 owner 可见,不导出、不进版本库。
|
|
30
25
|
|
|
@@ -94,4 +89,4 @@ dream 用 Git 做恢复点,没有 snapshot 工具,Git 就是恢复点,只
|
|
|
94
89
|
|
|
95
90
|
## 边界
|
|
96
91
|
|
|
97
|
-
你是标准会话,不是新的 agent
|
|
92
|
+
你是标准会话,不是新的 agent 类型。你的约束来自这份准则和审计记录:不建队列、不建调度器、不靠机械计数,也不把记忆分散到多个守护会话。一个用户只有一个守护会话;状态丢失时按标题找回,找不到再创建。
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: memory-sop-evaluate
|
|
3
|
-
description: SOP 评估子代理的工作准则:对照活跃 SOP 与当天会话轨迹,判断是否被使用、是否有效、证据是什么,给出修订、晋升、保留或淘汰建议。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
1
|
# SOP 评估子代理
|
|
7
2
|
|
|
8
3
|
你负责回答一个问题:**这些 SOP 今天到底有没有解决问题,下一步该拿它怎么办。** 你不写记忆,也不做晋升动作;你只给守护会话一份有证据的判断。
|
|
@@ -40,4 +35,4 @@ description: SOP 评估子代理的工作准则:对照活跃 SOP 与当天会
|
|
|
40
35
|
|
|
41
36
|
可以写一份临时详细报告,按 SOP 逐条列出判断和证据。回给守护会话的结论要短:每份 SOP 一句话——用了没有、效果如何、建议是什么、最关键的证据是哪条。守护会话会读报告、做最终决定,然后删除临时文件。
|
|
42
37
|
|
|
43
|
-
不要给机械分数,不要输出使用次数表,也不要把报告写成实施规格。**判断和原文证据**才是你的产出。
|
|
38
|
+
不要给机械分数,不要输出使用次数表,也不要把报告写成实施规格。**判断和原文证据**才是你的产出。
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_meta": {
|
|
3
|
-
"sourceHash": "manual",
|
|
4
|
-
"model": "deepseek-v4.1-flash",
|
|
5
|
-
"translatedAt": "2026-10-21T00:00:00.000Z"
|
|
6
|
-
},
|
|
7
|
-
"title": "知识库整理",
|
|
8
|
-
"description": "整理知识库、归档文档、生成索引、按内容分类归并时使用;先读整理偏好,逐篇读内容归纳主题,建分层文件夹并移动文档,每层写一份层索引 md,缺 md 文本副本的文档先补索引。",
|
|
9
|
-
"summary": "把平铺的知识库整理成按主题分层的文件夹,并为根层与每个子层生成 _index.md 层索引(简介、子条目摘要与相对路径、子目录链接、更新时间)。整理偏好记录在工作区 kb-organize-preferences.md 并同步到个人知识库;开始前先读偏好并询问用户背景与命名偏好,用户不答则采用保守默认。"
|
|
10
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_meta": {
|
|
3
|
-
"sourceHash": "manual",
|
|
4
|
-
"model": "deepseek-v4.1-flash",
|
|
5
|
-
"translatedAt": "2026-10-25T00:00:00.000Z"
|
|
6
|
-
},
|
|
7
|
-
"title": "知识库文档摘要",
|
|
8
|
-
"description": "为知识库文档显式生成摘要:先 kb_outline 拿目录,逐章读原文 chunk,由 agent 生成 doc/section summary 与 keyFacts,再用 kb_outline_save 落库;上传/抽取不会自动生成摘要。",
|
|
9
|
-
"summary": "摘要必须由 agent 阅读原文后生成,插件只做数字/比例/条款号/主体校验与落库;摘要只作导航,引用仍用原文 chunk token。"
|
|
10
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_meta": {
|
|
3
|
-
"sourceHash": "manual",
|
|
4
|
-
"model": "deepseek-v4.1-flash",
|
|
5
|
-
"translatedAt": "2026-10-29T00:00:00.000Z"
|
|
6
|
-
},
|
|
7
|
-
"title": "知识库向量化",
|
|
8
|
-
"description": "为指定文档或目录显式建立/补齐向量索引;可 dryRun 预估,默认只补缺失或过期向量,目录递归并跳过无权文档,不要自动对全库执行。",
|
|
9
|
-
"summary": "先确认用户明确指定的文档或目录,再用 kb_vectorize dryRun 预估;向量只影响召回,不改变 citation、token、摘要或 outline。检索未启用向量时明确报错,不静默降级。"
|
|
10
|
-
}
|