home / skills / ruvnet / ruflo / memory-management

memory-management skill

/.agents/skills/memory-management

This skill enhances learning and knowledge management by providing fast memory storage and semantic search with HNSW vector index.

npx playbooks add skill ruvnet/ruflo --skill memory-management

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
3.2 KB
---
name: memory-management
description: >
  AgentDB memory system with HNSW vector search. Provides 150x-12,500x faster pattern retrieval, persistent storage, and semantic search capabilities for learning and knowledge management.
  Use when: need to store successful patterns, searching for similar solutions, semantic lookup of past work, learning from previous tasks, sharing knowledge between agents, building knowledge base.
  Skip when: no learning needed, ephemeral one-off tasks, external data sources available, read-only exploration.
---

# Memory Management Skill

## Purpose
AgentDB memory system with HNSW vector search. Provides 150x-12,500x faster pattern retrieval, persistent storage, and semantic search capabilities for learning and knowledge management.

## When to Trigger
- need to store successful patterns
- searching for similar solutions
- semantic lookup of past work
- learning from previous tasks
- sharing knowledge between agents
- building knowledge base

## When to Skip
- no learning needed
- ephemeral one-off tasks
- external data sources available
- read-only exploration

## Commands

### Store Pattern
Store a pattern or knowledge item in memory

```bash
npx @claude-flow/cli memory store --key "[key]" --value "[value]" --namespace patterns
```

**Example:**
```bash
npx @claude-flow/cli memory store --key "auth-jwt-pattern" --value "JWT validation with refresh tokens" --namespace patterns
```

### Semantic Search
Search memory using semantic similarity

```bash
npx @claude-flow/cli memory search --query "[search terms]" --limit 10
```

**Example:**
```bash
npx @claude-flow/cli memory search --query "authentication best practices" --limit 5
```

### Retrieve Entry
Retrieve a specific memory entry by key

```bash
npx @claude-flow/cli memory get --key "[key]" --namespace [namespace]
```

**Example:**
```bash
npx @claude-flow/cli memory get --key "auth-jwt-pattern" --namespace patterns
```

### List Entries
List all entries in a namespace

```bash
npx @claude-flow/cli memory list --namespace [namespace]
```

**Example:**
```bash
npx @claude-flow/cli memory list --namespace patterns --limit 20
```

### Delete Entry
Delete a memory entry

```bash
npx @claude-flow/cli memory delete --key "[key]" --namespace [namespace]
```

### Initialize HNSW Index
Initialize HNSW vector search index

```bash
npx @claude-flow/cli memory init --enable-hnsw
```

### Memory Stats
Show memory usage statistics

```bash
npx @claude-flow/cli memory stats
```

### Export Memory
Export memory to JSON

```bash
npx @claude-flow/cli memory export --output memory-backup.json
```


## Scripts

| Script | Path | Description |
|--------|------|-------------|
| `memory-backup` | `.agents/scripts/memory-backup.sh` | Backup memory to external storage |
| `memory-consolidate` | `.agents/scripts/memory-consolidate.sh` | Consolidate and optimize memory |


## References

| Document | Path | Description |
|----------|------|-------------|
| `HNSW Guide` | `docs/hnsw.md` | HNSW vector search configuration |
| `Memory Schema` | `docs/memory-schema.md` | Memory namespace and schema reference |

## Best Practices
1. Check memory for existing patterns before starting
2. Use hierarchical topology for coordination
3. Store successful patterns after completion
4. Document any new learnings

Overview

This skill provides an AgentDB memory system with HNSW vector search for ultra-fast pattern retrieval, persistent storage, and semantic lookup. It accelerates similarity searches by orders of magnitude and centralizes learned patterns for multi-agent workflows and knowledge sharing. Use it to capture successful solutions, retrieve related past work, and build a reusable knowledge base.

How this skill works

The skill stores keyed memory entries in namespaces and builds an HNSW vector index for semantic similarity search. It exposes commands to store, retrieve, list, delete, export, and show stats for memory entries, plus an initializer to enable HNSW indexing. Agents and developers query memory with semantic search or exact-key lookup to find prior patterns and context quickly.

When to use it

  • You want to persist successful patterns or solutions for reuse
  • You need semantic lookup of past work or similar problem-solving examples
  • Learning from previous tasks to improve agent behavior over time
  • Sharing knowledge between agents and coordinating multi-agent workflows
  • Building a searchable knowledge base for agent-driven automation

Best practices

  • Check memory for existing patterns before starting a task to avoid duplication
  • Store clear keys and concise values; include tags or namespace conventions for discoverability
  • Initialize and tune the HNSW index for your dataset size and query patterns
  • Store successful patterns after task completion and add brief metadata describing context
  • Regularly back up and consolidate memory to maintain performance and persistence

Example use cases

  • Save authentication or deployment patterns so agents can reuse proven solutions
  • Semantic search for past incidents when troubleshooting a new error
  • Share onboarding snippets and best practices across agent swarms to standardize behavior
  • Build incremental agent learning by storing outcome summaries and retrieving similar past outcomes
  • Export memory for audit, migration, or offline analysis

FAQ

How do I enable fast semantic search?

Initialize the HNSW index (enable-hnsw) and ensure entries are embedded consistently; HNSW provides approximate nearest neighbor search for large datasets.

When should I skip using this memory system?

Skip it for ephemeral, one-off tasks, when no learning is required, if you rely solely on external data sources, or when read-only exploration suffices.