Initial commit
This commit is contained in:
54
.claude/skills/memory-graph/SKILL.md
Normal file
54
.claude/skills/memory-graph/SKILL.md
Normal file
@@ -0,0 +1,54 @@
|
||||
---
|
||||
name: memory-graph
|
||||
description: Persistent memory graph skill using the MCP Memory server
|
||||
audience: agents
|
||||
visibility: project
|
||||
---
|
||||
|
||||
# Memory Graph Skill
|
||||
|
||||
This skill teaches you how to create, update, search, and prune a persistent knowledge graph using the Model Context Protocol (MCP) Memory server.
|
||||
|
||||
When connected, Memory tools appear as MCP tools named like `mcp__memory__<tool>`. Use these tools proactively whenever you identify durable facts, entities, or relationships you want to persist across sessions.
|
||||
|
||||
See `operations.md` for exact tool I/O shapes and `playbooks.md` for common patterns and routing rules.
|
||||
|
||||
## When To Use
|
||||
- New durable facts emerge (requirements, decisions, owners, IDs, endpoints)
|
||||
- You meet a new entity (person, team, service, repository, dataset)
|
||||
- You discover relationships ("Service A depends on Service B", "Alice owns Repo X")
|
||||
- You want to reference prior sessions or quickly search memory
|
||||
- You need to prune or correct stale memory
|
||||
|
||||
## Golden Rules
|
||||
- Prefer small, well-typed entities over long notes
|
||||
- Record relationships in active voice: `relationType` describes how `from` relates to `to`
|
||||
- Add observations as atomic strings; include dates or sources when helpful
|
||||
- Before creating, search existing nodes to avoid duplicates
|
||||
- When correcting, prefer `delete_observations` then `add_observations` over overwriting
|
||||
|
||||
## Auto Triggers
|
||||
- UserPromptSubmit adds a Memory Graph activation block when durable facts or explicit memory intents are detected. Disable with `LAZYDEV_DISABLE_MEMORY_SKILL=1`.
|
||||
- PostToolUse emits lightweight suggestions when tool results include durable facts. Disable with `LAZYDEV_DISABLE_MEMORY_SUGGEST=1`.
|
||||
|
||||
## Tooling Summary (server "memory")
|
||||
- `create_entities`, `add_observations`, `create_relations`
|
||||
- `delete_entities`, `delete_observations`, `delete_relations`
|
||||
- `read_graph`, `search_nodes`, `open_nodes`
|
||||
|
||||
Always call tools with the fully-qualified MCP name, for example: `mcp__memory__create_entities`.
|
||||
|
||||
## Minimal Flow
|
||||
1) `mcp__memory__search_nodes` for likely duplicates
|
||||
2) `mcp__memory__create_entities` as needed
|
||||
3) `mcp__memory__add_observations` with concise facts
|
||||
4) `mcp__memory__create_relations` to wire the graph
|
||||
5) Optional: `mcp__memory__open_nodes` to verify saved nodes
|
||||
|
||||
## Error Handling
|
||||
- If create fails due to existing name, switch to `add_observations`
|
||||
- If `add_observations` fails (unknown entity), retry with `create_entities`
|
||||
- All delete tools are safe on missing targets (no-op)
|
||||
|
||||
## Examples
|
||||
See `examples.md` for end-to-end examples covering projects, APIs, and people.
|
||||
69
.claude/skills/memory-graph/examples.md
Normal file
69
.claude/skills/memory-graph/examples.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# Examples
|
||||
|
||||
All examples assume the Memory MCP server is connected under the name `memory`, so tool names are `mcp__memory__...`.
|
||||
|
||||
## Project/Service
|
||||
Persist a service and its basics.
|
||||
|
||||
1) Prevent duplicates
|
||||
```
|
||||
tool: mcp__memory__search_nodes
|
||||
input: {"query": "service:alpha"}
|
||||
```
|
||||
|
||||
2) Create entity if missing
|
||||
```
|
||||
tool: mcp__memory__create_entities
|
||||
input: {
|
||||
"entities": [
|
||||
{
|
||||
"name": "service:alpha",
|
||||
"entityType": "service",
|
||||
"observations": [
|
||||
"owner: alice",
|
||||
"repo: github.com/org/alpha",
|
||||
"primary_language: python",
|
||||
"deploy_url: https://alpha.example.com"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
3) Add relation to its owner
|
||||
```
|
||||
tool: mcp__memory__create_relations
|
||||
input: {
|
||||
"relations": [
|
||||
{"from": "service:alpha", "to": "person:alice", "relationType": "owned_by"}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## People
|
||||
Create or enrich people entities.
|
||||
|
||||
```
|
||||
tool: mcp__memory__create_entities
|
||||
input: {"entities": [{"name": "person:alice", "entityType": "person", "observations": ["email: alice@example.com"]}]}
|
||||
```
|
||||
|
||||
Add title change
|
||||
```
|
||||
tool: mcp__memory__add_observations
|
||||
input: {"observations": [{"entityName": "person:alice", "contents": ["title: Staff Engineer (2025-10-27)"]}]}
|
||||
```
|
||||
|
||||
## Corrections
|
||||
Remove stale owner, add new owner.
|
||||
|
||||
```
|
||||
tool: mcp__memory__delete_observations
|
||||
input: {"deletions": [{"entityName": "service:alpha", "observations": ["owner: alice"]}]}
|
||||
```
|
||||
|
||||
```
|
||||
tool: mcp__memory__add_observations
|
||||
input: {"observations": [{"entityName": "service:alpha", "contents": ["owner: bob"]}]}
|
||||
```
|
||||
|
||||
113
.claude/skills/memory-graph/operations.md
Normal file
113
.claude/skills/memory-graph/operations.md
Normal file
@@ -0,0 +1,113 @@
|
||||
# Memory Graph Operations (I/O)
|
||||
|
||||
Use the fully-qualified tool names with the MCP prefix: `mcp__memory__<tool>`.
|
||||
|
||||
All tools below belong to the server `memory`.
|
||||
|
||||
## create_entities
|
||||
Create multiple new entities. Skips any entity whose `name` already exists.
|
||||
|
||||
Input
|
||||
```
|
||||
{
|
||||
"entities": [
|
||||
{
|
||||
"name": "string",
|
||||
"entityType": "string",
|
||||
"observations": ["string", "string"]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## create_relations
|
||||
Create multiple relations. Skips duplicates.
|
||||
|
||||
Input
|
||||
```
|
||||
{
|
||||
"relations": [
|
||||
{
|
||||
"from": "string",
|
||||
"to": "string",
|
||||
"relationType": "string" // active voice, e.g. "depends_on", "owned_by"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## add_observations
|
||||
Add observations to existing entities. Fails if `entityName` doesn’t exist.
|
||||
|
||||
Input
|
||||
```
|
||||
{
|
||||
"observations": [
|
||||
{
|
||||
"entityName": "string",
|
||||
"contents": ["string", "string"]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## delete_entities
|
||||
Remove entities and cascade their relations. No-op if missing.
|
||||
|
||||
Input
|
||||
```
|
||||
{ "entityNames": ["string", "string"] }
|
||||
```
|
||||
|
||||
## delete_observations
|
||||
Remove specific observations from entities. No-op if missing.
|
||||
|
||||
Input
|
||||
```
|
||||
{
|
||||
"deletions": [
|
||||
{
|
||||
"entityName": "string",
|
||||
"observations": ["string", "string"]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## delete_relations
|
||||
Remove specific relations. No-op if missing.
|
||||
|
||||
Input
|
||||
```
|
||||
{
|
||||
"relations": [
|
||||
{
|
||||
"from": "string",
|
||||
"to": "string",
|
||||
"relationType": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## read_graph
|
||||
Return the entire graph.
|
||||
|
||||
Input: none
|
||||
|
||||
## search_nodes
|
||||
Fuzzy search across entity names, types, and observations.
|
||||
|
||||
Input
|
||||
```
|
||||
{ "query": "string" }
|
||||
```
|
||||
|
||||
## open_nodes
|
||||
Return specific nodes and relations connecting them. Skips non-existent names.
|
||||
|
||||
Input
|
||||
```
|
||||
{ "names": ["string", "string"] }
|
||||
```
|
||||
|
||||
44
.claude/skills/memory-graph/playbooks.md
Normal file
44
.claude/skills/memory-graph/playbooks.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# Memory Graph Playbooks
|
||||
|
||||
Use these routing patterns to decide which tools to call and in what order.
|
||||
|
||||
## 1) Persist a New Entity (+ facts)
|
||||
1. `mcp__memory__search_nodes` with the proposed name
|
||||
2. If not found → `mcp__memory__create_entities`
|
||||
3. Then `mcp__memory__add_observations`
|
||||
4. Optionally `mcp__memory__open_nodes` to verify
|
||||
|
||||
Example intent → tools
|
||||
- Intent: “Remember service Alpha (owner: Alice, repo: org/alpha)”
|
||||
- Tools:
|
||||
- `create_entities` → name: "service:alpha", type: "service"
|
||||
- `add_observations` → key facts (owner, repo URL, language, deploy URL)
|
||||
|
||||
## 2) Add Relations Between Known Entities
|
||||
1. `mcp__memory__open_nodes` for both
|
||||
2. If either missing → create it first
|
||||
3. `mcp__memory__create_relations`
|
||||
|
||||
Relation guidance
|
||||
- Use active voice `relationType`: `depends_on`, `owned_by`, `maintained_by`, `deployed_to`, `docs_at`
|
||||
- Prefer directional relations; add reverse relation only if it has a different meaning
|
||||
|
||||
## 3) Correct or Update Facts
|
||||
1. `mcp__memory__open_nodes`
|
||||
2. `mcp__memory__delete_observations` to remove stale/incorrect facts
|
||||
3. `mcp__memory__add_observations` to append correct facts
|
||||
|
||||
## 4) Remove Entities or Links
|
||||
- `mcp__memory__delete_relations` for just the link
|
||||
- `mcp__memory__delete_entities` for full removal (cascades relations)
|
||||
|
||||
## 5) Explore or Export
|
||||
- `mcp__memory__read_graph` to dump entire graph
|
||||
- `mcp__memory__search_nodes` to find relevant nodes by keyword
|
||||
- For focused context, use `mcp__memory__open_nodes` with names
|
||||
|
||||
## 6) Session Rhythm
|
||||
- Before deep work: `search_nodes` or `open_nodes` for today’s entities
|
||||
- During work: add small observations at decision points
|
||||
- After work: link new entities and summarize outcomes as observations
|
||||
|
||||
Reference in New Issue
Block a user