Prerequisites
First ensure memory-graph is executable:
- Already ran
{Skill}/assets/install.sh - Execute
memory-graph -vcan output the version number
Actions
link
Look up the memory graph according to the user's request, and describe to the user your understanding based on historical memories, as well as how it will affect the current task
memory-graph search "<关键词1[空格]关键词2 ...>" [--nodes 5]
patch/apply
Used when the user requests consolidating memories.
- During patch: first review the session history, focus onuser input information
- During apply: first understand the content provided by the user or the user's request
- Then execute the following steps
- Extract reusable conclusions, evidence, rules, actions, experience, or assets
- For the user's convenience in editing, first generate
/tmp/memory-apply.yaml, provide the user with a clickable preview link - Let the user view, edit, or give an optimization direction
- After receiving the confirmation write instruction, then write to the memory graph
- Write to memory graph:
memory-graph apply /tmp/memory-apply.yaml
Example:
summary: 本轮会话摘要。
nodes:
- id: note:worktree-reuse-node-modules
type: Note
title: worktree 复用 node_modules
summary: >
master 已有 node_modules 时,新 worktree 应软链复用,
避免重复安装依赖。
tags: [worktree, node_modules, symlink]
edges: []
look
Used when the user needs to view, clean up, or manage memories
memory-graph look
- Supports: overview, search, node details, update/delete nodes, delete relationships
Rules
- Storage always uses global
~/.memory-graph - nodes only use
Concept、Note、Basis、Asset、Rule、Skill、Action - nodes can write
tags, used for lightweight indexing and retrieval; tags are not built into nodes - Prioritize consolidating reusable conclusions, do not write running accounts, do not write entire chat transcripts as nodes
- patch uses YAML by default, fields remain
summary / nodes / edges, temporary files are always written to/tmp/memory-apply.yaml - Without user confirmation, do not execute
apply
Graph model
Nodes
| Type | Definition and purpose |
|---|---|
Concept |
Concepts, modules, project names, tools, commands, person names... |
Basis |
Raw evidence: user instructions, chat records, code snippets, errors, terminal output... |
Note |
Stable conclusions, judgments, experience, derived by Basis induction |
Asset |
Files, directories, commands, configurations, interfaces, functions within the project... |
Rule |
Rules, user preferences, behavioral constraints... |
Skill |
Tool invocation experience, operation steps, workflows... |
Action |
Specific to execution operations, but must include a verb and an object |
Edges
| Edge | Meaning | Domain (source) | Range (target) |
|---|---|---|---|
DESCRIBES |
Conclusion/rule describes object characteristics | Note, Rule | Concept, Asset |
BASED_ON |
Conclusion is based on raw evidence | Note | Basis |
APPLIES_TO |
Rule/skill applicable object | Rule, Skill | Concept, Asset |
REQUIRES |
Operation/skill depends on a certain condition or artifact | Action, Skill | Asset, Rule, Concept |
PRODUCED |
Operation produces an artifact or raw output | Action | Asset, Basis |
NEXT |
Next step in the process | Skill, Action | Skill, Action |
USES |
Usage relationship | Action, Skill, Concept, Asset | Concept, Asset |
CONTAINS |
Hierarchical containment | Concept, Asset | Concept, Asset |
CAUSES |
Causal relationship | Action, Basis | Basis |
RELATES_TO |
Fuzzy association, used for diary-style management | Any node | Any node |