Causal Graph Builder
v1.0.0自动从日志和记忆中提取实体、事件及其因果关系,构建动态知识图谱并支持查询与可视化。
Security Scan
OpenClaw
Suspicious
medium confidencePurpose & Capability
The skill's name/description (auto-extract entities/events/causal relations from logs/memory) matches the included build.mjs which reads local memory files, extracts entities/events, infers relations, and writes memory/causal-graph.json. However SKILL.md describes additional inputs (.issues/open-*.md, memory/INDEX.md) and capabilities (LLM-based extraction, query.mjs, visualize.mjs, Dashboard integration) that are not implemented in the provided code. That mismatch is unexpected but could be an incomplete implementation rather than malicious.
Instruction Scope
SKILL.md instructs the agent to read multiple paths (memory/YYYY-MM-DD.md, MEMORY.md, .issues/open-*.md) and run commands referencing query.mjs and visualize.mjs. The actual build.mjs only attempts to read MEMORY.md and files under workspace/memory with date-named files, and there are no query.mjs or visualize.mjs files in the bundle. SKILL.md also mentions LLM extraction as an option, but the shipped code uses only local regex/heuristics and does not call any external LLMs or endpoints. This divergence gives the agent broad discretion in instructions without corresponding implementation and could confuse users.
Install Mechanism
There is no install spec (instruction-only style) and the included script is a small local Node module. No remote downloads, package installs, or third-party registries are used. The script writes memory/causal-graph.json in the workspace — expected for this task. Minor implementation risk: build.mjs calls fs.readdirSync on WORKSPACE/memory without guarding for the directory's existence, which can cause runtime failure.
Credentials
The only environment variable referenced is OPENCLAW_WORKSPACE to override the workspace directory; this is proportionate to the stated purpose. No credentials, tokens, or external service keys are requested or used.
Persistence & Privilege
The skill is not marked always:true and does not persist credentials or modify other skills. It does write an output file memory/causal-graph.json in the workspace (expected). SKILL.md mentions Dashboard integration and interactive visualization, but no code implements that; if future versions add remote/dashboard integration, that would raise new persistence/privilege considerations.
What to consider before installing
This skill appears to implement a local-only causal-graph builder and does not request secrets or network access, but the documentation and code disagree in several places. Before installing or running: (1) inspect the workspace/memory directory it will read and confirm you are comfortable with those files being scanned; (2) be aware it will write memory/causal-graph.json to your workspace; (3) note that query.mjs and visualize.mjs referenced in SKILL.md are missing and LLM integration is described but not implemented — if you need those features expect additional code that may require network access or credentials; (4) the script may crash if workspace/memory does not exist (minor bug). Because of the mismatches and incomplete implementation, proceed with caution or request a corrected/released version that matches its documentation.Like a lobster shell, security has layers — review code before you run it.
latest
Causal Graph Auto-Builder — 因果图谱自动构建
降低 Knowledge Graph 维护成本,自动发现事件因果关系
概述
从日志和记忆文件中自动提取事件、实体、因果关系,构建知识图谱。
核心功能
1. 实体识别
- 人物: 瓜农, 龙虾, Jason Zuo
- 项目: AgentAwaken, NeuroBoost, ClawWork
- 工具: GitHub, Vercel, ClawHub
- 概念: 永续记忆, 三层架构, P0 标记
2. 事件提取
[2026-02-22] 实施永续记忆增强
[2026-02-26] NeuroBoost v5.0 发布
[2026-03-01] 创建 agentawaken repo
3. 因果关系推断
ClawHub 超时 → 检查版本 → 发现已发布
永续记忆增强 → 记忆健康度提升 → 任务完成率提升
图谱结构
节点类型
- Entity (实体): 人、项目、工具
- Event (事件): 带时间戳的动作
- Concept (概念): 抽象想法
边类型
- causes (导致): A → B
- enables (使能): A 让 B 成为可能
- requires (需要): A 依赖 B
- relates (相关): A 与 B 有关
自动构建流程
输入
memory/YYYY-MM-DD.md(日志)MEMORY.md(长期记忆).issues/open-*.md(任务)
处理
- NER (命名实体识别) — 提取人名、项目名
- 事件抽取 — 识别动作和时间
- 因果推断 — 分析前后关系
- 去重合并 — 同一实体不同表述合并
输出
{
"nodes": [
{ "id": "agent-awaken", "type": "project", "label": "AgentAwaken" },
{ "id": "vercel", "type": "tool", "label": "Vercel" },
{ "id": "deploy-event", "type": "event", "label": "部署到 Vercel", "timestamp": "2026-03-01" }
],
"edges": [
{ "from": "agent-awaken", "to": "vercel", "type": "requires" },
{ "from": "deploy-event", "to": "agent-awaken", "type": "affects" }
]
}
实现方案
方案 A: 规则匹配(快速)
// 简单正则匹配
const patterns = {
cause: /因为|由于|导致|所以/,
enable: /使得|让|允许/,
require: /需要|依赖|基于/
};
方案 B: LLM 提取(准确)
// 用 LLM 分析文本
const prompt = `
从以下文本提取因果关系,输出 JSON:
{ "cause": "...", "effect": "...", "confidence": 0.9 }
文本: ${text}
`;
方案 C: 混合(推荐)
- 规则匹配快速筛选候选
- LLM 验证和补充细节
- 人工审核低置信度关系
使用示例
# 构建图谱
node skills/causal-graph/build.mjs
# 查询
node skills/causal-graph/query.mjs "AgentAwaken 的依赖"
# 输出: Vercel, GitHub, Next.js, pnpm
# 可视化
node skills/causal-graph/visualize.mjs > graph.html
集成到 AgentAwaken
在 Dashboard 显示:
- 交互式知识图谱
- 点击节点查看详情
- 高亮因果链路
- 时间轴动画
维护成本对比
| 方式 | 初始成本 | 维护成本 | 准确度 |
|---|---|---|---|
| 手动维护 | 高 | 极高 | 高 |
| 规则匹配 | 低 | 中 | 中 |
| LLM 提取 | 中 | 低 | 高 |
| 混合方案 | 中 | 低 | 极高 |
结论: 混合方案最优,初期投入中等,长期维护成本低。
下一步
- 实现基础规则匹配版本
- 集成 LLM 提取
- 添加可视化界面
- 接入 AgentAwaken Dashboard
Comments
Loading comments...
