change
它能做什么
这项技能展示 Semantica 知识图谱及其本体随时间的变化。适合需要比较两个时间点的图谱,或了解其词汇如何演变的人。
适用场景
- ✓当你想查看图谱在某个较早日期的样子的时候。
- ✓当你想比较两个日期之间的图谱,看看新增了什么的时候。
- ✓当你需要比较两个本体版本(即定义你术语结构的框架)的时候。
技能链接
https://github.com/semantica-agi/semantica/blob/main/plugins/skills/change/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我看看 6 月 1 日的知识图谱是什么样子,以及到 9 月为止新增了哪些内容?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会为所选日期加载图谱保存的状态,并通过匹配节点 ID,将其与另一个日期进行比较。对于本体版本,它使用单独的版本管理器,因为图谱历史和本体历史是两回事。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
/semantica:change
Track what changed. Usage: /semantica:change <task> [args]
Two distinct mechanisms cover this, and they are not interchangeable:
Question Tool "What did the graph look like on date X?" ContextGraph.state_at()"What changed between ontology versions?" change_management.VersionManager
graph-at <timestamp> — point-in-time graph state
import os
from semantica.context import ContextGraph
graph = ContextGraph()
graph.load_from_file(os.path.expanduser("~/.semantica/kg.json")) # load_from_file does not expand ~
snapshot = graph.state_at("2026-06-01") # str | int | float | datetime
Diff two moments by comparing node IDs — state_at()["nodes"] is a list of
dicts (unhashable), so compare the id fields, not the dicts themselves:
before = graph.state_at("2026-06-01")
after = graph.state_at("2026-09-01")
before_ids = {n["id"] for n in before["nodes"]}
after_ids = {n["id"] for n in after["nodes"]}
added = after_ids - before_ids
For richer temporal work (scrubbing, evolution, temporal patterns) use
/semantica:temporal, which wraps the same layer.
node-history <node_id> — who touched this node
Node-level history is provenance, not change management:
import os
from semantica.provenance import ProvenanceManager
db_path = os.path.expanduser("~/.semantica/prov.db") # storage_path is passed to
os.makedirs(os.path.dirname(db_path), exist_ok=True) # sqlite3.connect() unexpanded
pm = ProvenanceManager(storage_path=db_path)
history = pm.revision_history(node_id)
log = pm.audit_log(since="2026-01-01")
versions / diff <v1> <v2> — ontology versioning
from semantica.change_management import VersionManager
vm = VersionManager()
vm.create_version("1.1.0", ontology)
vm.list_versions()
vm.get_latest_version()
delta = vm.compare_versions("1.0.0", "1.1.0")
delta = vm.diff_ontologies(base_ontology, target_ontology)
migrated = vm.migrate_ontology("1.0.0", "1.1.0", ontology)
TemporalVersionManager and OntologyVersionManager are also exported for
time-scoped and ontology-specific variants.
常见问题
这和审计记录一样吗?
不一样。节点历史是溯源记录,而这项技能关注的是整个图谱及其本体的变化。
能显示是谁修改了某个节点吗?
能。通过节点历史命令,可以列出谁修改过该节点。
可以使用哪些日期格式?
可以用文本日期、数字或日期时间值来选择时间点。
详情
作者的原始描述
Inspect graph changes over time and ontology version diffs in Semantica. Uses ContextGraph.state_at for point-in-time graph state and change_management.VersionManager for ontology versioning.
repo: semantica-agi/semantica
热度
- GitHub 星标
- 14k
- 排名
- #11143
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …