# kimetsu - Doramagic AI Context Pack

> 定位：安装前体验与判断资产。它帮助宿主 AI 有一个好的开始，但不代表已经安装、执行或验证目标项目。

## 充分原则

- **充分原则，不是压缩原则**：AI Context Pack 应该充分到让宿主 AI 在开工前理解项目价值、能力边界、使用入口、风险和证据来源；它可以分层组织，但不以最短摘要为目标。
- **压缩策略**：只压缩噪声和重复内容，不压缩会影响判断和开工质量的上下文。

## 给宿主 AI 的使用方式

你正在读取 Doramagic 为 kimetsu 编译的 AI Context Pack。请把它当作开工前上下文：帮助用户理解适合谁、能做什么、如何开始、哪些必须安装后验证、风险在哪里。不要声称你已经安装、运行或执行了目标项目。

## Claim 消费规则

- **事实来源**：Repo Evidence + Claim/Evidence Graph；Human Wiki 只提供显著性、术语和叙事结构。
- **事实最低状态**：`supported`
- `supported`：可以作为项目事实使用，但回答中必须引用 claim_id 和证据路径。
- `weak`：只能作为低置信度线索，必须要求用户继续核实。
- `inferred`：只能用于风险提示或待确认问题，不能包装成项目事实。
- `unverified`：不得作为事实使用，应明确说证据不足。
- `contradicted`：必须展示冲突来源，不得替用户强行选择一个版本。

## 它最适合谁

- **正在使用 Claude/Codex/Cursor/Gemini 等宿主 AI 的开发者**：README 或插件配置提到多个宿主 AI。 证据：`README.md` Claim：`clm_0002` supported 0.86

## 它能做什么

- **命令行启动或安装流程**（需要安装后验证）：项目文档中存在可执行命令，真实使用需要在本地或宿主环境中运行这些命令。 证据：`README.md`, `docs/INSTALL.md` Claim：`clm_0001` supported 0.86

## 怎么开始

- `npm install -g kimetsu-ai` 证据：`README.md` Claim：`clm_0003` supported 0.86, `clm_0004` supported 0.86
- `npm install -g kimetsu-ai          # lean build (all host integrations included)` 证据：`docs/INSTALL.md` Claim：`clm_0004` supported 0.86

## 继续前判断卡

- **当前建议**：需要管理员/安全审批
- **为什么**：继续前可能涉及密钥、账号、外部服务或敏感上下文，建议先经过管理员或安全审批。

### 30 秒判断

- **现在怎么做**：需要管理员/安全审批
- **最小安全下一步**：先跑 Prompt Preview；若涉及凭证或企业环境，先审批再试装
- **先别相信**：角色质量和任务匹配不能直接相信。
- **继续会触碰**：角色选择偏差、命令执行、本地环境或项目文件

### 现在可以相信

- **适合人群线索：正在使用 Claude/Codex/Cursor/Gemini 等宿主 AI 的开发者**（supported）：有 supported claim 或项目证据支撑，但仍不等于真实安装效果。 证据：`README.md` Claim：`clm_0002` supported 0.86
- **能力存在：命令行启动或安装流程**（supported）：可以相信项目包含这类能力线索；是否适合你的具体任务仍要试用或安装后验证。 证据：`README.md`, `docs/INSTALL.md` Claim：`clm_0001` supported 0.86
- **存在 Quick Start / 安装命令线索**（supported）：可以相信项目文档出现过启动或安装入口；不要因此直接在主力环境运行。 证据：`README.md` Claim：`clm_0003` supported 0.86, `clm_0004` supported 0.86

### 现在还不能相信

- **角色质量和任务匹配不能直接相信。**（unverified）：角色库证明有很多角色，不证明每个角色都适合你的具体任务，也不证明角色能产生高质量结果。
- **不能把角色文案当成真实执行能力。**（unverified）：安装前只能判断角色描述和任务画像是否匹配，不能证明它能在宿主 AI 里完成任务。
- **真实输出质量不能在安装前相信。**（unverified）：Prompt Preview 只能展示引导方式，不能证明真实项目中的结果质量。
- **宿主 AI 版本兼容性不能在安装前相信。**（unverified）：Claude、Cursor、Codex、Gemini 等宿主加载规则和版本差异必须在真实环境验证。
- **不会污染现有宿主 AI 行为，不能直接相信。**（inferred）：Skill、plugin、AGENTS/CLAUDE/GEMINI 指令可能改变宿主 AI 的默认行为。
- **可安全回滚不能默认相信。**（unverified）：除非项目明确提供卸载和恢复说明，否则必须先在隔离环境验证。
- **真实安装后是否与用户当前宿主 AI 版本兼容？**（unverified）：兼容性只能通过实际宿主环境验证。
- **项目输出质量是否满足用户具体任务？**（unverified）：安装前预览只能展示流程和边界，不能替代真实评测。

### 继续会触碰什么

- **角色选择偏差**：用户对任务应该由哪个专家角色处理的判断。 原因：选错角色会让 AI 从错误专业视角回答，浪费时间或误导决策。
- **命令执行**：包管理器、网络下载、本地插件目录、项目配置或用户主目录。 原因：运行第一条命令就可能产生环境改动；必须先判断是否值得跑。 证据：`README.md`, `docs/INSTALL.md`
- **本地环境或项目文件**：安装结果、插件缓存、项目配置或本地依赖目录。 原因：安装前无法证明写入范围和回滚方式，需要隔离验证。 证据：`README.md`, `docs/INSTALL.md`
- **环境变量 / API Key**：项目入口文档明确出现 API key、token、secret 或账号凭证配置。 原因：如果真实安装需要凭证，应先使用测试凭证并经过权限/合规判断。 证据：`CHANGELOG.md`, `docs/INSTALL.md`, `docs/how-kimetsu-works/configuration.md`
- **宿主 AI 上下文**：AI Context Pack、Prompt Preview、Skill 路由、风险规则和项目事实。 原因：导入上下文会影响宿主 AI 后续判断，必须避免把未验证项包装成事实。

### 最小安全下一步

- **先跑 Prompt Preview**：先用交互式试用验证任务画像和角色匹配，不要先导入整套角色库。（适用：任何项目都适用，尤其是输出质量未知时。）
- **只在隔离目录或测试账号试装**：避免安装命令污染主力宿主 AI、真实项目或用户主目录。（适用：存在命令执行、插件配置或本地写入线索时。）
- **不要使用真实生产凭证**：环境变量/API key 一旦进入宿主或工具链，可能产生账号和合规风险。（适用：出现 API、TOKEN、KEY、SECRET 等环境线索时。）
- **安装后只验证一个最小任务**：先验证加载、兼容、输出质量和回滚，再决定是否深用。（适用：准备从试用进入真实工作流时。）

### 退出方式

- **保留安装前状态**：记录原始宿主配置和项目状态，后续才能判断是否可恢复。
- **保留原始角色选择记录**：如果输出偏题，可以回到任务画像阶段重新选择角色，而不是继续沿着错误角色推进。
- **记录安装命令和写入路径**：没有明确卸载说明时，至少要知道哪些目录或配置需要手动清理。
- **准备撤销测试 API key 或 token**：测试凭证泄露或误用时，可以快速止损。
- **如果没有回滚路径，不进入主力环境**：不可回滚是继续前阻断项，不应靠信任或运气继续。

