Obsidian-Ontology Sync
Philosophy: Obsidian is PRIMARY (human writes natural notes) → Ontology is DERIVED (machine extracts structure) → Feedback loop improves both
Core Concept
CODEBLOCK0
When to Use
| Situation | Action |
|---|
| After creating/updating contacts | Run sync to extract entities |
| Before business queries |
Sync then query ontology |
| Weekly review | Sync + analyze + get suggestions |
| New project setup | Extract entities + suggest structure |
| Team status tracking | Sync daily-status → ontology → analytics |
What Gets Extracted
From Contact Notes (references/contacts/*.md)
Extracts:
- -
Person entity (name, email, phone) - INLINECODE2 → INLINECODE3
- INLINECODE4 → INLINECODE5
- INLINECODE6 →
Project (if mentioned) - INLINECODE8 → (prospect, warm_lead, client, etc.)
Example:
CODEBLOCK1
Becomes:
CODEBLOCK2
From Client Notes (references/clients/*.md)
Extracts:
- -
Organization entity - INLINECODE11 → number
- INLINECODE12 →
Project entities - INLINECODE14 → INLINECODE15
From Team Notes (references/team/*.md)
Extracts:
- -
Person entity - INLINECODE18 → INLINECODE19
- INLINECODE20 → INLINECODE21
- INLINECODE22 → INLINECODE23
- INLINECODE24 → (proactive, reactive, non-responsive)
From Daily Status (daily-status/YYYY-MM-DD/*.md)
Extracts:
- -
response_time property on Person - INLINECODE27 → INLINECODE28
- INLINECODE29 →
Issue entities - INLINECODE31 tracking
From Project Notes (projects/*.md)
Extracts:
- -
Project entity - INLINECODE34 → INLINECODE35
- INLINECODE36 → INLINECODE37
- INLINECODE38 ,
value, INLINECODE40
Sync Process
1. Extract Phase (Markdown → Ontology)
CODEBLOCK3
Detection Rules:
CODEBLOCK4
2. Analysis Phase (Ontology → Insights)
CODEBLOCK5
3. Feedback Phase (Insights → Improve PKM)
CODEBLOCK6
Example Feedback:
CODEBLOCK7
Configuration
config.yaml
CODEBLOCK8
Scheduled Sync (Cron Integration)
Setup Automatic Sync
CODEBLOCK9
Cron Jobs Created:
- 1. Every 3 hours: Extract entities from Obsidian → Update ontology
- Daily 9 AM: Run analytics and generate insights
- Weekly Monday 10 AM: Generate feedback report + template suggestions
Queries (Using Ontology)
Once synced, you can query:
CODEBLOCK10
Feedback Loop Examples
Example 1: Missing Email Detection
Ontology finds: Person entity with no email property
Feedback generated:
CODEBLOCK11
Example 2: Broken Project Links
Ontology finds: Person assigned_to Project that doesn't exist
Feedback generated:
CODEBLOCK12
Example 3: Relationship Discovery
Ontology finds: Multiple people working at same company
Feedback generated:
CODEBLOCK13
Integration with Daily Workflow
Morning Routine (9 AM)
CODEBLOCK14
Weekly Review (Monday 10 AM)
CODEBLOCK15
On-Demand Queries
CODEBLOCK16
Benefits
✅ For You
- 1. Zero Extra Work: Just keep writing normal Obsidian notes
- Automatic Structure: Ontology extracted automatically
- Powerful Queries: Find patterns across all your data
- Quality Improvement: Feedback loop catches missing info
- No Double Entry: Single source of truth (Obsidian)
✅ For Team Management
- - Track who's on which project (auto-extracted)
- Monitor response patterns (from daily-status)
- Identify unbalanced workloads
- Find blockers across projects
✅ For Sales/BD
- - Track contact network (who you met, where, when)
- Follow-up reminders (contacted >7 days ago)
- Relationship mapping (who knows who)
- Pipeline insights (prospects → warm → clients)
✅ For Finance
- - Project valuations (extracted from client notes)
- Team cost allocation (people → projects → revenue)
- Revenue forecasting (active projects × value)
File Structure After Sync
CODEBLOCK17
Advanced: Bidirectional Sync
Future capability:
Update Obsidian notes FROM ontology insights:
CODEBLOCK18
Safety: Always creates backup before modifying files.
Comparison with Alternatives
| Approach | Pros | Cons |
|---|
| Manual ontology | Full control | Too much work, falls behind |
| Obsidian only |
Simple | No structured queries |
|
Ontology only | Powerful queries | Not human-friendly |
|
This skill | Best of both | Initial setup needed |
Getting Started
1. Install Dependencies
CODEBLOCK19
2. Create Config
CODEBLOCK20
3. Run First Sync
CODEBLOCK21
4. Enable Automatic Sync
CODEBLOCK22
5. Query Your Data
CODEBLOCK23
Troubleshooting
Extraction Issues
CODEBLOCK24
Query Not Finding Data
CODEBLOCK25
Feedback Not Generated
CODEBLOCK26
Version History
- - 1.0.0 (2026-02-27) - Initial version with extraction, analysis, feedback loop
Author: Built for team management, contact tracking, and business intelligence at scale
License: MIT
Tags: obsidian, ontology, knowledge-graph, pkm, automation, sync
Obsidian-Ontology 同步
核心理念: Obsidian 是主要工具(人类撰写自然笔记)→ 本体是衍生工具(机器提取结构)→ 反馈循环使两者共同改进
核心概念
Obsidian 笔记 (Markdown)
↓ 提取 (每3小时)
本体图谱 (结构化)
↓ 查询与分析
洞察与建议
↓ 反馈
改进的笔记模板
使用时机
| 场景 | 操作 |
|---|
| 创建/更新联系人后 | 运行同步以提取实体 |
| 业务查询前 |
同步后查询本体 |
| 每周回顾 | 同步 + 分析 + 获取建议 |
| 新项目启动 | 提取实体 + 建议结构 |
| 团队状态跟踪 | 同步每日状态 → 本体 → 分析 |
提取内容
从联系人笔记 (references/contacts/*.md)
提取:
- - Person 实体(姓名、邮箱、电话)
- worksat → Organization
- metat → Event
- assigned_to → Project(如提及)
- status →(潜在客户、热线索、客户等)
示例:
markdown
张三
邮箱: zhangsan@company.com
公司: 某公司
结识于: 2026技术大会
项目: Alpha项目
备注
优秀的开发者,响应及时。
转换为:
json
{
entity: {
id: personzhangsan,
type: Person,
properties: {
name: 张三,
email: zhangsan@company.com,
notes: 优秀的开发者,响应及时
}
},
relations: [
{from: personzhangsan, rel: worksat, to: orgmou_company},
{from: personzhangsan, rel: metat, to: event2026techconference},
{from: personzhangsan, rel: assignedto, to: projectalpha}
]
}
从客户笔记 (references/clients/*.md)
提取:
- - Organization 实体
- hascontractvalue → 数字
- projects → Project 实体
- primary_contact → Person
从团队笔记 (references/team/*.md)
提取:
- - Person 实体
- worksfor → Organization
- assignedto → Project[]
- reportsto → Person
- responsepattern →(主动、被动、无响应)
从每日状态 (daily-status/YYYY-MM-DD/*.md)
提取:
- - responsetime 属性(Person)
- statusupdate → Event
- blockers → Issue 实体
- behavioral_pattern 跟踪
从项目笔记 (projects/*.md)
提取:
- - Project 实体
- for_client → Organization
- team → Person[]
- status、value、deadline
同步流程
1. 提取阶段(Markdown → 本体)
bash
运行提取
python3 skills/obsidian-ontology-sync/scripts/sync.py extract
功能:
1. 扫描配置的 Obsidian 目录
2. 解析 Markdown 前置元数据 + 内容
3. 提取实体(Person、Project、Organization 等)
4. 提取关系(worksat、assignedto 等)
5. 使用仅追加操作写入本体
检测规则:
python
联系人文件
if file.startswith(references/contacts/):
entity_type = Person
extract
emailfrom_content()
extract
companyfrom_property(Company:)
extract
projectsfrom_links([[Project]])
客户文件
if file.startswith(references/clients/):
entity_type = Organization
extract
contractvalue()
extract_projects()
团队文件
if file.startswith(references/team/):
entity_type = Person
role = team_member
extract_assignments()
extract
responsepatterns()
2. 分析阶段(本体 → 洞察)
bash
运行分析
python3 skills/obsidian-ontology-sync/scripts/sync.py analyze
生成洞察,例如:
- 3名团队成员没有分配项目
- 联系人张三缺少邮箱地址
- 项目X有5人但未关联客户
- 来自AI峰会的10个联系人未链接后续任务
3. 反馈阶段(洞察 → 改进PKM)
bash
获取建议
python3 skills/obsidian-ontology-sync/scripts/sync.py feedback
创建:
- 缺失属性建议
- 断链报告
- 关系建议
- 模板改进
反馈示例:
markdown
同步反馈 - 2026-02-27
缺失信息(10项)
- - [ ] 张三 缺少电话号码
- [ ] 李四 团队文件中缺少邮箱
- [ ] 项目 Alpha项目 缺少截止日期
建议链接(5项)
- - [ ] 将 王五(某科技公司)链接到组织 某科技公司
- [ ] 将 赵六 链接到项目(在每日状态中发现但不在团队文件中)
关系洞察
- - Alpha项目 团队:张三、王五、刘七(从每日状态中提取)
- 建议更新项目文件中的团队分配
模板建议
- - 在联系人模板中添加 Projects: [[]] 字段
- 在团队模板中添加 Response Pattern: 字段
配置
config.yaml
yaml
/root/life/pkm/ontology-sync/config.yaml
obsidian:
vault_path: /root/life/pkm
# 同步内容
sources:
contacts:
path: references/contacts
entity_type: Person
extract:
- emailfromcontent
- companyfromproperty
- projectsfromlinks
clients:
path: references/clients
entity_type: Organization
extract:
- contract_value
- projects
- contacts
team:
path: references/team
entity_type: Person
role: team_member
extract:
- assignments
- response_patterns
- reports_to
daily_status:
path: daily-status
extract:
- response_times
- behavioral_patterns
- blockers
ontology:
storage_path: /root/life/pkm/memory/ontology
format: jsonl # 或 sqlite 用于扩展
# 要跟踪的实体类型
entities:
- Person
- Organization
- Project
- Event
- Task
# 要提取的关系
relationships:
- works_at
- assigned_to
- met_at
- for_client
- reports_to
- has_task
- blocks
feedback:
output_path: /root/life/pkm/ontology-sync/feedback
generate_reports: true
suggest_templates: true
highlight_missing: true
schedule:
# 通过cron每3小时运行
sync_interval: 0 /3
analyze_daily: 0 9 * # 每天上午9点
feedback_weekly: 0 10 MON # 周一上午10点
定时同步(Cron集成)
设置自动同步
bash
添加到OpenClaw cron
python3 skills/obsidian-ontology-sync/scripts/setup-cron.py
或通过cron工具手动添加
cron add \
--schedule 0
/3 \
--task python3 skills/obsidian-ontology-sync/scripts/sync.py extract \
--label Obsidian → Ontology Sync
创建的Cron任务:
- 1. 每3小时: 从Obsidian提取实体 → 更新本体
- 每天上午9点: 运行分析并生成洞察
- 每周一上午10点: 生成反馈报告 + 模板建议
查询(使用本体)
同步后,您可以查询:
bash
所有参与高价值项目的团队成员
python3 skills/ontology/scripts/ontology.py query \
--type Person \
--where {role:team_member} \
--related assigned_to \
--filter {type:Project