@sparkelf/dsh-knowledge-base 0.6.3 → 0.6.5

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/lib/index.js CHANGED
@@ -3581,10 +3581,10 @@ function renderOutlineMarkdown(input) {
3581
3581
  lines.push(`> 本文件是导航索引(${input.summaryVersion}):${origin},**不是引用来源**。`);
3582
3582
  lines.push(`> 引用请使用原文 chunk 的 \`kb://doc/${String(input.docId)}/chunk/<chunkKey>\` token(由 \`kb_search\` / \`kb_chunk_get\` 返回)。`);
3583
3583
  lines.push(`> 源文件:\`${input.sourcePath}\``, "");
3584
- if (summaryKind === "none") lines.push("> 生成摘要:调用 `kb-summarize` 技能阅读原文后,用 `kb_outline_save` 落库。", "");
3584
+ if (summaryKind === "none") lines.push("> 生成摘要:按 knowledge-base 技能的 `references/summarize.md` 阅读原文后,用 `kb_outline_save` 落库。", "");
3585
3585
  lines.push("## 文档摘要", "");
3586
3586
  if (input.summary !== "") lines.push(input.summary);
3587
- else if (summaryKind === "none") lines.push("(尚未生成摘要:调用 kb-summarize 技能生成摘要)");
3587
+ else if (summaryKind === "none") lines.push("(尚未生成摘要:按 knowledge-base 技能的摘要流程生成)");
3588
3588
  else lines.push("(无正文)");
3589
3589
  lines.push("");
3590
3590
  lines.push(`来源 chunk:${input.summarySourceChunkIds.length === 0 ? "(无)" : input.summarySourceChunkIds.join(", ")}`, "");
@@ -3927,7 +3927,7 @@ function planOutlineSave(input) {
3927
3927
  const sectionsById = new Map(input.storedSections.map((section) => [section.sectionId, section]));
3928
3928
  const summary = typeof input.submission.summary === "string" ? input.submission.summary.trim() : "";
3929
3929
  const submittedSections = Array.isArray(input.submission.sections) ? input.submission.sections : [];
3930
- if (summary === "") rejected.push(rejection("summary", "文档摘要不能为空;摘要应由 kb-summarize 技能阅读原文后生成"));
3930
+ if (summary === "") rejected.push(rejection("summary", "文档摘要不能为空;摘要应由 knowledge-base 技能的摘要流程(references/summarize.md)阅读原文后生成"));
3931
3931
  else if (summary.length > 4e3) rejected.push(rejection("summary", `文档摘要超过 ${String(MAX_DOC_SUMMARY_CHARS)} 字符`, { value: preview(summary) }));
3932
3932
  else if (input.chunks.length === 0) rejected.push(rejection("summary", "文档没有可读 chunk,不能生成摘要"));
3933
3933
  if (submittedSections.length > 500) rejected.push(rejection("sections", `一次最多提交 ${String(500)} 个章节`));
@@ -8974,7 +8974,7 @@ const createKnowledgeFileTools = (host) => [
8974
8974
  }),
8975
8975
  defineTool({
8976
8976
  name: "kb_outline",
8977
- description: "Read one document's navigation index: the summary (when one exists), table of contents (chapters/sections/articles), section summaries and key facts (thresholds, ratios, responsible bodies, exceptions). Call this FIRST for broad, comparison or difference questions (区别/对比/全面/是否), then use kb_search or kb_chunk_get to read the original clauses. Accepts `docId` or a full `kb://doc/<docId>/chunk/<key>` citation token (the chunk part is ignored). Returns `summaryKind` (none/extractive/llm), `summaryStatus` (missing/ready) and `indexPath`. `summaryStatus: \"missing\"` means upload/extraction created only the TOC and section structure; it is NOT an old index and this tool never auto-generates a summary. When a summary is needed, run the `kb-summarize` skill to read the original chunks and persist it with `kb_outline_save`. It returns no chapter body and never substitutes for the source: summaries are navigation only and MUST NOT be cited. Citations still use the original chunk token from kb_search / kb_chunk_get. `indexPath` is the `/nas/kb/index/md/<docId>.INDEX.md` file you may read for the same content.",
8977
+ description: "Read one document's navigation index: the summary (when one exists), table of contents (chapters/sections/articles), section summaries and key facts (thresholds, ratios, responsible bodies, exceptions). Call this FIRST for broad, comparison or difference questions (区别/对比/全面/是否), then use kb_search or kb_chunk_get to read the original clauses. Accepts `docId` or a full `kb://doc/<docId>/chunk/<key>` citation token (the chunk part is ignored). Returns `summaryKind` (none/extractive/llm), `summaryStatus` (missing/ready) and `indexPath`. `summaryStatus: \"missing\"` means upload/extraction created only the TOC and section structure; it is NOT an old index and this tool never auto-generates a summary. When a summary is needed, follow the knowledge-base skill reference `references/summarize.md` to read the original chunks and persist it with `kb_outline_save`. It returns no chapter body and never substitutes for the source: summaries are navigation only and MUST NOT be cited. Citations still use the original chunk token from kb_search / kb_chunk_get. `indexPath` is the `/nas/kb/index/md/<docId>.INDEX.md` file you may read for the same content.",
8978
8978
  parameters: {
8979
8979
  docId: {
8980
8980
  type: "number",
@@ -9027,7 +9027,7 @@ const createKnowledgeFileTools = (host) => [
9027
9027
  }),
9028
9028
  defineTool({
9029
9029
  name: "kb_outline_save",
9030
- description: "Persist the summary you wrote after reading one document through the `kb-summarize` skill. This is the ONLY path that creates document/section summaries; upload and extraction deliberately leave them empty. Pass the document summary, the section summaries keyed by the `sectionId` values returned by `kb_outline`, and key facts with the exact `chunkId` they came from. Every number, ratio, clause number and responsible body in `summary`/`keyFacts` is checked against the cited source chunks; a mismatch is refused and nothing is written. Sections you omit keep their heading structure but lose any previous summary. On success it updates `kb_docs.summary`, `kb_sections`, the summary FTS rows and the generated INDEX.md. Summaries are navigation only and MUST NOT be cited; citations still use the original `kb://doc/<docId>/chunk/<key>` token.",
9030
+ description: "Persist the summary you wrote after reading one document through the knowledge-base summarize flow. This is the ONLY path that creates document/section summaries; upload and extraction deliberately leave them empty. Pass the document summary, the section summaries keyed by the `sectionId` values returned by `kb_outline`, and key facts with the exact `chunkId` they came from. Every number, ratio, clause number and responsible body in `summary`/`keyFacts` is checked against the cited source chunks; a mismatch is refused and nothing is written. Sections you omit keep their heading structure but lose any previous summary. On success it updates `kb_docs.summary`, `kb_sections`, the summary FTS rows and the generated INDEX.md. Summaries are navigation only and MUST NOT be cited; citations still use the original `kb://doc/<docId>/chunk/<key>` token.",
9031
9031
  parameters: {
9032
9032
  docId: {
9033
9033
  type: "number",
@@ -18349,7 +18349,7 @@ function withGuardianTimeout(operation, timeoutMs, label) {
18349
18349
  /** Title is display-only but stable, so an operator can recognize the session. */
18350
18350
  const GUARDIAN_SESSION_TITLE = "记忆守护会话";
18351
18351
  /** Skill the guardian must load before doing anything else. */
18352
- const GUARDIAN_SKILL_NAME = "memory-guardian";
18352
+ const GUARDIAN_SKILL_NAME = "memory";
18353
18353
  /**
18354
18354
  * The preset first message. It intentionally stays product-level: read the
18355
18355
  * skill, check memory state, ensure the daily dream task exists.
@@ -18357,7 +18357,7 @@ const GUARDIAN_SKILL_NAME = "memory-guardian";
18357
18357
  function guardianSeedText() {
18358
18358
  return [
18359
18359
  "你是记忆守护会话:唯一负责个人记忆提取、合并、纠偏、遗忘和 SOP 维护的会话。",
18360
- `第一步:阅读 ${GUARDIAN_SKILL_NAME} 技能,之后严格按该技能工作。`,
18360
+ `第一步:阅读 ${GUARDIAN_SKILL_NAME} 技能,再按其中的指引读取 references/guardian.md,之后严格按该准则工作。`,
18361
18361
  "启动检查:确认个人记忆状态与待处理队列;确认每日 dream 任务存在,不存在则创建。",
18362
18362
  "之后只处理收到的 idle / compaction / dream 消息;串行处理,不为单条消息新建会话。"
18363
18363
  ].join("\n");
@@ -24674,12 +24674,11 @@ function describeError(error) {
24674
24674
  const KNOWLEDGE_SKILL_PROVIDER = "dsh-knowledge-base";
24675
24675
  /** Name the model sees in the skill catalog. */
24676
24676
  const KNOWLEDGE_SKILL_NAME = "knowledge-base";
24677
- /** Second bundled skill: the explicit, model-authored summarisation workflow. */
24678
- const KB_SUMMARIZE_SKILL_NAME = "kb-summarize";
24679
- /** Third bundled skill: explicit document/directory vectorization. */
24680
- const KB_VECTORIZE_SKILL_NAME = "kb-vectorize";
24681
- const KNOWLEDGE_GRAPH_SKILL_NAME = "knowledge-graph";
24682
- const KNOWLEDGE_GRAPH_SKILL_DESCRIPTION = "读写团队知识库里的知识图谱:主题卡、关系文档与四个动作。";
24677
+ /**
24678
+ * One bundled memory skill: the guardian, extraction subagent, and SOP evaluation
24679
+ * subagent rules moved into `references/` under this single catalog entry.
24680
+ */
24681
+ const MEMORY_SKILL_NAME = "memory";
24683
24682
  /**
24684
24683
  * Short description shown in the skill list.
24685
24684
  *
@@ -24687,18 +24686,7 @@ const KNOWLEDGE_GRAPH_SKILL_DESCRIPTION = "读写团队知识库里的知识图
24687
24686
  * catalog answers `list()` without reading any skill content, so the text has to
24688
24687
  * be available before the file is opened.
24689
24688
  */
24690
- const KNOWLEDGE_SKILL_DESCRIPTION = "Read and change the shared knowledge base: browse, search, create, upload, rename, move and delete documents in the 全局 / 部门 / 个人 trees. Cite with the stable kb://doc/<docId>/chunk/<key> token, never with line or block numbers.";
24691
- /**
24692
- * Short description of the explicit summary skill.
24693
- *
24694
- * Upload and extraction never write summaries. This skill is the only documented way to
24695
- * turn source chunks into document/section summaries and key facts, and it does so through
24696
- * the model's own reading plus `kb_outline_save` -- never through a hidden LLM call inside
24697
- * the plugin.
24698
- */
24699
- const KB_SUMMARIZE_SKILL_DESCRIPTION = "为知识库文档显式生成摘要:先 kb_outline 拿目录,逐章读原文 chunk,再由 agent 生成 doc/section summary + keyFacts,最后用 kb_outline_save 落库。摘要只作导航,引用仍用原文 chunk token;上传/抽取不会自动生成摘要。";
24700
- /** Short description of the explicit vectorization skill. */
24701
- const KB_VECTORIZE_SKILL_DESCRIPTION = "为指定文档或目录显式建立/补齐向量索引:kb_vectorize 可 dryRun 预估,默认只补缺失/过期向量,目录递归且跳过无权文档;不要自动对全库执行。向量只影响召回,不改变 citation/token/摘要。";
24689
+ const KNOWLEDGE_SKILL_DESCRIPTION = "知识库统一入口:检索、浏览、新建、上传、改名、移动、删除全局 / 部门 / 个人文档;需要整理归档、生成文档摘要、定向向量化或读写知识图谱时,按需加载 references 中的对应流程。Cite with the stable kb://doc/<docId>/chunk/<key> token, never with line or block numbers.";
24702
24690
  /**
24703
24691
  * Where this package's SKILL.md lives, from either build layout.
24704
24692
  *
@@ -24712,49 +24700,13 @@ function knowledgeSkillPath() {
24712
24700
  const moduleDirectory = dirname(fileURLToPath(import.meta.url));
24713
24701
  return join(moduleDirectory, "..", "SKILL.md");
24714
24702
  }
24715
- /**
24716
- * Where the bundled `kb-summarize` skill lives.
24717
- *
24718
- * Same layout reasoning as {@link knowledgeSkillPath}: both `lib/index.js` and a source
24719
- * run from `src/` sit one level below the package root.
24720
- *
24721
- * @returns absolute path of the kb-summarize SKILL.md.
24722
- */
24723
- function kbSummarizeSkillPath() {
24724
- const moduleDirectory = dirname(fileURLToPath(import.meta.url));
24725
- return join(moduleDirectory, "..", "skills", KB_SUMMARIZE_SKILL_NAME, "SKILL.md");
24726
- }
24727
- /** Where the bundled `kb-vectorize` skill lives. */
24728
- function kbVectorizeSkillPath() {
24703
+ /** Where the bundled one-entry `memory` skill lives. */
24704
+ function memorySkillPath() {
24729
24705
  const moduleDirectory = dirname(fileURLToPath(import.meta.url));
24730
- return join(moduleDirectory, "..", "skills", KB_VECTORIZE_SKILL_NAME, "SKILL.md");
24731
- }
24732
- /** Where the bundled `knowledge-graph` skill lives. */
24733
- function knowledgeGraphSkillPath() {
24734
- const moduleDirectory = dirname(fileURLToPath(import.meta.url));
24735
- return join(moduleDirectory, "..", "skills", KNOWLEDGE_GRAPH_SKILL_NAME, "SKILL.md");
24736
- }
24737
- /** The guardian's own operating skill. */
24738
- const MEMORY_GUARDIAN_SKILL_NAME = "memory-guardian";
24739
- /** The extraction subagent's skill. */
24740
- const MEMORY_EXTRACT_SKILL_NAME = "memory-extract";
24741
- /** The SOP evaluation subagent's skill. */
24742
- const MEMORY_SOP_EVALUATE_SKILL_NAME = "memory-sop-evaluate";
24743
- /** Where the bundled `memory-guardian` skill lives. */
24744
- function memoryGuardianSkillPath() {
24745
- const moduleDirectory = dirname(fileURLToPath(import.meta.url));
24746
- return join(moduleDirectory, "..", "skills", MEMORY_GUARDIAN_SKILL_NAME, "SKILL.md");
24747
- }
24748
- /** Where the bundled `memory-extract` skill lives. */
24749
- function memoryExtractSkillPath() {
24750
- const moduleDirectory = dirname(fileURLToPath(import.meta.url));
24751
- return join(moduleDirectory, "..", "skills", MEMORY_EXTRACT_SKILL_NAME, "SKILL.md");
24752
- }
24753
- /** Where the bundled `memory-sop-evaluate` skill lives. */
24754
- function memorySopEvaluateSkillPath() {
24755
- const moduleDirectory = dirname(fileURLToPath(import.meta.url));
24756
- return join(moduleDirectory, "..", "skills", MEMORY_SOP_EVALUATE_SKILL_NAME, "SKILL.md");
24706
+ return join(moduleDirectory, "..", "skills", MEMORY_SKILL_NAME, "SKILL.md");
24757
24707
  }
24708
+ /** Short description of the unified memory skill. */
24709
+ const MEMORY_SKILL_DESCRIPTION = "个人记忆系统的统一入口:记忆守护会话、记忆抽取子代理与 SOP 评估子代理都先读它,再按角色加载 references 中的对应准则。";
24758
24710
  /**
24759
24711
  * Where this package's tutorial document lives, from either build layout.
24760
24712
  *
@@ -24779,10 +24731,8 @@ function tutorialTemplatePath() {
24779
24731
  * @returns a provider the skill registry can list and read.
24780
24732
  */
24781
24733
  const KNOWLEDGE_SKILL_RANK = 640;
24782
- /** The summary skill is more specialised, so it sorts after the general KB skill. */
24783
- const KB_SUMMARIZE_SKILL_RANK = 650;
24784
- /** Vectorization is another explicit, specialised action. */
24785
- const KB_VECTORIZE_SKILL_RANK = 660;
24734
+ /** The memory skill is a specialised role bundle, so it sorts after the general KB skill. */
24735
+ const MEMORY_SKILL_RANK = 670;
24786
24736
  /** Both a human and the model may invoke this skill. */
24787
24737
  const KNOWLEDGE_SKILL_INVOCATION = {
24788
24738
  modelInvocable: true,
@@ -24802,106 +24752,33 @@ const KNOWLEDGE_SKILL_INVOCATION = {
24802
24752
  * @returns a provider the skill registry can list and read.
24803
24753
  */
24804
24754
  function knowledgeBaseSkillProvider() {
24805
- const candidates = [
24806
- {
24807
- name: KNOWLEDGE_SKILL_NAME,
24808
- description: KNOWLEDGE_SKILL_DESCRIPTION,
24809
- invocation: KNOWLEDGE_SKILL_INVOCATION,
24810
- source: "bundled",
24811
- provider: KNOWLEDGE_SKILL_PROVIDER,
24812
- path: knowledgeSkillPath(),
24813
- resourceBase: {
24814
- kind: "directory",
24815
- path: dirname(knowledgeSkillPath())
24816
- },
24817
- rank: 640,
24818
- locator: knowledgeSkillPath()
24819
- },
24820
- {
24821
- name: KB_SUMMARIZE_SKILL_NAME,
24822
- description: KB_SUMMARIZE_SKILL_DESCRIPTION,
24823
- invocation: KNOWLEDGE_SKILL_INVOCATION,
24824
- source: "bundled",
24825
- provider: KNOWLEDGE_SKILL_PROVIDER,
24826
- path: kbSummarizeSkillPath(),
24827
- resourceBase: {
24828
- kind: "directory",
24829
- path: dirname(kbSummarizeSkillPath())
24830
- },
24831
- rank: 650,
24832
- locator: kbSummarizeSkillPath()
24833
- },
24834
- {
24835
- name: KB_VECTORIZE_SKILL_NAME,
24836
- description: KB_VECTORIZE_SKILL_DESCRIPTION,
24837
- invocation: KNOWLEDGE_SKILL_INVOCATION,
24838
- source: "bundled",
24839
- provider: KNOWLEDGE_SKILL_PROVIDER,
24840
- path: kbVectorizeSkillPath(),
24841
- resourceBase: {
24842
- kind: "directory",
24843
- path: dirname(kbVectorizeSkillPath())
24844
- },
24845
- rank: 660,
24846
- locator: kbVectorizeSkillPath()
24755
+ const candidates = [{
24756
+ name: KNOWLEDGE_SKILL_NAME,
24757
+ description: KNOWLEDGE_SKILL_DESCRIPTION,
24758
+ invocation: KNOWLEDGE_SKILL_INVOCATION,
24759
+ source: "bundled",
24760
+ provider: KNOWLEDGE_SKILL_PROVIDER,
24761
+ path: knowledgeSkillPath(),
24762
+ resourceBase: {
24763
+ kind: "directory",
24764
+ path: dirname(knowledgeSkillPath())
24847
24765
  },
24848
- {
24849
- name: KNOWLEDGE_GRAPH_SKILL_NAME,
24850
- description: KNOWLEDGE_GRAPH_SKILL_DESCRIPTION,
24851
- invocation: KNOWLEDGE_SKILL_INVOCATION,
24852
- source: "bundled",
24853
- provider: KNOWLEDGE_SKILL_PROVIDER,
24854
- path: knowledgeGraphSkillPath(),
24855
- resourceBase: {
24856
- kind: "directory",
24857
- path: dirname(knowledgeGraphSkillPath())
24858
- },
24859
- rank: 36,
24860
- locator: knowledgeGraphSkillPath()
24766
+ rank: 640,
24767
+ locator: knowledgeSkillPath()
24768
+ }, {
24769
+ name: MEMORY_SKILL_NAME,
24770
+ description: MEMORY_SKILL_DESCRIPTION,
24771
+ invocation: KNOWLEDGE_SKILL_INVOCATION,
24772
+ source: "bundled",
24773
+ provider: KNOWLEDGE_SKILL_PROVIDER,
24774
+ path: memorySkillPath(),
24775
+ resourceBase: {
24776
+ kind: "directory",
24777
+ path: dirname(memorySkillPath())
24861
24778
  },
24862
- {
24863
- name: MEMORY_GUARDIAN_SKILL_NAME,
24864
- description: "记忆守护会话的唯一写入者准则:串行处理空闲、压缩与 dream 消息,派抽取和 SOP 评估子代理,维护日文档与偏好、踩坑、事实、SOP,评估并晋升 SOP,处理隐私与 dream 快照。",
24865
- invocation: KNOWLEDGE_SKILL_INVOCATION,
24866
- source: "bundled",
24867
- provider: KNOWLEDGE_SKILL_PROVIDER,
24868
- path: memoryGuardianSkillPath(),
24869
- resourceBase: {
24870
- kind: "directory",
24871
- path: dirname(memoryGuardianSkillPath())
24872
- },
24873
- rank: 670,
24874
- locator: memoryGuardianSkillPath()
24875
- },
24876
- {
24877
- name: MEMORY_EXTRACT_SKILL_NAME,
24878
- description: "记忆抽取子代理的工作准则:读一次会话的新增消息和工具轨迹,只提取可长期复用的偏好、踩坑、情景、事实与 SOP 候选,给出证据并避开秘密与闲聊。",
24879
- invocation: KNOWLEDGE_SKILL_INVOCATION,
24880
- source: "bundled",
24881
- provider: KNOWLEDGE_SKILL_PROVIDER,
24882
- path: memoryExtractSkillPath(),
24883
- resourceBase: {
24884
- kind: "directory",
24885
- path: dirname(memoryExtractSkillPath())
24886
- },
24887
- rank: 680,
24888
- locator: memoryExtractSkillPath()
24889
- },
24890
- {
24891
- name: MEMORY_SOP_EVALUATE_SKILL_NAME,
24892
- description: "SOP 评估子代理的工作准则:对照活跃 SOP 与当天会话轨迹,判断是否被使用、是否有效、证据是什么,给出修订、晋升、保留或淘汰建议。",
24893
- invocation: KNOWLEDGE_SKILL_INVOCATION,
24894
- source: "bundled",
24895
- provider: KNOWLEDGE_SKILL_PROVIDER,
24896
- path: memorySopEvaluateSkillPath(),
24897
- resourceBase: {
24898
- kind: "directory",
24899
- path: dirname(memorySopEvaluateSkillPath())
24900
- },
24901
- rank: 690,
24902
- locator: memorySopEvaluateSkillPath()
24903
- }
24904
- ];
24779
+ rank: 670,
24780
+ locator: memorySkillPath()
24781
+ }];
24905
24782
  return {
24906
24783
  name: KNOWLEDGE_SKILL_PROVIDER,
24907
24784
  list: () => Promise.resolve(candidates),
@@ -27674,7 +27551,7 @@ function apply(ctx, deploymentConfig) {
27674
27551
  summary: outline.summary,
27675
27552
  summaryKind: outline.summaryKind ?? (outline.summary.trim() === "" ? "none" : "extractive"),
27676
27553
  summaryStatus: outline.summaryStatus ?? (outline.summary.trim() === "" ? "missing" : "ready"),
27677
- ...(outline.summaryStatus ?? (outline.summary.trim() === "" ? "missing" : "ready")) === "missing" ? { hint: "调用 kb-summarize 技能生成摘要" } : {},
27554
+ ...(outline.summaryStatus ?? (outline.summary.trim() === "" ? "missing" : "ready")) === "missing" ? { hint: "按 knowledge-base 技能的摘要流程生成摘要" } : {},
27678
27555
  ...outline.summaryVersion === void 0 ? {} : { summaryVersion: outline.summaryVersion },
27679
27556
  sourceChunkIds: outline.sourceChunkIds,
27680
27557
  toc: outline.toc,
@@ -28621,4 +28498,4 @@ async function executeStep(runner, step, hostId, record) {
28621
28498
  }
28622
28499
  }
28623
28500
  //#endregion
28624
- export { BindingStore, Config, FACT_KINDS, GUARDIAN_SESSION_TITLE, GUARDIAN_SKILL_NAME, GraphLoadError, GuardianSessionStore, IDLE_DEBOUNCE_MS, KB_ROOT_RESOURCE_ID, KB_SUMMARIZE_SKILL_DESCRIPTION, KB_SUMMARIZE_SKILL_NAME, KB_SUMMARIZE_SKILL_RANK, KB_VECTORIZE_SKILL_DESCRIPTION, KB_VECTORIZE_SKILL_NAME, KB_VECTORIZE_SKILL_RANK, KNOWLEDGE_GRAPH_SKILL_DESCRIPTION, KNOWLEDGE_GRAPH_SKILL_NAME, KNOWLEDGE_SKILL_DESCRIPTION, KNOWLEDGE_SKILL_INVOCATION, KNOWLEDGE_SKILL_NAME, KNOWLEDGE_SKILL_PROVIDER, KNOWLEDGE_SKILL_RANK, KnowledgeError, KnowledgeWriteError, LOCAL_USER_ID, MAX_KNOWLEDGE_WRITE_BYTES, MEMORY_ENTRY_MARKER, MEMORY_EXTRACT_SKILL_NAME, MEMORY_FACT_FILE, MEMORY_GUARDIAN_SKILL_NAME, MEMORY_LOG_DIR, MEMORY_PITFALL_FILE, MEMORY_PREFERENCE_FILE, MEMORY_SOP_DIR, MEMORY_SOP_EVALUATE_SKILL_NAME, MEMORY_TYPES, MemoryGraphWriter, MemoryGraphWriterError, MemoryStore, MemoryStoreError, PERSONAL_MEMORY_FOLDER, PERSONAL_MEMORY_GRAPH_ID, PRIVACY_VALUES, SOP_STATUSES, TEMPLATE_READ_TIMEOUT_MS, actualRelPathForView, adoptViewFile, apply, applyMigration, applySummaryWriteback, assertValidMemoryEntry, bindingKey, canManageGrants, canManageGraph, canReadPath, canReviewWorkflows, canViewGraph, canWritePath, checkLocalPath, classifyMount, createGrant, createKnowledgeEntry, createMemoryGuardianTools, createMemoryRecordTools, createMemoryTools, decideMemoryAction, deleteSopAfterPromotion, diffSnapshots, extractBeside, extractionOutcomeOf, fetchCaller, fetchGrants, fetchPrincipals, filterVisibleGraphs, inject, installMemoryTriggers, isFactKind, isMemoryType, isPrivacy, isSafeMemorySlug, isSopStatus, isTeamDeployment, kbSummarizeSkillPath, kbVectorizeSkillPath, knowledgeAncestorsFor, knowledgeBaseSkillProvider, knowledgeBaseToolDisclosure, knowledgeGraphScopeRoots, knowledgeGraphSkillPath, knowledgeSkillPath, listDirectory, listDirectoryShapes, listDirectoryWithPermissions, listGraphs, listRelativeFiles, loadGraph, localConfig, localManagementContext, localStatus, localStorageRoot, markUpstreamUpdates, memoryExtractSkillPath, memoryGuardianSkillPath, memorySopEvaluateSkillPath, mineruUrlFor, name, newMemoryId, normalizePersonalWritePath, parentChain, parseMemoryEntries, parseNodeFrontMatter, permissionForKbRoute, planContext, planMigration, promoteSopToSkill, readAuthorized, readDepartmentOf, readKnowledgeFile, readKnowledgeFileForDownload, readSharedMineruUrl, refreshDirtySummaries, renderMemoryContextMarkdown, renderMigrationReport, resolveMemoryContext, resolveMineruUrl, resolveOrCreateGuardian, resolveWorkflowActor, revokeGrant, runGuardianPass, runtimeInjectionTags, scanKnowledgeTree, searchKnowledge, sendToGuardian, serializeMemoryEntry, summarySnapshotPathFor, syncCallerView, syncPersonalMemoryGraph, toolScopedActualPath, toolScopedViewPath, tutorialTemplatePath, validateGraph, validateMemoryEntry, withLocalStorageRoot, withStoredStorage };
28501
+ export { BindingStore, Config, FACT_KINDS, GUARDIAN_SESSION_TITLE, GUARDIAN_SKILL_NAME, GraphLoadError, GuardianSessionStore, IDLE_DEBOUNCE_MS, KB_ROOT_RESOURCE_ID, KNOWLEDGE_SKILL_DESCRIPTION, KNOWLEDGE_SKILL_INVOCATION, KNOWLEDGE_SKILL_NAME, KNOWLEDGE_SKILL_PROVIDER, KNOWLEDGE_SKILL_RANK, KnowledgeError, KnowledgeWriteError, LOCAL_USER_ID, MAX_KNOWLEDGE_WRITE_BYTES, MEMORY_ENTRY_MARKER, MEMORY_FACT_FILE, MEMORY_LOG_DIR, MEMORY_PITFALL_FILE, MEMORY_PREFERENCE_FILE, MEMORY_SKILL_DESCRIPTION, MEMORY_SKILL_NAME, MEMORY_SKILL_RANK, MEMORY_SOP_DIR, MEMORY_TYPES, MemoryGraphWriter, MemoryGraphWriterError, MemoryStore, MemoryStoreError, PERSONAL_MEMORY_FOLDER, PERSONAL_MEMORY_GRAPH_ID, PRIVACY_VALUES, SOP_STATUSES, TEMPLATE_READ_TIMEOUT_MS, actualRelPathForView, adoptViewFile, apply, applyMigration, applySummaryWriteback, assertValidMemoryEntry, bindingKey, canManageGrants, canManageGraph, canReadPath, canReviewWorkflows, canViewGraph, canWritePath, checkLocalPath, classifyMount, createGrant, createKnowledgeEntry, createMemoryGuardianTools, createMemoryRecordTools, createMemoryTools, decideMemoryAction, deleteSopAfterPromotion, diffSnapshots, extractBeside, extractionOutcomeOf, fetchCaller, fetchGrants, fetchPrincipals, filterVisibleGraphs, inject, installMemoryTriggers, isFactKind, isMemoryType, isPrivacy, isSafeMemorySlug, isSopStatus, isTeamDeployment, knowledgeAncestorsFor, knowledgeBaseSkillProvider, knowledgeBaseToolDisclosure, knowledgeGraphScopeRoots, knowledgeSkillPath, listDirectory, listDirectoryShapes, listDirectoryWithPermissions, listGraphs, listRelativeFiles, loadGraph, localConfig, localManagementContext, localStatus, localStorageRoot, markUpstreamUpdates, memorySkillPath, mineruUrlFor, name, newMemoryId, normalizePersonalWritePath, parentChain, parseMemoryEntries, parseNodeFrontMatter, permissionForKbRoute, planContext, planMigration, promoteSopToSkill, readAuthorized, readDepartmentOf, readKnowledgeFile, readKnowledgeFileForDownload, readSharedMineruUrl, refreshDirtySummaries, renderMemoryContextMarkdown, renderMigrationReport, resolveMemoryContext, resolveMineruUrl, resolveOrCreateGuardian, resolveWorkflowActor, revokeGrant, runGuardianPass, runtimeInjectionTags, scanKnowledgeTree, searchKnowledge, sendToGuardian, serializeMemoryEntry, summarySnapshotPathFor, syncCallerView, syncPersonalMemoryGraph, toolScopedActualPath, toolScopedViewPath, tutorialTemplatePath, validateGraph, validateMemoryEntry, withLocalStorageRoot, withStoredStorage };
@@ -12,6 +12,7 @@
12
12
  * @module @sparkelf/dsh-knowledge-base/client
13
13
  */
14
14
  import type { Context as ClientContext } from '@deepseek-ai/cordis';
15
+ import './guide-uniform.module.css';
15
16
  import { type KnowledgeKey } from './locales.ts';
16
17
  import { type WorkflowPlazaInjected } from './workflows/WorkflowPlaza.tsx';
17
18
  declare module '@deepseek-ai/dsh-client-ui-slots' {
@@ -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 kb-vectorize for one document or directory.";
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-guardian";
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.
@@ -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 `kb-summarize` skill through
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
- /** Second bundled skill: the explicit, model-authored summarisation workflow. */
1197
- export declare const KB_SUMMARIZE_SKILL_NAME = "kb-summarize";
1198
- /** Third bundled skill: explicit document/directory vectorization. */
1199
- export declare const KB_VECTORIZE_SKILL_NAME = "kb-vectorize";
1200
- export declare const KNOWLEDGE_GRAPH_SKILL_NAME = "knowledge-graph";
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
- * Where the bundled `kb-summarize` skill lives.
1233
- *
1234
- * Same layout reasoning as {@link knowledgeSkillPath}: both `lib/index.js` and a source
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 summary skill is more specialised, so it sorts after the general KB skill. */
1278
- export declare const KB_SUMMARIZE_SKILL_RANK = 650;
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 `kb-summarize` saves a model-authored summary. */
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;
@@ -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
- * `kb-summarize` skill has read the original chunks and the model submits it through
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",
3
+ "version": "0.6.5",
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.25.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: knowledge-graph
3
- description: 读写团队知识库里的知识图谱:主题卡、关系文档、四个动作和五个剧本。
4
- ---
5
-
6
1
  # knowledge-graph
7
2
 
8
3
  知识图谱是知识库的导航层,不是第二套文档库。它只有三样东西:**图谱**(一个可见文件夹)、**主题**(图谱下的可见子文件夹 + `index.md` 卡)、**关系**(`index.md` 之间的一篇文档)。
@@ -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
- 在此之前,新机器上要么手动建软链接,要么跑 `scripts/sync-harness-skills.sh`。**不要为此去改 profile 的 `cordis.patch.yml`**:`dsh-plus` 的能力引导会整文件覆盖它。
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`。