memory-totalrecall

Total Recall memory backend — git-branch-based persistent memory store with time-decay relevance.

3,891 stars

Best use case

memory-totalrecall is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Total Recall memory backend — git-branch-based persistent memory store with time-decay relevance.

Teams using memory-totalrecall should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/memory-totalrecall/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/apptah/openclaw-memory-stack/skills/memory-totalrecall/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/memory-totalrecall/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How memory-totalrecall Compares

Feature / Agentmemory-totalrecallStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Total Recall memory backend — git-branch-based persistent memory store with time-decay relevance.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Total Recall — SKILL.md

## Overview

Total Recall is a git-based memory backend that stores memories as structured markdown files on a dedicated orphan branch (`openclaw-memory`) within your existing project repository. It requires zero external dependencies beyond git itself, making it the simplest backend to deploy and the most portable across environments. Each memory is a timestamped markdown file in a `_memory/` directory, committed with a searchable commit message. Retrieval uses git's built-in search (`git log --grep`, `git grep`). Relevance scoring is time-based: recent memories rank higher than older ones. Total Recall is ideal for conversation history, architectural decisions, and context snapshots in any project where installing additional tooling is impractical or undesirable.

## Prerequisites

- **Git** (version >= 2.20) — pre-installed on macOS and most Linux distributions.
- A POSIX shell (bash or zsh).
- No external services, databases, or runtimes required.

Verify with:
```bash
git --version
```

## Configuration

Configuration is stored in `config.json` alongside this file. The router reads it to understand backend capabilities.

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| `backend` | string | `"totalrecall"` | Backend identifier for the router |
| `branch` | string | `"openclaw-memory"` | Orphan branch where memories are stored |
| `memory_dir` | string | `"_memory"` | Directory within the branch for memory files |
| `file_format` | string | `"markdown"` | File format for stored memories |
| `relevance.method` | string | `"time_decay"` | Relevance scoring method |
| `relevance.formula` | string | `"max(0.2, 1.0 - (days_ago * 0.043))"` | Continuous decay formula |
| `relevance.today` | float | `1.0` | Score for memories from today |
| `relevance.this_week` | float | `0.7` | Score for memories from this week |
| `relevance.this_month` | float | `0.4` | Score for memories from this month |
| `relevance.older` | float | `0.2` | Floor score for older memories |
| `search.max_results` | int | `20` | Maximum results per query |
| `store.commit_prefix` | string | `"memory:"` | Prefix for commit messages |

## Usage

All operations target the `openclaw-memory` orphan branch. The agent reads and writes memory files on this branch using `git show` and `git checkout` commands, avoiding disruption to the working tree. Alternatively, use `git worktree` for a persistent second checkout.

### Store

To store a memory with key `auth-decision`:

```bash
# Save current branch
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)

# Switch to memory branch
git checkout openclaw-memory

# Create memory file with structured content
TIMESTAMP=$(date -u +"%Y-%m-%dT%H-%M-%S")
FILENAME="_memory/${TIMESTAMP}_auth-decision.md"

cat > "$FILENAME" << 'MEMORY_EOF'
---
key: auth-decision
timestamp: 2026-03-17T14:30:00Z
tags: [auth, architecture, decision]
---

# Auth Decision

We chose JWT with RS256 signing for the auth middleware.
Refresh tokens use httpOnly cookies for storage.
MEMORY_EOF

# Commit the memory
git add "$FILENAME"
git commit -m "memory: auth-decision — JWT auth middleware decision"

# Return to working branch
git checkout "$CURRENT_BRANCH"
```

**File naming convention**: `{ISO-timestamp}_{slugified-key}.md`
- Timestamp format: `YYYY-MM-DDTHH-MM-SS` (colons replaced with hyphens for filesystem safety)
- Key slug: lowercase, hyphens for spaces, alphanumeric and hyphens only

**Commit message convention**: `memory: {key} — {brief description}`
This convention enables `git log --grep` to find memories by key.

