ImpKind

hippocampus

0
0
# Install this skill:
npx skills add ImpKind/hippocampus-skill

Or install specific skill: npx add-skill https://github.com/ImpKind/hippocampus-skill

# Description

Background memory organ for AI agents. Runs separately from the main agent—encoding, decaying, and reinforcing memories automatically. Just like the real hippocampus in your brain. Based on Stanford Generative Agents (Park et al., 2023).

# SKILL.md


name: hippocampus
description: "Background memory organ for AI agents. Runs separately from the main agent—encoding, decaying, and reinforcing memories automatically. Just like the real hippocampus in your brain. Based on Stanford Generative Agents (Park et al., 2023)."
metadata:
openclaw:
emoji: "🧠"
version: "3.1.0"
author: "Community"
repo: "https://github.com/ImpKind/hippocampus-skill"
requires:
bins: ["python3", "jq"]
install:
- id: "manual"
kind: "manual"
label: "Run install.sh"
instructions: "./install.sh --with-cron"


Hippocampus Skill

"Memory is identity. This skill is how I stay alive."

The hippocampus is the brain region responsible for memory formation. This skill makes memory capture automatic, structured, and persistent—with importance scoring, decay, and reinforcement.

Quick Start

# Install
./install.sh --with-cron

# Load core memories
./scripts/load-core.sh

# Search with importance weighting
./scripts/recall.sh "query" --reinforce

# Apply decay (runs daily via cron)
./scripts/decay.sh

Core Concept

The LLM is just the engine—raw cognitive capability. The agent is the accumulated memory. Without these files, there's no continuity—just a generic assistant.

Memory Lifecycle

CAPTURE → SCORE → STORE → DECAY/REINFORCE → RETRIEVE
   ↑                                            │
   └────────────────────────────────────────────┘

Memory Structure

$WORKSPACE/
├── memory/
│   ├── index.json           # Central weighted index
│   ├── user/                # Facts about the user
│   ├── self/                # Facts about the agent
│   ├── relationship/        # Shared context
│   └── world/               # External knowledge
└── HIPPOCAMPUS_CORE.md      # Auto-generated for OpenClaw RAG

Scripts

Script Purpose
decay.sh Apply 0.99^days decay to all memories
reinforce.sh Boost importance when memory is used
recall.sh Search with importance weighting
load-core.sh Output high-importance memories
sync-core.sh Generate HIPPOCAMPUS_CORE.md
preprocess.sh Extract signals from transcripts

All scripts use $WORKSPACE environment variable (default: ~/.openclaw/workspace).

Importance Scoring

Initial Score (0.0-1.0)

Signal Score
Explicit "remember this" 0.9
Emotional/vulnerable content 0.85
Preferences ("I prefer...") 0.8
Decisions made 0.75
Facts about people/projects 0.7
General knowledge 0.5

Decay Formula

Based on Stanford Generative Agents (Park et al., 2023):

new_importance = importance × (0.99 ^ days_since_accessed)
  • After 7 days: 93% of original
  • After 30 days: 74% of original
  • After 90 days: 40% of original

Reinforcement Formula

When a memory is accessed and useful:

new_importance = old + (1 - old) × 0.15

Each use adds ~15% of remaining headroom toward 1.0.

Thresholds

Score Status
0.7+ Core — high priority
0.4-0.7 Active — normal retrieval
0.2-0.4 Background — specific search only
<0.2 Archive candidate

Memory Index Schema

memory/index.json:

{
  "version": 1,
  "lastUpdated": "2025-01-20T19:00:00Z",
  "decayLastRun": "2025-01-20",
  "memories": [
    {
      "id": "mem_001",
      "domain": "user",
      "category": "preferences",
      "content": "User prefers concise responses",
      "importance": 0.85,
      "created": "2025-01-15",
      "lastAccessed": "2025-01-20",
      "timesReinforced": 3,
      "keywords": ["preference", "concise", "style"]
    }
  ]
}

Cron Jobs

Set up via OpenClaw cron:

# Daily decay at 3 AM
openclaw cron add --name hippocampus-decay \
  --cron "0 3 * * *" \
  --session main \
  --system-event "🧠 Run: WORKSPACE=\$WORKSPACE decay.sh"

