Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

agentdb-persistent-memory-patterns

FreeNo executable scriptsNot checked

AgentDB Persistent Memory Patterns operates on 3 fundamental principles:

diegosouzapwby diegosouzapw★ 68 GitHub stars

About this skill

AgentDB Persistent Memory Patterns


LIBRARY-FIRST PROTOCOL (MANDATORY)

Before writing ANY code, you MUST check:

Step 1: Library Catalog

  • Location: .claude/library/catalog.json
  • If match >70%: REUSE or ADAPT

Step 2: Patterns Guide

  • Location: .claude/docs/inventories/LIBRARY-PATTERNS-GUIDE.md
  • If pattern exists: FOLLOW documented approach

Step 3: Existing Projects

  • Location: D:\Projects\*
  • If found: EXTRACT and adapt

Decision Matrix

Match Action
Library >90% REUSE directly
Library 70-90% ADAPT minimally
Pattern exists FOLLOW pattern
In project EXTRACT
No match BUILD (add to library after)

Overview

Implement persistent memory patterns for AI agents using AgentDB - session memory, long-term storage, pattern learning, and context management for stateful agents, chat systems, and intelligent assistants.

SOP Framework: 5-Phase Memory Implementation

Phase 1: Design Memory Architecture (1-2 hours)

  • Define memory schemas (episodic, semantic, procedural)
  • Plan storage layers (short-term, working, long-term)
  • Design retrieval mechanisms
  • Configure persistence strategies

Phase 2: Implement Storage Layer (2-3 hours)

  • Create memory stores in AgentDB
  • Implement session management
  • Build long-term memory persistence
  • Setup memory indexing

Phase 3: Test Memory Operations (1-2 hours)

  • Validate store/retrieve operations
  • Test memory consolidation
  • Verify pattern recognition
  • Benchmark performance

Phase 4: Optimize Performance (1-2 hours)

  • Implement caching layers
  • Optimize retrieval queries
  • Add memory compression
  • Performance tuning

Phase 5: Document Patterns (1 hour)

  • Create usage documentation
  • Document memory patterns
  • Write integration examples
  • Generate API documentation

Quick Start

import { AgentDB, MemoryManager } from 'agentdb-memory';

// Initialize memory system
const memoryDB = new AgentDB({
  name: 'agent-memory',
  dimensions: 768,
  memory: {
    sessionTTL: 3600,
    consolidationInterval: 300,
    maxSessionSize: 1000
  }
});

const memoryManager = new MemoryManager({
  database: memoryDB,
  layers: ['episodic', 'semantic', 'procedural']
});

// Store memory
await memoryManager.store({
  type: 'episodic',
  content: 'User preferred dark theme',
  context: { userId: '123', timestamp: Date.now() }
});

// Retrieve memory
const memories = await memoryManager.retrieve({
  query: 'user preferences',
  type: 'episodic',
  limit: 10
});

Memory Patterns

Session Memory

const session = await memoryManager.createSession('user-123');
await session.store('conversation', messageHistory);
await session.store('preferences', userPrefs);
const context = await session.getContext();

Long-Term Storage

await memoryManager.consolidate({
  from: 'working-memory',
  to: 'long-term-memory',
  strategy: 'importance-based'
});

Pattern Learning

const patterns = await memoryManager.learnPatterns({
  memory: 'episodic',
  algorithm: 'clustering',
  minSupport: 0.1
});

Success Metrics

  • Memory persists across agent restarts
  • Retrieval latency < 50ms (p95)
  • Pattern recognition accuracy > 85%
  • Context maintained with 95% accuracy
  • Memory consolidation working

MCP Requirements

This skill operates using AgentDB's npm package and API only. No additional MCP servers required.

All AgentDB memory operations are performed through:

  • npm CLI: npx agentdb@latest
  • TypeScript/JavaScript API: import { AgentDB, MemoryManager } from 'agentdb-memory'

Additional Resources

Core Principles

AgentDB Persistent Memory Patterns operates on 3 fundamental principles:

Principle 1: Memory Layering - Separate Short-Term, Working, and Long-Term Storage

Memory systems mirror human cognition by organizing information across distinct temporal layers. Short-term memory handles immediate context (current conversation), working memory maintains active task state, and long-term memory consolidates important patterns for future retrieval.

In practice:

  • Store conversation context in session memory with TTL expiration (1-hour default)
  • Use working memory for active agent tasks and intermediate computation results
  • Consolidate proven patterns and user preferences to long-term storage using importance-based criteria

Principle 2: Pattern Learning - Extract Reusable Knowledge from Episodic Memory

Raw episodic memories (specific events) are valuable but incomplete. True intelligence emerges when systems detect patterns across episodes - recurring user preferences, common error scenarios, effective solution strategies - and encode them as semantic knowledge.

In practice:

  • Run clustering algorithms on episodic memory to identify recurring patterns (min support threshold: 10%
Full SKILL.md on GitHub

Install agentdb-persistent-memory-patterns in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

Read
Write
Edit
Task
TodoWrite
Glob
Grep

Bundled files

metadata.json

FAQ

What does the agentdb-persistent-memory-patterns skill do?

AgentDB Persistent Memory Patterns operates on 3 fundamental principles:

How do I install the agentdb-persistent-memory-patterns skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the agentdb-persistent-memory-patterns skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare agentdb-persistent-memory-patterns with