knowledge-agent

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Knowledge Agent

知识Agent

Build and query AI-powered knowledge bases from claude-mem observations.
基于claude-mem的观测记录构建并查询AI驱动的知识库。

What Are Knowledge Agents?

什么是知识Agent?

Knowledge agents are filtered corpora of observations compiled into a conversational AI session. Build a corpus from your observation history, prime it (loads the knowledge into an AI session), then ask it questions conversationally.
Think of them as custom "brains": "everything about hooks", "all decisions from the last month", "all bugfixes for the worker service".
知识Agent是经过筛选的观测语料库,可整合到对话式AI会话中。你可以从自己的观测历史构建语料库,对其进行启动(将知识加载到AI会话中),然后以对话方式向其提问。
你可以把它们看作自定义的「大脑」:比如「所有关于hooks的内容」、「上个月的全部决策」、「worker服务的所有bug修复记录」。

Workflow

工作流程

Step 1: Build a corpus

步骤1:构建语料库

text
build_corpus name="hooks-expertise" description="Everything about the hooks lifecycle" project="claude-mem" concepts="hooks" limit=500
Filter options:
  • project
    — filter by project name
  • types
    — comma-separated: decision, bugfix, feature, refactor, discovery, change
  • concepts
    — comma-separated concept tags
  • files
    — comma-separated file paths (prefix match)
  • query
    — semantic search query
  • dateStart
    /
    dateEnd
    — ISO date range
  • limit
    — max observations (default 500)
text
build_corpus name="hooks-expertise" description="Everything about the hooks lifecycle" project="claude-mem" concepts="hooks" limit=500
筛选选项:
  • project
    — 按项目名称筛选
  • types
    — 逗号分隔的类型,可选值:decision、bugfix、feature、refactor、discovery、change
  • concepts
    — 逗号分隔的概念标签
  • files
    — 逗号分隔的文件路径(前缀匹配)
  • query
    — 语义搜索查询词
  • dateStart
    /
    dateEnd
    — ISO格式的日期范围
  • limit
    — 最大观测记录数(默认500)

Step 2: Prime the corpus

步骤2:启动语料库

text
prime_corpus name="hooks-expertise"
This creates an AI session loaded with all the corpus knowledge. Takes a moment for large corpora.
text
prime_corpus name="hooks-expertise"
该操作会创建一个加载了全部语料库知识的AI会话。如果语料库较大,需要等待一段时间。

Step 3: Query

步骤3:查询

text
query_corpus name="hooks-expertise" question="What are the 5 lifecycle hooks and when does each fire?"
The knowledge agent answers from its corpus. Follow-up questions maintain context.
text
query_corpus name="hooks-expertise" question="What are the 5 lifecycle hooks and when does each fire?"
知识Agent会基于其语料库进行回答,后续提问会保留上下文。

Step 4: List corpora

步骤4:列出所有语料库

text
list_corpora
Shows all corpora with stats and priming status.
text
list_corpora
展示所有语料库的统计数据和启动状态。

Tips

使用提示

  • Focused corpora work best — "hooks architecture" beats "everything ever"
  • Prime once, query many times — the session persists across queries
  • Reprime for fresh context — if the conversation drifts, reprime to reset
  • Rebuild to update — when new observations are added, rebuild then reprime
  • 聚焦的语料库效果最佳 — 「hooks架构」这类定向语料的效果远好于「全部历史内容」
  • 一次启动,多次查询 — 会话会在多次查询之间保留
  • 重新启动以获得全新上下文 — 如果对话偏离了方向,重新启动即可重置上下文
  • 重建以更新内容 — 新增观测记录后,先重建语料库再重新启动即可

Maintenance

维护操作

Rebuild a corpus (refresh with new observations)

重建语料库(用新的观测记录刷新内容)

text
rebuild_corpus name="hooks-expertise"
After rebuilding, reprime to load the updated knowledge:
text
rebuild_corpus name="hooks-expertise"
重建完成后,重新启动以加载更新后的知识:

Reprime (fresh session)

重新启动(全新会话)

text
reprime_corpus name="hooks-expertise"
Clears prior Q&A context and reloads the corpus into a new session.
text
reprime_corpus name="hooks-expertise"
清除之前的问答上下文,将语料库重新加载到新的会话中。