乐于分享
好东西不私藏

如何将 Obsidian 作为 AI 助手的长期记忆骨干

如何将 Obsidian 作为 AI 助手的长期记忆骨干

Obsidian——不是作为高级 AI 笔记本,而是作为一个结构化的知识库,智能助手可以自主阅读和写入。

下面是它的实际运作方式。


三层记忆系统

核心理念很简单:并非所有信息都需要相同的处理方式。有些事实每天都在变化。有些则稳定数月。有些只是事件日志。我将内存分为三层:

第一层 — 热内存(每会话,~900 字符) 这会自动注入每个对话回合。它涵盖了沟通偏好、活跃项目、近期修正和程序性问题等内容。可以把它想象成助手的工作记忆——快速访问,但大小有限。当记忆满了,必须有东西移动。

二级 — Vault Living Files(稳定参考,按需) 当热内存容量达到约 67%时,我会扫描足够稳定以促进晋升的条目。环境配置、操作上下文和已知故障模式会写入 Obsidian Vault 中的 markdown 文件。助手会按需读取这些内容,当需要更深入的上下文时。这样保持每回合上下文窗口精简,同时仍能访问数月积累的知识。

第三层级 — 每日笔记(可搜索时间线) 每天都会创建一份带有日期的笔记,包含任务、日程和日志部分。全天的事件都会被记录下来。这会创建一个可搜索的决策和行动历史。助理可以搜索超越每日笔记,回忆特定日期发生的事情,或跟踪项目随时间的发展。


晨间简报管道

这是每个工作日早晨运行的工作流程,也是最能展示系统实际运行状态的流程。

上午 6:50 — 数据收集一个 cron 任务会触发并执行三件事:

  1. 通过 API 从 Todoist 获取任务,按项目(工作、个人、副业)进行分类

  2. 从谷歌日历获取日历事件,过滤掉诸如睡眠追踪条目的噪声

  3. 在 Obsidian 保险库中创建或更新每日笔记,地址为 Daily/YYYY-MM-DD.d

每日简报遵循严格格式:

  • 任务部分,包含复选框、优先级标签和逾期跟踪

  • 时间安排部分,包含时间分区的活动

  • 空白日志区用于白天记录事情

  • 比赛结束时的胜利部分

  • 上下文部分,包含指向人物、决策和文件的反向链接

上午 7:00 — 送达第二个 cron 任务读取缓存数据,直接向我的 Telegram 发送格式化简报。简报很干净——没有复选框,只有按类别整理的项目符号和逾期计数。我醒来,查看手机,准确知道一天的安排。


财务简报

每个工作日上午 9 点,都会运行另一个 cron 任务:

  1. 每个跟踪股票代码都可导航到雅虎财经

  2. 摘录当前价格、每日变动及近期头条

  3. 分类每个标题的情绪(看涨、中性、看跌)

  4. 将摘要表发送给 Telegram

输出看起来像一份迷你市场报告。如果股票代码没有新内容,它就会显示。整个系统自动运行——无需提示。


信息如何在系统中流动

以下是数据流的简明说明:

外部 API(日历、Todoist、股票、电子邮件、天气)会输入到 AI 助手中。助手通过安排的 cron 工作和交互技能处理这些数据。结果会在两个地方出现:

  • 热记忆用于即时上下文(偏好、纠正、激活状态)

  • Obsidian Vault 用于持久存储(每日笔记、操作文档、稳定参考文件)

保险库还会反馈——助手在需要更深入的上下文时按需读取保险库文件,而不是热记忆中的内容。这是一条双向的道路。


为什么特别选择 Obsidian

这在 Obsidian 上效果不错的几个原因:

  1. 纯文本标记——AI 可以无需任何特殊插件或 API 即可读写 Obsidian 笔记。它只是磁盘上的文件。

  2. 反向链接和图表视图 ——当助理在每日笔记中链接到某个人、决策或文件时,Obsidian 的原生链接会生成一个时间变化的视觉连接图。你实际上可以看到主题之间的关联。

  3. 可搜索历史 ——每条每日笔记都是带时间戳的记录。想知道上周二发生了什么?搜索保险库。AI 也能做到同样的事。

  4. 无需 AI 也能正常工作 ——即使助手离线,Vault 依然是一个功能齐全的 PKM 系统。没有厂商锁定。


