214 lines
5.5 KiB
Markdown
214 lines
5.5 KiB
Markdown
---
|
|
name: qdrant-memory
|
|
description: |
|
|
Manual memory backup to Qdrant vector database.
|
|
Memories are stored ONLY when explicitly requested by the user.
|
|
No automatic storage, no proactive retrieval, no background consolidation.
|
|
Enhanced metadata (confidence, source, expiration) available for manual use.
|
|
Includes separate KB collection for documents, web data, etc.
|
|
metadata:
|
|
openclaw:
|
|
os: ["darwin", "linux", "win32"]
|
|
---
|
|
|
|
# Qdrant Memory - Manual Mode
|
|
|
|
## Overview
|
|
|
|
**MODE: MANUAL ONLY**
|
|
|
|
This system provides manual memory storage to Qdrant vector database for semantic search.
|
|
- **File-based logs**: Daily notes (`memory/YYYY-MM-DD.md`) continue normally
|
|
- **Vector storage**: Qdrant available ONLY when user explicitly requests storage
|
|
- **No automatic operations**: No auto-storage, no proactive retrieval, no auto-consolidation
|
|
|
|
## Collections
|
|
|
|
### `kimi_memories` (Personal Memories)
|
|
- **Purpose**: Personal memories, preferences, rules, lessons learned
|
|
- **Vector size**: 1024 (snowflake-arctic-embed2)
|
|
- **Distance**: Cosine
|
|
- **Usage**: "q remember", "q save", "q recall"
|
|
|
|
### `kimi_kb` (Knowledge Base)
|
|
- **Purpose**: Web search results, documents, scraped data, reference materials
|
|
- **Vector size**: 1024 (snowflake-arctic-embed2)
|
|
- **Distance**: Cosine
|
|
- **Usage**: Manual storage of external data only when requested
|
|
|
|
## Architecture
|
|
|
|
### Storage Layers
|
|
|
|
```
|
|
Session Memory (this conversation) - Normal operation
|
|
↓
|
|
Daily Logs (memory/YYYY-MM-DD.md) - Automatic, file-based
|
|
↓
|
|
Manual Qdrant Storage - ONLY when user says "store this" or "q [command]"
|
|
↓
|
|
├── kimi_memories (personal) - "q remember", "q recall"
|
|
└── kimi_kb (knowledge base) - web data, docs, manual only
|
|
```
|
|
|
|
### Memory Metadata
|
|
|
|
Available when manually storing:
|
|
- **text**: The memory content
|
|
- **date**: Creation date
|
|
- **tags**: Topics/keywords
|
|
- **importance**: low/medium/high
|
|
- **confidence**: high/medium/low (accuracy of the memory)
|
|
- **source_type**: user/inferred/external (how it was obtained)
|
|
- **verified**: bool (has this been confirmed)
|
|
- **expires_at**: Optional expiration date
|
|
- **related_memories**: IDs of connected memories
|
|
- **access_count**: How many times retrieved
|
|
- **last_accessed**: When last retrieved
|
|
|
|
## Scripts
|
|
|
|
### For kimi_memories (Personal)
|
|
|
|
#### store_memory.py
|
|
**Manual storage only** - Store with full metadata support:
|
|
|
|
```bash
|
|
# Basic manual storage
|
|
python3 store_memory.py "Memory text" --importance high
|
|
|
|
# With full metadata
|
|
python3 store_memory.py "Memory text" \
|
|
--importance high \
|
|
--confidence high \
|
|
--source-type user \
|
|
--verified \
|
|
--tags "preference,voice" \
|
|
--expires 2026-03-01 \
|
|
--related id1,id2
|
|
```
|
|
|
|
#### search_memories.py
|
|
Manual search of stored memories:
|
|
|
|
```bash
|
|
# Basic search
|
|
python3 search_memories.py "voice setup"
|
|
|
|
# Filter by tag
|
|
python3 search_memories.py "voice" --filter-tag "preference"
|
|
|
|
# JSON output
|
|
python3 search_memories.py "query" --json
|
|
```
|
|
|
|
### For kimi_kb (Knowledge Base)
|
|
|
|
#### kb_store.py
|
|
Store external data to KB:
|
|
|
|
```bash
|
|
# Store web page content
|
|
python3 kb_store.py "Content text" \
|
|
--title "Page Title" \
|
|
--url "https://example.com" \
|
|
--domain "Tech" \
|
|
--tags "docker,containerization"
|
|
|
|
# Store document excerpt
|
|
python3 kb_store.py "Document content" \
|
|
--title "API Documentation" \
|
|
--source "docs.openclaw.ai" \
|
|
--domain "OpenClaw" \
|
|
--tags "api,reference"
|
|
```
|
|
|
|
#### kb_search.py
|
|
Search knowledge base:
|
|
|
|
```bash
|
|
# Basic search
|
|
python3 kb_search.py "docker volumes"
|
|
|
|
# Filter by domain
|
|
python3 kb_search.py "query" --domain "OpenClaw"
|
|
|
|
# Include source URLs
|
|
python3 kb_search.py "query" --include-urls
|
|
```
|
|
|
|
### Hybrid Search (Both Collections)
|
|
|
|
#### hybrid_search.py
|
|
Search both files and vectors (manual use):
|
|
|
|
```bash
|
|
python3 hybrid_search.py "query" --file-limit 3 --vector-limit 3
|
|
```
|
|
|
|
## Usage Rules
|
|
|
|
### When to Store to Qdrant
|
|
|
|
**ONLY** when user explicitly requests:
|
|
- "Remember this..." → kimi_memories
|
|
- "Store this in Qdrant..." → kimi_memories
|
|
- "q save..." → kimi_memories
|
|
- "Add to KB..." → kimi_kb
|
|
- "Store this document..." → kimi_kb
|
|
|
|
### What NOT to Do
|
|
|
|
❌ **DO NOT** automatically store any memories to either collection
|
|
❌ **DO NOT** auto-scrape web data to kimi_kb
|
|
❌ **DO NOT** run proactive retrieval
|
|
❌ **DO NOT** auto-consolidate
|
|
|
|
## Manual Integration
|
|
|
|
### Personal Memories (kimi_memories)
|
|
|
|
```bash
|
|
# Only when user explicitly says "q remember"
|
|
python3 store_memory.py "User prefers X" --importance high --tags "preference"
|
|
|
|
# Only when user explicitly says "q recall"
|
|
python3 search_memories.py "query"
|
|
```
|
|
|
|
### Knowledge Base (kimi_kb)
|
|
|
|
```bash
|
|
# Only when user explicitly requests KB storage
|
|
python3 kb_store.py "Content" --title "X" --domain "Y" --tags "z"
|
|
|
|
# Search KB only when requested
|
|
python3 kb_search.py "query"
|
|
```
|
|
|
|
## Best Practices
|
|
|
|
1. **Wait for explicit request** - Never auto-store to either collection
|
|
2. **Use right collection**:
|
|
- Personal/lessons → `kimi_memories`
|
|
- Documents/web data → `kimi_kb`
|
|
3. **Always tag memories** - Makes retrieval more accurate
|
|
4. **Include source for KB** - URL, document name, etc.
|
|
5. **File-based memory continues normally** - Daily logs still automatic
|
|
|
|
## Troubleshooting
|
|
|
|
**Q: Qdrant not storing?**
|
|
- Check Qdrant is running: `curl http://10.0.0.40:6333/`
|
|
- Verify user explicitly requested storage
|
|
|
|
**Q: Search returning wrong results?**
|
|
- Try hybrid search for better recall
|
|
- Use `--filter-tag` for precision
|
|
|
|
---
|
|
|
|
**CONFIGURATION: Manual Mode Only**
|
|
**Collections: kimi_memories (personal), kimi_kb (knowledge base)**
|
|
**Last Updated: 2026-02-10**
|