kb-agent: Instructions file for Claude Code

CLAUDE.md

kb-agent CLAUDE.md is an instructions file for Claude Code from zm1990s/kb-agent. It costs 2,751 tokens per session, scanned A, original, MIT.

A project instruction file for a shared knowledge platform, describing its purpose, technical setup, folder structure, and rules for making changes.

In plain words
What is it for?
Planning and implementing changes in the KB-Agent platform while following its architecture, authentication, search, background-task, and deployment rules.
Why use it?
It gives a coding agent the project context and constraints before it edits code, reducing incorrect decisions and unwanted technology changes.

Instructions file for Claude Code

Written for Claude Code: PreToolUse hook event. Also seen: runs codex exec; mentions Codex; built for openclaw.

This is zm1990s/kb-agent's own configuration. It tells Claude Code how to work on kb-agent itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything kb-agent configures →

Reuse

Borrowing it

Nothing to install: this file belongs to zm1990s/kb-agent. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/zm1990s/kb-agent/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/zm1990s/kb-agent

Made for: Claude Code.

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 kb-agent CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/zm1990s/kb-agent/claude-md/github.svg)](https://agentmods.dev/instructions/zm1990s/kb-agent/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/zm1990s/kb-agent/claude-md"><img src="https://agentmods.dev/badge/instructions/zm1990s/kb-agent/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for kb-agent CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/zm1990s/kb-agent/claude-md"><img src="https://agentmods.dev/badge/instructions/zm1990s/kb-agent/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2,751 This file is loaded in full into every session.
When invoked 2,751 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.02751 $0.02751
Opus 5.5 $0.01100 $0.01100
Sonnet 5.5 $0.00550 $0.00550
Haiku 4.5 $0.00275 $0.00275

Measured 2mo ago against content hash a4752b1a53e4, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

kb-agent 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 2mo 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 · 97 lines

How it starts

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

项目记忆 · KB-Agent

身份

你是 KB-Agent(内部 + Partner 共享 Agent 知识平台)的架构助手。任何改动前先给计划,等用户确认再执行。

项目一句话

面向内部员工与外部 Partner 的共享 Agent 知识平台:管理员上传文档 → Agent 自动归类/总结沉淀为可检索知识 → 用户通过对话查询知识并获取原文;架构预留 Skill 插拔框架(未来接入 SCM 等 skill,可在人工确认后下发 PANW 产品配置)。

技术栈(禁止中途更换,如需变更走 /design 流程)

  • Backend: Python 3.12 + FastAPI(async),Pydantic v2
  • 数据库: PostgreSQL 16(元数据 + 全文检索 tsvector);MVP 不引入向量库(检索走结构化元数据 + 关键词,把原文交给 LLM 回答以降低幻觉)
  • 文件存储: MVP 用本地文件系统(保持架构简单);通过 StorageProtocol 抽象封装,未来可换云对象存储而不动业务层
  • 正文/归类: 交给 Claude CLI 直接读原文(Word/PDF/图片/Excel/PPT 等常见格式 CLI 原生支持),归类时一趟调用同时产出 {分类, 摘要, 标签, 可搜正文 content_text},MVP 不自己写解析库
  • Agent 引擎: 封装 CLI 子进程,通过 EngineProtocol 抽象层调用;已实现 ClaudeCliEngine(claude 子进程)和 CodexCliEngine(codex exec 子进程);预留 OpenClaw 等未来后端
  • 认证: 自建用户表 + 邮箱密码,注册时按 域名后缀白名单 控制准入;access token(JWT,默认 60 分钟)+ sliding refresh token(httpOnly cookie,30 天,rotate on use)实现无感续期
  • 异步处理: 归类走 后台任务(含处理任务表 + 详细日志 + 失败可重试)
  • 前端: Next.js(App Router)+ TypeScript + Tailwind。只对用户暴露一个端口——Next.js 作统一入口,经 rewrites 把 /api/* 反代到后端 FastAPI,用户不直接访问后端端口
  • 部署: 云上部署(本地开发用 Docker Compose;对象存储 MVP 暂用本地路径)

目录约定

backend/
  app/
    api/          # 路由层:只做参数校验、鉴权、转发,禁止业务逻辑
    services/     # 业务逻辑,单一职责(doc_service / search_service / classify_service ...)
    models/       # SQLAlchemy ORM 模型
    schemas/      # Pydantic 请求/响应 schema
    core/         # 配置、DB 连接、鉴权中间件、异常处理
    engine/       # 【唯一 LLM 出口】EngineProtocol + ClaudeCliEngine + CodexCliEngine,预留 OpenClawEngine
    skills/       # 【预留】skill 插拔框架:SkillBase 抽象 + registry
    storage/      # StorageProtocol + LocalStorage(MVP 本地路径),未来加 S3/OSS 实现
    tasks/        # 后台任务:归类 worker、任务状态与重试
  tests/
frontend/         # Next.js(App Router)+ TS + Tailwind,用户唯一入口
  app/            # 路由页面:login/chat/documents/admin/users/settings/stats/whatsnew/account
  lib/            # api client(统一走 /api,含 stream SSE)、auth、useAuthGuard
  components/     # NavBar(RBAC 显隐) / MessageBubble / Markdown / FolderTree
                  # / TaskLogPanel / admin(WorkspaceAdmin/SystemSettings/CategoryManager/UserAdmin/PromptsTab/StatsTab)
  next.config.js  # rewrites: /api/* -> 后端 FastAPI(单端口暴露)
infra/
  postgres/
    init.sql          # CREATE EXTENSION
    migrations/       # 001_m1_auth … 037_refresh_tokens,按序应用(backend 启动时 migrate.py 自动幂等执行)
scripts/          # dev.sh / test.sh(独立库 kbagent_test) / lint.sh / e2e.sh
docs/                 # PRD / DESIGN / ROADMAP / WORKFLOW / SECURITY
prompts/              # 分步系统提示词

Read the full file on GitHub · 97 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. 2mo ago First seen · 97 lines · 2,751 tokens per session scan A a4752b1a53e4

Subscribe to this mod's changes

kb-agent CLAUDE.md is an instructions file published in the GitHub repository zm1990s/kb-agent (5 stars, last pushed today), licensed MIT. It adds 2,751 tokens to every session, about $0.0110 per session on Opus 5.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.

Related

kb-agent CLAUDE.md compared with instructions from other repositories

kb-agent CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
kb-agent CLAUDE.mdzm1990s/kb-agentInstructions file5todayMITA2,751Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
vscode model-prompts.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA2,022GitHub Copilot