Agent + Obsidian = Long-Term Memory: Implementing Cross-Session Memory for Agents using Obsidian

Introduction

When working on long-running tasks in environments like Cursor or Claude Code, context windows shift, sessions disconnect, and Agents often fail to remember your previous preferences, project blockers, or past pitfalls. The common practice is to manually paste notes every time or pile up documentation in the project. This consumes tokens and makes it difficult to maintain “what is still valid” versus “what is outdated.”

Here we introduce a community Skill on SkillHub: agent+obsidian=long-term memory (Coordinates: @user_7da98a98/obsidian-memory). It stores memory in Markdown files within an Obsidian vault, loads them according to rules at the start of a task, writes back only after you specify trigger words, and includes Anti-Rot style auditing and decay mechanisms to reduce memory vault bloat and conflicts.

What is this

agent+obsidian=long-term memory is a general-purpose long-term memory Skill categorized under ai-agent. The current version displayed on SkillHub is v1.0.2, the source is community, and the publisher is user_7da98a98. The SKILL.md inside the package lists the author as GDPLAY and describes v2.0 behavioral instructions (this may differ from the store page version number; prioritize the package content you install).

It solves the core problem of providing cross-session, manually editable, and governable Agent memory—data resides in a local Obsidian Vault and does not rely on additional API Keys (SkillHub tag requires_api_key=false).

Core Features

The following capabilities are derived from the SKILL.md / README.md within the installed package and can be compared with the official description.

Path and Initialization

  1. Read the memory vault root path from OBSIDIAN_MEMORY_PATH in SOUL.md; if this field is missing, check if the user instruction contains a path; if neither exists, ask once.
  2. At the start of a task, it defaults to reading profile.md, rules.md, and the last 20 lines of session-log.md. It does not automatically load project files under projects/ unless the user explicitly mentions a project name in the instruction (in which case, only the “Current Status” block of that project file is read).

Write-back and Trigger Words

Writing only occurs when the following trigger words are received (the AI does not independently judge “whether the task is finished”):

Trigger Word Function
任务完成 (Task Complete) Full write-back
/记一下, /记录, /更新记忆 Record current key information
/查历史 {project name} Read the complete history archive section of that project

The write-back scope includes: slowly changing profile.md, project-isolated projects/{project_name}.md, and appended session-log.md (keeping the latest 10 entries). rules.md is written by the process only after audit confirmation; routine tasks do not actively modify the rules file.

Anti-Rot Governance (v2.0 Instructions)

  • Hit Marking: Memory entries that are actually used update their “Last Hit: YYYY-MM-DD”, merged into the write-back at the end of the task, avoiding frequent disk writes for pure reads.
  • Memory Audit: The user can say /审计记忆 (Audit Memory), or a reminder will appear at the end of the reply if it has been more than 7 days since the last audit. The audit scans for conflicts, aging entries, repeated pitfalls (suggesting escalation to rules.md rules if the same type of problem occurs ≥3 times), session-log capacity, etc. A report is generated first, and changes are made only after user confirmation.
  • Directory Structure: The memory vault contains profile.md, rules.md, projects/, session-log.md, audit-log.md; completed projects can be archived to projects/archive/.

The SkillHub page introduction focuses on “reading paths from SOUL.md, loading at task start, writing back at task end”; details such as Anti-Rot, trigger words, and file layering are subject to the documentation within the package.

Installation and Activation

Install SkillHub CLI (if not installed)

First, check if the CLI is already available:

command -v skillhub && skillhub --version

If not installed, follow the SkillHub official instructions (full installation example):

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash

Install this Skill

During installation, you must use --dir to point to the current Agent’s skills directory; otherwise, the default installation to ./skills/ might not be recognized. The installation prompt given on the SkillHub page is: install @user_7da98a98/obsidian-memory following the SkillHub Installation Documentation.

Example (Cursor users can set the directory to ~/.cursor/skills/):

skillhub install @user_7da98a98/obsidian-memory --dir ~/.cursor/skills/

Other common paths (excerpted from SkillHub installation docs): Claude Code is ~/.claude/skills/; Codex is ~/.codex/skills/ or .agents/skills/ under the project. After installation, restart or refresh the Agent according to your client’s requirements to enable the Skill.

Prepare Obsidian Memory Vault

Create _agent-memory/ under your Vault (the name can be customized, but must match the path configuration). The initial structure recommended by the README is as follows:

YourVault/
└── _agent-memory/
    ├── profile.md
    ├── rules.md
    ├── session-log.md
    ├── audit-log.md
    └── projects/
        └── archive/

You can copy templates from the templates/ folder in the Skill package to the corresponding files; audit-log.md and projects/archive/ need to be created manually.

Configure SOUL.md

Create or edit SOUL.md in the Agent configuration directory and write the absolute path of the memory vault. The README example writes the configuration directory as ~/.workbuddy/ (Windows: %USERPROFILE%\.workbuddy\). You should place SOUL.md in the location agreed upon by your actual client environment. The field format is as follows:

OBSIDIAN_MEMORY_PATH: Full_path_to_your_agent-memory

Example:

OBSIDIAN_MEMORY_PATH: D:\obsidian\vault\_agent-memory

Once the path is confirmed, the Skill will not ask for it again.

Typical Usage

Following the steps above, a complete collaboration looks roughly like this.

  1. Start Task: The Agent reads profile.md, rules.md, and recent session logs according to the Skill, integrating memory into the response rather than reciting memory content to the user item by item.
  2. Execute Work: Complete writing, development, and other tasks normally; if pitfalls occur, the Skill guides writing them to the “Pitfall Records” section of the corresponding project, separate from “Recent Decisions”.
  3. Explicit Write-back: Say 任务完成 (Task Complete) at the end, or use trigger words like /记一下 (Note this down) during the process; the Agent should reply “Memory updated” and briefly describe what was written.
  4. Regular Audit: Say /审计记忆 (Audit Memory), and choose “Execute All”, “Confirm Item by Item”, or “Cancel” based on the report; when repeated pitfalls reach the threshold, the suggested text can be written into rules.md.

If the user explicitly says “no memory needed”, the Skill rules dictate skipping all reading and writing, executing only the task.

Use Cases and Notes

Who it is for: Users who need to reuse personal preferences long-term, manage multiple projects in parallel, and want to view and edit memory themselves in Obsidian. Scenarios such as official account writing, project development, and daily affairs are mentioned in the official introduction.

Usage Notes:

  • No write-back occurs without trigger words (hit marking also waits until the next actual write to disk), so make sure to add a 任务完成 or /记一下 after finishing a task.
  • The memory vault is Markdown; the format needs to roughly conform to the section conventions in the Skill. Otherwise, reads will skip abnormal blocks, and write-backs will complete them according to specifications.
  • SkillHub Statistics (as of page scrape): Rating 100000, Downloads 1343, Displayed Installs 0; this is a community Skill, so it is recommended to verify the version on SkillHub or in the package README before upgrading.
  • For more complete instructions and the GitHub repository, see the README in the package: https://github.com/GDPLAY/obsidian-memory.

Conclusion

agent+obsidian=long-term memory breaks down “remembering” into readable path configuration, layered Markdown, trigger-based write-back, and a confirmable audit process, aligning the Agent’s long-term memory with the Obsidian note vault. If you want to try installing it locally, start from the SkillHub skill page:

  • Skill Page: https://www.skillhub.cn/skills/user_7da98a98/obsidian-memory
  • API Entry: https://api.skillhub.cn/user_7da98a98/obsidian-memory
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye