provenance
它能做什么
这项技能追溯 Semantica 知识图谱中数据的来源和历史,包括来源、变更和审计记录。适合需要说明信息从何而来的人。
适用场景
- ✓当你需要知道某条数据最初来自哪里的时候。
- ✓当你想获得自某个日期以来实体变更的审计日志时。
- ✓当审计人员或监管机构要求提供正式的数据历史记录的时候。
技能链接
https://github.com/semantica-agi/semantica/blob/main/plugins/skills/provenance/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我展示客户记录 C-102 的完整血缘和来源,并列出一月以来的每一项变更?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会查找导致某个条目产生的数据链、它的所有来源以及修订历史,并可以生成审计日志。条目也可以被标记为已被替代,而无需删除其历史。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
/semantica:provenance
Lineage and audit trails. Usage: /semantica:provenance <task> [args]
lineage <entity_id> [--depth N]
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) # SQLite, or omit for in-memory
chain = pm.lineage(entity_id, depth=3)
full = pm.get_lineage(entity_id) # complete ancestry
down = pm.get_descendants(entity_id) # what this entity influenced
sources <entity_id>
srcs = pm.get_all_sources(entity_id) # every source that contributed
prov = pm.get_provenance(entity_id) # the raw PROV entry
hist = pm.revision_history(entity_id)
audit [--since <iso-date>] [--format table|json]
log = pm.audit_log(since="2026-01-01", format="table")
between = pm.query_recorded_between(start, end)
stats = pm.get_statistics()
export [--format turtle|json-ld|xml]
W3C PROV-O export — this is the regulator-facing artifact.
rdf = pm.export_prov(format="turtle", base_uri="https://example.org/prov/")
invalidate <entity_id> <agent_id> [--reason ...]
Mark an entity superseded without deleting history.
pm.invalidate(entity_id, agent_id, reason="source retracted")
check [--strict]
report = pm.check(strict=False) # integrity check over the provenance store
常见问题
什么是 W3C PROV-O?
它是一种描述数据来源的标准方式,这项技能可以按此格式导出记录。
它会删除旧数据吗?
不会。条目可以被标记为已被取代,历史记录会保留。
记录存放在哪里?
可以存放在本地数据库文件中;如果没有指定文件,则只保存在内存中。
详情
作者的原始描述
Trace data lineage, source attribution, audit trails, and W3C PROV-O export in Semantica graphs. Uses ProvenanceManager.
repo: semantica-agi/semantica
热度
- GitHub 星标
- 14k
- 排名
- #11153
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …