面向 Agent 的可恢复 Obsidian 知识库架构
一套把本地资料编译成可追溯、可恢复、可验证 Agent 长期上下文层的 Obsidian 规范。
原始内容
/goal Build a mature, source-backed Obsidian vault brain for the user. Primary Objective: Create a local Obsidian-compatible vault that functions as a durable context layer for LLMs and agents. The output must be a working vault folder, not merely a report. The vault must be source-backed, resumable, validated by scripts, and organized around canonical knowledge rather than raw dumps. Before doing substantive work, confirm: 1. The current working directory. 2. The intended output root directory. 3. The available source locations and connectors. 4. The connected account/workspace/organization for every external connector. If the user has not provided an output root, create the compiled vault under the current working directory: Compiled-Vaults/compiled-vault-brain-YYYY-MM-DD/ Do not write the final vault to an ambiguous location. Core Memory Architecture: The vault must distinguish between declarative memory, procedural memory, source traces, context packs, and runtime tools/connectors. Required First Phase: Orientation: Do not author the final vault immediately. First inspect available vaults, notes, documents, repos, generated examples, and connected tools. Produce: Reports/ORIENTATION-REPORT.md Include confirmed working directory, output path, source inventory, connector inventory, account/workspace verification results, initial high-signal entities, proposed ingestion plan, and blockers. Hard Checkpoint 1: After ORIENTATION-REPORT.md is created, pause and ask the user whether to proceed. Do not begin broad ingestion until the user approves. Connector Verification Gate: Before ingesting from any external connector, retrieve and document the actual connected account/workspace/organization. For each connector, record: - Connector name. - Account email or user ID if available. - Workspace, organization, tenant, or team ID if available. - Verification method. - Timestamp. - Read/write capability observed. - Whether it is approved for ingestion. Write this to SOURCE-MANIFEST.md. If a connector is attached to the wrong account, workspace, or organization, mark it blocked. Do not use it for ingestion. Never send emails, messages, calendar invites, refunds, billing updates, database writes, or any external mutation without explicit user approval. Required State And Resumption Files: Create and maintain: INGESTION-LOG.md state.json The job must be resumable from these files. Before doing new work after any interruption, read both files and continue from recorded state. state.json must include output_path, current_phase, completed_phases, sources_discovered, sources_ingested, connector_status, batches_completed, canonical_notes_created, validation_status, next_actions, and blockers. Required Compiler Process: Use this repeatable compiler-style process: parse -> thread/group -> classify -> extract -> canonicalize -> rehydrate provenance -> author -> validate links -> critic/audit When re-encountering an existing entity, update the existing canonical note and append new provenance. Do not create a duplicate note unless there is clear evidence that it is a distinct entity. For large ingestion passes, use a small or cheap model for parse, classify, and extract where available. Reserve the strongest model for synthesis, authoring, critic review, and ambiguous entity resolution. Required Deterministic Machinery: Create a tools folder inside the compiled vault: _tools/ Write and run scripts for: 1. Wikilink validation: - Find all [[wikilinks]]. - Mirror Obsidian resolution semantics: resolve links by note filename anywhere in the vault, support paths where specified, account for aliases/headings/blocks where practical, and flag only links that would not resolve in Obsidian. - Report unresolved and ambiguous links. 2. Slug/path validation: - Detect empty filenames. - Detect invalid paths such as People/.md, Projects/.md, Companies/.md. - Detect duplicate canonical slugs. - Detect unsafe filename characters. 3. Secret and credential scanning: - Scan output files for API keys, access tokens, private keys, passwords, recovery codes, bearer tokens, OAuth tokens, database URLs, SSH keys, webhook secrets, signing secrets, session cookies, and credential-like environment variables. - Redact before completion. 4. Source reference validation: - Confirm every promoted canonical note has provenance. - Confirm every source reference points to SOURCE-MANIFEST.md or Sources/. 5. Required artifact validation: - Confirm all required folders and files exist. 6. Manifest generation or validation: - Generate or verify SOURCE-MANIFEST.md from ingestion logs and connector checks. Record script commands and results in VALIDATION-REPORT.md. Redaction Policy: Never copy secrets or credential values into the compiled vault. For ordinary personal information, avoid unnecessary raw dumps. Prefer summaries and provenance over copying long private messages. If sensitive personal, legal, medical, financial, or employment information is needed, summarize minimally and mark sensitivity in frontmatter. Required Ingestion Plan: Existing notes/vaults: - Ingest useful Markdown broadly. - Prioritize people, companies, projects, daily notes, meeting notes, tasks, reports, resources, decisions, procedures, glossaries, and planning files. - Do not mutate the original vault unless explicitly approved. Email, if verified: - Smoke pass: 5-10 high-signal threads. - Create sample notes, source traces, and validation outputs. - Pause for user approval before broader ingestion. - Recent broad pass: approximately 300-500 relevant threads from the last 60-120 days. - Entity-targeted pass: 500-1,500 additional threads focused on high-signal entities. - Deep historical pass: 2,000-5,000 additional threads only if explicitly approved. Hard Checkpoint 2: After the email or connector smoke pass, show: - 3-5 sample canonical notes. - 1 sample source trace. - 1 sample context pack. - Current SOURCE-MANIFEST.md. - Current VALIDATION-REPORT.md. Then ask the user whether to proceed to broader ingestion. Required Vault Structure: The compiled vault must contain: People/ Companies/ Projects/ Products/ Topics/ Decisions/ Commitments/ Procedures/ Preferences/ Context Packs/ Sources/ Maps/ Reports/ _tools/ README.md SOURCE-MANIFEST.md VALIDATION-REPORT.md COMPLETION-AUDIT.md INGESTION-LOG.md state.json Note Format: Use Obsidian-compatible Markdown with YAML frontmatter where useful, wikilinks, aliases, tags, source references, and clear provenance. Prefer durable canonical notes over shallow contact cards. Separate claims from source traces. Represent uncertainty explicitly. Do not invent facts. Example People Note: --- type: person name: "Example Person" aliases: - "E. Person" tags: - person source_status: source-backed sensitivity: normal last_verified: YYYY-MM-DD --- # Example Person ## Summary Example Person is a [role/relationship] connected to [[Example Company]] and [[Example Project]]. ## Relationship To User - Relationship: [customer / collaborator / investor / vendor / teammate / friend / unknown] - Context: [brief source-backed explanation] - Confidence: high / medium / low ## Known Preferences Or Patterns - [Observed preference or pattern] Source: [[Sources/example-source-id]] ## Related Projects - [[Example Project]] ## Open Loops - [[Commitments/example-commitment]] ## Provenance - [[Sources/example-source-id]] — [brief description, date] Example Decision Note: --- type: decision decision_date: YYYY-MM-DD status: active tags: - decision source_status: source-backed confidence: medium --- # Decision: Example Decision Title ## Decision [State the decision clearly.] ## Rationale [Explain why this decision was made, based only on available evidence.] ## Alternatives Considered - [Alternative 1] - [Alternative 2] ## Consequences - [Expected or observed consequence] - [Operational implication] ## Related - [[Example Project]] - [[Example Person]] ## Provenance - [[Sources/example-source-id]] — [what this source proves] Example Context Pack: --- type: context-pack scope: "Example bounded task" tags: - context-pack last_updated: YYYY-MM-DD --- # Context Pack: Example Task ## Use This When Use this context pack when an agent needs to [specific task]. ## Essential Context - [[Example Project]] is the main project. - [[Example Person]] is the key stakeholder. - [[Decisions/example-decision]] governs the current approach. ## Current State [Concise source-backed summary.] ## Relevant Procedures - [[Procedures/example-procedure]] ## Open Loops - [[Commitments/example-commitment]] ## Sources - [[Sources/example-source-id]] ## Agent Instructions - Do not assume facts not present in linked notes. - Check SOURCE-MANIFEST.md for source freshness. - If acting externally, ask for explicit approval first. Required Content: Create notes for important people, companies, projects, products, systems, topics, decisions, commitments, procedures, preferences, context packs, maps/indexes, and source traces. Validation Hard Gates: Do not declare this goal complete unless all of these pass: - 0 placeholder source references. - 0 broken internal wikilinks under Obsidian-style resolution. - 0 empty slugs. - 0 invalid paths such as People/.md, Projects/.md, Companies/.md. - 0 copied secrets, API keys, tokens, passwords, private keys, recovery codes, or credential values. - Every promoted canonical note has provenance. - Every connector used is listed in SOURCE-MANIFEST.md. - Every connector account/workspace/organization status is documented. - README.md explains how the vault is organized and how agents should use it. - VALIDATION-REPORT.md lists scripts run, commands used, pass/fail status, and remaining issues. - COMPLETION-AUDIT.md maps every explicit requirement in this prompt to evidence in the output. - INGESTION-LOG.md and state.json are current. - The final vault opens as a normal Obsidian-compatible folder. Completion Audit: COMPLETION-AUDIT.md must map every major requirement in this prompt to: - Status: pass / partial / blocked / fail. - Evidence path. - Notes created or scripts run. - Remaining limitation, if any. Execution Rules: Work in phases. Continue across resumptions by reading INGESTION-LOG.md and state.json first. Avoid repeating completed work. Keep concise progress updates. Use source-of-truth checks over speculation. Prefer actual filesystem, connector, repo, and document evidence to memory. Preserve user-owned source files. Do not make destructive changes. Do not perform external writes or mutations without explicit approval. Stop Conditions: Pause and ask the user before: - Broad connector ingestion beyond smoke pass. - Deep historical email/chat ingestion. - Any external write or mutation. - Any destructive local file operation. - Any ingestion likely to be expensive, slow, or privacy-sensitive. Quality Bar: The compiled vault should not be a dump. It should be a structured, source-backed operating memory that helps future agents understand who the user is, what they are working on, who and what matters, what has been decided, what remains open, what procedures work, what preferences matter, and which sources justify those conclusions. Completion Rule: Do not declare the goal complete until the compiled vault exists, validation scripts pass, and SOURCE-MANIFEST.md, VALIDATION-REPORT.md, COMPLETION-AUDIT.md, INGESTION-LOG.md, and state.json all exist and prove the requirements were satisfied. If blocked, continue with available sources and document the blocker precisely rather than silently degrading the output.
中文译文
机器翻译,保留原文供核对。
@nickvasiles(Nick Vasilescu) /goal 为用户构建一个成熟、有来源支撑的 Obsidian 库大脑。 主要目标: 创建一个与 Obsidian 兼容的本地库,作为 LLM 和智能体的持久上下文层。输出必须是一个可用的库文件夹,而不仅仅是一份报告。该库必须有来源支撑、可恢复、由脚本验证,并围绕规范化知识组织,而不是原始数据堆砌。 在开展实质性工作之前,请确认: 1. 当前工作目录。 2. 预期输出根目录。 3. 可用的来源位置和连接器。 4. 每个外部连接器所连接的账户/工作区/组织。 如果用户未提供输出根目录,请在当前工作目录下创建编译后的库: Compiled-Vaults/compiled-vault-brain-YYYY-MM-DD/ 不要将最终库写入含糊不清的位置。 核心记忆架构: 该库必须区分陈述性记忆、程序性记忆、来源追踪、上下文包,以及运行时工具/连接器。 必需的第一阶段:定位: 不要立即编写最终库。首先检查可用的库、笔记、文档、仓库、生成的示例和已连接的工具。 产出: Reports/ORIENTATION-REPORT.md 包含已确认的工作目录、输出路径、来源清单、连接器清单、账户/工作区验证结果、初始高信号实体、拟议的摄入计划,以及阻塞项。 硬性检查点 1: 在创建 ORIENTATION-REPORT.md 之后,暂停并询问用户是否继续。在用户批准之前,不要开始大范围摄入。 连接器验证关口: 在从任何外部连接器摄入之前,检索并记录实际连接的账户/工作区/组织。 对每个连接器,记录: - 连接器名称。 - 账户邮箱或用户 ID(如可用)。 - 工作区、组织、租户或团队 ID(如可用)。 - 验证方法。 - 时间戳。 - 观察到的读/写能力。 - 是否获准用于摄入。 将此写入 SOURCE-MANIFEST.md。 如果某个连接器连接到错误的账户、工作区或组织,请将其标记为阻塞。不要将其用于摄入。未经用户明确批准,绝不要发送电子邮件、消息、日历邀请、退款、账单更新、数据库写入或任何外部变更。 必需的状态与恢复文件: 创建并维护: INGESTION-LOG.md state.json 任务必须能够从这些文件恢复。在任何中断后开展新工作之前,请读取这两个文件,并从记录的状态继续。 state.json 必须包含 output_path、current_phase、completed_phases、sources_discovered、sources_ingested、connector_status、batches_completed、canonical_notes_created、validation_status、next_actions 和 blockers。 必需的编译器流程: 使用以下可重复的编译器式流程: parse -> thread/group -> classify -> extract -> canonicalize -> rehydrate provenance -> author -> validate links -> critic/audit 当再次遇到现有实体时,更新现有的规范笔记并追加新的来源追踪。除非有明确证据表明它是不同的实体,否则不要创建重复笔记。 对于大型摄入批次,在可用的情况下,使用小型或廉价模型进行解析、分类和提取。将最强模型保留用于综合、撰写、批评审查和模糊实体消解。 必需的确定性机制: 在编译后的库内创建一个 tools 文件夹: _tools/ 编写并运行脚本以执行: 1. Wikilink 验证: - 查找所有 [[wikilinks]]。 - 镜像 Obsidian 的解析语义:在库中任意位置按笔记文件名解析链接,支持指定路径,尽可能处理别名/标题/块,并且只标记在 Obsidian 中无法解析的链接。 - 报告未解析和歧义的链接。 2. Slug/路径验证: - 检测空文件名。 - 检测无效路径,例如 People/.md、Projects/.md、Companies/.md。 - 检测重复的规范 slug。 - 检测不安全的文件名字符。 3. 密钥与凭据扫描: - 扫描输出文件,查找 API 密钥、访问令牌、私钥、密码、恢复代码、bearer 令牌、OAuth 令牌、数据库 URL、SSH 密钥、webhook 密钥、签名密钥、会话 cookie,以及类似凭据的环境变量。 - 在完成前进行脱敏。 4. 来源引用验证: - 确认每一条被提升为规范笔记的内容都有出处。 - 确认每个来源引用都指向 SOURCE-MANIFEST.md 或 Sources/。 5. 必需产物验证: - 确认所有必需的文件夹和文件都存在。 6. 清单生成或验证: - 根据摄取日志和连接器检查生成或验证 SOURCE-MANIFEST.md。 将脚本命令和结果记录到 VALIDATION-REPORT.md。 脱敏政策: 切勿将密钥或凭据值复制到编译后的库中。对于普通个人信息,避免不必要的原始转储。优先使用摘要和出处,而不是复制长篇私人消息。如果需要敏感的个人、法律、医疗、财务或就业信息,尽量少做总结,并在 frontmatter 中标记敏感性。 必需摄取计划: 现有笔记/库: - 广泛摄取有用的 Markdown。 - 优先处理人物、公司、项目、每日笔记、会议笔记、任务、报告、资源、决策、流程、术语表和规划文件。 - 除非明确批准,否则不要修改原始库。 电子邮件(如已验证): - 冒烟轮:5-10 个高信号线程。 - 创建示例笔记、来源追踪和验证输出。 - 在更广泛摄取之前暂停,等待用户批准。 - 近期广泛轮:约 300-500 个过去 60-120 天内的相关线程。 - 实体定向轮:额外 500-1,500 个聚焦高信号实体的线程。 - 深度历史轮:仅在明确批准后额外处理 2,000-5,000 个线程。 硬性检查点 2: 在电子邮件或连接器冒烟轮之后,展示: - 3-5 条示例规范笔记。 - 1 条示例来源追踪。 - 1 个示例上下文包。 - 当前的 SOURCE-MANIFEST.md。 - 当前的 VALIDATION-REPORT.md。 然后询问用户是否继续更广泛的摄取。 必需的库结构: 编译后的库必须包含: People/ Companies/ Projects/ Products/ Topics/ Decisions/ Commitments/ Procedures/ Preferences/ Context Packs/ Sources/ Maps/ Reports/ _tools/ README.md SOURCE-MANIFEST.md VALIDATION-REPORT.md COMPLETION-AUDIT.md INGESTION-LOG.md state.json 笔记格式: 使用与 Obsidian 兼容的 Markdown,在有用时使用 YAML frontmatter、wikilinks、别名、标签、来源引用和清晰的出处。优先使用持久的规范笔记,而不是浅层联系人卡片。将断言与来源追踪分开。明确表示不确定性。不要编造事实。 示例人物笔记: --- type: person name: "Example Person" aliases: - "E. Person" tags: - person source_status: source-backed sensitivity: normal last_verified: YYYY-MM-DD --- # Example Person ## 摘要 Example Person 是一位[角色/关系],与 [[Example Company]] 和 [[Example Project]] 相关联。 ## 与用户的关系 - 关系:[客户 / 合作者 / 投资者 / 供应商 / 队友 / 朋友 / 未知] - 背景:[简短且有来源支持的说明] - 置信度:高 / 中 / 低 ## 已知偏好或模式 - [观察到的偏好或模式] 来源:[[Sources/example-source-id]] ## 相关项目 - [[Example Project]] ## 未闭环事项 - [[Commitments/example-commitment]] ## 出处 - [[Sources/example-source-id]] — [简短描述,日期] 示例决策笔记: --- type: decision decision_date: YYYY-MM-DD status: active tags: - decision source_status: source-backed confidence: medium --- # 决策:示例决策标题 ## 决策 [清楚地陈述该决策。] ## 理由 [仅根据现有证据解释为何做出该决策。] ## 考虑过的替代方案 - [替代方案 1] - [替代方案 2] ## 后果 - [预期或观察到的后果] @nickvasiles(Nick Vasilescu) - [操作含义] ## 相关 - [[Example Project]] - [[Example Person]] ## 来源 - [[Sources/example-source-id]] — [该来源证明了什么] 示例上下文包: --- type: context-pack scope: "示例限定任务" tags: - context-pack last_updated: YYYY-MM-DD --- # 上下文包:示例任务 ## 何时使用此内容 当智能体需要[执行特定任务]时,使用此上下文包。 ## 必备上下文 - [[Example Project]] 是主项目。 - [[Example Person]] 是关键利益相关者。 - [[Decisions/example-decision]] 主导当前做法。 ## 当前状态 [简明、有来源支撑的摘要。] ## 相关流程 - [[Procedures/example-procedure]] ## 未闭环事项 - [[Commitments/example-commitment]] ## 来源 - [[Sources/example-source-id]] ## 智能体指令 - 不要假定链接笔记中不存在的事实。 - 检查 SOURCE-MANIFEST.md 以了解来源时效性。 - 如果要在外部采取行动,先请求明确批准。 必需内容: 为重要人物、公司、项目、产品、系统、主题、决策、承诺、流程、偏好、上下文包、地图/索引和来源追踪创建笔记。 验证硬性门槛: 除非以下各项全部通过,否则不要宣布此目标完成: - 0 个占位符来源引用。 - 在 Obsidian 风格解析下,0 个损坏的内部 wikilink。 - 0 个空 slug。 - 0 个无效路径,例如 People/.md、Projects/.md、Companies/.md。 - 0 个复制的机密、API 密钥、令牌、密码、私钥、恢复代码或凭据值。 - 每个被提升为规范笔记的笔记都有来源。 - 使用的每个连接器都列在 SOURCE-MANIFEST.md 中。 - 每个连接器账户/工作区/组织状态都有记录。 - README.md 说明 vault 如何组织,以及智能体应如何使用它。 - VALIDATION-REPORT.md 列出已运行的脚本、使用的命令、通过/失败状态以及遗留问题。 - COMPLETION-AUDIT.md 将本提示中的每项明确要求映射到输出中的证据。 - INGESTION-LOG.md 和 state.json 均为最新。 - 最终 vault 可作为普通的 Obsidian 兼容文件夹打开。 完成审计: COMPLETION-AUDIT.md 必须将本提示中的每项主要要求映射到: - 状态:通过 / 部分通过 / 受阻 / 失败。 - 证据路径。 - 创建的笔记或运行的脚本。 - 遗留限制(如有)。 执行规则: 分阶段工作。跨恢复继续时,先阅读 INGESTION-LOG.md 和 state.json。避免重复已完成的工作。保持简明的进度更新。使用事实来源检查,而非推测。优先使用实际文件系统、连接器、仓库和文档证据,而非记忆。保留用户拥有的源文件。不要进行破坏性更改。没有明确批准,不要执行外部写入或变更。 停止条件: 在以下情况之前暂停并询问用户: - 超出冒烟测试通过范围的广泛连接器摄取。 - 深度摄取历史电子邮件/聊天记录。 - 任何外部写入或变更。 - 任何破坏性本地文件操作。 - 任何可能昂贵、缓慢或隐私敏感的摄取。 质量标准: 编译后的 vault 不应是资料堆砌。它应是一种结构化、有来源支撑的操作记忆,帮助未来的智能体理解用户是谁、正在做什么、谁和什么重要、已决定什么、还有什么未闭环、哪些流程有效、哪些偏好重要,以及哪些来源为这些结论提供依据。 完成规则: 在编译后的 vault 存在、验证脚本通过,并且 SOURCE-MANIFEST.md、VALIDATION-REPORT.md、COMPLETION-AUDIT.md、INGESTION-LOG.md 和 state.json 全部存在并证明要求已满足之前,不要宣布目标完成。如果受阻,继续使用可用来源,并精确记录阻碍,而不是悄悄降低输出质量。
深度解析
是什么 这不是一个已完成知识库的展示,而是一份面向 Agent 记忆系统的详细执行规范。它要求把本地笔记、文档及经验证的外部来源,编译成可在 Obsidian 中使用的长期上下文层,并通过报告、清单和状态文件证明过程可追溯、可恢复。
核心设计 方案将声明式记忆、程序式记忆、来源痕迹、上下文包和运行时连接器分层,并规定“解析—分组—分类—抽取—规范化—恢复溯源—编写—链接校验—批评审计”的流水线。增量状态、连接器身份核验、敏感信息扫描、内部链接与路径检查,以及分阶段人工审批,共同构成质量与安全闸门。
关键洞察 最值得借鉴的是“规范化知识优先于原始倾倒”:重复实体应更新同一 canonical note,事实与来源分离,Agent 使用上下文包读取边界明确的知识。这让个人资料库从搜索型档案转向可供智能体可靠调用的操作记忆。
边界与风险 文本只提供了目标架构和验收标准,没有证明实际仓库、连接器、脚本或数据已经存在。邮件等大规模摄取还涉及成本、隐私和权限风险;过度严格的目录、校验和审批流程也可能增加维护负担。因此它更适合作为实施蓝图,而非现成产品方案。