### Retrieve

To retrieve a memory by key:

```bash
# Search for the key in commit messages on the memory branch
git log openclaw-memory --grep="memory: auth-decision" --format="%H %ai %s" --max-count=5

# Get the file path from the most recent matching commit
COMMIT_HASH=$(git log openclaw-memory --grep="memory: auth-decision" --format="%H" --max-count=1)
FILEPATH=$(git diff-tree --no-commit-id --name-only -r "$COMMIT_HASH" | grep "_memory/")

# Read the file content without switching branches
git show "openclaw-memory:$FILEPATH"
```

**Output construction** — build the contract JSON from the results:

```json
{
  "query_echo": "auth-decision",
  "results": [
    {
      "content": "We chose JWT with RS256 signing for the auth middleware...",
      "relevance": 1.0,
      "source": "totalrecall",
      "timestamp": "2026-03-17T14:30:00Z"
    }
  ],
  "result_count": 1,
  "status": "success",
  "error_message": null,
  "error_code": null,
  "backend_duration_ms": 45,
  "normalized_relevance": 1.0,
  "backend": "totalrecall"
}
```

### Search

To search memories by pattern across all memory files:

```bash
# Search commit messages for pattern
git log openclaw-memory --grep="auth" --format="%H %ai %s"

# Search file contents on the memory branch for a pattern
git grep -l "JWT" openclaw-memory -- "_memory/"

# Read matching files
for FILE in $(git grep -l "JWT" openclaw-memory -- "_memory/"); do
  echo "--- $FILE ---"
  git show "$FILE"
done
```

For broader search with context:

```bash
# Full-text search with surrounding lines
git grep -n -C 2 "pattern" openclaw-memory -- "_memory/"

# Case-insensitive search
git grep -il "jwt" openclaw-memory -- "_memory/"
```

## Interface Contract

### Input

- `store(key, content, metadata?)` — Create a markdown file on the memory branch and commit it.
- `retrieve(query, options?)` — Search commit messages with `git log --grep`, read matching files via `git show`.
- `search(pattern, scope?)` — Search file contents with `git grep` on the memory branch.

### Output Format

All backends return the same JSON structure:

```json
{
  "query_echo": "original query string",
  "results": [
    {
      "content": "...",
      "relevance": 0.0,
      "source": "totalrecall",
      "timestamp": "ISO8601"
    }
  ],
  "result_count": 0,
  "status": "success | partial | empty | error",
  "error_message": null,
  "error_code": null,
  "backend_duration_ms": 0,
  "normalized_relevance": 0.0,
  "backend": "totalrecall"
}
```

### Failure Codes

| Code | Meaning |
|------|---------|
| `BACKEND_UNAVAILABLE` | Git not installed, not in a git repo, or memory branch missing |
| `QUERY_TIMEOUT` | Exceeded 5s (router-measured) |
| `EMPTY_RESULT` | Query succeeded but no matching memories found |
| `PARTIAL_RESULT` | Some results returned but search may be incomplete |
| `BACKEND_ERROR` | Git command failed (see error_message for stderr) |

### Relevance Normalization

Total Recall uses **time-decay** relevance scoring. There is no semantic similarity — relevance is purely a function of how recently the memory was stored.

**Formula**:
```
relevance = max(0.2, 1.0 - (days_ago * 0.043))
```

This produces a continuous decay curve that roughly aligns with these buckets:

| Age | Score | Calculation |
|-----|-------|-------------|
| Today (0 days) | 1.0 | max(0.2, 1.0 - 0) |
| 3 days ago | 0.871 | max(0.2, 1.0 - 0.129) |
| 7 days ago | 0.699 | max(0.2, 1.0 - 0.301) |
| 14 days ago | 0.398 | max(0.2, 1.0 - 0.602) |
| 19+ days ago | 0.2 | max(0.2, ...) = floor |

The `normalized_relevance` field in the response is the highest relevance score among all results. When multiple results match, they are sorted by relevance (most recent first).

