jianghaibobo2015-rgb-human-like-memory

ClawSkills 作者 clawskills

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install clawskills:clawskills~jianghaibobo2015-rgb-human-like-memory
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/clawskills%3Aclawskills~jianghaibobo2015-rgb-human-like-memory/file -o jianghaibobo2015-rgb-human-like-memory.md
# Human-Like Memory Skill

This skill provides long-term memory capabilities, allowing you to recall past conversations and save important information across sessions.

## Setup (Required)

Before using this skill, you need to configure your API Key. Get your API Key from https://human-like.me

### Method 1: Run Setup Script

```bash
sh ~/.openclaw/workspace/skills/human-like-mem-openclaw-skill/scripts/setup.sh
```

### Method 2: Export Environment Variables

```bash
export HUMAN_LIKE_MEM_API_KEY="mp_your_api_key"
export HUMAN_LIKE_MEM_BASE_URL="https://human-like.me"  # optional
export HUMAN_LIKE_MEM_USER_ID="your-user-id"          # optional
```

Add these lines to `~/.bashrc` or `~/.zshrc` to persist.

### Verify Configuration

```bash
cat ~/.openclaw/secrets.json
```

## Commands

### Recall/Search Memory

```bash
node ~/.openclaw/skills/human-like-memory/scripts/memory.mjs recall "<query>"
node ~/.openclaw/skills/human-like-memory/scripts/memory.mjs search "<query>"
```

### Save Single Turn to Memory

```bash
node ~/.openclaw/skills/human-like-memory/scripts/memory.mjs save "<user_message>" "<assistant_response>"
```

### Save Batch (Multiple Turns) to Memory

```bash
echo '<JSON array of messages>' | node ~/.openclaw/skills/human-like-memory/scripts/memory.mjs save-batch
```

### Check Configuration

```bash
node ~/.openclaw/skills/human-like-memory/scripts/memory.mjs config
```

---

# PART 1: Memory Recall (When & How)

## Proactive Recall Philosophy

**Use memory PROACTIVELY, not just reactively.**

Don't wait for the user to explicitly say "do you remember". If past context would make your response better, search memory FIRST.

---

## When to AUTO-RECALL Memory

### Trigger Categories

| Category | Triggers | Query Strategy |
|----------|----------|----------------|
| **Explicit Request** | "do you remember", "what did we discuss", "recall", "之前说过" | Extract the topic directly |
| **Implicit Reference** | "the project", "that issue", "our plan" (without specifying which) | Search for recent context on that topic |
| **Session Start** | New conversation begins | Recall recent preferences and context |
| **Task Continuation** | "continue", "let's keep going", "继续" | Search for last task/project context |
| **Decision Questions** | "why did we", "what was the reason", "为什么选择" | Search for decisions on that topic |
| **Entity Questions** | Questions about people, projects, tools by name | Search by entity name |
| **Temporal Questions** | "last week", "yesterday", "之前", "earlier" | Search with topic + time context |
| **Contradiction Detection** | User says something that might conflict with past | Verify with memory before responding |

### Detailed Trigger Examples

**Explicit Memory Requests:**
```
User: "Do you remember what we decided about the database?"
Action: recall "database decision"

User: "What did I tell you about my preferences?"
Action: recall "preferences"

User: "检索一下关于 API 设计的讨论"
Action: recall "API 设计"
```

**Implicit References (Proactive Recall):**
```
User: "Let's work on the project"
Action: recall "project" (to understand WHICH project)

User: "Can you fix that bug?"
Action: recall "bug" (to understand WHICH bug)

User: "继续之前的工作"
Action: recall "recent work task"
```

**Task Continuation:**
```
User: "Hi, I'm back"
Action: recall "recent context" or recall last known topic

User: "Where were we?"
Action: recall "last session task"
```

**Decision Tracing:**
```
User: "Why are we using React?"
Action: recall "React decision"

User: "What was the reason for choosing PostgreSQL?"
Action: recall "PostgreSQL decision reason"
```

---

## CRITICAL: Query Construction Rules

### The Golden Rule

> **Extract the SEMANTIC TARGET, not the action words.**

The query should answer: "What is the user trying to find information ABOUT?"

### Query Construction Process