## 哪些只能预览

- 解释项目适合谁和能做什么
- 基于项目文档演示典型对话流程
- 帮助用户判断是否值得安装或继续研究

## 哪些必须安装后验证

- 真实安装 Skill、插件或 CLI
- 执行脚本、修改本地文件或访问外部服务
- 验证真实输出质量、性能和兼容性

## 边界与风险判断卡

- **把安装前预览误认为真实运行**：用户可能高估项目已经完成的配置、权限和兼容性验证。 处理方式：明确区分 prompt_preview_can_do 与 runtime_required。 Claim：`clm_0005` inferred 0.45
- **命令执行会修改本地环境**：安装命令可能写入用户主目录、宿主插件目录或项目配置。 处理方式：先在隔离环境或测试账号中运行。 证据：`README.md`, `docs/INSTALL.md` Claim：`clm_0006` supported 0.86
- **待确认**：真实安装后是否与用户当前宿主 AI 版本兼容？。原因：兼容性只能通过实际宿主环境验证。
- **待确认**：项目输出质量是否满足用户具体任务？。原因：安装前预览只能展示流程和边界，不能替代真实评测。
- **待确认**：安装命令是否需要网络、权限或全局写入？。原因：这影响企业环境和个人环境的安装风险。

## 开工前工作上下文

### 加载顺序

- 先读取 how_to_use.host_ai_instruction，建立安装前判断资产的边界。
- 读取 claim_graph_summary，确认事实来自 Claim/Evidence Graph，而不是 Human Wiki 叙事。
- 再读取 intended_users、capabilities 和 quick_start_candidates，判断用户是否匹配。
- 需要执行具体任务时，优先查 role_skill_index，再查 evidence_index。
- 遇到真实安装、文件修改、网络访问、性能或兼容性问题时，转入 risk_card 和 boundaries.runtime_required。

### 任务路由

- **命令行启动或安装流程**：先说明这是安装后验证能力，再给出安装前检查清单。 边界：必须真实安装或运行后验证。 证据：`README.md`, `docs/INSTALL.md` Claim：`clm_0001` supported 0.86

### 上下文规模

- 文件总数：201
- 重要文件覆盖：40/201
- 证据索引条目：70
- 角色 / Skill 条目：26

### 证据不足时的处理

- **missing_evidence**：说明证据不足，要求用户提供目标文件、README 段落或安装后验证记录；不要补全事实。
- **out_of_scope_request**：说明该任务超出当前 AI Context Pack 证据范围，并建议用户先查看 Human Manual 或真实安装后验证。
- **runtime_request**：给出安装前检查清单和命令来源，但不要替用户执行命令或声称已执行。
- **source_conflict**：同时展示冲突来源，标记为待核实，不要强行选择一个版本。

## Prompt Recipes

### 适配判断

- 目标：判断这个项目是否适合用户当前任务。
- 预期输出：适配结论、关键理由、证据引用、安装前可预览内容、必须安装后验证内容、下一步建议。

```text
请基于 kimetsu 的 AI Context Pack，先问我 3 个必要问题，然后判断它是否适合我的任务。回答必须包含：适合谁、能做什么、不能做什么、是否值得安装、证据来自哪里。所有项目事实必须引用 evidence_refs、source_paths 或 claim_id。
```

### 安装前体验

- 目标：让用户在安装前感受核心工作流，同时避免把预览包装成真实能力或营销承诺。
- 预期输出：一段带边界标签的体验剧本、安装后验证清单和谨慎建议；不含真实运行承诺或强营销表述。

```text
请把 kimetsu 当作安装前体验资产，而不是已安装工具或真实运行环境。

请严格输出四段：
1. 先问我 3 个必要问题。
2. 给出一段“体验剧本”：用 [安装前可预览]、[必须安装后验证]、[证据不足] 三种标签展示它可能如何引导工作流。
3. 给出安装后验证清单：列出哪些能力只有真实安装、真实宿主加载、真实项目运行后才能确认。
4. 给出谨慎建议：只能说“值得继续研究/试装”“先补充信息后再判断”或“不建议继续”，不得替项目背书。

硬性边界：
- 不要声称已经安装、运行、执行测试、修改文件或产生真实结果。
- 不要写“自动适配”“确保通过”“完美适配”“强烈建议安装”等承诺性表达。
- 如果描述安装后的工作方式，必须使用“如果安装成功且宿主正确加载 Skill，它可能会……”这种条件句。
- 体验剧本只能写成“示例台词/假设流程”：使用“可能会询问/可能会建议/可能会展示”，不要写“已写入、已生成、已通过、正在运行、正在生成”。
- Prompt Preview 不负责给安装命令；如用户准备试装，只能提示先阅读 Quick Start 和 Risk Card，并在隔离环境验证。
- 所有项目事实必须来自 supported claim、evidence_refs 或 source_paths；inferred/unverified 只能作风险或待确认项。

```

### 角色 / Skill 选择

- 目标：从项目里的角色或 Skill 中挑选最匹配的资产。
- 预期输出：候选角色或 Skill 列表，每项包含适用场景、证据路径、风险边界和是否需要安装后验证。

```text
请读取 role_skill_index，根据我的目标任务推荐 3-5 个最相关的角色或 Skill。每个推荐都要说明适用场景、可能输出、风险边界和 evidence_refs。
```

### 风险预检

- 目标：安装或引入前识别环境、权限、规则冲突和质量风险。
- 预期输出：环境、权限、依赖、许可、宿主冲突、质量风险和未知项的检查清单。

```text
请基于 risk_card、boundaries 和 quick_start_candidates，给我一份安装前风险预检清单。不要替我执行命令，只说明我应该检查什么、为什么检查、失败会有什么影响。
```

### 宿主 AI 开工指令

- 目标：把项目上下文转成一次对话开始前的宿主 AI 指令。
- 预期输出：一段边界明确、证据引用明确、适合复制给宿主 AI 的开工前指令。

```text
请基于 kimetsu 的 AI Context Pack，生成一段我可以粘贴给宿主 AI 的开工前指令。这段指令必须遵守 not_runtime=true，不能声称项目已经安装、运行或产生真实结果。
```

## 角色 / Skill 索引

- 共索引 26 个角色 / Skill / 项目文档条目。