金库结构

文件夹层级结构如下:

Vault/├── Daily/                    # YYYY-MM-DD.md daily notes├── System/│   └── Assistant/│       ├── context.md        # Operations overview│       ├── preferences.md    # Communication style│       └── environment.md    # Hardware, services, known issues├── Work/│   ├── Business-A/           # Workplace safety operations│   └── Business-B/           # Cleaning services operations├── Personal/│   ├── Finance/              # Stock tracking, budgets│   └── Health/               # Weight, sleep, Steps protocol├── People/                   # Contacts map of content└── Inbox/                    # Unclassified incoming

关键的学科是归档规则:操作事件会进入每日日志,系统问题会单独进入故障排除日志,学习到的修正会进入热内存(如果稳定则存入库),重复的工作流程则成为技能文件。


这带来的意义

  • 跨会话的持续上下文 ——助理能记住修正、偏好和项目状态,而我不会重复自己

  • 自动化每日站会 ——早间简报、财务报告和签到提醒均按时进行

  • 可搜索决策历史 ——每条每日笔记都是经过时间戳的记录,记录发生了什么、决定了什么以及涉及的文件

  • 关注点分离 ——工作与个人环境在保险库结构和简报输出中都被明确区分开


入门(高级)

这是你可以复制粘贴到你的 Hermes 上的模板。

Obsidian + AI 助手 — 入门模板

将以下说明复制粘贴到你的 AI 助手(Hermes、Claude、Cursor 等)中,建立一个作为持久长期记忆的 Obsidian 保险库。


第一部分 — 告诉你的 AI 助手

将以下方块作为系统指令或持续提示,粘贴到你的 AI 助手中。调整避难所路径以匹配你实际创建避难所的位置。

OBSIDIAN VAULT INTEGRATIONYou have access to an Obsidian vault that serves as persistent long-term memory.The vault root is/PATH/TO/YOUR/VAULT/VAULT STRUCTURE:Vault/├── Daily/                    # YYYY-MM-DD.md daily notes — append-only├── System/│   └── Assistant/│       ├── context.md        # Operations, health, family overview│       ├── preferences.md    # Communication style, delivery rules│       └── environment.md    # Hardware, services, known issues├── Work/│   └── Business/             # Work documents, reports, logs├── Personal/│   └── Projects/             # Side projects, personal tracking├── People/                   # Contacts, relationships, MOC└── Inbox/                    # Unclassified incoming — file these laterRULES FOR VAULT ACCESS:1. DAILY NOTES   - Create Daily/YYYY-MM-DD.md each day if it does not exist   - Use frontmatter: ---\ndate: YYYY-MM-DD\ntype: daily\ntags: [daily]\n---   - Sections in order: ## Tasks, ## Schedule, ## Log, ## Wins, ## Context   - Tasks use checkboxes: - [ ] Task Description (p2), (p3), (p4)   - Log entries: - HH:MM AM/PM — what happened   - Wins: completed items with checkmark: ✅ Task Description   - Context section: backlinks to People, Decisions, Files   - APPEND ONLY — never delete content from daily notes2. MEMORY PIPELINE (Three Tiers)   - Tier 1 — Hot Memory: Your per-session memory (MEMORY.md or equivalent).     Injected every turn. Keep it under 6000 characters. Covers active projects,     recent corrections, communication preferences, procedural quirks.   - Tier 2 — Vault Living Files: When hot memory hits ~67% capacity, promote     stable entries to System/Assistant/ files (context.md, preferences.md,     environment.md). Read these on-demand when deeper context is needed.   - Tier 3 — Daily Notes: Searchable timeline. Every event logged during the day     creates a permanent timestamped record. Search past daily notes to recall     what happened on a specific date.3. CONTENT ROUTING   When the user says "log it" or "save it", route by type:   - Operational events (meetings, calls, decisions) → Daily/YYYY-MM-DD.md ## Log   - System issues, technical fixes → System/Assistant/logs/issues-fixes-log.md   - Learned corrections, preferences → Hot memory (or vault if stable)   - Recurring workflows → Save as a reusable skill/procedure file   - Unknown incoming → Inbox/ until classified4. VAULT HYGIENE   - Always use Obsidian wiki-links: [[People/Name]], [[Daily/2026-04-23]]   - Build the link graph — every person, decision, and file mentioned in daily     notes should be linked so the vault graph view shows real connections   - Notice orphaned notes unprompted — if a note has no incoming links, flag it   - Never delete vault content without explicit user confirmation   - Use absolute paths when referencing vault files5. PERSONA FILE SETUP   Tell the user to create the following three files in System/Assistant/:   System/Assistant/context.md — Current life situation, active things to track.     Include: operations overview, health goals, family, work dependencies,     location/timezone, admin tendencies.   System/Assistant/preferences.md — How the user likes things done.     Include: communication style, agenda ordering, delivery preferences,     session style, task management conventions.   System/Assistant/environment.md — Hardware, tools, known issues.     Include: hardware specs, services/ports, key file paths,     known failure patterns, troubleshooting steps.6. HOT MEMORY FILES   The AI assistant uses two memory files that are injected into every session:   MEMORY.md — Your personal notes (procedural knowledge, environment facts,     tool quirks, lessons learned). Format each entry with a § separator.     Keep entries compact and factual. Delete entries that are no longer relevant.   USER.md — Who the user is (name, role, preferences, timezone, family,     vault lookup map). This helps the assistant personalize responses.   Both files live in the AI's memory directory (e.g., ~/.hermes/memories/)   and are automatically loaded at the start of each session.

