bdi-mental-states by crinkj/common-claude-setting
npx skills add https://github.com/crinkj/common-claude-setting --skill bdi-mental-states使用形式化的 BDI 本体模式,将外部 RDF 上下文转化为智能体的心智状态(信念、欲望、意图)。此技能使智能体能够通过认知架构对上下文进行推理,支持多智能体系统中的审慎推理、可解释性和语义互操作性。
在以下情况下激活此技能:
心智状态(持续体) :持久的认知属性
Belief:智能体认为关于世界的真实情况Desire:智能体希望实现的事情Intention:智能体承诺要达成的目标心智过程(过程体) :修改心智状态的事件
BeliefProcess:通过感知形成/更新信念DesireProcess:根据信念产生欲望Transform external RDF context into agent mental states (beliefs, desires, intentions) using formal BDI ontology patterns. This skill enables agents to reason about context through cognitive architecture, supporting deliberative reasoning, explainability, and semantic interoperability within multi-agent systems.
Activate this skill when:
Mental States (Endurants) : Persistent cognitive attributes
Belief: What the agent believes to be true about the worldDesire: What the agent wishes to bring aboutIntention: What the agent commits to achieving: Events that modify mental states
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
IntentionProcess:将欲望承诺为可执行的意图:Belief_store_open a bdi:Belief ;
rdfs:comment "Store is open" ;
bdi:motivates :Desire_buy_groceries .
:Desire_buy_groceries a bdi:Desire ;
rdfs:comment "I desire to buy groceries" ;
bdi:isMotivatedBy :Belief_store_open .
:Intention_go_shopping a bdi:Intention ;
rdfs:comment "I will buy groceries" ;
bdi:fulfils :Desire_buy_groceries ;
bdi:isSupportedBy :Belief_store_open ;
bdi:specifies :Plan_shopping .
心智状态引用环境的结构化配置:
:Agent_A a bdi:Agent ;
bdi:perceives :WorldState_WS1 ;
bdi:hasMentalState :Belief_B1 .
:WorldState_WS1 a bdi:WorldState ;
rdfs:comment "Meeting scheduled at 10am in Room 5" ;
bdi:atTime :TimeInstant_10am .
:Belief_B1 a bdi:Belief ;
bdi:refersTo :WorldState_WS1 .
意图通过任务序列指定解决目标的计划:
:Intention_I1 bdi:specifies :Plan_P1 .
:Plan_P1 a bdi:Plan ;
bdi:addresses :Goal_G1 ;
bdi:beginsWith :Task_T1 ;
bdi:endsWith :Task_T3 .
:Task_T1 bdi:precedes :Task_T2 .
:Task_T2 bdi:precedes :Task_T3 .
三元组到信念再到三元组实现了 RDF 知识图谱与内部心智状态之间的双向流动:
阶段 1:三元组到信念
# 外部 RDF 上下文触发信念形成
:WorldState_notification a bdi:WorldState ;
rdfs:comment "Push notification: Payment request $250" ;
bdi:triggers :BeliefProcess_BP1 .
:BeliefProcess_BP1 a bdi:BeliefProcess ;
bdi:generates :Belief_payment_request .
阶段 2:信念到三元组
# 心智审慎过程产生新的 RDF 输出
:Intention_pay a bdi:Intention ;
bdi:specifies :Plan_payment .
:PlanExecution_PE1 a bdi:PlanExecution ;
bdi:satisfies :Plan_payment ;
bdi:bringsAbout :WorldState_payment_complete .
| C4 层级 | 表示法 | 心智状态表示 |
|---|---|---|
| L1 上下文 | ArchiMate | 智能体边界、外部感知源 |
| L2 容器 | ArchiMate | BDI 推理引擎、信念存储、计划执行器 |
| L3 组件 | UML | 心智状态管理器、过程处理器 |
| L4 代码 | UML/RDF | 信念/欲望/意图类、本体实例 |
心智实体链接到支持证据,以实现可追溯的推理:
:Belief_B1 a bdi:Belief ;
bdi:isJustifiedBy :Justification_J1 .
:Justification_J1 a bdi:Justification ;
rdfs:comment "Official announcement received via email" .
:Intention_I1 a bdi:Intention ;
bdi:isJustifiedBy :Justification_J2 .
:Justification_J2 a bdi:Justification ;
rdfs:comment "Location precondition satisfied" .
心智状态在有限的时间段内持续存在:
:Belief_B1 a bdi:Belief ;
bdi:hasValidity :TimeInterval_TI1 .
:TimeInterval_TI1 a bdi:TimeInterval ;
bdi:hasStartTime :TimeInstant_9am ;
bdi:hasEndTime :TimeInstant_11am .
查询在特定时刻活跃的心智状态:
SELECT ?mentalState WHERE {
?mentalState bdi:hasValidity ?interval .
?interval bdi:hasStartTime ?start ;
bdi:hasEndTime ?end .
FILTER(?start <= "2025-01-04T10:00:00"^^xsd:dateTime &&
?end >= "2025-01-04T10:00:00"^^xsd:dateTime)
}
复杂的心智实体可分解为组成部分,以便进行选择性更新:
:Belief_meeting a bdi:Belief ;
rdfs:comment "Meeting at 10am in Room 5" ;
bdi:hasPart :Belief_meeting_time , :Belief_meeting_location .
# 仅更新位置组件
:BeliefProcess_update a bdi:BeliefProcess ;
bdi:modifies :Belief_meeting_location .
用本体约束增强 LLM 输出:
def augment_llm_with_bdi_ontology(prompt, ontology_graph):
ontology_context = serialize_ontology(ontology_graph, format='turtle')
augmented_prompt = f"{ontology_context}\n\n{prompt}"
response = llm.generate(augmented_prompt)
triples = extract_rdf_triples(response)
is_consistent = validate_triples(triples, ontology_graph)
return triples if is_consistent else retry_with_feedback()
将 BDI 本体映射到可执行的生产规则:
% 信念触发欲望形成
[HEAD: belief(agent_a, store_open)] /
[CONDITIONALS: time(weekday_afternoon)] »
[TAIL: generate_desire(agent_a, buy_groceries)].
% 欲望触发意图承诺
[HEAD: desire(agent_a, buy_groceries)] /
[CONDITIONALS: belief(agent_a, has_shopping_list)] »
[TAIL: commit_intention(agent_a, buy_groceries)].
hasPart 关系,以实现选择性信念更新。atTime 或 hasValidity 将每个心智实体与时间结构关联。motivates/isMotivatedBy、generates/isGeneratedBy)以实现灵活的查询。Justification 实例,以实现可解释性和信任。BeliefProcess ⊑ ∃generates.Belief)。使用以下 SPARQL 查询验证实现:
# CQ1:哪些信念促成了特定欲望的形成?
SELECT ?belief WHERE {
:Desire_D1 bdi:isMotivatedBy ?belief .
}
# CQ2:特定意图实现了哪个欲望?
SELECT ?desire WHERE {
:Intention_I1 bdi:fulfils ?desire .
}
# CQ3:哪个心智过程生成了一个信念?
SELECT ?process WHERE {
?process bdi:generates :Belief_B1 .
}
# CQ4:计划中任务的顺序序列是什么?
SELECT ?task ?nextTask WHERE {
:Plan_P1 bdi:hasComponent ?task .
OPTIONAL { ?task bdi:precedes ?nextTask }
} ORDER BY ?task
hasPart 的组合建模。详见 references/ 文件夹中的详细文档:
bdi-ontology-core.md - 核心本体模式和类定义rdf-examples.md - 完整的 RDF/Turtle 示例sparql-competency.md - 完整的能力问题 SPARQL 查询framework-integration.md - SEMAS、JADE、LAG 集成模式主要来源:
每周安装数
1
仓库
首次出现
今天
安全审计
安装于
zencoder1
amp1
cline1
openclaw1
opencode1
cursor1
BeliefProcess: Forming/updating beliefs from perceptionDesireProcess: Generating desires from beliefsIntentionProcess: Committing to desires as actionable intentions:Belief_store_open a bdi:Belief ;
rdfs:comment "Store is open" ;
bdi:motivates :Desire_buy_groceries .
:Desire_buy_groceries a bdi:Desire ;
rdfs:comment "I desire to buy groceries" ;
bdi:isMotivatedBy :Belief_store_open .
:Intention_go_shopping a bdi:Intention ;
rdfs:comment "I will buy groceries" ;
bdi:fulfils :Desire_buy_groceries ;
bdi:isSupportedBy :Belief_store_open ;
bdi:specifies :Plan_shopping .
Mental states reference structured configurations of the environment:
:Agent_A a bdi:Agent ;
bdi:perceives :WorldState_WS1 ;
bdi:hasMentalState :Belief_B1 .
:WorldState_WS1 a bdi:WorldState ;
rdfs:comment "Meeting scheduled at 10am in Room 5" ;
bdi:atTime :TimeInstant_10am .
:Belief_B1 a bdi:Belief ;
bdi:refersTo :WorldState_WS1 .
Intentions specify plans that address goals through task sequences:
:Intention_I1 bdi:specifies :Plan_P1 .
:Plan_P1 a bdi:Plan ;
bdi:addresses :Goal_G1 ;
bdi:beginsWith :Task_T1 ;
bdi:endsWith :Task_T3 .
:Task_T1 bdi:precedes :Task_T2 .
:Task_T2 bdi:precedes :Task_T3 .
Triples-to-Beliefs-to-Triples implements bidirectional flow between RDF knowledge graphs and internal mental states:
Phase 1: Triples-to-Beliefs
# External RDF context triggers belief formation
:WorldState_notification a bdi:WorldState ;
rdfs:comment "Push notification: Payment request $250" ;
bdi:triggers :BeliefProcess_BP1 .
:BeliefProcess_BP1 a bdi:BeliefProcess ;
bdi:generates :Belief_payment_request .
Phase 2: Beliefs-to-Triples
# Mental deliberation produces new RDF output
:Intention_pay a bdi:Intention ;
bdi:specifies :Plan_payment .
:PlanExecution_PE1 a bdi:PlanExecution ;
bdi:satisfies :Plan_payment ;
bdi:bringsAbout :WorldState_payment_complete .
| C4 Level | Notation | Mental State Representation |
|---|---|---|
| L1 Context | ArchiMate | Agent boundaries, external perception sources |
| L2 Container | ArchiMate | BDI reasoning engine, belief store, plan executor |
| L3 Component | UML | Mental state managers, process handlers |
| L4 Code | UML/RDF | Belief/Desire/Intention classes, ontology instances |
Mental entities link to supporting evidence for traceable reasoning:
:Belief_B1 a bdi:Belief ;
bdi:isJustifiedBy :Justification_J1 .
:Justification_J1 a bdi:Justification ;
rdfs:comment "Official announcement received via email" .
:Intention_I1 a bdi:Intention ;
bdi:isJustifiedBy :Justification_J2 .
:Justification_J2 a bdi:Justification ;
rdfs:comment "Location precondition satisfied" .
Mental states persist over bounded time periods:
:Belief_B1 a bdi:Belief ;
bdi:hasValidity :TimeInterval_TI1 .
:TimeInterval_TI1 a bdi:TimeInterval ;
bdi:hasStartTime :TimeInstant_9am ;
bdi:hasEndTime :TimeInstant_11am .
Query mental states active at specific moments:
SELECT ?mentalState WHERE {
?mentalState bdi:hasValidity ?interval .
?interval bdi:hasStartTime ?start ;
bdi:hasEndTime ?end .
FILTER(?start <= "2025-01-04T10:00:00"^^xsd:dateTime &&
?end >= "2025-01-04T10:00:00"^^xsd:dateTime)
}
Complex mental entities decompose into constituent parts for selective updates:
:Belief_meeting a bdi:Belief ;
rdfs:comment "Meeting at 10am in Room 5" ;
bdi:hasPart :Belief_meeting_time , :Belief_meeting_location .
# Update only location component
:BeliefProcess_update a bdi:BeliefProcess ;
bdi:modifies :Belief_meeting_location .
Augment LLM outputs with ontological constraints:
def augment_llm_with_bdi_ontology(prompt, ontology_graph):
ontology_context = serialize_ontology(ontology_graph, format='turtle')
augmented_prompt = f"{ontology_context}\n\n{prompt}"
response = llm.generate(augmented_prompt)
triples = extract_rdf_triples(response)
is_consistent = validate_triples(triples, ontology_graph)
return triples if is_consistent else retry_with_feedback()
Map BDI ontology to executable production rules:
% Belief triggers desire formation
[HEAD: belief(agent_a, store_open)] /
[CONDITIONALS: time(weekday_afternoon)] »
[TAIL: generate_desire(agent_a, buy_groceries)].
% Desire triggers intention commitment
[HEAD: desire(agent_a, buy_groceries)] /
[CONDITIONALS: belief(agent_a, has_shopping_list)] »
[TAIL: commit_intention(agent_a, buy_groceries)].
Model world states as configurations independent of agent perspectives, providing referential substrate for mental states.
Distinguish endurants (persistent mental states) from perdurants (temporal mental processes), aligning with DOLCE ontology.
Treat goals as descriptions rather than mental states, maintaining separation between cognitive and planning layers.
Use hasPart relations for meronymic structures enabling selective belief updates.
Associate every mental entity with temporal constructs via atTime or hasValidity.
Use bidirectional property pairs (motivates/isMotivatedBy, generates/isGeneratedBy) for flexible querying.
Link mental entities to Justification instances for explainability and trust.
Implement T2B2T through: (1) translate RDF to beliefs, (2) execute BDI reasoning, (3) project mental states back to RDF.
Define existential restrictions on mental processes (e.g., BeliefProcess ⊑ ∃generates.Belief).
Reuse established ODPs (EventCore, Situation, TimeIndexedSituation, BasicPlan, Provenance) for interoperability.
Validate implementation against these SPARQL queries:
# CQ1: What beliefs motivated formation of a given desire?
SELECT ?belief WHERE {
:Desire_D1 bdi:isMotivatedBy ?belief .
}
# CQ2: Which desire does a particular intention fulfill?
SELECT ?desire WHERE {
:Intention_I1 bdi:fulfils ?desire .
}
# CQ3: Which mental process generated a belief?
SELECT ?process WHERE {
?process bdi:generates :Belief_B1 .
}
# CQ4: What is the ordered sequence of tasks in a plan?
SELECT ?task ?nextTask WHERE {
:Plan_P1 bdi:hasComponent ?task .
OPTIONAL { ?task bdi:precedes ?nextTask }
} ORDER BY ?task
Conflating mental states with world states : Mental states reference world states, they are not world states themselves.
Missing temporal bounds : Every mental state should have validity intervals for diachronic reasoning.
Flat belief structures : Use compositional modeling with hasPart for complex beliefs.
Implicit justifications : Always link mental entities to explicit justification instances.
Direct intention-to-action mapping : Intentions specify plans which contain tasks; actions execute tasks.
See references/ folder for detailed documentation:
bdi-ontology-core.md - Core ontology patterns and class definitionsrdf-examples.md - Complete RDF/Turtle examplessparql-competency.md - Full competency question SPARQL queriesframework-integration.md - SEMAS, JADE, LAG integration patternsPrimary sources:
Weekly Installs
1
Repository
First Seen
Today
Security Audits
Installed on
zencoder1
amp1
cline1
openclaw1
opencode1
cursor1
超能力技能使用指南:AI助手技能调用优先级与工作流程详解
45,100 周安装
json-render-core:AI驱动的JSON模式定义与动态UI渲染核心库
340 周安装
SaaS订阅管理全攻略:生命周期、定价策略、流失预防与收入优化
355 周安装
模板引擎技能:自动化生成Word/Excel/PPT文档,支持Jinja2语法与批量邮件合并
354 周安装
VueUse最佳实践指南:组合式函数高效使用、SSR调试与类型推断解决方案
341 周安装
Cloudflare Workflows 完整指南:生产就绪的服务器端工作流解决方案
341 周安装
Cloudflare Browser Rendering 浏览器自动化指南:Puppeteer与Playwright API完整参考
341 周安装