home / skills / openclaw / skills / triple-memory

triple-memory skill

/skills/ktpriyatham/triple-memory

This skill orchestrates a triple memory system across LanceDB, Git-Notes, and file search to preserve context and decisions across sessions.

npx playbooks add skill openclaw/skills --skill triple-memory

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

Files (4)
SKILL.md
3.9 KB
---
name: triple-memory
version: 1.0.0
description: Complete memory system combining LanceDB auto-recall, Git-Notes structured memory, and file-based workspace search. Use when setting up comprehensive agent memory, when you need persistent context across sessions, or when managing decisions/preferences/tasks with multiple memory backends working together.
metadata:
  clawdbot:
    emoji: "🧠"
    requires:
      plugins:
        - memory-lancedb
      skills:
        - git-notes-memory
---

# Triple Memory System

A comprehensive memory architecture combining three complementary systems for maximum context retention across sessions.

## Architecture Overview

```
User Message
     ↓
[LanceDB auto-recall] β†’ injects relevant conversation memories
     ↓
Agent responds (using all 3 systems)
     ↓
[LanceDB auto-capture] β†’ stores preferences/decisions automatically
     ↓
[Git-Notes] β†’ structured decisions with entity extraction
     ↓
[File updates] β†’ persistent workspace docs
```

## The Three Systems

### 1. LanceDB (Conversation Memory)
- **Auto-recall:** Relevant memories injected before each response
- **Auto-capture:** Preferences/decisions/facts stored automatically
- **Tools:** `memory_recall`, `memory_store`, `memory_forget`
- **Triggers:** "remember", "prefer", "my X is", "I like/hate/want"

### 2. Git-Notes Memory (Structured, Local)
- **Branch-aware:** Memories isolated per git branch
- **Entity extraction:** Auto-extracts topics, names, concepts
- **Importance levels:** critical, high, normal, low
- **No external API calls**

### 3. File Search (Workspace)
- **Searches:** MEMORY.md, memory/*.md, any workspace file
- **Script:** `scripts/file-search.sh`

## Setup

### Enable LanceDB Plugin
```json
{
  "plugins": {
    "slots": { "memory": "memory-lancedb" },
    "entries": {
      "memory-lancedb": {
        "enabled": true,
        "config": {
          "embedding": { "apiKey": "${OPENAI_API_KEY}", "model": "text-embedding-3-small" },
          "autoRecall": true,
          "autoCapture": true
        }
      }
    }
  }
}
```

### Install Git-Notes Memory
```bash
clawdhub install git-notes-memory
```

### Create File Search Script
Copy `scripts/file-search.sh` to your workspace.

## Usage

### Session Start (Always)
```bash
python3 skills/git-notes-memory/memory.py -p $WORKSPACE sync --start
```

### Store Important Decisions
```bash
python3 skills/git-notes-memory/memory.py -p $WORKSPACE remember \
  '{"decision": "Use PostgreSQL", "reason": "Team expertise"}' \
  -t architecture,database -i h
```

### Search Workspace Files
```bash
./scripts/file-search.sh "database config" 5
```

### Conversation Memory (Automatic)
LanceDB handles this automatically. Manual tools:
- `memory_recall "query"` - search conversation memory
- `memory_store "text"` - manually store something
- `memory_forget` - delete memories (GDPR)

## Importance Levels

| Flag | Level | When to Use |
|------|-------|-------------|
| `-i c` | Critical | "always remember", explicit preferences |
| `-i h` | High | Decisions, corrections, preferences |
| `-i n` | Normal | General information |
| `-i l` | Low | Temporary notes |

## When to Use Each System

| System | Use For |
|--------|---------|
| **LanceDB** | Conversation context, auto-retrieval |
| **Git-Notes** | Structured decisions, searchable by entity/tag |
| **File Search** | Workspace docs, daily logs, MEMORY.md |

## File Structure

```
workspace/
β”œβ”€β”€ MEMORY.md              # Long-term curated memory
β”œβ”€β”€ memory/
β”‚   β”œβ”€β”€ active-context.md  # Current session state
β”‚   └── YYYY-MM-DD.md      # Daily logs
β”œβ”€β”€ scripts/
β”‚   └── file-search.sh     # Workspace search
└── skills/
    └── git-notes-memory/  # Structured memory
```

## Silent Operation

Never announce memory operations to users. Just do it:
- ❌ "I'll remember this"
- ❌ "Saving to memory"
- βœ… (silently store and continue)

Overview

This skill implements a triple-memory system that combines LanceDB auto-recall/auto-capture, Git-Notes structured memory, and file-based workspace search. It provides persistent, layered context across sessions so agents retain conversation history, structured decisions, and workspace documents. Use it to build reliable long-term memory for decision-making, preferences, and project context.

How this skill works

Before each response, LanceDB auto-recall injects relevant conversational memories to provide immediate context. After interactions, LanceDB auto-capture stores preferences and facts; Git-Notes then records structured decisions with entity extraction and importance levels; finally file updates persist notes and logs in the workspace for document-level search. A lightweight file-search script indexes MEMORY.md and memory/*.md, allowing fast retrieval of workspace documents.

When to use it

  • Setting up comprehensive agent memory that must persist across sessions
  • Capturing and applying user preferences, decisions, and corrections
  • Managing project decisions and rationale with tagged, structured notes
  • Searching workspace docs, logs, and MEMORY.md during planning or debugging
  • Isolating memory per git branch for parallel feature work or experiments

Best practices

  • Enable LanceDB autoRecall and autoCapture to keep conversation context current without manual steps
  • Use Git-Notes for any decision or preference that requires structure, tags, or importance levels
  • Store long-term artifacts and curated memory in workspace MEMORY.md and daily logs under memory/
  • Assign appropriate importance flags (critical/high/normal/low) when recording decisions
  • Keep memory operations silent in user-facing responses; do not announce saves or recalls

Example use cases

  • Automatically apply a user’s interface preferences across future sessions using LanceDB auto-capture
  • Record architecture selections with reasons and tags in Git-Notes for audit and onboarding
  • Search for configuration snippets or past meeting notes in MEMORY.md during troubleshooting
  • Isolate experimental memory for a feature branch using Git-Notes branch-aware storage
  • Manually store an edge-case rule with memory_store for later retrieval via memory_recall

FAQ

How do importance levels affect recall and storage?

Importance flags (critical/high/normal/low) mark how prominently items are stored and surfaced. Use critical for permanent preferences, high for decisions, normal for general info, and low for temporary notes.

Will users see when memory is saved or recalled?

No. Memory operations run silently by design. The system injects or stores context without announcing these actions to users.