第二部分 — 创建保险库文件夹结构

在终端里运行这个,用来搭建金库的脚手架:

VAULT_PATH="/PATH/TO/YOUR/VAULT"mkdir -p "$VAULT_PATH"/{Daily,System/Assistant/logs,Work/Business,Personal/Projects,People,Inbox}# Create the three core assistant filescat > "$VAULT_PATH/System/Assistant/context.md" << 'EOF'# Assistant — ContextCurrent life situation, health protocols, and active things to track.Read when context matters for decisions or advice.---## Operations- Describe your main work or business here- Note any secondary projects or side operations## Health- Goals and baselines- Any recurring protocols or reminders## Family- Key people and relationships- Link to People/ folder for details## Work Dependencies- Who you wait on for approvals or sign-offs- Blockers and their schedules## Location & Timezone- Home address (optional)- Timezone- Weather location---*Last updated: YYYY-MM-DD*EOFcat > "$VAULT_PATH/System/Assistant/preferences.md" << 'EOF'# Assistant — PreferencesHow you like things done. Read this when unsure about tone, formator approach.---## Communication- Concise, direct. Dry wit welcome. Never sycophantic.- One clear sentence beats three hedged ones.- When something is urgent, say so plainly.## Operations Separation- Keep work and personal clearly separated- Never mix contexts without explicit labeling## Agenda & Briefings- Priority ordering: Due today > Active/P1 > Bills > Upcoming- Morning brief: always read from actual daily note. Never show template placeholders.## Task Management- Every task completion paired with a log entry in daily note- EOD wrap-ups sourced from daily note log## Delivery Preferences- Where should scheduled summaries go? (email, messaging app, etc.)## Session Style- Continuous same-session conversations or fresh starts each day?---*Last updated: YYYY-MM-DD*EOFcat > "$VAULT_PATH/System/Assistant/environment.md" << 'EOF'# Assistant — Environment & Technical SetupHardware, tools, quirks, and gotchas. Read when troubleshooting or configuring.---## Hardware- Primary machine and specs- Any secondary devices or servers## Services- Key services, ports, and endpoints- API configurations## Key Paths Resource | Path----------|------ Vault | /PATH/TO/YOUR/VAULT/ Daily notes | /PATH/TO/YOUR/VAULT/Daily/YYYY-MM-DD.md## Known Issues & Patterns- Document any recurring problems and their fixes here---*Last updated: YYYY-MM-DD*EOF# Create the issues logcat > "$VAULT_PATH/System/Assistant/logs/issues-fixes-log.md" << 'EOF'# Issues & Fixes LogAppend-only record of system issues, technical failures, and their resolutions.Format: Symptom → Root Cause → Fix → Status---*No entries yet.*EOF# Create People MOCcat > "$VAULT_PATH/People/MOC.md" << 'EOF'# People — Map of ContentContacts and relationships. Each person gets their own note in this folder.---## Family- [[People/Partner]] — spouse/partner- [[People/Child]] — children## Work- [[People/Colleague]] — key colleagues## Personal- [[People/Friend]] — friends and acquaintances---*Last updated: YYYY-MM-DD*EOFecho "Vault scaffolded at $VAULT_PATH"

