[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M76Z4ERY273GF0N13B24TJKH":3,"skill-same:01M76Z4ERY273GF0N13B24TJKH":51},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":28,"commitSha":29,"skillDirectory":30,"forksCount":31,"repositoryHtmlUrl":32,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":6,"ownerDescription":35,"updatedAt":36,"install":37,"resources":50},"01M76Z4ERY273GF0N13B24TJKH","amber-hunter",null,"Lord1Egypt\u002Fawesome-skill-forge","Lord1Egypt","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99746359?v=4","01M7592YDNT0XK9WJ0T2MQVPDN","Mohamed Mounir Ali AL Keshita","01M75GRFNHC8VZNWEB8DKDE433",3,"MIT","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Fa\u002Famber-hunter\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\ntitle: amber-hunter\nsummary: Long-term memory and knowledge compilation skill for Claude Code — manages memory capsules, insight caching, semantic\u002Fkeyword hybrid recall, DID E2E encryption, and AI-driven knowledge wiki compiler.\nversion: 1.2.41\nsource: ~\u002F.openclaw\u002Fskills\u002Famber-hunter\u002Famber_hunter.py\nprotocol: FastAPI \u002F Bearer Token \u002F localhost-only admin ops\nport: 18998\n---\n\n# amber-hunter — AI 第二大脑 Skill\n\n## What It Is\n\namber-hunter 是运行在本地（port 18998）的 FastAPI 服务，为 Claude Code 提供长期记忆能力和知识自动编译能力。\n\n**核心能力矩阵：**\n\n| 能力 | 说明 | 引入版本 |\n|------|------|---------|\n| 记忆胶囊 | 持久化存储 AI 工作产生的想法\u002F决策\u002F上下文 | v1.0 |\n| 混合搜索 | LanceDB 向量 + 关键词联合检索 | v1.2.27 |\n| 意图预测 | 根据 session 内容预测下一步最可能的需求 | v1.2.27 |\n| DID E2E 加密 | 设备绑定加密，云端隐私保护 | v1.2.24 |\n| 知识编译器 | 同类胶囊自动编译成 wiki 概念页 | v1.2.38 |\n\n## 启动\n\n```bash\ncd ~\u002F.openclaw\u002Fskills\u002Famber-hunter\npython3 amber_hunter.py\n# 或后台运行\npython3 amber_hunter.py &\n```\n\n服务启动时：\n1. 自动初始化 SQLite 数据库（`memory.db`）\n2. 启动编译 daemon（每 6 小时扫描一次覆盖缺口）\n3. 冷启动编译（启动时如果有覆盖缺口，立即触发一次）\n\n## 认证\n\n| 操作 | 认证方式 |\n|------|---------|\n| 所有外部请求 | Bearer Token（从 `\u002Ftoken` 获取，写入 `~\u002F.openclaw\u002Ftoken`）|\n| `\u002Ftoken`, `\u002Fbind-apikey`, `\u002Fmaster-password` | 强制 localhost 检查 |\n| Bearer Token 调用 | 在 `Authorization: Bearer \u003Ctoken>` Header 中传递 |\n\n**Token 获取流程（首次设置）：**\n```bash\n# 1. 启动服务\npython3 amber_hunter.py\n\n# 2. 从本地获取 token（仅 localhost 可访问）\ncurl http:\u002F\u002Flocalhost:18998\u002Ftoken\n# 返回: {\"token\": \"xxx\"}\n\n# 3. 写入本地配置\necho \"Bearer xxx\" > ~\u002F.openclaw\u002Ftoken\n```\n\n## API 端点总览\n\n### 无需认证（localhost）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `GET \u002Fstatus` | GET | 服务状态、版本、平台、胶囊数 |\n| `GET \u002Ftoken` | GET | 读取本地 API Token |\n| `POST \u002Fbind-apikey` | POST | 更新 Huper 云端 API Key（存 Keychain）|\n| `POST \u002Fmaster-password` | POST | 设置 master_password（Keychain）|\n\n### 核心 — 胶囊管理（Bearer Token）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fcapsules` | GET | 列出胶囊（支持 `category_path` 过滤 + 分页 `limit`）|\n| `\u002Fcapsules` | POST | 创建胶囊 |\n| `\u002Fcapsules\u002F{id}` | GET | 获取单个胶囊详情 |\n| `\u002Fcapsules\u002F{id}` | PATCH | 更新胶囊 |\n| `\u002Fcapsules\u002F{id}` | DELETE | 删除胶囊 |\n\n### 核心 — 记忆召回（Bearer Token）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Frecall` | GET | 混合搜索（向量+关键词+LanceDB，rerank）|\n| `\u002Frerank` | POST | 强制 LLM 重排候选记忆 |\n| `\u002Fclassify` | GET | 关键词+LLM fallback 分类 |\n| `\u002Fextract` | POST | 从文本中提取记忆（LLM 驱动）|\n| `\u002Fingest` | POST | AI 主动写入记忆（→ 入库或审阅队列）|\n\n**`\u002Frecall` 参数：**\n\n| 参数 | 类型 | 默认 | 说明 |\n|------|------|------|------|\n| `q` | string | 必填 | 查询文本 |\n| `rerank` | bool | false | 是否启用 LLM rerank (deprecated, use rerank_engine) |\n| `rerank_engine` | string | \"auto\" | 重排序引擎：auto \\| model \\| llm \\| none |\n| `hyde` | bool | false | 是否启用 HyDE（假设性答案增强检索）v1.2.41 |\n| `multi_hop` | bool | false | 是否启用多跳检索 v1.2.41 |\n| `limit` | int | 3 | 返回数量 |\n| `category_path` | string | \"\" | MFS路径过滤 |\n| `use_insights` | bool | true | 是否优先返回 insight 缓存 |\n| `citation` | int | 0 | 1=返回 embedding 裁剪的片段 |\n\n**`\u002Frecall` 响应新增字段（v1.2.41）：**\n\n| 字段 | 类型 | 说明 |\n|------|------|------|\n| `rerank_time_ms` | float | reranker 耗时（毫秒） |\n| `hyde_time_ms` | float | HyDE 生成耗时（毫秒） |\n| `retrieval_hops` | int | 检索跳数（multi_hop 启用时 > 1） |\n\n**`\u002Frecall\u002Fevaluate` 端点（v1.2.41）：**\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Frecall\u002Fevaluate` | POST | RAG 评测（RAGAS + NDCG@5） |\n\n**`\u002Frecall\u002Fevaluate` 请求体：**\n```json\n{\"queries\": [{\"q\": \"...\", \"expected_capsule_ids\": [\"...\"]}]}\n```\n\n**`\u002Frecall\u002Fevaluate` 响应：**\n```json\n{\n  \"ragas_scores\": {\"faithfulness\": 0.x, \"answer_relevancy\": 0.x, \"context_precision\": 0.x},\n  \"ndcg_at_5\": 0.x,\n  \"evaluated_at\": \"...\",\n  \"total_queries\": 2\n}\n```\n\n**`\u002Fingest` 参数：**\n\n| 参数 | 类型 | 说明 |\n|------|------|------|\n| `content` | string | 记忆内容 |\n| `tags` | string | 标签（逗号分隔）|\n| `session_key` | string | 来源 session |\n| `auto_review` | bool | true=直接入库，false=进审阅队列 |\n\n### 审阅队列（Bearer Token）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fqueue` | GET | 列出待审阅记忆 |\n| `\u002Fqueue\u002F{qid}\u002Fapprove` | POST | 批准写入胶囊 |\n| `\u002Fqueue\u002F{qid}\u002Freject` | POST | 拒绝 |\n| `\u002Fqueue\u002F{qid}\u002Fedit` | POST | 修改后批准 |\n\n### 知识编译器 v1.2.38+（Bearer Token）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fconcepts` | GET | 列出所有已编译概念页（`?limit=50&offset=0` 分页）|\n| `\u002Fconcepts\u002F{path}` | GET | 获取指定 path 的 wiki 内容 |\n| `\u002Fadmin\u002Fcompile` | POST | 手动触发编译（`?path=` 指定路径）|\n| `\u002Fadmin\u002Fcompile\u002Fstatus` | GET | daemon 状态 + 覆盖缺口列表 + **健康指标**（alert\u002Fcrashes\u002Fsuccess_count）|\n\n**编译触发条件：**\n\n| 条件 | 说明 |\n|------|------|\n| 胶囊数比上次编译时多 ≥100 | 增量触发 |\n| 超过 6 小时未编译 | 定时触发 |\n\n**覆盖缺口：** 有 ≥3 个胶囊但无 concept page 的 category_path。\n\n### 管理操作（Bearer Token + localhost）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fadmin\u002Fbackfill-paths` | POST | 批量修复缺失的 category_path |\n| `\u002Fadmin\u002Freindex-vectors` | POST | 重建 LanceDB 向量索引 |\n| `\u002Fadmin\u002Ftrain` | POST | 触发 embedding 模型训练 |\n| `\u002Fadmin\u002Ftrain\u002Fstatus` | GET | 训练状态 |\n| `\u002Fadmin\u002Ftrain\u002Fscore` | GET | 模型评分 |\n| `\u002Fadmin\u002Ftrain\u002Ftags` | GET | 标签统计 |\n| `\u002Fadmin\u002Fgenerate-insights` | POST | 手动生成 insights（按 path）|\n| `\u002Fstats` | GET | 系统统计 |\n| `\u002Fadmin\u002Fexport` | GET | 导出备份 |\n\n### DID E2E 加密（Bearer Token）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fdid\u002Fsetup` | POST | 初始化 DID（生成密钥对，存 Keychain）|\n| `\u002Fdid\u002Fstatus` | GET | DID 初始化状态 |\n| `\u002Fdid\u002Fregister-device` | POST | 注册设备到 DID 网络 |\n| `\u002Fdid\u002Fauth\u002Fchallenge` | POST | 获取 auth challenge |\n| `\u002Fdid\u002Fauth\u002Fsign-challenge` | POST | 签名 challenge，完成认证 |\n\n### WAL（Write-Ahead Log）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fwal\u002Fstatus` | GET | WAL 状态 |\n| `\u002Fwal\u002Fentries` | GET | 读取 WAL 条目 |\n| `\u002Fwal\u002Fgc` | POST | 触发 WAL GC |\n\n### Session 上下文\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fsession\u002Fsummary` | GET | 当前 session 记忆摘要 |\n| `\u002Fsession\u002Ffiles` | GET | 当前 session 相关文件列表 |\n| `\u002Fsession\u002Fpreload` | GET | 预加载 context（供 Claude Code 使用）|\n| `\u002Ffreeze` | GET\u002FPOST | 冻结当前 session 上下文 |\n\n### Profile\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fprofile` | GET | 完整用户 profile |\n| `\u002Fprofile\u002F{section}` | GET\u002FPUT | 读取\u002F更新 profile 章节 |\n| `\u002Fprofile\u002Fbuild` | POST | 触发 profile 自动构建 |\n\n### Corrections（记忆纠错）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fcorrections\u002Fstats` | GET | 纠错统计 |\n| `\u002Fcorrections\u002Fsuggestions` | GET | 纠错建议 |\n| `\u002Fcorrections\u002Fapply` | POST | 应用纠错规则 |\n\n### 工具类\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `GET \u002F` | GET | 根路径，返回欢迎信息 |\n| `GET \u002Fpatterns` | GET | 当前系统运作的 Pattern 列表 |\n| `POST \u002Fmcp` | POST | MCP（Model Context Protocol）接口 |\n\n## 数据模型\n\n### capsules 表\n\n```sql\nCREATE TABLE capsules (\n    id              TEXT PRIMARY KEY,     -- 唯一 ID (secrets.token_hex)\n    memo            TEXT,                 -- 记忆摘要\n    content         TEXT,                  -- 完整内容\n    category_path   TEXT,                  -- 分类路径，如 \"dev\u002Fpython\"\n    tags            TEXT,                  -- 逗号分隔标签\n    hotness_score   REAL DEFAULT 0,        -- 热度分\n    hit_count       INTEGER DEFAULT 0,     -- 被 recall 命中的次数\n    session_id      TEXT,                  -- 来源 session\n    encrypted       INTEGER DEFAULT 0,     -- 是否加密\n    vector_id       TEXT,                  -- LanceDB 向量 ID\n    synced          INTEGER DEFAULT 0,    -- 是否已同步云端\n    created_at      REAL,                  -- unix timestamp\n    updated_at      REAL,\n    content_hash    TEXT                   -- 去重用\n)\n```\n\n### insights 表（v1.2.17+）\n\n```sql\nCREATE TABLE insights (\n    id              TEXT PRIMARY KEY,\n    capsule_ids     TEXT,          -- JSON array\n    summary         TEXT,           -- 纯文本摘要\n    path            TEXT,           -- category_path\n    concept_slug    TEXT,           -- slug化 path (v1.2.38+)\n    wiki_content    TEXT,           -- 完整 markdown (v1.2.38+)\n    hotness_score   REAL DEFAULT 0,\n    created_at      REAL,\n    updated_at      REAL\n)\n```\n\n### memory_queue 表\n\n```sql\nCREATE TABLE memory_queue (\n    id          TEXT PRIMARY KEY,\n    content     TEXT,\n    tags        TEXT,\n    session_id  TEXT,\n    source      TEXT DEFAULT 'ingest',\n    created_at  REAL\n)\n```\n\n## 配置\n\n配置文件：`~\u002F.openclaw\u002Fskills\u002Famber-hunter\u002Fconfig.json`\n\n```json\n{\n  \"auto_sync\": true,\n  \"sync_interval_seconds\": 300,\n  \"embed_model\": \"BAAI\u002Fbge-m3\",\n  \"vector_dim\": 1024,\n  \"rerank_model\": \"BAAI\u002Fbge-reranker-v2-m3\",\n  \"llm_model\": \"gpt-4o-mini\",\n  \"huper_api_key\": \"sk-...\",\n  \"key_source\": \"pbkdf2\",\n  \"compile_interval_hours\": 6.0,\n  \"compile_capsule_threshold\": 100\n}\n```\n\n## 关键行为\n\n### 胶囊创建时的 category_path 推断\n\n`\u002Fingest` 和 `\u002Fcapsules POST` 会自动从内容中推断 category_path：\n\n```\n推理依据：content + tags → LLM 分类\n兜底：category_path = \"general\u002Fdefault\"\n```\n\n### `\u002Frecall` 混合评分公式\n\n```\nfinal_score = 0.35 * norm_lance + 0.25 * norm_kw + 0.20 * recency + 0.20 * hotness\n```\n\n- LanceDB 向量相似度（归一化）\n- 关键词 overlap 分\n- 近期性（7天衰减）\n- 热度分\n\n### wikilinks 注入策略（Knowledge Compiler）\n\nLLM 生成 wikilinks 不稳定（max_tokens=600 时 Related Capsules 部分常被截断）。\n最终策略：**代码事后注入**：\n\n```python\nwikilinks = \" \".join(f\"[[{cid}:{short_label}]]\" for cid in capsule_ids)\nwiki_content = wiki_content.rstrip() + f\"\\n\\n### Related Capsules\\n{wikilinks}\"\n```\n\n### Cold Start 行为\n\n服务启动时：\n1. 如果有覆盖缺口，立即触发一次 `_run_batch_compile()`\n2. 如果 `auto_train` 启用，触发 embedding 模型训练\n\n## 使用示例\n\n### 创建记忆\n\n```bash\ncurl -X POST http:\u002F\u002Flocalhost:18998\u002Fingest \\\n  -H \"Authorization: Bearer $(cat ~\u002F.openclaw\u002Ftoken)\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"content\": \"修了一个版本号测试过时的问题\", \"tags\": \"amber-hunter,bugfix\"}'\n```\n\n### 召回记忆\n\n```bash\ncurl \"http:\u002F\u002Flocalhost:18998\u002Frecall?query=amber-hunter版本号问题&rerank=true\" \\\n  -H \"Authorization: Bearer $(cat ~\u002F.openclaw\u002Ftoken)\"\n```\n\n### 手动触发知识编译\n\n```bash\n# 编译指定 path\ncurl -X POST \"http:\u002F\u002Flocalhost:18998\u002Fadmin\u002Fcompile?path=knowledge\u002Fdevops\" \\\n  -H \"Authorization: Bearer $(cat ~\u002F.openclaw\u002Ftoken)\"\n\n# 查看 daemon 状态和缺口\ncurl \"http:\u002F\u002Flocalhost:18998\u002Fadmin\u002Fcompile\u002Fstatus\" \\\n  -H \"Authorization: Bearer $(cat ~\u002F.openclaw\u002Ftoken)\"\n```\n\n### 获取已编译的概念页\n\n```bash\n# 列出所有概念页\ncurl \"http:\u002F\u002Flocalhost:18998\u002Fconcepts\" \\\n  -H \"Authorization: Bearer $(cat ~\u002F.openclaw\u002Ftoken)\"\n\n# 获取指定概念页\ncurl \"http:\u002F\u002Flocalhost:18998\u002Fconcepts\u002Fknowledge\u002Fdevops\" \\\n  -H \"Authorization: Bearer $(cat ~\u002F.openclaw\u002Ftoken)\"\n```\n\n## 已知限制\n\n1. **Bearer Token 存在磁盘**：`~\u002F.openclaw\u002Ftoken` 是明文，localhost 以外不安全\n2. **向量索引重建昂贵**：`\u002Fadmin\u002Freindex-vectors` 在大量胶囊时耗时较长\n3. **Wiki 编译器依赖 LLM**：LLM 不可用时 `compile_concept_page` 返回 None\n4. **DID 注册需要 Huper 云端**：本地 DID setup 后还需要云端注册才生效\n\n## 相关文件\n\n```\namber-hunter\u002F\n├── amber_hunter.py      # FastAPI 主文件，所有端点\n├── core\u002F\n│   ├── db.py            # SQLite 数据层\n│   ├── wiki_compiler.py # 知识编译器（v1.2.38）\n│   └── llm.py           # LLM 调用封装\n├── tests\u002F\n│   └── test_api\u002F\n│       └── test_status.py  # 状态 API 测试\n├── config.json          # 配置文件\n└── SKILL.md             # 本文档\n```\n\n## 适用场景\n\n**用 amber-hunter 当：**\n- 需要 AI 在长时间对话中保持\"记忆\"\n- 需要从历史胶囊中检索相关经验\n- 需要将多个相关记忆自动组织成概念页\n- 需要加密存储敏感记忆到云端\n\n**不用 amber-hunter 当：**\n- 简单 KV 存储（用文件或 SQLite 直接写）\n- 需要服务端部署（它是纯本地服务）\n- 需要多人实时协作（它是单人设计）\n","# amber-hunter — AI 第二大脑 Skill\n\n## What It Is\n\namber-hunter 是运行在本地（port 18998）的 FastAPI 服务，为 Claude Code 提供长期记忆能力和知识自动编译能力。\n\n**核心能力矩阵：**\n\n| 能力 | 说明 | 引入版本 |\n|------|------|---------|\n| 记忆胶囊 | 持久化存储 AI 工作产生的想法\u002F决策\u002F上下文 | v1.0 |\n| 混合搜索 | LanceDB 向量 + 关键词联合检索 | v1.2.27 |\n| 意图预测 | 根据 session 内容预测下一步最可能的需求 | v1.2.27 |\n| DID E2E 加密 | 设备绑定加密，云端隐私保护 | v1.2.24 |\n| 知识编译器 | 同类胶囊自动编译成 wiki 概念页 | v1.2.38 |\n\n## 启动\n\n```bash\ncd ~\u002F.openclaw\u002Fskills\u002Famber-hunter\npython3 amber_hunter.py\n# 或后台运行\npython3 amber_hunter.py &\n```\n\n服务启动时：\n1. 自动初始化 SQLite 数据库（`memory.db`）\n2. 启动编译 daemon（每 6 小时扫描一次覆盖缺口）\n3. 冷启动编译（启动时如果有覆盖缺口，立即触发一次）\n\n## 认证\n\n| 操作 | 认证方式 |\n|------|---------|\n| 所有外部请求 | Bearer Token（从 `\u002Ftoken` 获取，写入 `~\u002F.openclaw\u002Ftoken`）|\n| `\u002Ftoken`, `\u002Fbind-apikey`, `\u002Fmaster-password` | 强制 localhost 检查 |\n| Bearer Token 调用 | 在 `Authorization: Bearer \u003Ctoken>` Header 中传递 |\n\n**Token 获取流程（首次设置）：**\n```bash\n# 1. 启动服务\npython3 amber_hunter.py\n\n# 2. 从本地获取 token（仅 localhost 可访问）\ncurl http:\u002F\u002Flocalhost:18998\u002Ftoken\n# 返回: {\"token\": \"xxx\"}\n\n# 3. 写入本地配置\necho \"Bearer xxx\" > ~\u002F.openclaw\u002Ftoken\n```\n\n## API 端点总览\n\n### 无需认证（localhost）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `GET \u002Fstatus` | GET | 服务状态、版本、平台、胶囊数 |\n| `GET \u002Ftoken` | GET | 读取本地 API Token |\n| `POST \u002Fbind-apikey` | POST | 更新 Huper 云端 API Key（存 Keychain）|\n| `POST \u002Fmaster-password` | POST | 设置 master_password（Keychain）|\n\n### 核心 — 胶囊管理（Bearer Token）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fcapsules` | GET | 列出胶囊（支持 `category_path` 过滤 + 分页 `limit`）|\n| `\u002Fcapsules` | POST | 创建胶囊 |\n| `\u002Fcapsules\u002F{id}` | GET | 获取单个胶囊详情 |\n| `\u002Fcapsules\u002F{id}` | PATCH | 更新胶囊 |\n| `\u002Fcapsules\u002F{id}` | DELETE | 删除胶囊 |\n\n### 核心 — 记忆召回（Bearer Token）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Frecall` | GET | 混合搜索（向量+关键词+LanceDB，rerank）|\n| `\u002Frerank` | POST | 强制 LLM 重排候选记忆 |\n| `\u002Fclassify` | GET | 关键词+LLM fallback 分类 |\n| `\u002Fextract` | POST | 从文本中提取记忆（LLM 驱动）|\n| `\u002Fingest` | POST | AI 主动写入记忆（→ 入库或审阅队列）|\n\n**`\u002Frecall` 参数：**\n\n| 参数 | 类型 | 默认 | 说明 |\n|------|------|------|------|\n| `q` | string | 必填 | 查询文本 |\n| `rerank` | bool | false | 是否启用 LLM rerank (deprecated, use rerank_engine) |\n| `rerank_engine` | string | \"auto\" | 重排序引擎：auto \\| model \\| llm \\| none |\n| `hyde` | bool | false | 是否启用 HyDE（假设性答案增强检索）v1.2.41 |\n| `multi_hop` | bool | false | 是否启用多跳检索 v1.2.41 |\n| `limit` | int | 3 | 返回数量 |\n| `category_path` | string | \"\" | MFS路径过滤 |\n| `use_insights` | bool | true | 是否优先返回 insight 缓存 |\n| `citation` | int | 0 | 1=返回 embedding 裁剪的片段 |\n\n**`\u002Frecall` 响应新增字段（v1.2.41）：**\n\n| 字段 | 类型 | 说明 |\n|------|------|------|\n| `rerank_time_ms` | float | reranker 耗时（毫秒） |\n| `hyde_time_ms` | float | HyDE 生成耗时（毫秒） |\n| `retrieval_hops` | int | 检索跳数（multi_hop 启用时 > 1） |\n\n**`\u002Frecall\u002Fevaluate` 端点（v1.2.41）：**\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Frecall\u002Fevaluate` | POST | RAG 评测（RAGAS + NDCG@5） |\n\n**`\u002Frecall\u002Fevaluate` 请求体：**\n```json\n{\"queries\": [{\"q\": \"...\", \"expected_capsule_ids\": [\"...\"]}]}\n```\n\n**`\u002Frecall\u002Fevaluate` 响应：**\n```json\n{\n  \"ragas_scores\": {\"faithfulness\": 0.x, \"answer_relevancy\": 0.x, \"context_precision\": 0.x},\n  \"ndcg_at_5\": 0.x,\n  \"evaluated_at\": \"...\",\n  \"total_queries\": 2\n}\n```\n\n**`\u002Fingest` 参数：**\n\n| 参数 | 类型 | 说明 |\n|------|------|------|\n| `content` | string | 记忆内容 |\n| `tags` | string | 标签（逗号分隔）|\n| `session_key` | string | 来源 session |\n| `auto_review` | bool | true=直接入库，false=进审阅队列 |\n\n### 审阅队列（Bearer Token）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fqueue` | GET | 列出待审阅记忆 |\n| `\u002Fqueue\u002F{qid}\u002Fapprove` | POST | 批准写入胶囊 |\n| `\u002Fqueue\u002F{qid}\u002Freject` | POST | 拒绝 |\n| `\u002Fqueue\u002F{qid}\u002Fedit` | POST | 修改后批准 |\n\n### 知识编译器 v1.2.38+（Bearer Token）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fconcepts` | GET | 列出所有已编译概念页（`?limit=50&offset=0` 分页）|\n| `\u002Fconcepts\u002F{path}` | GET | 获取指定 path 的 wiki 内容 |\n| `\u002Fadmin\u002Fcompile` | POST | 手动触发编译（`?path=` 指定路径）|\n| `\u002Fadmin\u002Fcompile\u002Fstatus` | GET | daemon 状态 + 覆盖缺口列表 + **健康指标**（alert\u002Fcrashes\u002Fsuccess_count）|\n\n**编译触发条件：**\n\n| 条件 | 说明 |\n|------|------|\n| 胶囊数比上次编译时多 ≥100 | 增量触发 |\n| 超过 6 小时未编译 | 定时触发 |\n\n**覆盖缺口：** 有 ≥3 个胶囊但无 concept page 的 category_path。\n\n### 管理操作（Bearer Token + localhost）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fadmin\u002Fbackfill-paths` | POST | 批量修复缺失的 category_path |\n| `\u002Fadmin\u002Freindex-vectors` | POST | 重建 LanceDB 向量索引 |\n| `\u002Fadmin\u002Ftrain` | POST | 触发 embedding 模型训练 |\n| `\u002Fadmin\u002Ftrain\u002Fstatus` | GET | 训练状态 |\n| `\u002Fadmin\u002Ftrain\u002Fscore` | GET | 模型评分 |\n| `\u002Fadmin\u002Ftrain\u002Ftags` | GET | 标签统计 |\n| `\u002Fadmin\u002Fgenerate-insights` | POST | 手动生成 insights（按 path）|\n| `\u002Fstats` | GET | 系统统计 |\n| `\u002Fadmin\u002Fexport` | GET | 导出备份 |\n\n### DID E2E 加密（Bearer Token）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fdid\u002Fsetup` | POST | 初始化 DID（生成密钥对，存 Keychain）|\n| `\u002Fdid\u002Fstatus` | GET | DID 初始化状态 |\n| `\u002Fdid\u002Fregister-device` | POST | 注册设备到 DID 网络 |\n| `\u002Fdid\u002Fauth\u002Fchallenge` | POST | 获取 auth challenge |\n| `\u002Fdid\u002Fauth\u002Fsign-challenge` | POST | 签名 challenge，完成认证 |\n\n### WAL（Write-Ahead Log）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fwal\u002Fstatus` | GET | WAL 状态 |\n| `\u002Fwal\u002Fentries` | GET | 读取 WAL 条目 |\n| `\u002Fwal\u002Fgc` | POST | 触发 WAL GC |\n\n### Session 上下文\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fsession\u002Fsummary` | GET | 当前 session 记忆摘要 |\n| `\u002Fsession\u002Ffiles` | GET | 当前 session 相关文件列表 |\n| `\u002Fsession\u002Fpreload` | GET | 预加载 context（供 Claude Code 使用）|\n| `\u002Ffreeze` | GET\u002FPOST | 冻结当前 session 上下文 |\n\n### Profile\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fprofile` | GET | 完整用户 profile |\n| `\u002Fprofile\u002F{section}` | GET\u002FPUT | 读取\u002F更新 profile 章节 |\n| `\u002Fprofile\u002Fbuild` | POST | 触发 profile 自动构建 |\n\n### Corrections（记忆纠错）\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `\u002Fcorrections\u002Fstats` | GET | 纠错统计 |\n| `\u002Fcorrections\u002Fsuggestions` | GET | 纠错建议 |\n| `\u002Fcorrections\u002Fapply` | POST | 应用纠错规则 |\n\n### 工具类\n\n| 端点 | 方法 | 说明 |\n|------|------|------|\n| `GET \u002F` | GET | 根路径，返回欢迎信息 |\n| `GET \u002Fpatterns` | GET | 当前系统运作的 Pattern 列表 |\n| `POST \u002Fmcp` | POST | MCP（Model Context Protocol）接口 |\n\n## 数据模型\n\n### capsules 表\n\n```sql\nCREATE TABLE capsules (\n    id              TEXT PRIMARY KEY,     -- 唯一 ID (secrets.token_hex)\n    memo            TEXT,                 -- 记忆摘要\n    content         TEXT,                  -- 完整内容\n    category_path   TEXT,                  -- 分类路径，如 \"dev\u002Fpython\"\n    tags            TEXT,                  -- 逗号分隔标签\n    hotness_score   REAL DEFAULT 0,        -- 热度分\n    hit_count       INTEGER DEFAULT 0,     -- 被 recall 命中的次数\n    session_id      TEXT,                  -- 来源 session\n    encrypted       INTEGER DEFAULT 0,     -- 是否加密\n    vector_id       TEXT,                  -- LanceDB 向量 ID\n    synced          INTEGER DEFAULT 0,    -- 是否已同步云端\n    created_at      REAL,                  -- unix timestamp\n    updated_at      REAL,\n    content_hash    TEXT                   -- 去重用\n)\n```\n\n### insights 表（v1.2.17+）\n\n```sql\nCREATE TABLE insights (\n    id              TEXT PRIMARY KEY,\n    capsule_ids     TEXT,          -- JSON array\n    summary         TEXT,           -- 纯文本摘要\n    path            TEXT,           -- category_path\n    concept_slug    TEXT,           -- slug化 path (v1.2.38+)\n    wiki_content    TEXT,           -- 完整 markdown (v1.2.38+)\n    hotness_score   REAL DEFAULT 0,\n    created_at      REAL,\n    updated_at      REAL\n)\n```\n\n### memory_queue 表\n\n```sql\nCREATE TABLE memory_queue (\n    id          TEXT PRIMARY KEY,\n    content     TEXT,\n    tags        TEXT,\n    session_id  TEXT,\n    source      TEXT DEFAULT 'ingest',\n    created_at  REAL\n)\n```\n\n## 配置\n\n配置文件：`~\u002F.openclaw\u002Fskills\u002Famber-hunter\u002Fconfig.json`\n\n```json\n{\n  \"auto_sync\": true,\n  \"sync_interval_seconds\": 300,\n  \"embed_model\": \"BAAI\u002Fbge-m3\",\n  \"vector_dim\": 1024,\n  \"rerank_model\": \"BAAI\u002Fbge-reranker-v2-m3\",\n  \"llm_model\": \"gpt-4o-mini\",\n  \"huper_api_key\": \"sk-...\",\n  \"key_source\": \"pbkdf2\",\n  \"compile_interval_hours\": 6.0,\n  \"compile_capsule_threshold\": 100\n}\n```\n\n## 关键行为\n\n### 胶囊创建时的 category_path 推断\n\n`\u002Fingest` 和 `\u002Fcapsules POST` 会自动从内容中推断 category_path：\n\n```\n推理依据：content + tags → LLM 分类\n兜底：category_path = \"general\u002Fdefault\"\n```\n\n### `\u002Frecall` 混合评分公式\n\n```\nfinal_score = 0.35 * norm_lance + 0.25 * norm_kw + 0.20 * recency + 0.20 * hotness\n```\n\n- LanceDB 向量相似度（归一化）\n- 关键词 overlap 分\n- 近期性（7天衰减）\n- 热度分\n\n### wikilinks 注入策略（Knowledge Compiler）\n\nLLM 生成 wikilinks 不稳定（max_tokens=600 时 Related Capsules 部分常被截断）。\n最终策略：**代码事后注入**：\n\n```python\nwikilinks = \" \".join(f\"[[{cid}:{short_label}]]\" for cid in capsule_ids)\nwiki_content = wiki_content.rstrip() + f\"\\n\\n### Related Capsules\\n{wikilinks}\"\n```\n\n### Cold Start 行为\n\n服务启动时：\n1. 如果有覆盖缺口，立即触发一次 `_run_batch_compile()`\n2. 如果 `auto_train` 启用，触发 embedding 模型训练\n\n## 使用示例\n\n### 创建记忆\n\n```bash\ncurl -X POST http:\u002F\u002Flocalhost:18998\u002Fingest \\\n  -H \"Authorization: Bearer $(cat ~\u002F.openclaw\u002Ftoken)\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"content\": \"修了一个版本号测试过时的问题\", \"tags\": \"amber-hunter,bugfix\"}'\n```\n\n### 召回记忆\n\n```bash\ncurl \"http:\u002F\u002Flocalhost:18998\u002Frecall?query=amber-hunter版本号问题&rerank=true\" \\\n  -H \"Authorization: Bearer $(cat ~\u002F.openclaw\u002Ftoken)\"\n```\n\n### 手动触发知识编译\n\n```bash\n# 编译指定 path\ncurl -X POST \"http:\u002F\u002Flocalhost:18998\u002Fadmin\u002Fcompile?path=knowledge\u002Fdevops\" \\\n  -H \"Authorization: Bearer $(cat ~\u002F.openclaw\u002Ftoken)\"\n\n# 查看 daemon 状态和缺口\ncurl \"http:\u002F\u002Flocalhost:18998\u002Fadmin\u002Fcompile\u002Fstatus\" \\\n  -H \"Authorization: Bearer $(cat ~\u002F.openclaw\u002Ftoken)\"\n```\n\n### 获取已编译的概念页\n\n```bash\n# 列出所有概念页\ncurl \"http:\u002F\u002Flocalhost:18998\u002Fconcepts\" \\\n  -H \"Authorization: Bearer $(cat ~\u002F.openclaw\u002Ftoken)\"\n\n# 获取指定概念页\ncurl \"http:\u002F\u002Flocalhost:18998\u002Fconcepts\u002Fknowledge\u002Fdevops\" \\\n  -H \"Authorization: Bearer $(cat ~\u002F.openclaw\u002Ftoken)\"\n```\n\n## 已知限制\n\n1. **Bearer Token 存在磁盘**：`~\u002F.openclaw\u002Ftoken` 是明文，localhost 以外不安全\n2. **向量索引重建昂贵**：`\u002Fadmin\u002Freindex-vectors` 在大量胶囊时耗时较长\n3. **Wiki 编译器依赖 LLM**：LLM 不可用时 `compile_concept_page` 返回 None\n4. **DID 注册需要 Huper 云端**：本地 DID setup 后还需要云端注册才生效\n\n## 相关文件\n\n```\namber-hunter\u002F\n├── amber_hunter.py      # FastAPI 主文件，所有端点\n├── core\u002F\n│   ├── db.py            # SQLite 数据层\n│   ├── wiki_compiler.py # 知识编译器（v1.2.38）\n│   └── llm.py           # LLM 调用封装\n├── tests\u002F\n│   └── test_api\u002F\n│       └── test_status.py  # 状态 API 测试\n├── config.json          # 配置文件\n└── SKILL.md             # 本文档\n```\n\n## 适用场景\n\n**用 amber-hunter 当：**\n- 需要 AI 在长时间对话中保持\"记忆\"\n- 需要从历史胶囊中检索相关经验\n- 需要将多个相关记忆自动组织成概念页\n- 需要加密存储敏感记忆到云端\n\n**不用 amber-hunter 当：**\n- 简单 KV 存储（用文件或 SQLite 直接写）\n- 需要服务端部署（它是纯本地服务）\n- 需要多人实时协作（它是单人设计）\n",{"port":23,"title":5,"source":24,"summary":25,"version":26,"protocol":27},18998,"~\u002F.openclaw\u002Fskills\u002Famber-hunter\u002Famber_hunter.py","Long-term memory and knowledge compilation skill for Claude Code — manages memory capsules, insight caching, semantic\u002Fkeyword hybrid recall, DID E2E encryption, and AI-driven knowledge wiki compiler.","1.2.41","FastAPI \u002F Bearer Token \u002F localhost-only admin ops","master","4aa004da461d820f4ea5499e58eb8d196cf99016","community\u002Fclawhub\u002Fa\u002Famber-hunter",0,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge","https:\u002F\u002Fskill-explorer-rho.vercel.app","https:\u002F\u002Fgithub.com\u002FLord1Egypt","Unbreakable. Unstoppable. Unmatched⚡.\r\n Speaker of machine tongues 🤖  | World-builder of decentralized dreams 🌐 | Defender of the digital realm🛡️.","2026-06-10 08:21:01",{"source":7,"skillName":5,"commands":38,"prompt":48,"zipAvailable":49},[39,42,45],{"tool":40,"command":41},"npx","npx skills add Lord1Egypt\u002Fawesome-skill-forge --skill amber-hunter",{"tool":43,"command":44},"bunx","bunx skills add Lord1Egypt\u002Fawesome-skill-forge --skill amber-hunter",{"tool":46,"command":47},"pnpm","pnpm dlx skills add Lord1Egypt\u002Fawesome-skill-forge --skill amber-hunter","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Fa\u002Famber-hunter\u002FSKILL.md",true,[],[52,60,67,74,81,88],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":59},"01M785WKJB99G3STR1NF9NRTJW","youtube-content","YouTube transcripts to summaries, threads, blogs.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fyoutube-content\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":59},"01M785WEFHB0G2S9YA6EPR3H0E","xurl","X\u002FTwitter via xurl CLI: post, search, DM, media, v2 API.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fxurl\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":59},"01M785W98EDN4EFJXJPMQEHCRC","touchdesigner-mcp","Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftouchdesigner-mcp\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":59},"01M785W5S9FP3QBH2V191E025P","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":59},"01M785W2AS08NSSH9YATCV6FJB","teams-meeting-pipeline","Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fteams-meeting-pipeline\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":59},"01M785VXKW4T34BTP1SCHW1R7F","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fsystematic-debugging\u002FSKILL.md",[],[]]