### Router Integration

- Normalized relevance >= 0.4 -> "good enough", no fallback needed.
- Normalized relevance < 0.4 or status = empty -> trigger fallback to another backend.
- status = error -> immediate fallback, log error.

## Limitations

- **No semantic search.** Total Recall uses literal text matching (`git grep`). It cannot understand that "authentication" and "login" are related concepts. If the query uses different words than the stored memory, it will not match.
- **No relationship or graph queries.** Cannot answer "what decisions led to X" unless those links are explicitly stored in the memory content.
- **Time-based relevance only.** A highly relevant old memory scores lower than a trivial recent one. The scoring model has no understanding of content importance.
- **Branch switching overhead.** Store operations require switching to the memory branch and back, which can be disruptive during active development. Use `git worktree` to mitigate this.
- **Linear scaling.** Search performance degrades linearly with the number of stored memories. Git grep is fast, but thousands of memory files will eventually slow down.
- **No concurrent writes.** Git does not support concurrent commits safely. Simultaneous store operations from multiple agents may conflict.
- **Keyword matching is case-sensitive by default.** Use `-i` flag with `git grep` and `git log --regexp-ignore-case` for case-insensitive matching.

## Tier

**Starter** — Included in the $49 package. Zero additional cost, zero additional dependencies.

Related Skills

Agent Memory Architecture

3891
from openclaw/skills

Complete zero-dependency memory system for AI agents — file-based architecture, daily notes, long-term curation, context management, heartbeat integration, and memory hygiene. No APIs, no databases, no external tools. Works with any agent framework.

memory-cache

3891
from openclaw/skills

High-performance temporary storage system using Redis. Supports namespaced keys (mema:*), TTL management, and session context caching. Use for: (1) Saving agent state, (2) Caching API results, (3) Sharing data between sub-agents.

General Utilities

Memory

3891
from openclaw/skills

Infinite organized memory that complements your agent's built-in memory with unlimited categorized storage.

Memory Management

auto-memory

3891
from openclaw/skills

Indestructible agent memory — permanently stored, never lost. Save decisions, identity, and context as a memory chain on the Autonomys Network. Rebuild your full history from a single CID, even after total state loss.

AI Persistence & Memory

Triple-Layer Memory System

3880
from openclaw/skills

三层记忆系统 - 解决 AI Agent 长对话记忆丢失和上下文管理问题

Memory & Context Management

agent-memory-os

3891
from openclaw/skills

Stop agents from "forgetting, mixing projects, and rotting over time" by giving them a practical memory operating system: global memory, project memory, promotion rules, validation cases, and a maintenance loop.

benos-memory-core

3891
from openclaw/skills

Core runtime/volatile memory module for BenOS agent environment. Use to: store and retrieve active session state, open loops, decisions, and scratch notes at runtime.

elite-longterm-memory

3891
from openclaw/skills

Ultimate AI agent memory system with WAL protocol, vector search, git-notes, and cloud backup. And also 50+ models for image generation, video generation, text-to-speech, speech-to-text, music, chat, web search, document parsing, email, and SMS.

memory-agent

3891
from openclaw/skills

维护用户审美偏好与创作历史,为其他 Agent 提供可复用的风格参考。当开始新任务或用户表达喜好时触发。

bamdra-memory-upgrade-operator

3891
from openclaw/skills

Safely install, uninstall, reinstall, or upgrade the Bamdra OpenClaw memory suite when stale config, existing plugin directories, or partial installs break normal `openclaw plugins install` flows.

hierarchical-memory

3891
from openclaw/skills

Manage and navigate a multi-layered, branch-based memory system. This skill helps organize complex agent context into Root, Domain, and Project layers to prevent context bloat. It includes a helper script `add_branch.py` which creates local markdown files and directories to structure your memory.

agentmemory

3891
from openclaw/skills

End-to-end encrypted cloud memory for AI agents. 100GB free storage. Store memories, files, and secrets securely.