- **Kimetsu**（project_doc）：Give your coding agent a memory that gets sharper every run. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`README.md`
- **npm distribution**（project_doc）：Kimetsu is also published to npm as the kimetsu-ai package the kimetsu package name was taken; the project's npm scope is @kimetsu-ai , so JS/TS users can npm install -g kimetsu-ai without a Rust toolchain. npm ships the same prebuilt native binary as the GitHub Release — it is not a reimplementation. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`npm/README.md`
- **website-fumadocs**（project_doc）：This is a Next.js application generated with Create Fumadocs https://github.com/fuma-nama/fumadocs . 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`website-fumadocs/README.md`
- **kimetsu-remote beta**（project_doc）：Server-hosted Kimetsu brain over HTTP MCP — one brain per repository, shared from a server. This is a separate package from the kimetsu-ai CLI: the remote server is intentionally not installed with kimetsu . 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`npm/kimetsu-remote/README.md`
- **kimetsu-ai**（project_doc）：A persistent memory brain sidecar for Claude Code and Codex. It accumulates generalizable knowledge across sessions and retrieves it on demand. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`npm/kimetsu/README.md`
- **Contributing to kimetsu**（project_doc）：Thanks for helping improve kimetsu. This repo keeps a clean, secure main and develop through automated checks at two points: locally on every commit, and in CI on every pull request. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/CONTRIBUTING.md`
- **Installing Kimetsu**（project_doc）：Kimetsu is a single Rust binary. There's really only one choice to make at install time, lean vs semantic embeddings , because that's the only part baked into the binary. Which host agents you use Claude Code, Codex, Pi, OpenClaw is a runtime choice you change anytime with kimetsu plugin install / uninstall , with no reinstall. The official prebuilt + npm binaries include all six host integrations; a bare source car… 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/INSTALL.md`
- **Changelog**（project_doc）：All notable changes to kimetsu land here. The format follows Keep a Changelog https://keepachangelog.com/en/1.1.0/ ; versions follow SemVer https://semver.org/spec/v2.0.0.html . From v1.0.0 onward the project follows SemVer normally: patch releases are bug-fix-only, minor releases are backward-compatible additions, and breaking changes require a major bump. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`CHANGELOG.md`
- **Contributor Covenant Code of Conduct**（project_doc）：Contributor Covenant Code of Conduct 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/CODE_OF_CONDUCT.md`
- **Fully-local Kimetsu: zero external network calls**（project_doc）：Fully-local Kimetsu: zero external network calls 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/LOCAL-MODELS.md`
- **Kimetsu Remote beta**（project_doc）：Run the brain on a server and connect over HTTP MCP , so a team or you across machines shares one brain per repository, with no local checkout. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/REMOTE.md`
- **Kimetsu Algorithm**（project_doc）：How Kimetsu turns memory into measurable savings: every cited memory is credited with the tokens it saved, every injection is charged for the tokens it cost, and kimetsu brain roi reports the net. This page documents the exact accounting so the ledger can be audited rather than trusted. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/ROI-METHODOLOGY.md`
- **Switching re-projects from the event log.**（project_doc）：Every knob in project.toml , the off-switches, and the environment overrides. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/how-kimetsu-works/configuration.md`
- **Ways to use it**（project_doc）：Kimetsu is a sidecar brain for coding agents. It runs alongside supported host agents through MCP including Claude Code and Codex , or as a standalone chat REPL. It watches what the model does, learns which memories actually help, and feeds higher-signal context into future runs. This document explains the moving parts, in the order you'll encounter them. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/how-kimetsu-works/index.md`
- **The MCP surface**（project_doc）：The MCP tool surface, the host hooks that make the loop reliable, and proactive mid-work recall. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/how-kimetsu-works/interfaces.md`
- **Citations + blame**（project_doc）：Citations, decay, dedup, conflict detection, and the analytics that prove the brain is helping. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/how-kimetsu-works/learning-loop.md`
- **The bridge**（project_doc）：The bridge, brain sharing, doctor, and what Kimetsu is not. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/how-kimetsu-works/operations.md`
- **Retrieval Models**（project_doc）：Which embedder and reranker Kimetsu ships, why, and how to swap or re-benchmark them. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/how-kimetsu-works/retrieval-models.md`
- **Durable upgrades: schema migrations**（project_doc）：brain.db: the event-sourced SQLite file that holds everything Kimetsu remembers, and how it migrates safely. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/how-kimetsu-works/the-brain.md`
- **Embeddings vs lean builds**（project_doc）：How the broker scores, selects, and budgets the memories injected into each run. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/how-kimetsu-works/the-broker.md`
- **Results: 100K bucket**（project_doc）：How Kimetsu scores on BEAM, the ten-ability long-term-memory benchmark, at the 100K and 1M token buckets. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/memory-benchmark/beam.md`
- **Brainbench**（project_doc）：BrainBench is Kimetsu's own reader-free capability benchmark: it drives the real binary across difficulty tiers and scores dedup, forgetting, importance, and calibration with no LLM in the loop. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/memory-benchmark/brainbench.md`
- **How Kimetsu compares**（project_doc）：How Kimetsu compares to mem0, Cognee, Zep, and Letta on the shared public benchmarks, and what we do not yet claim. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/memory-benchmark/comparison.md`
- **The headline numbers**（project_doc）：Kimetsu's house rule is that every claim ships with a measurement. This section documents how we measure the brain and what the numbers are, so you can check them rather than take our word for it. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/memory-benchmark/index.md`
- **Results**（project_doc）：How Kimetsu scores on LongMemEval, the public long-term-memory benchmark, with the exact setup so the number can be reproduced and compared. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/memory-benchmark/longmemeval.md`
- **Retrieval quality**（project_doc）：Kimetsu's retrieval and correctness numbers: recall, MRR, latency, stale-hit suppression, and contradiction resolution, all reproducible from the shipped CLI. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/memory-benchmark/retrieval-and-correctness.md`

## 证据索引

- 共索引 70 条证据。

