auto-knowledge-base CLAUDE.md

auto-knowledge-base CLAUDE.md is an instructions file for coding agents from guyeyouhun/auto-knowledge-base. It costs 1,020 tokens per session, scanned A, original, MIT.

Project instructions for an automatic knowledge base that stores engineering knowledge for agents. It uses SQLite and full-text search, and can capture, search, and classify project information with an AI model.

In plain words
What is it for?
Build or maintain the knowledge-base server, configure its language model, manage staged or confirmed knowledge, and work on search or installation features.
Why use it?
They explain the project’s storage, trust levels, setup, and fallback behavior so code changes fit its design.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/guyeyouhun/auto-knowledge-base/claude-md
Clone the repo
git clone --depth 1 https://github.com/guyeyouhun/auto-knowledge-base

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for auto-knowledge-base CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/guyeyouhun/auto-knowledge-base/claude-md.svg)](https://agentmods.dev/instructions/guyeyouhun/auto-knowledge-base/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/guyeyouhun/auto-knowledge-base/claude-md"><img src="https://agentmods.dev/badge/instructions/guyeyouhun/auto-knowledge-base/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,020 This file is loaded in full into every session.
When invoked 1,020 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01020 $0.01020
Opus 5 $0.00510 $0.00510
Sonnet 5 $0.00204 $0.00204
Haiku 4.5 $0.00102 $0.00102

Measured 3d ago against content hash 5424268985d9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

auto-knowledge-base CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 96 lines

How it starts

The opening of the file, as written. The whole thing — 96 lines — stays where its author put it; the contents beside it link to each section on GitHub.

自主知识库 (Auto Knowledge Base)

MCP 协议的知识库系统,为工程 Agent 提供智能知识服务。

当前状态

  • 版本: v0.1 MVP
  • GitHub: https://github.com/guyeyouhun/auto-knowledge-base
  • MCP Server: 通过 node dist/install.js 一键安装到 Claude Code
  • LLM 配置: 通过环境变量 LLM_BASE_URLLLM_API_KEYLLM_MODEL 指定
  • 存储: SQLite + FTS5 全文索引
  • 安装: 支持一键安装/卸载,复制到永久目录运行

核心设计原则

  1. 自带 LLM 层 — 不依赖 Claude Code 会话,MCP Server 独立调用 LLM
  2. staging 暂存 — 自动捕获的知识先存 staging,确认后才固化
  3. 主动推送knowledge_relevant 根据上下文推送,不被动等待查询
  4. 通用协议 — MCP,任何兼容客户端都能用,模型用户自配

知识类型

  • concept — 概念/理论
  • pattern — 可复用的实现模式
  • decision — 技术决策及理由
  • project — 项目特有知识

信任级别

  • confirmed — LLM 提取 + 指令导入,直接固化
  • staging — 自动捕获或暂存,需确认
  • extracted / inferred — 为后续扩展预留

架构决策(重要)

决策 选择 理由
LLM API 格式 单 LLM 提供商(当前通过 baseUrl 配置) 兼容主流格式
存储方式 SQLite 存储 生产级持久化,支持并发
搜索结果排序 关键词初筛 → LLM 语义重排 兼顾速度和理解力
降级策略 LLM 不可用时降级为纯文本搜索 不影响基本功能

技术债务 / 待改进

  1. 向量嵌入 — 已完成,集成 @fastembed/fastembed 进程内 ONNX 推理,模型文件在 knowledge/models/
  2. 自动捕获 — PostToolUse hook 提取工程知识到 staging
  3. 知识图谱可视化 — 展示实体间关系

一键安装 / 卸载

# 构建
npm run build

# 第 1 步:探测 LLM 配置(不安装)
node dist/install.js

# Agent 会看到探测结果并让用户选择 LLM 配置方式

# 第 2 步:根据用户选择执行安装
#   选项 A:用探测到的 LLM 安装
node dist/install.js --install
#   选项 B:自定义 LLM
node dist/install.js --install -u <URL> -k <KEY> -m <MODEL>
#   选项 C:不配 LLM,后续手动设置
node dist/install.js --install --no-detect

# 安装后使用(在任意 Claude Code 会话中)
claude> 把这份代码存到知识库
claude> 搜索关于 MCP 的知识

# 卸载
node dist/uninstall.js

Agent 安装指引

当用户在 Claude Code 中说"安装 auto-kb"时:

  1. 克隆仓库:git clone https://github.com/guyeyouhun/auto-knowledge-base.git
  2. 进入目录:cd auto-knowledge-base
  3. 安装依赖并构建:npm install && npm run build
  4. 探测 LLM:node dist/install.js → 看到 JSON 结果
  5. 问用户选哪个 LLM 配置
  6. 执行安装:node dist/install.js --install(或带参数安装)

开发记录

  • 2026-07-14: v0.1 全量修复完成,15 工具全部测试通过(157 tests)

知识库内容(./knowledge/)

存入的知识包括:

  • MCP 协议、React Hooks、TypeScript interface vs type、CC-Switch 等测试数据
  • 后续实际使用中会积累更多工程知识

Read the full file on GitHub · 96 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 96 lines · 1,020 tokens per session scan A 5424268985d9

Subscribe to this mod's changes

auto-knowledge-base CLAUDE.md is an instructions file published in the GitHub repository guyeyouhun/auto-knowledge-base (1 stars, last pushed 1mo ago), licensed MIT. It adds 1,020 tokens to every session, about $0.0051 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.