# Weekly consolidation
openclaw cron add --name hippocampus-consolidate \
  --cron "0 21 * * 6" \
  --session main \
  --system-event "🧠 Weekly consolidation time"

OpenClaw Integration

Add to memorySearch.extraPaths in openclaw.json:

{
  "agents": {
    "defaults": {
      "memorySearch": {
        "extraPaths": ["HIPPOCAMPUS_CORE.md"]
      }
    }
  }
}

This bridges hippocampus (index.json) with OpenClaw's RAG (memory_search).

Usage in AGENTS.md

Add to your agent's session start routine:

## Every Session
1. Run `~/.openclaw/workspace/skills/hippocampus/scripts/load-core.sh`

## When answering context questions
Use hippocampus recall:
\`\`\`bash
./scripts/recall.sh "query" --reinforce
\`\`\`

Capture Guidelines

What to Capture

  • User facts: Preferences, patterns, context
  • Self facts: Identity, growth, opinions
  • Relationship: Trust moments, shared history
  • World: Projects, people, tools

Trigger Phrases

Auto-capture when you hear:
- "Remember that..."
- "I prefer...", "I always..."
- Emotional content (struggles AND wins)
- Decisions made

References


Memory is identity. Text > Brain. If you don't write it down, you lose it.

# README.md

🧠 Hippocampus

GitHub
ClawdHub

A living memory system for OpenClaw agents with importance scoring, time-based decay, and reinforcement—just like a real brain.

The Concept

The hippocampus runs in the background, just like the real organ in your brain.

Your main agent is busy having conversations—it can't constantly stop to decide what to remember. That's what the hippocampus does. It operates as a separate process:

  1. Background encoding: A cron job or separate agent watches conversations and encodes important signals into memory
  2. Automatic decay: Unused memories fade over time (daily cron)
  3. Reinforcement on recall: When memories are accessed, they strengthen automatically

The main agent doesn't "think about" memory—it just recalls what it needs, and the hippocampus handles the rest. Like a real brain.

Features

  • Importance Scoring: Memories rated 0.0-1.0 based on signal type
  • Time-Based Decay: Unused memories fade (0.99^days)
  • Reinforcement: Used memories strengthen (+15% headroom)
  • Background Processing: Encoding runs via cron, not in main agent's context
  • OpenClaw Integration: Bridges with memory_search via HIPPOCAMPUS_CORE.md

Installation

cd ~/.openclaw/workspace/skills/hippocampus
./install.sh --with-cron

Or via ClawdHub:

clawdhub install hippocampus

Quick Usage

# Load core memories at session start
./scripts/load-core.sh

# Search with importance weighting
./scripts/recall.sh "project deadline" --reinforce

# Manually boost a memory
./scripts/reinforce.sh mem_001 --boost

# Apply decay (usually via cron)
./scripts/decay.sh

How It Works

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   Capture   │────▶│   Score &   │────▶│   Store in  │
│  (encoding) │     │   Classify  │     │  index.json │
└─────────────┘     └─────────────┘     └──────┬──────┘
                                               │
                    ┌──────────────────────────┘
                    │
                    ▼
┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│    Decay    │◀───▶│   Retrieve  │────▶│  Reinforce  │
│ (0.99^days) │     │  (recall.sh)│     │   on use    │
└─────────────┘     └─────────────┘     └─────────────┘

Memory Domains

Domain Contents
user/ Facts about the human
self/ Agent identity & growth
relationship/ Shared context & trust
world/ External knowledge

Decay Timeline

Days Unused Retention
7 93%
30 74%
90 40%

Requirements

  • Python 3
  • jq
  • OpenClaw

AI Brain Series

Building cognitive architecture for AI agents:

Part Function Status
hippocampus Memory formation, decay, reinforcement ✅ Live
amygdala-memory Emotional processing ✅ Live
basal-ganglia-memory Habit formation 🚧 Coming
anterior-cingulate-memory Conflict detection 🚧 Coming
insula-memory Internal state awareness 🚧 Coming
vta-memory Reward and motivation 🚧 Coming

Based On

Stanford Generative Agents: "Interactive Simulacra of Human Behavior" (Park et al., 2023)

License

MIT


Memory is identity. Text > Brain. Part of the AI Brain series.

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.