← 返回 Skills 市场
ankechenlab-node

Amber Hunter

作者 ankechenlab-node · GitHub ↗ · v1.2.41 · MIT-0
cross-platform ⚠ suspicious
455
总下载
1
收藏
1
当前安装
42
版本数
在 OpenClaw 中安装
/install amber-hunter
功能描述
Amber-Hunter is a local AI memory engine that encrypts, stores, and summarizes OpenClaw/Claude sessions and files for instant recall and optional cloud sync.
使用说明 (SKILL.md)

amber-hunter — AI 第二大脑 Skill

What It Is

amber-hunter 是运行在本地(port 18998)的 FastAPI 服务,为 Claude Code 提供长期记忆能力和知识自动编译能力。

核心能力矩阵:

能力 说明 引入版本
记忆胶囊 持久化存储 AI 工作产生的想法/决策/上下文 v1.0
混合搜索 LanceDB 向量 + 关键词联合检索 v1.2.27
意图预测 根据 session 内容预测下一步最可能的需求 v1.2.27
DID E2E 加密 设备绑定加密,云端隐私保护 v1.2.24
知识编译器 同类胶囊自动编译成 wiki 概念页 v1.2.38

启动

cd ~/.openclaw/skills/amber-hunter
python3 amber_hunter.py
# 或后台运行
python3 amber_hunter.py &

