Skip to content
hierarchical-memory logo

Hierarchical Memory System

hierarchical-memory

Hierarchical memory architecture combining short-term, long-term, and episodic memory layers. Based on Mem0 research showing 26% accuracy improvement. Use for persistent knowledge, context management, and RAG optimization.

SKILL.md

Full skill instructions

Hierarchical Memory System

TAISUN's hierarchical memory architecture based on Mem0 research, providing 26% accuracy improvement through structured memory layers.

Architecture Overview

┌─────────────────────────────────────────────────────────────────┐
│                    HIERARCHICAL MEMORY                          │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐ │
│  │   SHORT-TERM    │  │    LONG-TERM    │  │    EPISODIC     │ │
│  │   (Session)     │  │   (Persistent)  │  │   (Events)      │ │
│  ├─────────────────┤  ├─────────────────┤  ├─────────────────┤ │
│  │ taisun-proxy    │  │ Qdrant Vector   │  │ claude-mem      │ │
│  │ InMemoryStore   │  │ Database        │  │ Observations    │ │
│  ├─────────────────┤  ├─────────────────┤  ├─────────────────┤ │
│  │ TTL: Session    │  │ TTL: Permanent  │  │ TTL: 30 days    │ │
│  │ Size: 100 items │  │ Size: Unlimited │  │ Size: 50/​day    │ │
│  │ Search: Token   │  │ Search: Vector  │  │ Search: ID/​Time │ │
│  └─────────────────┘  └─────────────────┘  └─────────────────┘ │
│           │                   │                    │            │
│           └───────────────────┼────────────────────┘            │
│                               ▼                                 │
│                    ┌─────────────────┐                         │
│                    │  MEMORY ROUTER  │                         │
│                    │  (Consolidation)│                         │
│                    └─────────────────┘                         │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Memory Layers

1. Short-Term Memory (Working Memory)

System: taisun-proxy InMemoryStore Purpose: Current session context

PropertyValue
StorageIn-memory
TTLSession duration
Max Items100
SearchToken-based
Use CasesCurrent task context, recent commands, temp data
# Store in short-term
memory_add type="short-term" content="現在のタスク: API実装"

# Retrieve
memory_search query="タスク"

2. Long-Term Memory (Semantic Memory)

System: Qdrant Vector Database Purpose: Persistent knowledge and patterns

PropertyValue
StorageQdrant (localhost:6333)
TTLPermanent
Max ItemsUnlimited
SearchVector similarity
Use CasesCode patterns, learned solutions, domain knowledge
# Store important pattern
qdrant-store text="認証にはJWTを使用し..." metadata={topic: "auth"}

# Semantic search
qdrant-find query="認証の実装方法"

3. Episodic Memory (Event Memory)

System: claude-mem Observations Purpose: Decision history and context trails

PropertyValue
StorageJSONL files
TTL30 days
Max Items~50/​day
SearchID, timestamp, type
Use CasesPast decisions, debugging context, learning history
# Auto-captured by hooks
# Access via MCP
mcp__claude-mem-search__search query="bugfix"
mcp__claude-mem-search__timeline date="2026-01-19"

Memory Flow

Information Lifecycle

1. CAPTURE (Short-Term)
   User input → Session context → Working memory

2. CONSOLIDATE (Short → Long)
   Important patterns → Vector embedding → Qdrant storage

3. OBSERVE (Episodic)
   Decisions, discoveries → claude-mem → Timestamped records

4. RETRIEVE (All Layers)
   Query → Router → Best matching layer → Response

Consolidation Rules

TriggerAction
Session endImportant short-term → Long-term
Pattern detectedAuto-store in Qdrant
Decision madeLog to episodic
Error resolvedStore solution in long-term

Usage Patterns

1. Remember Important Information

User: このAPIパターンを覚えておいて
      [code snippet]

AI: 1. Short-term に即座に保存
    2. 重要度判定(コードパターン = HIGH)
    3. Qdrant に永続化
    4. claude-mem に観察記録

2. Retrieve Past Knowledge

User: 以前話した認証の実装方法は?

AI: 1. Qdrant でセマンティック検索
    2. claude-mem でエピソード検索
    3. 関連情報を統合
    4. コンテキスト付きで回答

3. Learn From Session

# Session end hook automatically:
1. Extracts key decisions
2. Stores successful patterns
3. Records errors and solutions
4. Updates long-term memory

Performance Benefits (Mem0 Research)

MetricImprovement
Accuracy+26%
P95 Latency-91%
Token Usage-90%

Source: Mem0 Research Paper

Integration Points

With Existing TAISUN Systems

SystemIntegration
taisun-proxymemory_add, memory_search tools
Qdrant MCPqdrant-store, qdrant-find tools
claude-memAuto-observation hooks
SessionStartState injection
SessionEndMemory consolidation

With Other MCPs

# Context7 + Long-Term Memory
「use context7 でReact 19の新機能を学習して、覚えておいて」

# GPT Researcher + Memory
「市場調査して、重要なポイントを長期記憶に保存」

Best Practices

  1. Explicit Memory Commands

    ✅ 「これを長期記憶に保存して」
    ✅ 「前回のセッションで話した〇〇について」
    ❌ 「覚えておいて」(曖昧)
    
  2. Tag Important Information

    metadata: { topic: "auth", type: "pattern", priority: "high" }
    
  3. Regular Memory Cleanup

    Outdated patterns should be removed from long-term memory
    
  4. Trust the Consolidation

    Let auto-hooks handle session → long-term migration
    

Troubleshooting

Memory Not Found

  1. Check if Qdrant is running (curl localhost:6333/​health)
  2. Verify collection exists
  3. Check search query specificity

Slow Retrieval

  1. Limit search scope with filters
  2. Use appropriate memory layer
  3. Check Qdrant index status

Sources

More Other skills

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

179.7K 100.1K
View

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

179.7K 89.5K
View

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

179.7K 76.1K
View

Fundamental design principles for writing maintainable, testable Python code.

40.2K 21.9K
View

Modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first strategies.

40.2K 20K
View

Generate Playwright tests from scenarios using interactive browser exploration and validation.

39.7K 18.2K
View

Modern React state management with Redux Toolkit, Zustand, Jotai, and React Query for every state category.

40.2K 14.7K
View

GDPR-compliant data handling with consent management, data subject rights, and privacy controls.

40.2K 14.3K
View

Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.

40.2K 13.5K
View

Detailed multi-file refactor planning with safety checks and rollback guidance.

39.7K 13K
View