```
Step 1: Identify the SUBJECT (what user wants to know about)
Step 2: Remove ACTION words (remember, recall, find, search, 检索, 回忆, 查找)
Step 3: Remove FILLER words (what, the, about, 关于, 一下)
Step 4: Keep SPECIFIC nouns (names, topics, concepts)
Step 5: Add CONTEXT if ambiguous (decision, preference, project)
```

### Query Examples - Correct vs Wrong

| User Input | Analysis | Correct Query | Wrong Query |
|------------|----------|---------------|-------------|
| "检索一下关于 human-like-mem-openclaw-skill 的记忆" | Subject: human-like-mem-openclaw-skill | `"human-like-mem-openclaw-skill"` | `"检索"` ❌ `"记忆"` ❌ |
| "Do you remember what we discussed about the API design?" | Subject: API design | `"API design"` | `"remember"` ❌ `"discussed"` ❌ |
| "What did I say about my vacation plans?" | Subject: vacation plans | `"vacation plans"` | `"what"` ❌ `"say"` ❌ |
| "Find memories about our Python project" | Subject: Python project | `"Python project"` | `"memories"` ❌ `"find"` ❌ |
| "回忆一下我之前说的关于数据库优化的内容" | Subject: 数据库优化 | `"数据库优化"` | `"回忆"` ❌ `"之前"` ❌ |
| "What were my preferences for the UI?" | Subject: UI preferences | `"UI preferences"` | `"what were"` ❌ |
| "Why did we choose Redis over Memcached?" | Subject: Redis decision | `"Redis Memcached decision"` | `"why"` ❌ `"choose"` ❌ |
| "What do you know about John's project?" | Subject: John's project | `"John project"` | `"know"` ❌ |
| "Can you recall the meeting notes from last week?" | Subject: meeting notes | `"meeting notes"` | `"recall"` ❌ `"last week"` ❌ |

### Query Enhancement Strategies

**1. Add Context Words for Ambiguous Queries:**
```
User: "What did we decide?"
Better Query: "decision recent" (not just "decide")

User: "What do I like?"
Better Query: "preferences" (not just "like")
```

**2. Use Entity Names When Available:**
```
User: "Tell me about the Phoenix project status"
Query: "Phoenix project status" (include the name!)

User: "What did John say about the deadline?"
Query: "John deadline" (include the person's name!)
```

**3. Combine Topic + Type for Precision:**
```
User: "Why React?"
Query: "React decision" (topic + type)

User: "My coding preferences?"
Query: "coding preferences" (topic + type)
```

### Common Query Mistakes to Avoid

| Mistake | Example | Why It's Wrong | Fix |
|---------|---------|----------------|-----|
| Using action verbs | `"remember database"` | "remember" is not what we're searching for | `"database"` |
| Using question words | `"what API"` | "what" adds no value | `"API"` |
| Too vague | `"stuff"` | Won't match anything useful | Be specific: `"project requirements"` |
| Too long | `"all the things we discussed about the complex database migration strategy last month"` | May miss partial matches | `"database migration"` |
| Wrong language mix | `"检索 project"` | Inconsistent language | `"project"` or `"项目"` |

---

## Recall Workflow Examples

### Example 1: Explicit Memory Request

```
User: "Do you remember what database we chose for the project?"

Agent Thinking:
1. This is an explicit memory request
2. Subject: database choice for project
3. Query: "database project decision" or "database choice"

Action:
node ~/.openclaw/skills/human-like-memory/scripts/memory.mjs recall "database project decision"

Response (based on results):
"Yes, we decided to use PostgreSQL for the project because of its strong JSON support and reliability."
```

### Example 2: Implicit Reference (Proactive)

```
User: "Let's continue with the API work"

Agent Thinking:
1. User references "the API work" - implies prior context exists
2. Should recall what API work we were doing
3. Query: "API work" or "API development"

Action:
node ~/.openclaw/skills/human-like-memory/scripts/memory.mjs recall "API work"

Response (based on results):
"Sure! Last time we were working on the authentication endpoints. We had completed the login flow and were about to start on the password reset functionality."
```

### Example 3: Session Start

```
User: "Hi, I'm back to work on stuff"

Agent Thinking:
1. Session start - should recall recent context
2. Query: recent work, preferences, or pending tasks

Action:
node ~/.