第三部分——创建你的第一个每日笔记

保险库设置好后,请你的 AI 助手创建今天的每日笔记。它应遵循以下格式:

---date: 2026-04-23type: dailytags: [daily]---## Tasks — 2026-04-23### Work- [ ] Task description (p2)- [ ] Another task (p3)### Personal- [ ] Personal task (p4)### Overdue- [ ] Overdue task (since Apr 15)### Waiting / BlockedNone## Schedule — 2026-04-23- 09:00 AM — Morning meeting- 01:00 PM — Lunch with colleague## Log- 08:00 AM — Started daily note## Wins — 2026-04-23✅ Completed first task## Context- People: [[People/Colleague]]- Decisions: None- Files: None

第四部分 — 设置内存文件

你的 AI 助手需要两个内存文件,每个会话都会注入。具体位置取决于你的 AI 平台,但格式是通用的。

MEMORY.md(热忆——你的助理笔记)

# MEMORY.md — Assistant's Personal NotesAccumulated procedural knowledge, environment facts, tool quirks, lessons learned.Each entry separated by §. Keep compact. Delete stale entries.§ENTRY-NAME: Brief description of a fact, quirk, or lesson learned.§ANOTHER-ENTRY: Another fact or correction.---*Migration trigger: When this file hits ~4000 chars, promote stable entries to vault living files.*

USER.md(用户资料——你是谁)

# USER.md — User ProfileNAME: Your NameTIMEZONE: Your Timezone (e.g., Eastern UTC-4)WEATHER_LOCATION: Your City, StateFAMILY: Partner name, children, key relationshipsVAULT LOOKUP MAP:System/Assistant/context.md → operations, health, family overviewSystem/Assistant/preferences.md → communication style, delivery rulesSystem/Assistant/environment.md → hardware, services, known issuesMemory pipeline: MEMORY.md holds hot procedural knowledge.Vault living files hold stable reference material.Daily notes at /PATH/TO/YOUR/VAULT/Daily/YYYY-MM-DD.md---§PREFERENCE: A specific preference or correction the assistant should remember.§ANOTHER-PREFERENCE: Another user-specific detail.

第五部分——一切如何协同运作

[External Sources] --> [AI Assistant] --> [Hot Memory / Vault]     |                     |                      |  Calendar              Your Tools           MEMORY.md (hot)  Email                 (API, CLI)           context.md  Tasks                 (browser, etc.)      preferences.md  Weather                                    environment.md     |                     |                      |     +-----> [Cron Jobs] -----> [Daily Notes] ----+

流程:

  1. 外部数据通过工具和 API 进入

  2. 助理处理并决定它归属

  3. 热记忆能立即获得上下文(偏好、修正、活动状态)

  4. Vault 文件会有持久存储(每日笔记、操作文档、稳定参考)

  5. Vault 反馈——助手在需要更深入上下文时按需读取 Vault 文件

为什么这样做有效:

  • 纯文本标记下意味着 AI 无需特殊插件即可读取和写入

  • 反向链接创建了时间变化的视觉连接图

  • 每条每日笔记都是带有时间戳的记录——你和 AI 都可以搜索

  • 即使没有 AI 系统,保险库依然完全正常——没有厂商锁定

  • 三层内存保持上下文窗口精简,同时保留积累的知识


第六部分 — 维护

每周:

  • 检查你的保险库里是否有孤立的笔记(没有输入链接的笔记)

  • 审核 MEMORY.md — 删除不再相关的条目

  • 如果 MEMORY.md 超过 4000 字符,则将稳定条目提升到 vault 文件

每月:

  • 审计库结构——文件是否属于正确的文件夹?

  • 检查系统/助手/文件是否有过时信息

  • 查看问题与修复日志,寻找值得作为技能记录的重复模式

当某物坏掉时:

  • 在 System/Assistant/logs/issues-fixes-log.md 中记录问题

  • 如果修复是重复的工作流程,保存为技能/过程文件

  • 如果发现新的已知问题模式,请 environment.md 及时更新


这个模板是个人配置,不是产品。根据你的需求进行调整。

译自:Jonathan_Rivera 的帖子