policy
它能做什么
这项技能根据合规规则检查已记录的决定,例如最低置信度、必需的结果和必填细节。适合需要确保每项决定都符合约定标准的团队。
适用场景
- ✓当你想在一项新决定被接受之前,依据团队规则对其进行检查的时候。
- ✓当你需要一份记录,说明某项决定违反了哪些规则的时候。
- ✓当你想为某一类决定设置带版本的策略的时候。
技能链接
https://github.com/semantica-agi/semantica/blob/main/plugins/skills/policy/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我根据我们的决策规则检查这份供应商批准,并告诉我它是否违反了任何规则?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会把决定与一套规则进行比较,可以使用内置默认值或你自己的规则。它会报告该决定是否合规,并列出任何违规和警告,也可以执行某项策略。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
/semantica:policy
Policy governance over recorded decisions. Usage: /semantica:policy <task> [args]
PolicyEnginelives insemantica.context. For most cases the two policy methods onContextGraphitself are enough.
check <decision> — the simple path
No policy store needed; rules default to a built-in policy set.
from semantica.context import ContextGraph
graph = ContextGraph()
result = graph.check_decision_rules({
"category": "vendor_selection",
"outcome": "approved",
"confidence": 0.93,
"decision_maker": "gyro",
})
# {'compliant': bool, 'violations': [...], 'warnings': [...], 'policy_rules': {...}}
Default rules: min_confidence=0.7, required_outcomes=['approved','rejected','flagged'],
required_metadata=['decision_maker'], max_reasoning_length=1000. Override by
passing your own rules= dict.
enforce <decision> [--rules <dict>]
verdict = graph.enforce_decision_policy(decision_data, policy_rules=None)
Managed policies — the full path
PolicyEngine requires a graph store and versioned Policy objects.
from semantica.context import PolicyEngine
from semantica.context.decision_models import Policy
engine = PolicyEngine(graph_store)
policy_id = engine.add_policy(Policy(...))
policies = engine.get_applicable_policies(category="vendor_selection", entities=[...])
ok = engine.check_compliance(decision, policy_id)
history = engine.get_policy_history(policy_id)
engine.update_policy(policy_id, rules={...}, change_reason="tightened threshold")
engine.record_exception(decision_id, policy_id, reason="...", approver="...")
impact = engine.analyze_policy_impact(policy_id, proposed_rules={...})
affected = engine.get_affected_decisions(policy_id, from_version, to_version)
Note check_compliance takes a Decision object, not a dict — fetch it from the
graph rather than constructing one by hand.
常见问题
内置了哪些规则?
默认值包括 0.7 的最低置信度、允许的结果(例如批准、拒绝或标记),以及必填的决策人字段。
我可以使用自己的规则吗?
可以。你可以传入自己的规则集来替代默认值。
开始使用前需要策略存储吗?
不需要。简单检查无需存储即可进行,而托管策略则需要图谱存储。
详情
作者的原始描述
Define and enforce decision policies, compliance rules, and exceptions over Semantica graphs. Uses ContextGraph.check_decision_rules/enforce_decision_policy and context.PolicyEngine.
repo: semantica-agi/semantica
热度
- GitHub 星标
- 14k
- 排名
- #11152
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …