介绍
# Obsidian Knowledge Base
Obsidian 仓库 = 包含 Markdown 文件的文件夹 + `.obsidian/` 配置。
## 配置
- **Vault Path:** `/home/ruslan/webdav/data/ruslain` - **Env:** `OBSIDIAN_VAULT=/home/ruslan/webdav/data/ruslain`
## CLI 用法
脚本位置:`/home/ruslan/.openclaw/workspace/skills/obsidian/scripts`
注意:全局标志(如 `--vault`、`--json`)必须位于命令之前。
```bash export OBSIDIAN_VAULT=/home/ruslan/webdav/data/ruslain cd /home/ruslan/.openclaw/workspace/skills/obsidian/scripts
# Search (fuzzy/phonetic) - uses ripgrep for speed python3 obsidian_search.py "$OBSIDIAN_VAULT" "query" --limit 10 --json
# List notes python3 obsidian_cli.py --json list # all notes python3 obsidian_cli.py --json list "Projects" # in folder
# List folders python3 obsidian_cli.py --json folders
# Read note python3 obsidian_cli.py --json read "Note Name"
# Create note python3 obsidian_cli.py --json create "Title" -c "Content" -f "Folder" -t tag1 tag2 python3 obsidian_cli.py --json create "Title" -c "Content" --auto-folder # auto-detect folder
# Edit note python3 obsidian_cli.py --json edit "Note" append -c "Text to append" python3 obsidian_cli.py --json edit "Note" prepend -c "Text at start" python3 obsidian_cli.py --json edit "Note" replace -c "New full content" python3 obsidian_cli.py --json edit "Note" replace-section -s "Summary" -c "New section text"
# Tags python3 obsidian_cli.py --json tags
# Links (incoming/outgoing) python3 obsidian_cli.py --json links "Note Name"
# Suggest folder for content python3 obsidian_cli.py --json suggest-folder "content text" --title "Note Title" ```
## 工作流:查询知识库
1. 使用用户查询运行 `obsidian_search.py` 2. 如需上下文,请阅读顶部结果 3. 根据找到的内容组织答案 4. 引用来源:`[[Note Name]]`
## 工作流:保存笔记
1. 如果未指定文件夹 → 运行 `suggest-folder` 或使用 `--auto-folder` 2. 使用 `create` 命令创建笔记 3. 根据内容添加适当的标签 4. 向用户报告创建的路径
## 工作流:通过提示词编辑笔记
用户提示词示例: - "Добавь резюме в конец заметки X" → `edit X append -c "..."` - "Перепиши заметку Y более кратко" → 读取笔记,重写,`edit Y replace -c "..."` - "Добавь секцию 'Выводы' в заметку Z" → `edit Z replace-section -s "Выводы" -c "..."`
## 笔记格式
```markdown --- created: 2024-01-15T10:30:00 modified: 2024-01-15T12:00:00 tags: - project - work ---
# Title
Content with [[wikilinks]] and #inline-tags. ```
## Wikilinks
- `[[Note Name]]` — 链接到笔记 - `[[Note Name|Display Text]]` — 带别名的链接 - `[[Note Name#Section]]` — 链接到章节
## Frontmatter 字段
标准字段: - `created` — 创建时间戳 - `modified` — 最后编辑时间戳 - `tags` — 标签列表 - `aliases` — 用于链接的别名
## 搜索行为
`obsidian_search.py` 使用: - ripgrep 进行快速初始筛选 - 标题匹配(权重最高) - 标签匹配 - 带有音译(RU↔EN)的模糊内容搜索 - 返回:路径、标题、分数、匹配的上下文