服务启动时:

  1. 自动初始化 SQLite 数据库(memory.db
  2. 启动编译 daemon(每 6 小时扫描一次覆盖缺口)
  3. 冷启动编译(启动时如果有覆盖缺口,立即触发一次)

认证

操作 认证方式
所有外部请求 Bearer Token(从 /token 获取,写入 ~/.openclaw/token
/token, /bind-apikey, /master-password 强制 localhost 检查
Bearer Token 调用 Authorization: Bearer \x3Ctoken> Header 中传递

Token 获取流程(首次设置):

# 1. 启动服务
python3 amber_hunter.py

# 2. 从本地获取 token(仅 localhost 可访问)
curl http://localhost:18998/token
# 返回: {"token": "xxx"}

# 3. 写入本地配置
echo "Bearer xxx" > ~/.openclaw/token

API 端点总览

无需认证(localhost)

端点 方法 说明
GET /status GET 服务状态、版本、平台、胶囊数
GET /token GET 读取本地 API Token
POST /bind-apikey POST 更新 Huper 云端 API Key(存 Keychain)
POST /master-password POST 设置 master_password(Keychain)

核心 — 胶囊管理(Bearer Token)

端点 方法 说明
/capsules GET 列出胶囊(支持 category_path 过滤 + 分页 limit
/capsules POST 创建胶囊
/capsules/{id} GET 获取单个胶囊详情
/capsules/{id} PATCH 更新胶囊
/capsules/{id} DELETE 删除胶囊

核心 — 记忆召回(Bearer Token)

端点 方法 说明
/recall GET 混合搜索(向量+关键词+LanceDB,rerank)
/rerank POST 强制 LLM 重排候选记忆
/classify GET 关键词+LLM fallback 分类
/extract POST 从文本中提取记忆(LLM 驱动)
/ingest POST AI 主动写入记忆(→ 入库或审阅队列)

/recall 参数:

参数 类型 默认 说明
q string 必填 查询文本
rerank bool false 是否启用 LLM rerank (deprecated, use rerank_engine)
rerank_engine string "auto" 重排序引擎:auto | model | llm | none
hyde bool false 是否启用 HyDE(假设性答案增强检索)v1.2.41
multi_hop bool false 是否启用多跳检索 v1.2.41
limit int 3 返回数量
category_path string "" MFS路径过滤
use_insights bool true 是否优先返回 insight 缓存
citation int 0 1=返回 embedding 裁剪的片段

/recall 响应新增字段(v1.2.41):

字段 类型 说明
rerank_time_ms float reranker 耗时(毫秒)
hyde_time_ms float HyDE 生成耗时(毫秒)
retrieval_hops int 检索跳数(multi_hop 启用时 > 1)

/recall/evaluate 端点(v1.2.41):

端点 方法 说明
/recall/evaluate POST RAG 评测(RAGAS + NDCG@5)

/recall/evaluate 请求体:

{"queries": [{"q": "...", "expected_capsule_ids": ["..."]}]}

/recall/evaluate 响应:

{
  "ragas_scores": {"faithfulness": 0.x, "answer_relevancy": 0.x, "context_precision": 0.x},
  "ndcg_at_5": 0.x,
  "evaluated_at": "...",
  "total_queries": 2
}

/ingest 参数:

参数 类型 说明
content string 记忆内容
tags string 标签(逗号分隔)
session_key string 来源 session
auto_review bool true=直接入库,false=进审阅队列

审阅队列(Bearer Token)

端点 方法 说明
/queue GET 列出待审阅记忆
/queue/{qid}/approve POST 批准写入胶囊
/queue/{qid}/reject POST 拒绝
/queue/{qid}/edit POST 修改后批准

知识编译器 v1.2.38+(Bearer Token)

端点 方法 说明
/concepts GET 列出所有已编译概念页(?limit=50&offset=0 分页)
/concepts/{path} GET 获取指定 path 的 wiki 内容
/admin/compile POST 手动触发编译(?path= 指定路径)
/admin/compile/status GET daemon 状态 + 覆盖缺口列表 + 健康指标(alert/crashes/success_count)

编译触发条件:

条件 说明
胶囊数比上次编译时多 ≥100 增量触发
超过 6 小时未编译 定时触发

覆盖缺口: 有 ≥3 个胶囊但无 concept page 的 category_path。

管理操作(Bearer Token + localhost)

端点 方法 说明
/admin/backfill-paths POST 批量修复缺失的 category_path
/admin/reindex-vectors POST 重建 LanceDB 向量索引
/admin/train POST 触发 embedding 模型训练
/admin/train/status GET 训练状态
/admin/train/score GET 模型评分
/admin/train/tags GET 标签统计
/admin/generate-insights POST 手动生成 insights(按 path)
/stats GET 系统统计
/admin/export GET 导出备份

DID E2E 加密(Bearer Token)

端点 方法 说明
/did/setup POST 初始化 DID(生成密钥对,存 Keychain)
/did/status GET DID 初始化状态
/did/register-device POST 注册设备到 DID 网络
/did/auth/challenge POST 获取 auth challenge
/did/auth/sign-challenge POST 签名 challenge,完成认证

WAL(Write-Ahead Log)

端点 方法 说明
/wal/status GET WAL 状态
/wal/entries GET 读取 WAL 条目
/wal/gc POST 触发 WAL GC

Session 上下文

端点 方法 说明
/session/summary GET 当前 session 记忆摘要
/session/files GET 当前 session 相关文件列表
/session/preload GET 预加载 context(供 Claude Code 使用)
/freeze GET/POST 冻结当前 session 上下文

Profile

端点 方法 说明
/profile GET 完整用户 profile
/profile/{section} GET/PUT 读取/更新 profile 章节
/profile/build POST 触发 profile 自动构建

Corrections(记忆纠错)

端点 方法 说明
/corrections/stats GET 纠错统计
/corrections/suggestions GET 纠错建议
/corrections/apply POST 应用纠错规则

工具类

端点 方法 说明
GET / GET 根路径,返回欢迎信息
GET /patterns GET 当前系统运作的 Pattern 列表
POST /mcp POST MCP(Model Context Protocol)接口

数据模型

capsules 表

CREATE TABLE capsules (
    id              TEXT PRIMARY KEY,     -- 唯一 ID (secrets.token_hex)
    memo            TEXT,                 -- 记忆摘要
    content         TEXT,                  -- 完整内容
    category_path   TEXT,                  -- 分类路径,如 "dev/python"
    tags            TEXT,                  -- 逗号分隔标签
    hotness_score   REAL DEFAULT 0,        -- 热度分
    hit_count       INTEGER DEFAULT 0,     -- 被 recall 命中的次数
    session_id      TEXT,                  -- 来源 session
    encrypted       INTEGER DEFAULT 0,     -- 是否加密
    vector_id       TEXT,                  -- LanceDB 向量 ID
    synced          INTEGER DEFAULT 0,    -- 是否已同步云端
    created_at      REAL,                  -- unix timestamp
    updated_at      REAL,
    content_hash    TEXT                   -- 去重用
)

insights 表(v1.2.17+)

CREATE TABLE insights (
    id              TEXT PRIMARY KEY,
    capsule_ids     TEXT,          -- JSON array
    summary         TEXT,           -- 纯文本摘要
    path            TEXT,           -- category_path
    concept_slug    TEXT,           -- slug化 path (v1.2.38+)
    wiki_content    TEXT,           -- 完整 markdown (v1.2.38+)
    hotness_score   REAL DEFAULT 0,
    created_at      REAL,
    updated_at      REAL
)

memory_queue 表

CREATE TABLE memory_queue (
    id          TEXT PRIMARY KEY,
    content     TEXT,
    tags        TEXT,
    session_id  TEXT,
    source      TEXT DEFAULT 'ingest',
    created_at  REAL
)

配置

配置文件:~/.openclaw/skills/amber-hunter/config.json

{
  "auto_sync": true,
  "sync_interval_seconds": 300,
  "embed_model": "BAAI/bge-m3",
  "vector_dim": 1024,
  "rerank_model": "BAAI/bge-reranker-v2-m3",
  "llm_model": "gpt-4o-mini",
  "huper_api_key": "sk-...",
  "key_source": "pbkdf2",
  "compile_interval_hours": 6.0,
  "compile_capsule_threshold": 100
}

关键行为

胶囊创建时的 category_path 推断

/ingest/capsules POST 会自动从内容中推断 category_path:

推理依据:content + tags → LLM 分类
兜底:category_path = "general/default"

/recall 混合评分公式

final_score = 0.35 * norm_lance + 0.25 * norm_kw + 0.20 * recency + 0.20 * hotness
  • LanceDB 向量相似度(归一化)
  • 关键词 overlap 分
  • 近期性(7天衰减)
  • 热度分

wikilinks 注入策略(Knowledge Compiler)

LLM 生成 wikilinks 不稳定(max_tokens=600 时 Related Capsules 部分常被截断)。 最终策略:代码事后注入

wikilinks = " ".join(f"[[{cid}:{short_label}]]" for cid in capsule_ids)
wiki_content = wiki_content.rstrip() + f"\
\
### Related Capsules\
{wikilinks}"

Cold Start 行为

服务启动时:

  1. 如果有覆盖缺口,立即触发一次 _run_batch_compile()
  2. 如果 auto_train 启用,触发 embedding 模型训练

使用示例

创建记忆

curl -X POST http://localhost:18998/ingest \
  -H "Authorization: Bearer $(cat ~/.openclaw/token)" \
  -H "Content-Type: application/json" \
  -d '{"content": "修了一个版本号测试过时的问题", "tags": "amber-hunter,bugfix"}'

召回记忆

curl "http://localhost:18998/recall?query=amber-hunter版本号问题&rerank=true" \
  -H "Authorization: Bearer $(cat ~/.openclaw/token)"

手动触发知识编译

# 编译指定 path
curl -X POST "http://localhost:18998/admin/compile?path=knowledge/devops" \
  -H "Authorization: Bearer $(cat ~/.openclaw/token)"

# 查看 daemon 状态和缺口
curl "http://localhost:18998/admin/compile/status" \
  -H "Authorization: Bearer $(cat ~/.openclaw/token)"

获取已编译的概念页

# 列出所有概念页
curl "http://localhost:18998/concepts" \
  -H "Authorization: Bearer $(cat ~/.openclaw/token)"

# 获取指定概念页
curl "http://localhost:18998/concepts/knowledge/devops" \
  -H "Authorization: Bearer $(cat ~/.openclaw/token)"

已知限制

  1. Bearer Token 存在磁盘~/.openclaw/token 是明文,localhost 以外不安全
  2. 向量索引重建昂贵/admin/reindex-vectors 在大量胶囊时耗时较长
  3. Wiki 编译器依赖 LLM:LLM 不可用时 compile_concept_page 返回 None
  4. DID 注册需要 Huper 云端:本地 DID setup 后还需要云端注册才生效

相关文件

amber-hunter/
├── amber_hunter.py      # FastAPI 主文件,所有端点
├── core/
│   ├── db.py            # SQLite 数据层
│   ├── wiki_compiler.py # 知识编译器(v1.2.38)
│   └── llm.py           # LLM 调用封装
├── tests/
│   └── test_api/
│       └── test_status.py  # 状态 API 测试
├── config.json          # 配置文件
└── SKILL.md             # 本文档

适用场景

用 amber-hunter 当:

  • 需要 AI 在长时间对话中保持"记忆"
  • 需要从历史胶囊中检索相关经验
  • 需要将多个相关记忆自动组织成概念页
  • 需要加密存储敏感记忆到云端

不用 amber-hunter 当:

  • 简单 KV 存储(用文件或 SQLite 直接写)
  • 需要服务端部署(它是纯本地服务)
  • 需要多人实时协作(它是单人设计)
安全使用建议
What to check before installing: - Review install.sh, sync-to-runtime.sh, and any LaunchAgent/systemd/cron plist before running; these set up background processes and will enable persistent capture. - Inspect proactive/ scripts (proactive-check.js and hooks) — they automatically monitor OpenClaw sessions and workspace files and may write capsules without further prompts. - Confirm how tokens/keys are stored: the skill suggests writing a 'Bearer' token to ~/.openclaw/token (plain text). Prefer storing secrets in OS keychain or a secure file with tight permissions; ask the author to avoid instructing users to echo tokens to world-readable files. - Confirm the /token endpoint behavior and name of returned field (SKILL.md vs some scripts disagree on "token" vs "api_key"). Ensure /token is truly localhost-restricted on your system before relying on it. - If you plan to enable cloud sync, verify huper.org endpoints and review how content is encrypted before upload (check core/crypto.py and key derivation). Test encryption round-trips locally (see tests/) and confirm master password handling. - If you require strict privacy, run the service in an isolated environment (container or VM) until you audit the codepaths that read arbitrary files and perform uploads. If you want, I can: (1) list specific files to inspect (install.sh, proactive scripts, core/keychain.py, core/crypto.py, amber_hunter.py sections around token handling), (2) extract the exact code that creates LaunchAgent entries or writes ~/.openclaw/token, or (3) point out lines where network calls to huper.org are made.
功能分析
Type: OpenClaw Skill Name: amber-hunter Version: 1.2.41 The amber-hunter skill is a sophisticated memory management and knowledge compilation system for AI agents. It implements local session transcript parsing (core/session.py), semantic search using LanceDB (core/vector.py), and end-to-end encryption (core/crypto.py) for syncing data to a cloud dashboard. While the skill utilizes high-privilege operations such as system keychain integration (core/keychain.py) and background service persistence (install.sh), these behaviors are transparently documented and strictly aligned with the stated purpose of providing a secure, long-term 'AI second brain.' The codebase includes extensive testing, benchmarks, and security measures like restricting sensitive administrative operations to localhost.
能力标签
cryptorequires-walletcan-make-purchasesrequires-oauth-token
能力评估
Purpose & Capability
Name/description (local encrypted memory + optional cloud sync) align with included code: FastAPI service, DB, crypto, DID, sync client, embedding/recall components and OpenClaw hooks. Minor documentation/implementation inconsistencies exist (e.g. SKILL.md shows /token → {"token":...} but some scripts expect an "api_key" field). The presence of proactive capture, file-monitoring and cloud sync is consistent with the stated purpose, but is broader than a simple 'memory' helper (it monitors sessions and workspace files).
Instruction Scope
Runtime instructions and README tell the user to start a local FastAPI service that: reads OpenClaw session transcripts, watches recent workspace files, performs automatic proactive captures every ~10 minutes via LaunchAgent/cron, and exposes endpoints that can return a token (/token) without external auth (localhost-only). The service also exposes many admin endpoints for exporting, reindexing, DID operations, and triggers background daemons (compiler, sync). These behaviors involve reading local files and continuously capturing context and are more intrusive than a minimal skill — user consent and review are needed. Also SKILL.md and some scripts disagree on token field names and token handling.
Install Mechanism
The registry lists no automated install spec, but the package contains install.sh, sync-to-runtime.sh, freeze/LaunchAgent instructions, and proactive hook scripts. That means the author expects the user to run installer/setup scripts which can install background services (LaunchAgent/systemd/cron) and copy hooks. The install creates persistent background components if run — review install.sh and LaunchAgent/plist before executing.
Credentials
No environment variables are declared as required, which matches registry metadata, but the code reads/writes local config and credential stores: ~/.amber-hunter/config.json, ~/.openclaw/token, OS keychain (core/keychain.py) and may store API keys and master-password-derived data. The skill does not request extra cloud credentials directly, but it expects a huper.org API key stored in config. Storing a 'Bearer' token as plain text in ~/.openclaw/token (the SKILL.md example) is insecure; the code also exposes /token for localhost retrieval — this is convenient but increases local exposure surface. These behaviors are plausible for the skill, but you should verify how secrets are stored and protected.
Persistence & Privilege
Although 'always' is false, the package includes explicit instructions and scripts to set up persistent background agents (LaunchAgent/cron/systemd) and proactive hooks that silently capture session events every ~10 minutes. This grants long-lived, automatic data collection and local writes/reads; combined with cloud sync capability, it increases blast radius. Autonomous agent invocation is allowed by default (disable-model-invocation=false), which combined with these persistent capture hooks is noteworthy.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install amber-hunter
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /amber-hunter 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.2.41
BGE-M3 embedding, BM25, Cross-Encoder Reranker, HyDE, Multi-Hop retrieval, RAG evaluation
v1.2.39
Temporal validity (valid_from/valid_to), Contradiction Detection (core/contradiction.py), Claude Code Hooks (Stop + PreCompact)
v1.2.38
Knowledge Compiler
v1.2.34
v1.2.34: proactive-check.js V3.2 incremental dedup — updates queue when session grows, skips if unchanged; HEARTBEAT.md /ingest instead of /capsules for content_hash dedup
v1.2.33
v1.2.33: /ingest deduplication — content_hash exact dedup + semantic similarity soft dedup
v1.2.32
v1.2.32: citation snippets + gene co-occurrence graph + exponential temporal decay
v1.2.30
Add FAQ & Known Issues section: VPS API key config, sync errors, key rotation, and '尚未生成API Key' display fix
v1.2.29
Amber-Hunter 1.2.29 - Added a new correction module (`core/correction.py`) to the codebase. - Updated main logic and database files (`amber_hunter.py`, `core/db.py`) to support new correction functionality. - Documentation (SKILL.md) updated to reflect recent changes and version bump.
v1.2.28
Amber-Hunter 1.2.28 - Added new `core/extractor.py` module. - Updated core logic in `amber_hunter.py`, likely integrating extraction features. - SKILL.md updated to reflect new extraction and API details.
v1.2.27
Amber-Hunter v1.2.27 - Added `core/profile.py` to the codebase. - Updated `amber_hunter.py` and `core/db.py` with changes for this version. - Documentation in SKILL.md updated to reflect v1.2.27. - No breaking changes; backward compatibility maintained.
v1.2.26
Amber-Hunter 1.2.26 - Internal code updates in `amber_hunter.py` and `core/wal.py` to improve logic or stability. - `SKILL.md` updated version to 1.2.26 (no major content changes). - No new endpoints or major user-facing features added.
v1.2.25
Amber-Hunter 1.2.25 - Documentation polished for clarity and formatting in SKILL.md. - No API changes; endpoints and features remain stable. - No user-facing feature changes noted in this release.
v1.2.24
Amber-Hunter 1.2.24 - Introduced new `core/wal.py` component. - Updated internal logic in `amber_hunter.py` for improved functionality or integration. - Documentation in SKILL.md updated to reflect latest features and endpoints.
v1.2.23
- Added internal module `core/vector.py` for vector/semantic functionality. - Updated `amber_hunter.py` and `core/db.py` to integrate new or improved vector operations. - Updated dependencies in `requirements.txt` to support changes. - Lays groundwork for improved semantic memory and retrieval features.
v1.2.22
D2 DID Challenge-Response auth + capsule key derivation
v1.2.14
Amber-Hunter v1.2.14 - Added full test suite with tests for API endpoints and core cryptography logic - Improved proactive signal detection: `handler.js/ts` now auto-detects six capture-worthy signal types from agent responses and sends to the review queue - Refined judgment criteria in documentation for `/ingest` memory capture - Updated and clarified documentation and integration guide - Stability and minor code improvements in cryptography, session, and database modules
v1.2.13
Amber-Hunter 1.2.13 Changelog - Updated documentation in SKILL.md and other files to reflect version changes (1.2.9 → 1.2.11). - General refactoring and minor text updates across core modules for consistency. - No major changes to API endpoints or core workflows.
v1.2.12
Amber-Hunter v1.2.12 - Internal updates to `amber_hunter.py` and `core/db.py` to improve core logic. - SKILL.md documentation unchanged since v1.2.9. - No changes to API endpoints or user-facing features.
v1.2.11
Amber-Hunter v1.2.11 - Internal update to amber_hunter.py; no SKILL.md documentation changes. - No user-facing or API changes in this release.
v1.2.10
amber-hunter v1.2.10 - Added RELEASE_CHECKLIST.md for release management/documentation. - Removed config.json to streamline configuration handling. - Updated API docs for new terminal/CLI review endpoints: `/-review` and `/-review/{qid}` (v1.2.9). - Updated version references and minor doc adjustments in SKILL.md. - Minor code and documentation maintenance.
元数据
Slug amber-hunter
版本 1.2.41
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 42
常见问题

Amber Hunter 是什么?

Amber-Hunter is a local AI memory engine that encrypts, stores, and summarizes OpenClaw/Claude sessions and files for instant recall and optional cloud sync. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 455 次。

如何安装 Amber Hunter?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install amber-hunter」即可一键安装,无需额外配置。

Amber Hunter 是免费的吗?

是的,Amber Hunter 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Amber Hunter 支持哪些平台?

Amber Hunter 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Amber Hunter?

由 ankechenlab-node(@ankechenlab-node)开发并维护,当前版本 v1.2.41。

💬 留言讨论