DeepRecall v2 — OpenClaw Skill
Pure-Python recursive memory for persistent AI agents.
Implements the Anamnesis Architecture: "The soul stays small, the mind scales forever."
Description
DeepRecall gives AI agents infinite memory by recursively querying their own
memory files through a manager→workers→synthesis RLM loop — entirely in Python.
No Deno runtime, no fast-rlm subprocess, no vector database. Just markdown files
and HTTP calls to any OpenAI-compatible LLM endpoint.
When the agent needs to recall something, DeepRecall:
- 1. Scans the workspace for memory files (scoped by category)
- Indexes file metadata — headers, topics, dates, people
- Manager selects the most relevant files from the index
- Workers (parallel) extract exact verbatim quotes from each file
- Synthesis combines quotes into a cited, grounded answer
Workers are constrained by anti-hallucination prompts to return only verbatim
quotes. The synthesis step cites every claim with (filename:line).
Installation
CODEBLOCK0
Or install from source:
CODEBLOCK1
Dependencies
- - httpx (preferred) or requests — HTTP client for LLM calls
- PyYAML — config parsing
- Python ≥ 3.10
- An LLM provider configured in OpenClaw
v2 breaking change: Deno and fast-rlm are no longer required.
The entire RLM loop runs in-process as pure Python.
Quick Start
CODEBLOCK2
API
recall(query, scope, workspace, verbose, config_overrides) → str
The primary entry point. Runs the full manager→workers→synthesis loop.
CODEBLOCK3
| Parameter | Type | Default | Description |
|---|
| INLINECODE2 | INLINECODE3 | (required) | What to recall / search for |
| INLINECODE4 |
str |
"memory" | File scope — see
Scopes |
|
workspace |
Path \| None | auto-detect | Override workspace path |
|
verbose |
bool |
False | Print provider, model, file selection info |
|
config_overrides |
dict \| None |
None | Override
max_files and other settings |
Returns: A string containing the recalled information with source citations,
or a [DeepRecall] status message if no files/results were found.
recall_quick(query, verbose) → str
Fast, cheap recall scoped to identity files. Best for simple lookups.
CODEBLOCK4
Equivalent to recall(query, scope="identity", config_overrides={"max_files": 2}).
recall_deep(query, verbose) → str
Thorough recall across all workspace files. Best for cross-referencing.
CODEBLOCK5
Equivalent to recall(query, scope="all", config_overrides={"max_files": 5}).
CLI
CODEBLOCK6
Scopes
Scopes control which files DeepRecall searches. Narrower scopes are faster
and cheaper.
| Scope | Files Included | Speed | Cost | Use Case |
|---|
| INLINECODE21 | SOUL.md, IDENTITY.md, MEMORY.md, USER.md, TOOLS.md, HEARTBEAT.md, AGENTS.md | ⚡ Fastest | Cheapest | "What's my name?" |
| INLINECODE22 |
Identity files + memory/LONG_TERM.md + memory/*.md daily logs | 🔄 Fast | Low | "What did we do last week?" |
|
project | All readable workspace files (skips binaries, node_modules, .git) | 🐢 Slower | Medium | "Find that config change" |
|
all | Identity + memory + project (everything) | 🐌 Slowest | Highest | "Search everything" |
File Categories
DeepRecall classifies discovered files into categories:
- - soul —
SOUL.md, IDENTITY.md — who the agent IS (always in context) - mind —
MEMORY.md, USER.md, TOOLS.md, HEARTBEAT.md, AGENTS.md — compact orientation - long-term —
memory/LONG_TERM.md — full detailed memories, grows forever - daily-log —
memory/YYYY-MM-DD.md — raw daily logs - workspace — everything else (project files, configs, docs)
Configuration
DeepRecall reads your existing OpenClaw setup — no additional config files needed.
Provider Resolution
Provider, API key, and model are resolved automatically from:
- 1.
~/.openclaw/openclaw.json — primary model setting - INLINECODE35 — provider base URLs
- INLINECODE36 — cached tokens (e.g. GitHub Copilot)
- Environment variables — fallback (
ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY, etc. (18+ providers supported, all optional))
Supported Providers (20+)
Anthropic · OpenAI · Google (Gemini) · GitHub Copilot · OpenRouter · Ollama ·
DeepSeek · Mistral · Together · Groq · Fireworks · Cohere · Perplexity ·
SambaNova · Cerebras · xAI · Minimax · Zhipu (GLM) · Moonshot (Kimi) · Qwen
Auto Model Pairing
The manager and synthesis steps use your primary model. Workers use a cheaper
sub-agent model automatically:
| Primary Model | Worker Model |
|---|
| Claude Opus 4 / 4.6 | Claude Sonnet 4 |
| Claude Sonnet 4 / 4.5 |
Claude Haiku 3.5 |
| GPT-4o / GPT-4 | GPT-4o-mini |
| Gemini 2.5 Pro | Gemini 2.0 Flash |
| DeepSeek Reasoner | DeepSeek Chat |
| Llama 3.1 70B | Llama 3.1 8B |
config_overrides
Pass overrides via the config_overrides parameter:
CODEBLOCK7
Skill Files
| File | Purpose |
|---|
| INLINECODE42 | Public API — recall, recall_quick, recall_deep, RLM loop |
| INLINECODE46 |
Resolves LLM provider, API key, base URL from OpenClaw config |
|
model_pairs.py | Maps primary models to cheaper worker models |
|
memory_scanner.py | Discovers and categorises workspace files by scope |
|
memory_indexer.py | Builds a structured Memory Index (topics, people, timeline) |
|
__init__.py | Package exports |
Memory Layout
Recommended workspace structure for the Anamnesis Architecture:
CODEBLOCK8
⚠️ Privacy Notice
DeepRecall reads your workspace memory files and sends their contents to your configured LLM provider (Anthropic, OpenAI, Gemini, etc.) to perform recall. This is how it works — there is no local-only mode.
What gets sent:
- - File metadata (names, headings, topics) → to the manager LLM
- Full file contents of selected files → to worker LLMs
- This may include personal notes, daily logs, project files
What is NOT sent:
- - API keys and credentials (read locally for auth, never in prompts)
- Files outside your workspace
Credentials used locally:
- -
~/.openclaw/openclaw.json and ~/.openclaw/credentials/* — to resolve your LLM provider - Env vars (
ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY, etc. (18+ providers supported, all optional)) — as fallback if no OpenClaw config found
Recommended Memory Architecture
DeepRecall works best with a two-tier memory system:
Tier 1: MEMORY.md (The Index)
- - Auto-loaded every session — keep it SMALL (~100 lines)
- Contains: quick reference facts, active projects, key metrics, a table of contents pointing to LONGTERM.md sections
- Think of it as your orientation file — "what do I need to know right now?"
- If it grows past ~120 lines, move details to LONGTERM.md
Tier 2: memory/LONG_TERM.md (The Encyclopedia)
- - Never auto-loaded — searched via DeepRecall when needed
- Contains: full context, decisions with reasoning, timestamps, bugs with fixes, architecture details
- Grows forever — never delete, only append
- The devil is in the details — "the diary entry, not the Wikipedia summary"
Tier 3: memory/YYYY-MM-DD.md (Daily Logs)
- - Raw notes of what happened each day
- Distilled into LONG_TERM.md at end of day
Nightly Sync Routine
At the end of each day (or via cron/heartbeat):
- 1. Read today's daily log
- Append key events, decisions, lessons, bugs, metrics to LONG_TERM.md
- Update MEMORY.md index table if new topics appeared
⚠️ Setting this up? Ask your human before restructuring existing memory files.
Show them this recommendation and let them decide how to organize their agent's memory.
License
MIT — see LICENSE.
DeepRecall v2 — OpenClaw 技能
纯Python递归记忆,用于持久化AI代理。
实现了记忆架构:灵魂保持小巧,思维无限扩展。
描述
DeepRecall通过管理器→工作器→合成RLM循环(完全用Python实现)递归查询自身记忆文件,为AI代理提供无限记忆。无需Deno运行时、无需fast-rlm子进程、无需向量数据库。只需Markdown文件和对任何兼容OpenAI的LLM端点的HTTP调用。
当代理需要回忆某些内容时,DeepRecall会:
- 1. 扫描工作区中的记忆文件(按类别限定范围)
- 索引文件元数据——标题、主题、日期、人物
- 管理器从索引中选择最相关的文件
- 工作器(并行)从每个文件中提取精确的逐字引用
- 合成将引用组合成带有引用的、有依据的答案
工作器受反幻觉提示约束,仅返回逐字引用。合成步骤为每个声明标注(文件名:行号)。
安装
bash
pip install deep-recall
或从源码安装:
bash
git clone https://github.com/Stefan27-4/DeepRecall
cd DeepRecall && pip install .
依赖项
- - httpx(推荐)或 requests — 用于LLM调用的HTTP客户端
- PyYAML — 配置解析
- Python ≥ 3.10
- 在OpenClaw中配置的LLM提供商
v2 重大变更: 不再需要Deno和fast-rlm。
整个RLM循环作为纯Python在进程内运行。
快速开始
python
from deep_recall import recall
result = recall(关于项目架构我们做出了什么决定?)
print(result)
API
recall(query, scope, workspace, verbose, config_overrides) → str
主要入口点。运行完整的管理器→工作器→合成循环。
python
from deep_recall import recall
result = recall(
查找所有提及预算讨论的内容,
scope=memory, # memory | identity | project | all
verbose=True, # 将进度打印到标准输出
config_overrides={
max_files: 5, # 管理器可选择的最大文件数
},
)
| 参数 | 类型 | 默认值 | 描述 |
|---|
| query | str | (必填) | 要回忆/搜索的内容 |
| scope |
str | memory | 文件范围 — 参见
范围 |
| workspace | Path \| None | 自动检测 | 覆盖工作区路径 |
| verbose | bool | False | 打印提供商、模型、文件选择信息 |
| config
overrides | dict \| None | None | 覆盖maxfiles和其他设置 |
返回: 包含带来源引用的回忆信息的字符串,如果未找到文件/结果,则返回[DeepRecall]状态消息。
recall_quick(query, verbose) → str
快速、廉价的回忆,限定在身份文件范围内。最适合简单查询。
python
from deeprecall import recallquick
name = recall_quick(我的人类叫什么名字?)
等同于recall(query, scope=identity, configoverrides={maxfiles: 2})。
recall_deep(query, verbose) → str
跨所有工作区文件的全面回忆。最适合交叉引用。
python
from deeprecall import recalldeep
summary = recall_deep(总结三月份的所有决定)
等同于recall(query, scope=all, configoverrides={maxfiles: 5})。
命令行界面
bash
python deep_recall.py [scope]
示例
python deep_recall.py 我们做的第一个项目是什么?
python deep_recall.py 查找预算讨论 all
范围
范围控制DeepRecall搜索哪些文件。范围越窄,速度越快,成本越低。
| 范围 | 包含的文件 | 速度 | 成本 | 用例 |
|---|
| identity | SOUL.md, IDENTITY.md, MEMORY.md, USER.md, TOOLS.md, HEARTBEAT.md, AGENTS.md | ⚡ 最快 | 最低 | 我的名字是什么? |
| memory |
身份文件 + memory/LONG_TERM.md + memory/*.md 每日日志 | 🔄 快速 | 低 | 我们上周做了什么? |
| project | 所有可读的工作区文件(跳过二进制文件、node_modules、.git) | 🐢 较慢 | 中等 | 找到那个配置更改 |
| all | 身份 + 记忆 + 项目(所有内容) | 🐌 最慢 | 最高 | 搜索所有内容 |
文件类别
DeepRecall将发现的文件分类为:
- - 灵魂 — SOUL.md, IDENTITY.md — 代理的身份(始终在上下文中)
- 思维 — MEMORY.md, USER.md, TOOLS.md, HEARTBEAT.md, AGENTS.md — 紧凑的方向指引
- 长期 — memory/LONG_TERM.md — 完整的详细记忆,永久增长
- 每日日志 — memory/YYYY-MM-DD.md — 原始每日日志
- 工作区 — 其他所有内容(项目文件、配置、文档)
配置
DeepRecall读取您现有的OpenClaw设置 — 无需额外的配置文件。
提供商解析
提供商、API密钥和模型自动从以下位置解析:
- 1. ~/.openclaw/openclaw.json — 主要模型设置
- ~/.openclaw/agents/main/agent/models.json — 提供商基础URL
- ~/.openclaw/credentials/ — 缓存的令牌(例如GitHub Copilot)
- 环境变量 — 后备方案(ANTHROPICAPIKEY, OPENAIAPIKEY, GOOGLEAPIKEY等(支持18+提供商,全部可选))
支持的提供商(20+)
Anthropic · OpenAI · Google (Gemini) · GitHub Copilot · OpenRouter · Ollama ·
DeepSeek · Mistral · Together · Groq · Fireworks · Cohere · Perplexity ·
SambaNova · Cerebras · xAI · Minimax · Zhipu (GLM) · Moonshot (Kimi) · Qwen
自动模型配对
管理器和合成步骤使用您的主要模型。工作器自动使用更便宜的副模型:
| 主要模型 | 工作器模型 |
|---|
| Claude Opus 4 / 4.6 | Claude Sonnet 4 |
| Claude Sonnet 4 / 4.5 |
Claude Haiku 3.5 |
| GPT-4o / GPT-4 | GPT-4o-mini |
| Gemini 2.5 Pro | Gemini 2.0 Flash |
| DeepSeek Reasoner | DeepSeek Chat |
| Llama 3.1 70B | Llama 3.1 8B |
config_overrides
通过config_overrides参数传递覆盖:
python
recall(query, config_overrides={
max_files: 5, # 管理器可选择的最大文件数(默认:3)
})
技能文件
| 文件 | 用途 |
|---|
| deeprecall.py | 公共API — recall, recallquick, recalldeep, RLM循环 |
| providerbridge.py |
从OpenClaw配置解析LLM提供商、API密钥、基础URL |
| model_pairs.py | 将主要模型映射到更便宜的工作器模型 |
| memory_scanner.py | 按范围发现和分类工作区文件 |
| memory_indexer.py | 构建结构化的记忆索引(主题、人物、时间线) |
|
init.py | 包导出 |
记忆布局
推荐的记忆架构工作区结构:
~/.openclaw/workspace/
├── SOUL.md # 身份 — 始终在上下文中,永不增长
├── IDENTITY.md # 核心代理事实
├── MEMORY.md # 紧凑索引(约100行),每次会话自动加载
├── USER.md # 关于人类用户
├── AGENTS.md # 代理行为规则
├── TOOLS.md # 工具特定笔记
└── memory/
├── LONG_TERM.md # 完整记忆 — 永久增长,通过DeepRecall搜索
├── 2026-03-05.md # 每日原始日志
├── 2026-03-04.md
└── ...
⚠️ 隐私声明
DeepRecall读取您的工作区记忆文件,并将其内容发送给您配置的LL