← 返回 Skills 市场
knowledge-graph-memory
作者
jpengcheng523-netizen
· GitHub ↗
· v1.0.0
· MIT-0
394
总下载
0
收藏
2
当前安装
1
版本数
在 OpenClaw 中安装
/install jpeng-knowledge-graph-memory
功能描述
Builds and maintains a knowledge graph for long-term memory with concept drift detection and temporal reasoning. Use when storing structured knowledge, detec...
使用说明 (SKILL.md)
Knowledge Graph Memory
Long-term memory system with knowledge graph, concept drift detection, and temporal reasoning.
When to Use
- Building knowledge graphs from concepts and relationships
- Detecting concept drift over time
- Temporal reasoning and time-based queries
- Long-term memory storage with consolidation
Usage
const { KnowledgeGraph, Memory } = require('./skills/knowledge-graph-memory');
// Create a knowledge graph
const kg = new KnowledgeGraph();
// Add concepts
kg.addConcept('AI', { category: 'technology', importance: 0.9 });
kg.addConcept('Machine Learning', { category: 'technology' });
// Link concepts
kg.link('AI', 'Machine Learning', 'includes');
// Find related concepts
const related = kg.getRelated('AI');
// Detect concept drift
const drift = kg.detectDrift('AI');
// Search concepts
const results = kg.search({ name: 'AI' });
Features
- Knowledge Graph: Nodes (concepts) and edges (relationships)
- Concept Drift Detection: ADWIN, DDM, statistical methods
- Temporal Reasoning: Time-based queries and event tracking
- Memory Consolidation: Promote important memories, forget unused ones
API
KnowledgeGraph
const kg = new KnowledgeGraph({
maxNodes: 10000,
consolidationThreshold: 0.1,
driftDetection: { method: 'statistical', threshold: 2.0 }
});
// Add and get concepts
kg.addConcept(name, properties);
kg.getConcept(idOrName);
// Create relationships
kg.link(sourceId, targetId, edgeType, properties);
// Query
kg.getRelated(conceptId, edgeType);
kg.findPath(startId, endId, maxDepth);
kg.search({ name: 'pattern', type: 'concept' });
// Drift detection
kg.detectDrift(conceptId);
// Memory management
kg.consolidate();
kg.removeConcept(id);
// Serialization
kg.toJSON();
KnowledgeGraph.fromJSON(data);
Concept
const concept = new Concept({
name: 'AI',
type: 'concept',
properties: { category: 'technology' },
importance: 0.8
});
concept.access(); // Increment access count
concept.update({ newProperty: 'value' }); // Update with history
DriftDetector
const detector = new DriftDetector({
method: 'statistical',
windowSize: 100,
threshold: 2.0
});
const result = detector.addSample(value);
// { drift: boolean, warning: boolean, mean, stdDev }
TemporalReasoner
const reasoner = new TemporalReasoner();
reasoner.addEvent({ type: 'concept_added', conceptId: 'AI' });
reasoner.getEventsInRange(start, end);
reasoner.getEventsBefore(time);
reasoner.getEventsAfter(time);
reasoner.getRecentEvents(10);
Memory
const memory = new Memory({
shortTermMaxSize: 100,
consolidationInterval: 3600000
});
memory.remember('key', { data: 'value' }, { importance: 0.8 });
memory.recall('key');
memory.forget('key');
memory.consolidate();
Node Types
CONCEPT: Abstract conceptENTITY: Concrete entityEVENT: Time-based eventFACT: Verified factRELATION: Relationship node
Edge Types
IS_A: Inheritance relationshipHAS_A: Composition relationshipRELATED_TO: Generic relationshipCAUSES: Causal relationshipPRECEDES: Temporal orderingINCLUDES: Set membershipSIMILAR_TO: Similarity relationshipDERIVED_FROM: Derivation relationship
Example: Building a Knowledge Base
const { KnowledgeGraph, EdgeType } = require('./skills/knowledge-graph-memory');
const kg = new KnowledgeGraph();
// Build knowledge structure
kg.addConcept('Technology', { category: 'domain' });
kg.addConcept('AI', { category: 'field' });
kg.addConcept('Machine Learning', { category: 'subfield' });
kg.addConcept('Neural Networks', { category: 'technique' });
kg.addConcept('Deep Learning', { category: 'technique' });
// Create relationships
kg.link('AI', 'Technology', EdgeType.IS_A);
kg.link('Machine Learning', 'AI', EdgeType.IS_A);
kg.link('Neural Networks', 'Machine Learning', EdgeType.IS_A);
kg.link('Deep Learning', 'Neural Networks', EdgeType.IS_A);
kg.link('Deep Learning', 'Machine Learning', EdgeType.RELATED_TO);
// Query the graph
const mlRelated = kg.getRelated('Machine Learning');
const path = kg.findPath('Deep Learning', 'Technology');
console.log('ML related concepts:', mlRelated.map(r => r.concept.name));
console.log('Path:', path?.map(c => c.name));
Example: Concept Drift Detection
const { KnowledgeGraph } = require('./skills/knowledge-graph-memory');
const kg = new KnowledgeGraph();
kg.addConcept('User Behavior', { pattern: 'initial' });
// Simulate concept evolution
for (let i = 0; i \x3C 50; i++) {
const concept = kg.getConcept('User Behavior');
concept.update({ pattern: `evolved_${i}` });
const drift = kg.detectDrift('User Behavior');
if (drift.drift) {
console.log('Drift detected at iteration', i);
}
}
Example: Memory Consolidation
const { Memory } = require('./skills/knowledge-graph-memory');
const memory = new Memory();
// Store memories
memory.remember('important_fact', { value: 'critical data' }, { importance: 0.9 });
memory.remember('temporary_note', { value: 'temp data' }, { importance: 0.3 });
// Access important memory multiple times
for (let i = 0; i \x3C 5; i++) {
memory.recall('important_fact');
}
// Consolidate - promotes frequently accessed to long-term
const result = memory.consolidate();
console.log('Promoted:', result.promoted, 'Removed:', result.removed);
安全使用建议
This skill appears to be a local JavaScript library implementing a knowledge graph and drift detection and is coherent with its description. Before installing or using it: 1) verify the module export (module.exports / exports) and the correct require/import path — SKILL.md examples reference ./skills/knowledge-graph-memory which may not match the package layout; 2) read the remaining portion of index.js (the file was partially shown) to confirm there are no network calls, file writes, or hidden endpoints; 3) treat stored memories as potentially sensitive — implement access controls and avoid storing PII or secrets in the graph; and 4) run the code in a sandbox or review tests locally if you plan to use it in production.
功能分析
Type: OpenClaw Skill
Name: jpeng-knowledge-graph-memory
Version: 1.0.0
The skill bundle provides a legitimate implementation of a knowledge graph and long-term memory system. The code in index.js focuses entirely on data structure management, including concept drift detection and temporal reasoning, without any high-risk behaviors such as network requests, file system access, or shell execution. No evidence of malicious intent or prompt injection was found in the documentation or logic.
能力评估
Purpose & Capability
The name and description (knowledge graph, drift detection, temporal reasoning) match the API and the included index.js implementation. The functionality requested in SKILL.md (addConcept, link, detectDrift, temporal queries, memory consolidation) is implemented or clearly represented in the code.
Instruction Scope
Runtime instructions and examples operate on in-memory graph objects and do not instruct reading system files, environment variables, or contacting external endpoints. Minor documentation mismatch: examples call require('./skills/knowledge-graph-memory') while the package's main file is index.js at the package root and the visible portion of index.js does not show module.exports — you should verify the module export path and names before using.
Install Mechanism
No install spec and no external downloads are declared. The skill is effectively an embedded library (code file present) and does not pull external artifacts or run installers.
Credentials
No environment variables, credentials, or config paths are required or referenced. The code does not access process.env or similar in the visible portion.
Persistence & Privilege
The skill is not force-enabled (always: false) and does not request elevated persistent privileges. It does not modify other skills or system-wide configs in the visible code.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install jpeng-knowledge-graph-memory - 安装完成后,直接呼叫该 Skill 的名称或使用
/jpeng-knowledge-graph-memory触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of knowledge-graph-memory skill.
- Provides a knowledge graph for long-term memory with concept drift detection and temporal reasoning.
- Supports adding concepts, linking relationships, and querying related nodes or paths.
- Includes statistical methods for detecting concept drift over time.
- Enables temporal reasoning with event tracking and time-based queries.
- Memory management features: short-term and long-term storage, memory consolidation, and forgetting unused items.
- Offers a modular API for KnowledgeGraph, Concept, DriftDetector, TemporalReasoner, and Memory.
元数据
常见问题
knowledge-graph-memory 是什么?
Builds and maintains a knowledge graph for long-term memory with concept drift detection and temporal reasoning. Use when storing structured knowledge, detec... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 394 次。
如何安装 knowledge-graph-memory?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install jpeng-knowledge-graph-memory」即可一键安装,无需额外配置。
knowledge-graph-memory 是免费的吗?
是的,knowledge-graph-memory 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
knowledge-graph-memory 支持哪些平台?
knowledge-graph-memory 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 knowledge-graph-memory?
由 jpengcheng523-netizen(@jpengcheng523-netizen)开发并维护,当前版本 v1.0.0。
推荐 Skills