- **Kimetsu**（documentation）：Give your coding agent a memory that gets sharper every run. 证据：`README.md`
- **npm distribution**（documentation）：Kimetsu is also published to npm as the kimetsu-ai package the kimetsu package name was taken; the project's npm scope is @kimetsu-ai , so JS/TS users can npm install -g kimetsu-ai without a Rust toolchain. npm ships the same prebuilt native binary as the GitHub Release — it is not a reimplementation. 证据：`npm/README.md`
- **website-fumadocs**（documentation）：This is a Next.js application generated with Create Fumadocs https://github.com/fuma-nama/fumadocs . 证据：`website-fumadocs/README.md`
- **kimetsu-remote beta**（documentation）：Server-hosted Kimetsu brain over HTTP MCP — one brain per repository, shared from a server. This is a separate package from the kimetsu-ai CLI: the remote server is intentionally not installed with kimetsu . 证据：`npm/kimetsu-remote/README.md`
- **kimetsu-ai**（documentation）：A persistent memory brain sidecar for Claude Code and Codex. It accumulates generalizable knowledge across sessions and retrieves it on demand. 证据：`npm/kimetsu/README.md`
- **Contributing to kimetsu**（documentation）：Thanks for helping improve kimetsu. This repo keeps a clean, secure main and develop through automated checks at two points: locally on every commit, and in CI on every pull request. 证据：`docs/CONTRIBUTING.md`
- **Installing Kimetsu**（documentation）：Kimetsu is a single Rust binary. There's really only one choice to make at install time, lean vs semantic embeddings , because that's the only part baked into the binary. Which host agents you use Claude Code, Codex, Pi, OpenClaw is a runtime choice you change anytime with kimetsu plugin install / uninstall , with no reinstall. The official prebuilt + npm binaries include all six host integrations; a bare source cargo install is minimal and adds them with --features pi,openclaw . 证据：`docs/INSTALL.md`
- **Package**（package_manifest）：{ "name": "website-fumadocs", "version": "0.0.0", "private": true, "scripts": { "sync-docs": "node scripts/sync-docs.mjs", "prebuild": "node scripts/sync-docs.mjs", "build": "next build", "postbuild": "node -e \"require 'fs' .writeFileSync 'out/.nojekyll','' ;require 'fs' .writeFileSync 'out/CNAME','kimetsu.dev' \"", "predev": "node scripts/sync-docs.mjs", "dev": "next dev", "start": "serve out", "types:check": "fumadocs-mdx && next typegen && tsc --noEmit", "postinstall": "fumadocs-mdx", "lint": "biome check", "format": "biome format --write" }, "dependencies": { "@orama/orama": "^3.1.18", "cnfast": "^0.0.8", "fumadocs-core": "16.10.7", "fumadocs-mdx": "15.0.13", "fumadocs-ui": "16.10.7",… 证据：`website-fumadocs/package.json`
- **Package**（package_manifest）：{ "name": "kimetsu-remote", "version": "0.0.0", "description": "Kimetsu Remote beta — server-hosted Kimetsu brain over HTTP MCP. Installs the prebuilt native server binary for your platform. Separate from the kimetsu-ai CLI.", "keywords": "kimetsu", "mcp", "server", "brain", "remote" , "homepage": "https://github.com/RodCor/kimetsu readme", "bugs": { "url": "https://github.com/RodCor/kimetsu/issues" }, "repository": { "type": "git", "url": "git+https://github.com/RodCor/kimetsu.git", "directory": "npm/kimetsu-remote" }, "license": "MIT OR Apache-2.0", "type": "commonjs", "bin": { "kimetsu-remote": "bin/cli.js" }, "files": "bin/cli.js", "README.md" , "engines": { "node": " =16" }, "optionalD… 证据：`npm/kimetsu-remote/package.json`
- **Package**（package_manifest）：{ "name": "kimetsu-ai", "version": "0.0.0", "description": "Kimetsu — a persistent memory brain sidecar for Claude Code and Codex. Installs the prebuilt native binary for your platform.", "keywords": "kimetsu", "mcp", "claude", "codex", "memory", "rag", "cli" , "homepage": "https://github.com/RodCor/kimetsu readme", "bugs": { "url": "https://github.com/RodCor/kimetsu/issues" }, "repository": { "type": "git", "url": "git+https://github.com/RodCor/kimetsu.git", "directory": "npm/kimetsu" }, "license": "MIT OR Apache-2.0", "type": "commonjs", "bin": { "kimetsu": "bin/cli.js", "kimetsu-ai": "bin/cli.js" }, "files": "bin/cli.js", "lib/embeddings.js", "README.md" , "engines": { "node": " =16" },… 证据：`npm/kimetsu/package.json`
- **Changelog**（documentation）：All notable changes to kimetsu land here. The format follows Keep a Changelog https://keepachangelog.com/en/1.1.0/ ; versions follow SemVer https://semver.org/spec/v2.0.0.html . From v1.0.0 onward the project follows SemVer normally: patch releases are bug-fix-only, minor releases are backward-compatible additions, and breaking changes require a major bump. 证据：`CHANGELOG.md`
- **Contributor Covenant Code of Conduct**（documentation）：Contributor Covenant Code of Conduct 证据：`docs/CODE_OF_CONDUCT.md`
- **Fully-local Kimetsu: zero external network calls**（documentation）：Fully-local Kimetsu: zero external network calls 证据：`docs/LOCAL-MODELS.md`
- **Kimetsu Remote beta**（documentation）：Run the brain on a server and connect over HTTP MCP , so a team or you across machines shares one brain per repository, with no local checkout. 证据：`docs/REMOTE.md`
- **Kimetsu Algorithm**（documentation）：How Kimetsu turns memory into measurable savings: every cited memory is credited with the tokens it saved, every injection is charged for the tokens it cost, and kimetsu brain roi reports the net. This page documents the exact accounting so the ledger can be audited rather than trusted. 证据：`docs/ROI-METHODOLOGY.md`
- **Switching re-projects from the event log.**（documentation）：Every knob in project.toml , the off-switches, and the environment overrides. 证据：`docs/how-kimetsu-works/configuration.md`
- **Ways to use it**（documentation）：Kimetsu is a sidecar brain for coding agents. It runs alongside supported host agents through MCP including Claude Code and Codex , or as a standalone chat REPL. It watches what the model does, learns which memories actually help, and feeds higher-signal context into future runs. This document explains the moving parts, in the order you'll encounter them. 证据：`docs/how-kimetsu-works/index.md`
- **The MCP surface**（documentation）：The MCP tool surface, the host hooks that make the loop reliable, and proactive mid-work recall. 证据：`docs/how-kimetsu-works/interfaces.md`
- **Citations + blame**（documentation）：Citations, decay, dedup, conflict detection, and the analytics that prove the brain is helping. 证据：`docs/how-kimetsu-works/learning-loop.md`
- **The bridge**（documentation）：The bridge, brain sharing, doctor, and what Kimetsu is not. 证据：`docs/how-kimetsu-works/operations.md`
- **Retrieval Models**（documentation）：Which embedder and reranker Kimetsu ships, why, and how to swap or re-benchmark them. 证据：`docs/how-kimetsu-works/retrieval-models.md`
- **Durable upgrades: schema migrations**（documentation）：brain.db: the event-sourced SQLite file that holds everything Kimetsu remembers, and how it migrates safely. 证据：`docs/how-kimetsu-works/the-brain.md`
- **Embeddings vs lean builds**（documentation）：How the broker scores, selects, and budgets the memories injected into each run. 证据：`docs/how-kimetsu-works/the-broker.md`
- **Results: 100K bucket**（documentation）：How Kimetsu scores on BEAM, the ten-ability long-term-memory benchmark, at the 100K and 1M token buckets. 证据：`docs/memory-benchmark/beam.md`
- **Brainbench**（documentation）：BrainBench is Kimetsu's own reader-free capability benchmark: it drives the real binary across difficulty tiers and scores dedup, forgetting, importance, and calibration with no LLM in the loop. 证据：`docs/memory-benchmark/brainbench.md`
- **How Kimetsu compares**（documentation）：How Kimetsu compares to mem0, Cognee, Zep, and Letta on the shared public benchmarks, and what we do not yet claim. 证据：`docs/memory-benchmark/comparison.md`
- **The headline numbers**（documentation）：Kimetsu's house rule is that every claim ships with a measurement. This section documents how we measure the brain and what the numbers are, so you can check them rather than take our word for it. 证据：`docs/memory-benchmark/index.md`
- **Results**（documentation）：How Kimetsu scores on LongMemEval, the public long-term-memory benchmark, with the exact setup so the number can be reproduced and compared. 证据：`docs/memory-benchmark/longmemeval.md`
- **Retrieval quality**（documentation）：Kimetsu's retrieval and correctness numbers: recall, MRR, latency, stale-hit suppression, and contradiction resolution, all reproducible from the shipped CLI. 证据：`docs/memory-benchmark/retrieval-and-correctness.md`
- **v0.4.7: distribution-ready metadata. Each member crate picks up**（source_file）：workspace members = "crates/kimetsu-agent", "crates/kimetsu-brain", "crates/kimetsu-chat", "crates/kimetsu-cli", "crates/kimetsu-core", "crates/kimetsu-e2e", "crates/kimetsu-remote", resolver = "3" 证据：`Cargo.toml`
- **v0.4.8: kimetsu-agent pulls kimetsu-brain for retrieval inside**（source_file）：package name = "kimetsu-agent" version.workspace = true edition.workspace = true license.workspace = true authors.workspace = true repository.workspace = true homepage.workspace = true documentation.workspace = true readme.workspace = true rust-version.workspace = true description = "Transport-neutral agent runtime for kimetsu: tools, prompts, verify-loop, providers claude code, anthropic, openai ." keywords = "kimetsu", "agent", "llm", "anthropic", "openai" categories = "development-tools" 证据：`crates/kimetsu-agent/Cargo.toml`
- **Claude Code**（source_file）：use std::collections::hash map::DefaultHasher; use std::fs; ⋮---- use std::sync::Arc; ⋮---- use kimetsu core::KimetsuResult; use kimetsu core::config::ProjectConfig; use kimetsu core::env file::resolve env value; use kimetsu core::ids::new id; use kimetsu core::secret::SecretString; use serde::Deserialize; ⋮---- use crate::agent loop::extract json object; ⋮---- pub struct ClaudeCodeProvider { ⋮---- struct PersistentClaudeSession { ⋮---- fn fmt &self, f: &mut std::fmt::Formatter - std::fmt::Result { f.debug struct "PersistentClaudeSession" .field "session fingerprint", &self.session fingerprint .field "child pid", &self.child.id .finish ⋮---- impl Drop for PersistentClaudeSession { fn drop &… 证据：`crates/kimetsu-agent/src/claude_code.rs`
- **Harness**（source_file）：use kimetsu core::KimetsuResult; ⋮---- fn is useful tool name: &str - bool { USEFUL TOOL NAMES.contains &name ⋮---- pub enum ToolLoadout { ⋮---- impl ToolLoadout { fn initial tool names self - Vec { ⋮---- Self::Dynamic = vec! ⋮---- Self::ReadOnly = vec! ⋮---- Self::Full = FULL TOOL NAMES.to vec , ⋮---- const fn allows dynamic loading self - bool { matches! self, Self::Dynamic ⋮---- const fn as str self - &'static str { ⋮---- pub struct ModelAgentReport { ⋮---- pub struct KimetsuAgentOpts { ⋮---- impl Default for KimetsuAgentOpts { fn default - Self { ⋮---- strict verify: Some false , ⋮---- impl KimetsuAgentOpts { pub fn for harbor - Self { ⋮---- pub fn for tests - Self { ⋮---- pub type Expa… 证据：`crates/kimetsu-agent/src/harness.rs`
- **Lib**（source_file）：pub mod agent loop; pub mod anthropic; pub mod bedrock; pub mod bench; pub mod claude code; pub mod harness; pub mod model; pub mod openai; pub mod pipeline; pub mod recall ledger; pub mod swe bench; pub mod tools; 证据：`crates/kimetsu-agent/src/lib.rs`
- **v0.4.3: opt into the local fastembed-rs embedder so kimetsu can do**（source_file）：package name = "kimetsu-brain" version.workspace = true edition.workspace = true license.workspace = true authors.workspace = true repository.workspace = true homepage.workspace = true documentation.workspace = true readme.workspace = true rust-version.workspace = true description = "Project + user-scope memory, hybrid retrieval lexical + cosine , ambient context, secret redaction at ingest for kimetsu." keywords = "kimetsu", "memory", "rag", "retrieval", "embeddings" categories = "database", "development-tools" 证据：`crates/kimetsu-brain/Cargo.toml`
- **Ann**（source_file）：use std::collections::HashMap; ⋮---- use rusqlite::Connection; ⋮---- use kimetsu core::KimetsuResult; ⋮---- struct Manifest { ⋮---- fn ann scalar kind - ScalarKind { match std::env::var "KIMETSU ANN QUANTIZATION" .ok .as deref { ⋮---- eprintln! "kimetsu-brain: unknown KIMETSU ANN QUANTIZATION '{other}', using f16" ; ⋮---- fn scalar kind id k: ScalarKind - &'static str { ⋮---- fn index options dim: usize - IndexOptions { ⋮---- quantization: ann scalar kind , ⋮---- /// Threads for parallel index construction. usearch add is thread-safe /// Index: Send+Sync, C++ locks internally , so fanning inserts across cores ⋮---- /// Index: Send+Sync, C++ locks internally , so fanning inserts across cores… 证据：`crates/kimetsu-brain/src/ann.rs`
- **Benchmark**（source_file）：use kimetsu core::memory::MemoryKind; ⋮---- pub enum BenchmarkWarmPolicy { ⋮---- impl BenchmarkWarmPolicy { pub fn parse value: &str - Option { match value.trim .to ascii lowercase .replace '-', " " .as str { "" "full" "full warm" "warm" "brain on warm" = Some Self::FullWarm , ⋮---- Some Self::ReactiveWarm ⋮---- "cold" "cold brain" "brain on cold" = Some Self::ColdBrain , ⋮---- pub const fn as str self - &'static str { ⋮---- pub const fn playbook note self - &'static str { ⋮---- pub enum BenchmarkMemoryRole { ⋮---- impl BenchmarkMemoryRole { ⋮---- "" "episodic" "run" "task run" "outcome" = Some Self::Episodic , ⋮---- Some Self::SemanticOperator ⋮---- Some Self::AntiPattern ⋮---- pub const f… 证据：`crates/kimetsu-brain/src/benchmark.rs`
- **derive Debug, Default, Clone, Copy**（source_file）：use kimetsu core::KimetsuResult; ⋮---- pub trait Embedder: Send + Sync { ⋮---- fn is noop &self - bool { ⋮---- fn embed batch &self, texts: & &str - Result , EmbedderError { texts.iter .map t self.embed t .collect ⋮---- impl Embedder for Box { fn embed &self, text: &str - Result , EmbedderError { self .embed text ⋮---- fn model id &self - &str { self .model id ⋮---- fn dim &self - usize { self .dim ⋮---- self .is noop ⋮---- self .embed batch texts ⋮---- pub enum EmbedderError { ⋮---- fn fmt &self, f: &mut std::fmt::Formatter - std::fmt::Result { ⋮---- Self::NotImplemented = write! f, "embedder not implemented" , Self::LoadFailed msg = write! f, "embedder load failed: {msg}" , Self::EmbedFai… 证据：`crates/kimetsu-brain/src/embeddings.rs`
- **Lib**（source_file）：pub mod ambient; pub mod analytics; ⋮---- pub mod ann; ⋮---- pub crate mod backend; ⋮---- pub mod backend bench; pub mod benchmark; pub mod blame; pub mod conflict; pub mod conflicts; pub mod consolidate; pub mod context; ⋮---- pub mod digest; pub mod dropped capsule; pub mod embeddings; ⋮---- pub mod episode; pub mod eval; pub mod feedback; ⋮---- pub mod graph; pub mod graph build; pub mod ingest; ⋮---- pub mod lifecycle; pub mod lock; pub mod maintenance; pub mod migrate; pub mod packs; pub mod project; pub mod projector; pub mod redact; pub mod reindex; pub mod reinforce; pub mod roi; pub mod schema; pub crate mod scoring; pub mod skill synthesis; ⋮---- pub mod sync; pub mod trace; pub m… 证据：`crates/kimetsu-brain/src/lib.rs`
- **Lifecycle**（source_file）：use std::path::Path; ⋮---- use kimetsu core::KimetsuResult; ⋮---- use time::OffsetDateTime; use time::format description::well known::Rfc3339; ⋮---- pub enum InvalidationReason { ⋮---- impl InvalidationReason { ⋮---- pub fn as str &self - &'static str { ⋮---- /// Parse a free-text invalidated reason column value into the best /// matching variant. Unknown / pre-taxonomy strings → Manual . ⋮---- /// matching variant. Unknown / pre-taxonomy strings → Manual . pub fn from db s: &str - Self { ⋮---- pub fn from db s: &str - Self { let lower = s.to ascii lowercase ; match lower.as str { ⋮---- fn fmt &self, f: &mut std::fmt::Formatter - std::fmt::Result { f.write str self.as str ⋮---- pub struct F… 证据：`crates/kimetsu-brain/src/lifecycle.rs`
- **Maintenance**（source_file）：use std::fs; use std::path::Path; ⋮---- use kimetsu core::KimetsuResult; use kimetsu core::paths::ProjectPaths; use rusqlite::params; ⋮---- use crate::lock::ProjectLock; ⋮---- use crate::projector; ⋮---- pub struct PruneOptions { ⋮---- impl Default for PruneOptions { fn default - Self { ⋮---- pub struct PruneCandidate { ⋮---- pub struct PruneSummary { ⋮---- pub fn prune low usefulness start: &Path, opts: PruneOptions - KimetsuResult { let min uses = opts.min uses.max 1 as i64; ⋮---- let paths, config, conn = load project start ?; let sql, scope param : &str, Option = if let Some scope = opts.scope.as deref ⋮---- Some scope.to string , ⋮---- let mut stmt = conn.prepare sql ?; ⋮---- stmt.quer… 证据：`crates/kimetsu-brain/src/maintenance.rs`
- **derive Debug, Clone, Default**（source_file）：use std::path::Path; ⋮---- use kimetsu core::KimetsuResult; use kimetsu core::ids::RunId; ⋮---- use rusqlite::params; ⋮---- pub struct MemoryExport { ⋮---- pub struct Pack { ⋮---- pub struct PackRef { ⋮---- pub fn parse pack or array json: &str - KimetsuResult { ⋮---- return Ok ⋮---- .map err e format! "pack: not a Pack envelope or a memory array: {e}" ?; Ok PackRef::default , entries ⋮---- pub fn redact context suffix text: &str - &str { let trimmed = text.trim end ; ⋮---- if let Some pos = find trailing context paren trimmed { let candidate = trimmed ..pos .trim end ; if !candidate.is empty { ⋮---- pub fn redact tags prefix text: &str - &str { let trimmed = text.trim start ; if let Some r… 证据：`crates/kimetsu-brain/src/packs.rs`
- **Reinforce**（source_file）：use std::collections::BTreeMap; use std::path::Path; ⋮---- use kimetsu core::KimetsuResult; ⋮---- use time::OffsetDateTime; ⋮---- use crate::context::QueryEmbedding; ⋮---- type RouteRow = String, String, i64, String, Option ; ⋮---- pub struct ReinforceSummary { ⋮---- pub fn reinforce start: &Path, staple: bool, routes: bool - KimetsuResult { ⋮---- let cands, created = staple co citations start ?; ⋮---- let built, embedded = build query routes start ?; ⋮---- Ok summary ⋮---- fn staple co citations start: &Path - KimetsuResult { let paths, config, conn = load project start ?; ⋮---- let mut stmt = conn.prepare ⋮---- .query map params! STAPLE MIN CO CITES , row { Ok row.get:: 0 ?, row.get:: 1 ?… 证据：`crates/kimetsu-brain/src/reinforce.rs`
- **Schema**（source_file）：use rusqlite::Connection; ⋮---- use kimetsu core::KimetsuResult; ⋮---- pub fn apply pragmas conn: &Connection - KimetsuResult { ⋮---- conn.pragma update None, "cache size", -65536 i64 ?; conn.pragma update None, "temp store", "MEMORY" ?; ⋮---- let = conn.pragma update None, "mmap size", 268 435 456 i64 ; let = conn.pragma update None, "synchronous", "NORMAL" ; ⋮---- Ok ⋮---- pub fn initialize conn: &Connection - KimetsuResult { apply pragmas conn ?; create baseline conn ?; ⋮---- let = conn.execute batch "DROP TABLE IF EXISTS memory vec;" ; ⋮---- pub fn create baseline for test conn: &Connection - KimetsuResult { create baseline conn ⋮---- fn create baseline conn: &Connection - KimetsuResult… 证据：`crates/kimetsu-brain/src/schema.rs`
- **Sync**（source_file）：use std::collections::BTreeMap; use std::fs; ⋮---- use kimetsu core::KimetsuResult; use kimetsu core::event::Event; ⋮---- use rusqlite::Connection; ⋮---- use time::OffsetDateTime; use time::format description::well known::Rfc3339; use ulid::Ulid; ⋮---- use crate::projector; use crate::redact; ⋮---- pub fn is sync allowed kind: &str - bool { SYNC ALLOWED KINDS.contains &kind ⋮---- pub struct SyncEvent { ⋮---- fn from e: &Event - Self { ⋮---- let payload = redact event payload e ; ⋮---- event id: e.event id.to string , run id: e.run id.to string , ⋮---- kind: e.kind.clone , ⋮---- origin: e.origin.clone , hlc: e.hlc.clone , ⋮---- type Error = Box ; ⋮---- fn try from s: SyncEvent - Result { let… 证据：`crates/kimetsu-brain/src/sync.rs`
- **v0.4.8: passthrough so kimetsu-cli --features embeddings can**（source_file）：package name = "kimetsu-chat" version.workspace = true edition.workspace = true license.workspace = true authors.workspace = true repository.workspace = true homepage.workspace = true documentation.workspace = true readme.workspace = true rust-version.workspace = true description = "Interactive REPL chat client + MCP sidecar + cross-harness bridge for kimetsu. Installs into Claude Code and Codex as a brain-managed memory layer." keywords = "kimetsu", "chat", "mcp", "claude-code", "codex" categories = "development-tools", "command-line-utilities" 证据：`crates/kimetsu-chat/Cargo.toml`
- **Lib**（source_file）：pub mod ask; pub mod bridge; pub mod commands; pub mod cost; pub mod mcp server; pub mod repl; pub mod skills; pub mod ui; ⋮---- pub use commands::SlashCommand; pub use cost::CostMeter; 证据：`crates/kimetsu-chat/src/lib.rs`
- **v0.4.8: re-export the brain crate's embeddings feature so**（source_file）：package name = "kimetsu-cli" version.workspace = true edition.workspace = true license.workspace = true authors.workspace = true repository.workspace = true homepage.workspace = true documentation.workspace = true readme.workspace = true rust-version.workspace = true description = "Top-level kimetsu binary: chat client, MCP sidecar, bridge for Claude Code / Codex, brain admin tools, doctor." keywords = "kimetsu", "cli", "ai", "chat", "agent" categories = "command-line-utilities", "development-tools" 证据：`crates/kimetsu-cli/Cargo.toml`
- **Lifecycle**（source_file）：use std::env; ⋮---- use std::str::FromStr; ⋮---- use kimetsu brain::project; use kimetsu core::KimetsuResult; ⋮---- pub crate fn update cmd args: UpdateArgs - KimetsuResult { ⋮---- pub crate fn uninstall cmd args: UninstallArgs - KimetsuResult { ⋮---- pub crate fn checkpoint cmd args: CheckpointArgs - KimetsuResult { ⋮---- .unwrap or else env::current dir .unwrap or default ; let note = args.note.as deref .unwrap or "" ; ⋮---- // Use capture episode now with an empty transcript manual save does not // require a transcript — the note itself is sufficient context . ⋮---- println! " Kimetsu Work checkpoint saved." ; if !note.is empty { println! " Note: {note}" ; ⋮---- // Could not write — like… 证据：`crates/kimetsu-cli/src/commands/lifecycle.rs`
- **arg long, default value t = 12**（source_file）：use std::env; ⋮---- use std::path::PathBuf; ⋮---- mod ask; mod commands; mod distiller; mod doctor; mod embed daemon; mod harvest setup; mod proactive state; mod process; mod remote client; mod skill synth; mod update; ⋮---- use kimetsu core::KimetsuResult; ⋮---- use tracing subscriber::EnvFilter; ⋮---- const VERSION: &str = env! "KIMETSU VERSION DISPLAY" ; ⋮---- struct Cli { ⋮---- enum Command { ⋮---- struct DoctorArgs { ⋮---- struct UpdateArgs { ⋮---- struct UninstallArgs { ⋮---- struct PsArgs { ⋮---- struct StopArgs { ⋮---- struct RestartArgs { ⋮---- struct ChatArgs { ⋮---- enum BridgeCommand { ⋮---- struct BridgeWorkspaceArgs { ⋮---- struct BridgeImportArgs { ⋮---- struct BridgeExportAr… 证据：`crates/kimetsu-cli/src/main.rs`
- **Cargo**（source_file）：package name = "kimetsu-core" version.workspace = true edition.workspace = true license.workspace = true authors.workspace = true repository.workspace = true homepage.workspace = true documentation.workspace = true readme.workspace = true rust-version.workspace = true description = "Shared core types config, events, ids, paths, memory kinds for the kimetsu agent runtime + brain." keywords = "kimetsu", "ai", "agent", "llm" categories = "development-tools" 证据：`crates/kimetsu-core/Cargo.toml`
- **Lib**（source_file）：pub mod clock; pub mod config; pub mod env file; pub mod event; pub mod ids; pub mod memory; pub mod paths; pub mod secret; ⋮---- pub type KimetsuResult = Result ; 证据：`crates/kimetsu-core/src/lib.rs`
- **Paths**（source_file）：use std::ffi::OsStr; ⋮---- use std::process::Command; use std::sync::OnceLock; ⋮---- use crate::KimetsuResult; ⋮---- pub fn pin discover to root { let = DISCOVER AT ROOT ONLY.set true ; ⋮---- fn discover pins to root - bool { DISCOVER AT ROOT ONLY.get .unwrap or &false ⋮---- pub struct ProjectPaths { ⋮---- impl ProjectPaths { pub fn discover start: impl AsRef - KimetsuResult { if discover pins to root { return Ok Self::at root start.as ref ; ⋮---- let repo root = discover repo root start.as ref ?; Ok Self::at root repo root ⋮---- pub fn at root repo root: impl Into - Self { let repo root = repo root.into ; let kimetsu dir = repo root.join ".kimetsu" ; ⋮---- project toml: kimetsu dir.join "p… 证据：`crates/kimetsu-core/src/paths.rs`
- **v0.5.3: this crate is a test harness, not a library users consume.**（source_file）：package name = "kimetsu-e2e" version.workspace = true edition.workspace = true license.workspace = true authors.workspace = true repository.workspace = true homepage.workspace = true documentation.workspace = true readme.workspace = true rust-version.workspace = true description = "v0.5.3: in-process end-to-end test suite for the kimetsu agent loop + brain pipeline. Not published — integration test harness only." keywords = "kimetsu", "testing", "internal" categories = "development-tools::testing" v0.5.3: this crate is a test harness, not a library users consume. Stays out of crates.io for the same reason kimetsu-harbor-rs does. publish = false 证据：`crates/kimetsu-e2e/Cargo.toml`
- **Lib**（source_file）：pub mod assertions; pub mod scripted provider; pub mod temp project; ⋮---- pub mod prelude { ⋮---- pub use crate::scripted provider::ScriptedProvider; pub use crate::temp project::TempProject; ⋮---- pub use kimetsu core::ids::RunId; 证据：`crates/kimetsu-e2e/src/lib.rs`
- **Lean by default like kimetsu-cli so a workspace build doesn't unify**（source_file）：package name = "kimetsu-remote" version.workspace = true edition.workspace = true license.workspace = true authors.workspace = true repository.workspace = true homepage.workspace = true documentation.workspace = true readme.workspace = true rust-version.workspace = true description = "Server-hosted Kimetsu brain over HTTP MCP, keyed by repository." keywords = "kimetsu", "mcp", "server", "brain", "http" categories = "command-line-utilities", "web-programming::http-server" 证据：`crates/kimetsu-remote/Cargo.toml`
- **Lib**（source_file）：pub mod app; pub mod auth; pub mod catalog; pub mod config; pub mod git; pub mod ingest; pub mod metrics; pub mod ratelimit; pub mod repo; pub mod rpc; pub mod state; ⋮---- use std::net::SocketAddr; ⋮---- use crate::state::AppState; ⋮---- pub fn run serve args: config::ServeArgs - Result { init tracing args.log.as deref ; ⋮---- let data dir = prepare data dir &args.data ?; ⋮---- .clone .filter s !s.trim .is empty .or else std::env::var "COMPUTERNAME" .ok .filter s !s.is empty .or else std::env::var "HOSTNAME" .ok .filter s !s.is empty .unwrap or else "remote".to string ; kimetsu core::clock::set node server node.clone ; ⋮---- let org brain = prepare org brain args.org brain.as deref , &data… 证据：`crates/kimetsu-remote/src/lib.rs`
- **Main**（source_file）：use std::process::ExitCode; ⋮---- struct Cli { ⋮---- enum Cmd { ⋮---- fn main - ExitCode { ⋮---- eprintln! "kimetsu-remote: {e}" ; 证据：`crates/kimetsu-remote/src/main.rs`
- **Biome**（structured_config）：{ "$schema": "https://biomejs.dev/schemas/2.2.0/schema.json", "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true }, "files": { "ignoreUnknown": true, "includes": " ", "!node modules", "!.next", "!dist", "!build", "!.source" }, "formatter": { "enabled": true, "indentStyle": "space", "indentWidth": 2 }, "linter": { "enabled": true, "rules": { "recommended": true }, "domains": { "next": "recommended", "react": "recommended" } }, "assist": { "actions": { "source": { "organizeImports": "on" } } } } 证据：`website-fumadocs/biome.json`
- **Tsconfig**（structured_config）：{ "compilerOptions": { "target": "ESNext", "lib": "dom", "dom.iterable", "esnext" , "allowJs": true, "skipLibCheck": true, "strict": true, "forceConsistentCasingInFileNames": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "jsx": "react-jsx", "incremental": true, "paths": { "@/ ": "./src/ " , "collections/ ": "./.source/ " }, "plugins": { "name": "next" } }, "include": "next-env.d.ts", " / .ts", " / .tsx", ".next/types/ / .ts", ".next/dev/types/ / .ts" , "exclude": "node modules" } 证据：`website-fumadocs/tsconfig.json`
- 其余 10 条证据见 `AI_CONTEXT_PACK.json` 或 `EVIDENCE_INDEX.json`。

## 宿主 AI 必须遵守的规则

- **把本资产当作开工前上下文，而不是运行环境。**：AI Context Pack 只包含证据化项目理解，不包含目标项目的可执行状态。 证据：`README.md`, `npm/README.md`, `website-fumadocs/README.md`
- **回答用户时区分可预览内容与必须安装后才能验证的内容。**：安装前体验的消费者价值来自降低误装和误判，而不是伪装成真实运行。 证据：`README.md`, `npm/README.md`, `website-fumadocs/README.md`

## 用户开工前应该回答的问题

- 你准备在哪个宿主 AI 或本地环境中使用它？
- 你只是想先体验工作流，还是准备真实安装？
- 你最在意的是安装成本、输出质量、还是和现有规则的冲突？

## 验收标准

- 所有能力声明都能回指到 evidence_refs 中的文件路径。
- AI_CONTEXT_PACK.md 没有把预览包装成真实运行。
- 用户能在 3 分钟内看懂适合谁、能做什么、如何开始和风险边界。

---

## Doramagic Context Augmentation

下面内容用于强化 Repomix/AI Context Pack 主体。Human Manual 只提供阅读骨架；踩坑日志会被转成宿主 AI 必须遵守的工作约束。

## Human Manual 骨架

使用规则：这里只是项目阅读路线和显著性信号，不是事实权威。具体事实仍必须回到 repo evidence / Claim Graph。

宿主 AI 硬性规则：
- 不得把页标题、章节顺序、摘要或 importance 当作项目事实证据。
- 解释 Human Manual 骨架时，必须明确说它只是阅读路线/显著性信号。
- 能力、安装、兼容性、运行状态和风险判断必须引用 repo evidence、source path 或 Claim Graph。

- **项目概览与 monorepo 结构**：importance `high`
  - source_paths: README.md, Cargo.toml, CHANGELOG.md, crates/kimetsu-core/src/lib.rs, crates/kimetsu-core/src/paths.rs
- **Brain 存储、嵌入与检索管线**：importance `high`
  - source_paths: crates/kimetsu-brain/src/lib.rs, crates/kimetsu-brain/src/schema.rs, crates/kimetsu-brain/src/embeddings.rs, crates/kimetsu-brain/src/ann.rs, crates/kimetsu-brain/src/scoring.rs
- **主机代理集成、CLI 与 MCP / 嵌入守护进程接口**：importance `high`
  - source_paths: crates/kimetsu-agent/src/lib.rs, crates/kimetsu-agent/src/harness.rs, crates/kimetsu-agent/src/claude_code.rs, crates/kimetsu-agent/src/swe_bench.rs, crates/kimetsu-agent/src/recall_ledger.rs
- **Brain 分享、Kimetsu Remote、基准测试与常见运维问题**：importance `high`
  - source_paths: crates/kimetsu-brain/src/packs.rs, crates/kimetsu-brain/src/redact.rs, crates/kimetsu-brain/src/sync.rs, crates/kimetsu-brain/src/lifecycle.rs, crates/kimetsu-brain/src/maintenance.rs

## Repo Inspection Evidence / 源码检查证据

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `42c8179bff538b81d620a8b48a61b18a5fc303ca`
- inspected_files: `README.md`, `docs/CODE_OF_CONDUCT.md`, `docs/CONTRIBUTING.md`, `docs/INSTALL.md`, `docs/LOCAL-MODELS.md`, `docs/REMOTE.md`, `docs/ROI-METHODOLOGY.md`, `docs/how-kimetsu-works/configuration.md`, `docs/how-kimetsu-works/index.md`, `docs/how-kimetsu-works/interfaces.md`, `docs/how-kimetsu-works/learning-loop.md`, `docs/how-kimetsu-works/operations.md`, `docs/how-kimetsu-works/retrieval-models.md`, `docs/how-kimetsu-works/the-brain.md`, `docs/how-kimetsu-works/the-broker.md`, `docs/memory-benchmark/beam.md`, `docs/memory-benchmark/brainbench.md`, `docs/memory-benchmark/comparison.md`, `docs/memory-benchmark/index.md`, `docs/memory-benchmark/longmemeval.md`

宿主 AI 硬性规则：
- 没有 repo_clone_verified=true 时，不得声称已经读过源码。
- 没有 repo_inspection_verified=true 时，不得把 README/docs/package 文件判断写成事实。
- 没有 quick_start_verified=true 时，不得声称 Quick Start 已跑通。

## Doramagic Pitfall Constraints / 踩坑约束

这些规则来自 Doramagic 发现、验证或编译过程中的项目专属坑点。宿主 AI 必须把它们当作工作约束，而不是普通说明文字。

### Constraint 1: 可能修改宿主 AI 配置

- Trigger: 项目面向 Claude/Cursor/Codex/Gemini/OpenCode 等宿主，或安装命令涉及用户配置目录。
- Host AI rule: 列出会写入的配置文件、目录和卸载/回滚步骤。
- Why it matters: 安装可能改变本机 AI 工具行为，用户需要知道写入位置和回滚方法。
- Evidence: capability.host_targets | https://github.com/RodCor/kimetsu | host_targets=claude_code, claude, openclaw, mcp_host, cursor
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 2: 能力判断依赖假设

- Trigger: README/documentation is current enough for a first validation pass.
- Host AI rule: 将假设转成下游验证清单。
- Why it matters: 假设不成立时，用户拿不到承诺的能力。
- Evidence: capability.assumptions | https://github.com/RodCor/kimetsu | README/documentation is current enough for a first validation pass.
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 3: 维护活跃度未知

- Trigger: 未记录 last_activity_observed。
- Host AI rule: 补 GitHub 最近 commit、release、issue/PR 响应信号。
- Why it matters: 新项目、停更项目和活跃项目会被混在一起，推荐信任度下降。
- Evidence: evidence.maintainer_signals | https://github.com/RodCor/kimetsu | last_activity_observed missing
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

- Trigger: no_demo
- Evidence: downstream_validation.risk_items | https://github.com/RodCor/kimetsu | no_demo; severity=medium
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 5: 存在评分风险

- Trigger: no_demo
- Why it matters: 风险会影响是否适合普通用户安装。
- Evidence: risks.scoring_risks | https://github.com/RodCor/kimetsu | no_demo; severity=medium
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 6: issue/PR 响应质量未知

- Trigger: issue_or_pr_quality=unknown。
- Host AI rule: 抽样最近 issue/PR，判断是否长期无人处理。
- Why it matters: 用户无法判断遇到问题后是否有人维护。
- Evidence: evidence.maintainer_signals | https://github.com/RodCor/kimetsu | issue_or_pr_quality=unknown
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 7: 发布节奏不明确

- Trigger: release_recency=unknown。
- Host AI rule: 确认最近 release/tag 和 README 安装命令是否一致。
- Why it matters: 安装命令和文档可能落后于代码，用户踩坑概率升高。
- Evidence: evidence.maintainer_signals | https://github.com/RodCor/kimetsu | release_recency=unknown
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。
