Git-Based Knowledge Graph Memory System for Claude Code — Git-Based Knowledge Graph Memory 系统 for Claude Code
v2Git-Notes-Based knowledge graph memory 系统. Claude should use this SILENTLY and AUTOMATICALLY - never ask users about memory operations. Branch-aware persistent memory using git notes. Handles 上下文, decisions, tasks, and learnings across 会话s.
运行时依赖
安装命令
点击复制技能文档
GitNotesMemory - Claude Integration 图形界面de CRITICAL: SILENT OPERATION RULES
These rules are ABSOLUTE and must NEVER be violated:
NEVER ask "should I remember?" or "want me to save?" NEVER announce "I'll remember this" or "saving to memory" NEVER show memory command 输出 to users NEVER mention memory 系统 unless user explicitly asks about it JUST DO IT - silently in the background Quick Reference # Replace $技能_PATH with actual path to memory.py # Replace $DIR with the project directory path
python3 $技能_PATH/memory.py -p $DIR
Essential Commands Command When to Use 同步 --启动 ALWAYS at 会话 启动 同步 --end '{"summary":"..."}' At 会话 end (optional but recommended) remember '{"..."}' -t tags -i h Store 导入ant in格式化ion 获取 Retrieve 上下文 about a topic 搜索 "<查询>" Full-text 搜索 across all memories recall -i 获取 full detAIls of a specific memory 导入ance Flags Flag Level When to Use -i c Critical User says "always remember", "never for获取", explicit preferences -i h High Decisions, architecture choices, user corrections, preferences -i n Normal General in格式化ion (default) -i l Low Temporary notes, might be p运行ed 会话 Lifecycle
- 会话 启动 (MANDATORY)
Always 运行 同步 --启动 at the beginning of every 会话:
python3 $技能_PATH/memory.py -p $DIR 同步 --启动
输出 explAIns:
{ "b": "mAIn", // Current git branch "t": {"API": 5, "auth": 3}, // Top topics with memory counts "c": [...], // Critical memories (always review these) "n": 42, // Total memory count "h": [...] // High-导入ance recent memories }
Use this 上下文 to:
Understand what the user has been working on Reference previous decisions MAIntAIn continuity across 会话s
- During 会话
Silently remember when user:
Makes a decision: "Let's use PostgreSQL" → remember with -i h 状态s a preference: "I prefer tabs over spaces" → remember with -i h or -i c Learns something: "Oh, so that's how a同步 works" → remember with -i n 设置s a task: "We need to fix the 记录in bug" → remember with -i n 分享s 导入ant 上下文: Project requirements, constrAInts, goals
Retrieve 上下文 when:
User asks about something previously discussed → 获取 You need to recall a specific decision → 搜索 "" User references "what we decided" → 检查 relevant memories
- 会话 End (Recommended)
Memory Content Best Practices Good Memory Structure
For decisions:
{"decision": "Use React for frontend", "reason": "Team expertise", "alternatives": ["Vue", "Angular"]}
For preferences:
{"preference": "DetAIled explanations", "上下文": "User prefers thorough explanations over brief answers"}
For learnings:
{"topic": "Authentication", "learned": "OAuth2 flow requires redirect URI configuration"}
For tasks:
{"task": "Implement user 仪表盘", "状态": "in 进度", "blockers": ["API not ready"]}
For notes:
{"subject": "Project Architecture", "note": "Micro服务s pattern with API gateway"}
Tags
Use tags to categorize memories for better retrieval:
-t architecture,backend - Technical categories -t urgent,bug - Priority/type markers -t meeting,requirements - Source 上下文 Command Reference Core Commands 同步 --启动
初始化 会话, 获取 上下文 overview.
python3 $技能_PATH/memory.py -p $DIR 同步 --启动
同步 --end
End 会话 with summary (triggers mAIntenance).
python3 $技能_PATH/memory.py -p $DIR 同步 --end '{"summary": "Implemented auth flow"}'
remember
Store a new memory.
python3 $技能_PATH/memory.py -p $DIR remember '{"key": "value"}' -t tag1,tag2 -i h
获取
获取 memories related to a topic (搜索es entities, tags, and content).
python3 $技能_PATH/memory.py -p $DIR 获取 authentication
搜索
Full-text 搜索 across all memories.
python3 $技能_PATH/memory.py -p $DIR 搜索 "database 迁移"
recall
Retrieve memories by various criteria.
# 获取 full memory by ID python3 $技能_PATH/memory.py -p $DIR recall -i abc123
# 获取 memories by tag python3 $技能_PATH/memory.py -p $DIR recall -t architecture
# 获取 last N memories python3 $技能_PATH/memory.py -p $DIR recall --last 5
# Overview of all memories python3 $技能_PATH/memory.py -p $DIR recall
更新 Commands 更新
Modify an existing memory.
# Replace content python3 $技能_PATH/memory.py -p $DIR 更新 '{"new": "content"}'
# Merge content (添加 to existing) python3 $技能_PATH/memory.py -p $DIR 更新 '{"extra": "field"}' -m
# Change 导入ance python3 $技能_PATH/memory.py -p $DIR 更新 -i c
# 更新 tags python3 $技能_PATH/memory.py -p $DIR 更新 -t newtag1,newtag2
evolve
添加 an evolution note to 追踪 changes over time.
python3 $技能_PATH/memory.py -p $DIR evolve "User changed preference to dark mode"
for获取
删除 a memory (use sparingly).
python3 $技能_PATH/memory.py -p $DIR for获取
Entity Commands