# kioku-mesh - Doramagic AI Context Pack

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

## 充分原则

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

## 给宿主 AI 的使用方式

你正在读取 Doramagic 为 kioku-mesh 编译的 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` Claim：`clm_0001` supported 0.86

## 怎么开始

- `uv tool install kioku-mesh` 证据：`README.md` Claim：`clm_0003` supported 0.86
- `pip install -e '.[dev,test]'` 证据：`README.md` Claim：`clm_0004` supported 0.86

## 继续前判断卡

- **当前建议**：先做角色匹配试用
- **为什么**：这个项目更像角色库，核心风险是选错角色或把角色文案当执行能力；先用 Prompt Preview 试角色匹配，再决定是否沙盒导入。

### 30 秒判断

- **现在怎么做**：先做角色匹配试用
- **最小安全下一步**：先用 Prompt Preview 试角色匹配；满意后再隔离导入
- **先别相信**：角色质量和任务匹配不能直接相信。
- **继续会触碰**：角色选择偏差、命令执行、宿主 AI 配置

### 现在可以相信

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

### 现在还不能相信

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

### 继续会触碰什么

- **角色选择偏差**：用户对任务应该由哪个专家角色处理的判断。 原因：选错角色会让 AI 从错误专业视角回答，浪费时间或误导决策。
- **命令执行**：包管理器、网络下载、本地插件目录、项目配置或用户主目录。 原因：运行第一条命令就可能产生环境改动；必须先判断是否值得跑。 证据：`README.md`
- **宿主 AI 配置**：Claude/Codex/Cursor/Gemini/OpenCode 等宿主的 plugin、Skill 或规则加载配置。 原因：宿主配置会改变 AI 后续工作方式，可能和用户已有规则冲突。 证据：`CLAUDE.md`
- **本地环境或项目文件**：安装结果、插件缓存、项目配置或本地依赖目录。 原因：安装前无法证明写入范围和回滚方式，需要隔离验证。 证据：`README.md`
- **宿主 AI 上下文**：AI Context Pack、Prompt Preview、Skill 路由、风险规则和项目事实。 原因：导入上下文会影响宿主 AI 后续判断，必须避免把未验证项包装成事实。

### 最小安全下一步

- **先跑 Prompt Preview**：先用交互式试用验证任务画像和角色匹配，不要先导入整套角色库。（适用：任何项目都适用，尤其是输出质量未知时。）
- **只在隔离目录或测试账号试装**：避免安装命令污染主力宿主 AI、真实项目或用户主目录。（适用：存在命令执行、插件配置或本地写入线索时。）
- **先备份宿主 AI 配置**：Skill、plugin、规则文件可能改变 Claude/Cursor/Codex 的默认行为。（适用：存在插件 manifest、Skill 或宿主规则入口时。）
- **安装后只验证一个最小任务**：先验证加载、兼容、输出质量和回滚，再决定是否深用。（适用：准备从试用进入真实工作流时。）

### 退出方式

- **保留安装前状态**：记录原始宿主配置和项目状态，后续才能判断是否可恢复。
- **准备移除宿主 plugin / Skill / 规则入口**：如果试装后行为异常，可以把宿主 AI 恢复到试装前状态。
- **保留原始角色选择记录**：如果输出偏题，可以回到任务画像阶段重新选择角色，而不是继续沿着错误角色推进。
- **记录安装命令和写入路径**：没有明确卸载说明时，至少要知道哪些目录或配置需要手动清理。
- **如果没有回滚路径，不进入主力环境**：不可回滚是继续前阻断项，不应靠信任或运气继续。

## 哪些只能预览

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

## 哪些必须安装后验证

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

## 边界与风险判断卡

- **把安装前预览误认为真实运行**：用户可能高估项目已经完成的配置、权限和兼容性验证。 处理方式：明确区分 prompt_preview_can_do 与 runtime_required。 Claim：`clm_0005` inferred 0.45
- **命令执行会修改本地环境**：安装命令可能写入用户主目录、宿主插件目录或项目配置。 处理方式：先在隔离环境或测试账号中运行。 证据：`README.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` Claim：`clm_0001` supported 0.86

### 上下文规模

- 文件总数：108
- 重要文件覆盖：40/108
- 证据索引条目：67
- 角色 / Skill 条目：48

### 证据不足时的处理

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

## Prompt Recipes

### 适配判断

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

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

### 安装前体验

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

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

请严格输出四段：
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
请基于 kioku-mesh 的 AI Context Pack，生成一段我可以粘贴给宿主 AI 的开工前指令。这段指令必须遵守 not_runtime=true，不能声称项目已经安装、运行或产生真实结果。
```

## 角色 / Skill 索引

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

- **Why kioku-mesh**（project_doc）：Shared memory for AI coding agents, across tools and machines. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`README.md`
- **kioku-mesh — agent rules**（project_doc）：- Do NOT push directly to main . Always go through a PR: branch → push → gh pr create → merge after review. - This repo is public on GitHub Free, which means branch protection rules and required PR reviews are available at the server side and should be enabled on main . Until they are, the "PR-only" rule above remains a convention that the agent and the human have to hold themselves. - If a direct push to main happe… 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`CLAUDE.md`
- **MCP registration**（project_doc）：Two binaries — know the difference - kioku-mesh one hyphen — the CLI . Run this yourself: kioku-mesh mcp install , kioku-mesh status , etc. - kioku-mesh-mcp two hyphens — the stdio MCP server . It is spawned in the background by an MCP client Claude Code, Codex CLI, Claude Desktop… ; you do not type this command directly. Running it from a terminal will print a usage message and exit. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/mcp-clients.md`
- **Multi-agent identity single host, multiple agents**（project_doc）：Multi-agent identity single host, multiple agents 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/multi-agent.md`
- **kioku-mesh 現状仕様**（project_doc）：この文書は、2026-06-01 時点のリポジトリ実装から読み取れる現状仕様をまとめたものです。将来構想ではなく、 src/mesh mem/ と tests/ が現在保証している振る舞いを基準にしています。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/Spec.md`
- **MCP 登録**（project_doc）：wrapper はインストール済みの kioku-mesh-mcp binary を解決し、クライアント別の 登録先へ書き込み、既定の identity env も設定します。上書きしたい値は --env KEY=VALUE 、既存登録の置換は --force 、生成される command / config の確認は --dry-run を使います。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/mcp-clients.ja.md`
- **Migration**（project_doc）：オンディスクパスの mesh-mem → kioku-mesh 改名 v0.3.1, 128 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/migration.md`
- **Mutual TLS mTLS for the mesh**（project_doc）：By default kioku-mesh trusts whoever can reach the Zenoh port 7447/tcp — it relies on network admission Tailscale, WireGuard, firewall rules, a trusted LAN . That is enough for a closed, trusted network and needs zero certificates. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/mtls.md`
- **マルチエージェント identity（単一ホスト・複数エージェント）**（project_doc）：1 台の PC で複数エージェントを並走させる場面は普通にあります。Claude Code を 別ターミナルで 2 つ、Codex CLI セッション 1 つ、夜間 cron で動く autonomous cleanup 1 つ、といった具合です。それぞれが Zenoh key で衝突しないように、 各エージェントは distinct な identity を持つ必要があります。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/multi-agent.ja.md`
- **Windows ホストのセットアップ**（project_doc）：Experimental — WSL2 強く推奨。 ネイティブ Windows は CI 対象外です。 zenohd の Windows バイナリ、RocksDB プラグイン、ファイアウォール / サービス 周りは利用者がメンテする想定で、予告なく動かなくなる可能性があります。 Windows ワークステーションで動かす場合は、 WSL2 上で通常の Linux peer として 動かす方を強く推奨 します（README の Quick start 参照）。WSL2 のネットワーク は mirrored モード（Windows 11 23H2 以降）にしておくと、WSL ゲストが他の LAN peer から TCP/7447 で到達可能になります。下記の手順は、ネイティブ Windows インストールが避けられない場合（例: WSL2 内 stdio MCP に到達できない Windows 版 Claude Desktop）の… 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/windows-setup.ja.md`
- **Windows host setup**（project_doc）：Experimental — WSL2 strongly recommended. Native Windows is not in CI; the zenohd Windows binary, RocksDB plugin, and firewall/service plumbing are user-maintained and may regress without notice. For a Windows workstation, prefer running kioku-mesh inside WSL2 as a regular Linux peer see the README Quick start . Keep WSL2 networking in mirrored mode Windows 11 23H2+ so the WSL guest is reachable from other LAN peers… 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/windows-setup.md`
- **ADR-0001: Zenoh + RocksDB をメッシュトランスポートに採用**（project_doc）：ADR-0001: Zenoh + RocksDB をメッシュトランスポートに採用 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0001-zenoh-rocksdb-transport.md`
- **ADR-0002: 削除モデルに existence-based tombstone を採用**（project_doc）：ADR-0002: 削除モデルに existence-based tombstone を採用 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0002-existence-based-tombstone.md`
- **ADR-0003: 検索実装を全件取得→Python側フィルタで先行実装（FTS5導入前）**（project_doc）：ADR-0003: 検索実装を全件取得→Python側フィルタで先行実装（FTS5導入前） 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0003-python-side-filter-before-fts5.md`
- **ADR-0004: pc id / session id を環境変数＋永続ファイルの二層で管理し MCP 引数から除外**（project_doc）：ADR-0004: pc id / session id を環境変数＋永続ファイルの二層で管理し MCP 引数から除外 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0004-identity-env-and-persistent-file.md`
- **ADR-0005: GC の初期実装を project 非依存スコープで先行実装**（project_doc）：ADR-0005: GC の初期実装を project 非依存スコープで先行実装 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0005-gc-project-agnostic-scope.md`
- **ADR-0006: メッシュ topology に hub-and-spoke を採用**（project_doc）：ADR-0006: メッシュ topology に hub-and-spoke を採用 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0006-hub-and-spoke-mesh-topology.md`
- **ADR-0007: 検索 read-path に SQLite local index sidecar を採用**（project_doc）：ADR-0007: 検索 read-path に SQLite local index sidecar を採用 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0007-sqlite-local-index-sidecar.md`
- **ADR-0008: GC を project スコープ + O N fast path に拡張**（project_doc）：ADR-0008: GC を project スコープ + O N fast path に拡張 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0008-gc-project-aware-and-o-n.md`
- **ADR-0009: MCP server の instructions で PROACTIVE SAVE 規約を出荷**（project_doc）：ADR-0009: MCP server の instructions で PROACTIVE SAVE 規約を出荷 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0009-mcp-server-instructions-protocol.md`
- **ADR 0010: Zenoh storage を真実源、SQLite local index は派生キャッシュ**（project_doc）：ADR 0010: Zenoh storage を真実源、SQLite local index は派生キャッシュ 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0010-zenoh-as-source-of-truth.md`
- **ADR 0011: rebuild reconcile は shadow-delete を経由する**（project_doc）：ADR 0011: rebuild reconcile は shadow-delete を経由する 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0011-rebuild-shadow-delete-reconcile.md`
- **ADR 0012: Forward-compat via extras side-channel for unknown Observation fields**（project_doc）：ADR 0012: Forward-compat via extras side-channel for unknown Observation fields 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0012-forward-compat-extras-side-channel.md`
- **ADR 0013: "Tier 1" を公開アーキテクチャから外し、demo mode に格下げ**（project_doc）：ADR 0013: "Tier 1" を公開アーキテクチャから外し、demo mode に格下げ 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0013-drop-tier-1-from-public-architecture.md`
- **ADR 0014: mesh の mutual TLS を CSR ベースの private CA で提供する**（project_doc）：ADR 0014: mesh の mutual TLS を CSR ベースの private CA で提供する 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0014-mtls-via-csr-private-ca.md`
- **ADR 0015: 証明書 enrollment はコピペをデフォルトにし、SSH 自動化はオプトインにする**（project_doc）：ADR 0015: 証明書 enrollment はコピペをデフォルトにし、SSH 自動化はオプトインにする 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0015-cert-enrollment-copy-paste-default.md`
- **ADR 0016: init --mode localhost を廃止し、 local / mesh start に集約**（project_doc）：ADR 0016: init --mode localhost を廃止し、 local / mesh start に集約 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0016-remove-localhost-init-mode.md`
- **ADR-0017: hub 冗長化 — connect.endpoints に 2 hub を併記する**（project_doc）：ADR-0017: hub 冗長化 — connect.endpoints に 2 hub を併記する 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0017-dual-hub-spoke-topology.md`
- **ADR-0018: save observation 取り逃し対策は「言語非依存 instructions + session-scoped nudge」で server 側に寄せる**（project_doc）：ADR-0018: save observation 取り逃し対策は「言語非依存 instructions + session-scoped nudge」で server 側に寄せる 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0018-save-recall-language-agnostic-instructions-and-session-nudge.md`
- **ADR-0019: Observation visibility tier による selective replication**（project_doc）：ADR-0019: Observation visibility tier による selective replication 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0019-visibility-tiered-replication.md`
- **ADR-0020: skills-mesh — 同一 mesh 上の別 namespace で skill を共有する**（project_doc）：ADR-0020: skills-mesh — 同一 mesh 上の別 namespace で skill を共有する 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0020-skills-mesh-namespace.md`
- **ADR-0021: 検索品質 — FTS5 trigram 導入と supersedes-aware search**（project_doc）：ADR-0021: 検索品質 — FTS5 trigram 導入と supersedes-aware search 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0021-fts5-trigram-and-supersedes-aware-search.md`
- **ADR 0022: Zenoh 上にエージェント間メッセージング（フロー）レイヤーを新設する**（project_doc）：ADR 0022: Zenoh 上にエージェント間メッセージング（フロー）レイヤーを新設する 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0022-zenoh-agent-messaging-flow-layer.md`
- **ADR 0023: messaging は別リポジトリに分けず、単一リポジトリ内で core / memory / messaging に層化する**（project_doc）：ADR 0023: messaging は別リポジトリに分けず、単一リポジトリ内で core / memory / messaging に層化する 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0023-single-repo-core-memory-messaging-layering.md`
- **ADR 0024: Python パッケージを mesh mem から kioku mesh にリネームする**（project_doc）：ADR 0024: Python パッケージを mesh mem から kioku mesh にリネームする 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/adr/0024-rename-package-mesh-mem-to-kioku-mesh.md`
- **Messaging MVP Design — Issue 185**（project_doc）：Date: 2026-06-24 Author: W4 / Codex 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/design/0185-messaging-mvp-design.md`
- **Proactive Save の遵守率を測る — opportunity coverage 設計 105**（project_doc）：Proactive Save の遵守率を測る — opportunity coverage 設計 105 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/design/issue-105-proactive-save-opportunity-coverage.md`
- **Local Backend Design — Issue 109**（project_doc）：Historical design note: command/package/path names in the original sketch may use mesh-mem . The implemented current behavior is documented in docs/Spec.md ../Spec.md : kioku-mesh init --mode local writes ~/.config/kioku-mesh/config.yaml with legacy mesh-mem fallback and stores local-only data under state dir /local/index.db . 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/design/issue-109-local-backend.md`
- **Tier 1 Fix-Forward Design Notes 112 post-merge**（project_doc）：Tier 1 Fix-Forward Design Notes 112 post-merge 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/design/issue-112-tier1-fix-mesh-integration.md`
- **mesh-mem: マルチエージェント分散メモリ PoC設計書**（project_doc）：ドキュメント状態 : 本書は 2026-04-23 に書き起こした as-designed な設計書を、 2026-04-27 時点の実装・運用・PoC 検証結果に突き合わせて as-built に同期した版である。 設計意図（PoC 制約、識別子設計、key expression、tombstone モデル等）はそのまま残し、 実装が確定した部分は「 実装ステータス 」ブロックで現状を併記している。 実機検証結果は末尾の 実機検証結果サマリ と 既知制約 / Open issues を参照。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/design/poc-plan.md`
- **PoC Reports — Summary**（project_doc）：短い検証ノートを下に追記していく。詳細YAMLは raw/ 配下に置く想定（必要時に追加）。 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/poc-reports/SUMMARY.md`
- **Topology PoC: hub-and-spoke transit verification 2026-05-10**（project_doc）：Topology PoC: hub-and-spoke transit verification 2026-05-10 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/poc-reports/topology-2026-05-10.md`
- **Changelog**（project_doc）：All notable changes to this project will be documented in this file. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`CHANGELOG.md`
- **Security policy**（project_doc）：kioku-mesh is in 0.x . Only the most recent minor release receives security fixes; older minors are EOL the moment a new minor ships. Patch releases on the current minor are issued as needed. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`SECURITY.md`
- **v0.3.0 Release Notes — v0.3 First-Impression Overhaul**（project_doc）：v0.3.0 Release Notes — v0.3 First-Impression Overhaul 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`release_notes/v0.3.0.md`
- **v0.3.1 Release Notes**（project_doc）：A consistency + polish release on top of v0.3.0. No breaking changes — existing installs keep working without any manual step. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`release_notes/v0.3.1.md`
- **v0.3.2 Release Notes**（project_doc）：A spoke-onboarding bug-fix release on top of v0.3.1. No breaking changes — existing installs keep working without any manual step. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`release_notes/v0.3.2.md`
- **v0.3.3 Release Notes**（project_doc）：A documentation release for the OSS launch. No code or on-disk storage changes — upgrading is optional and changes nothing at runtime. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`release_notes/v0.3.3.md`

## 证据索引

- 共索引 67 条证据。

- **Why kioku-mesh**（documentation）：Shared memory for AI coding agents, across tools and machines. 证据：`README.md`
- **kioku-mesh — agent rules**（documentation）：- Do NOT push directly to main . Always go through a PR: branch → push → gh pr create → merge after review. - This repo is public on GitHub Free, which means branch protection rules and required PR reviews are available at the server side and should be enabled on main . Until they are, the "PR-only" rule above remains a convention that the agent and the human have to hold themselves. - If a direct push to main happens by mistake, surface it immediately — do not silently continue. 证据：`CLAUDE.md`
- **MCP registration**（documentation）：Two binaries — know the difference - kioku-mesh one hyphen — the CLI . Run this yourself: kioku-mesh mcp install , kioku-mesh status , etc. - kioku-mesh-mcp two hyphens — the stdio MCP server . It is spawned in the background by an MCP client Claude Code, Codex CLI, Claude Desktop… ; you do not type this command directly. Running it from a terminal will print a usage message and exit. 证据：`docs/mcp-clients.md`
- **Multi-agent identity single host, multiple agents**（documentation）：Multi-agent identity single host, multiple agents 证据：`docs/multi-agent.md`
- **License**（source_file）：Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files the "Software" , to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 证据：`LICENSE`
- **kioku-mesh 現状仕様**（documentation）：この文書は、2026-06-01 時点のリポジトリ実装から読み取れる現状仕様をまとめたものです。将来構想ではなく、 src/mesh mem/ と tests/ が現在保証している振る舞いを基準にしています。 证据：`docs/Spec.md`
- **MCP 登録**（documentation）：wrapper はインストール済みの kioku-mesh-mcp binary を解決し、クライアント別の 登録先へ書き込み、既定の identity env も設定します。上書きしたい値は --env KEY=VALUE 、既存登録の置換は --force 、生成される command / config の確認は --dry-run を使います。 证据：`docs/mcp-clients.ja.md`
- **Migration**（documentation）：オンディスクパスの mesh-mem → kioku-mesh 改名 v0.3.1, 128 证据：`docs/migration.md`
- **Mutual TLS mTLS for the mesh**（documentation）：By default kioku-mesh trusts whoever can reach the Zenoh port 7447/tcp — it relies on network admission Tailscale, WireGuard, firewall rules, a trusted LAN . That is enough for a closed, trusted network and needs zero certificates. 证据：`docs/mtls.md`
- **マルチエージェント identity（単一ホスト・複数エージェント）**（documentation）：1 台の PC で複数エージェントを並走させる場面は普通にあります。Claude Code を 別ターミナルで 2 つ、Codex CLI セッション 1 つ、夜間 cron で動く autonomous cleanup 1 つ、といった具合です。それぞれが Zenoh key で衝突しないように、 各エージェントは distinct な identity を持つ必要があります。 证据：`docs/multi-agent.ja.md`
- **Windows ホストのセットアップ**（documentation）：Experimental — WSL2 強く推奨。 ネイティブ Windows は CI 対象外です。 zenohd の Windows バイナリ、RocksDB プラグイン、ファイアウォール / サービス 周りは利用者がメンテする想定で、予告なく動かなくなる可能性があります。 Windows ワークステーションで動かす場合は、 WSL2 上で通常の Linux peer として 動かす方を強く推奨 します（README の Quick start 参照）。WSL2 のネットワーク は mirrored モード（Windows 11 23H2 以降）にしておくと、WSL ゲストが他の LAN peer から TCP/7447 で到達可能になります。下記の手順は、ネイティブ Windows インストールが避けられない場合（例: WSL2 内 stdio MCP に到達できない Windows 版 Claude Desktop）のためのものです。 证据：`docs/windows-setup.ja.md`
- **Windows host setup**（documentation）：Experimental — WSL2 strongly recommended. Native Windows is not in CI; the zenohd Windows binary, RocksDB plugin, and firewall/service plumbing are user-maintained and may regress without notice. For a Windows workstation, prefer running kioku-mesh inside WSL2 as a regular Linux peer see the README Quick start . Keep WSL2 networking in mirrored mode Windows 11 23H2+ so the WSL guest is reachable from other LAN peers on TCP/7447. The steps below remain for the rare case where a native Windows install is unavoidable e.g. Claude Desktop on Windows, which cannot reach a WSL2 stdio MCP from the Windows host . 证据：`docs/windows-setup.md`
- **ADR-0001: Zenoh + RocksDB をメッシュトランスポートに採用**（documentation）：ADR-0001: Zenoh + RocksDB をメッシュトランスポートに採用 证据：`docs/adr/0001-zenoh-rocksdb-transport.md`
- **ADR-0002: 削除モデルに existence-based tombstone を採用**（documentation）：ADR-0002: 削除モデルに existence-based tombstone を採用 证据：`docs/adr/0002-existence-based-tombstone.md`
- **ADR-0003: 検索実装を全件取得→Python側フィルタで先行実装（FTS5導入前）**（documentation）：ADR-0003: 検索実装を全件取得→Python側フィルタで先行実装（FTS5導入前） 证据：`docs/adr/0003-python-side-filter-before-fts5.md`
- **ADR-0004: pc id / session id を環境変数＋永続ファイルの二層で管理し MCP 引数から除外**（documentation）：ADR-0004: pc id / session id を環境変数＋永続ファイルの二層で管理し MCP 引数から除外 证据：`docs/adr/0004-identity-env-and-persistent-file.md`
- **ADR-0005: GC の初期実装を project 非依存スコープで先行実装**（documentation）：ADR-0005: GC の初期実装を project 非依存スコープで先行実装 证据：`docs/adr/0005-gc-project-agnostic-scope.md`
- **ADR-0006: メッシュ topology に hub-and-spoke を採用**（documentation）：ADR-0006: メッシュ topology に hub-and-spoke を採用 证据：`docs/adr/0006-hub-and-spoke-mesh-topology.md`
- **ADR-0007: 検索 read-path に SQLite local index sidecar を採用**（documentation）：ADR-0007: 検索 read-path に SQLite local index sidecar を採用 证据：`docs/adr/0007-sqlite-local-index-sidecar.md`
- **ADR-0008: GC を project スコープ + O N fast path に拡張**（documentation）：ADR-0008: GC を project スコープ + O N fast path に拡張 证据：`docs/adr/0008-gc-project-aware-and-o-n.md`
- **ADR-0009: MCP server の instructions で PROACTIVE SAVE 規約を出荷**（documentation）：ADR-0009: MCP server の instructions で PROACTIVE SAVE 規約を出荷 证据：`docs/adr/0009-mcp-server-instructions-protocol.md`
- **ADR 0010: Zenoh storage を真実源、SQLite local index は派生キャッシュ**（documentation）：ADR 0010: Zenoh storage を真実源、SQLite local index は派生キャッシュ 证据：`docs/adr/0010-zenoh-as-source-of-truth.md`
- **ADR 0011: rebuild reconcile は shadow-delete を経由する**（documentation）：ADR 0011: rebuild reconcile は shadow-delete を経由する 证据：`docs/adr/0011-rebuild-shadow-delete-reconcile.md`
- **ADR 0012: Forward-compat via extras side-channel for unknown Observation fields**（documentation）：ADR 0012: Forward-compat via extras side-channel for unknown Observation fields 证据：`docs/adr/0012-forward-compat-extras-side-channel.md`
- **ADR 0013: "Tier 1" を公開アーキテクチャから外し、demo mode に格下げ**（documentation）：ADR 0013: "Tier 1" を公開アーキテクチャから外し、demo mode に格下げ 证据：`docs/adr/0013-drop-tier-1-from-public-architecture.md`
- **ADR 0014: mesh の mutual TLS を CSR ベースの private CA で提供する**（documentation）：ADR 0014: mesh の mutual TLS を CSR ベースの private CA で提供する 证据：`docs/adr/0014-mtls-via-csr-private-ca.md`
- **ADR 0015: 証明書 enrollment はコピペをデフォルトにし、SSH 自動化はオプトインにする**（documentation）：ADR 0015: 証明書 enrollment はコピペをデフォルトにし、SSH 自動化はオプトインにする 证据：`docs/adr/0015-cert-enrollment-copy-paste-default.md`
- **ADR 0016: init --mode localhost を廃止し、 local / mesh start に集約**（documentation）：ADR 0016: init --mode localhost を廃止し、 local / mesh start に集約 证据：`docs/adr/0016-remove-localhost-init-mode.md`
- **ADR-0017: hub 冗長化 — connect.endpoints に 2 hub を併記する**（documentation）：ADR-0017: hub 冗長化 — connect.endpoints に 2 hub を併記する 证据：`docs/adr/0017-dual-hub-spoke-topology.md`
- **ADR-0018: save observation 取り逃し対策は「言語非依存 instructions + session-scoped nudge」で server 側に寄せる**（documentation）：ADR-0018: save observation 取り逃し対策は「言語非依存 instructions + session-scoped nudge」で server 側に寄せる 证据：`docs/adr/0018-save-recall-language-agnostic-instructions-and-session-nudge.md`
- **ADR-0019: Observation visibility tier による selective replication**（documentation）：ADR-0019: Observation visibility tier による selective replication 证据：`docs/adr/0019-visibility-tiered-replication.md`
- **ADR-0020: skills-mesh — 同一 mesh 上の別 namespace で skill を共有する**（documentation）：ADR-0020: skills-mesh — 同一 mesh 上の別 namespace で skill を共有する 证据：`docs/adr/0020-skills-mesh-namespace.md`
- **ADR-0021: 検索品質 — FTS5 trigram 導入と supersedes-aware search**（documentation）：ADR-0021: 検索品質 — FTS5 trigram 導入と supersedes-aware search 证据：`docs/adr/0021-fts5-trigram-and-supersedes-aware-search.md`
- **ADR 0022: Zenoh 上にエージェント間メッセージング（フロー）レイヤーを新設する**（documentation）：ADR 0022: Zenoh 上にエージェント間メッセージング（フロー）レイヤーを新設する 证据：`docs/adr/0022-zenoh-agent-messaging-flow-layer.md`
- **ADR 0023: messaging は別リポジトリに分けず、単一リポジトリ内で core / memory / messaging に層化する**（documentation）：ADR 0023: messaging は別リポジトリに分けず、単一リポジトリ内で core / memory / messaging に層化する 证据：`docs/adr/0023-single-repo-core-memory-messaging-layering.md`
- **ADR 0024: Python パッケージを mesh mem から kioku mesh にリネームする**（documentation）：ADR 0024: Python パッケージを mesh mem から kioku mesh にリネームする 证据：`docs/adr/0024-rename-package-mesh-mem-to-kioku-mesh.md`
- **Messaging MVP Design — Issue 185**（documentation）：Date: 2026-06-24 Author: W4 / Codex 证据：`docs/design/0185-messaging-mvp-design.md`
- **Proactive Save の遵守率を測る — opportunity coverage 設計 105**（documentation）：Proactive Save の遵守率を測る — opportunity coverage 設計 105 证据：`docs/design/issue-105-proactive-save-opportunity-coverage.md`
- **Local Backend Design — Issue 109**（documentation）：Historical design note: command/package/path names in the original sketch may use mesh-mem . The implemented current behavior is documented in docs/Spec.md ../Spec.md : kioku-mesh init --mode local writes ~/.config/kioku-mesh/config.yaml with legacy mesh-mem fallback and stores local-only data under state dir /local/index.db . 证据：`docs/design/issue-109-local-backend.md`
- **Tier 1 Fix-Forward Design Notes 112 post-merge**（documentation）：Tier 1 Fix-Forward Design Notes 112 post-merge 证据：`docs/design/issue-112-tier1-fix-mesh-integration.md`
- **mesh-mem: マルチエージェント分散メモリ PoC設計書**（documentation）：ドキュメント状態 : 本書は 2026-04-23 に書き起こした as-designed な設計書を、 2026-04-27 時点の実装・運用・PoC 検証結果に突き合わせて as-built に同期した版である。 設計意図（PoC 制約、識別子設計、key expression、tombstone モデル等）はそのまま残し、 実装が確定した部分は「 実装ステータス 」ブロックで現状を併記している。 実機検証結果は末尾の 実機検証結果サマリ と 既知制約 / Open issues を参照。 证据：`docs/design/poc-plan.md`
- **PoC Reports — Summary**（documentation）：短い検証ノートを下に追記していく。詳細YAMLは raw/ 配下に置く想定（必要時に追加）。 证据：`docs/poc-reports/SUMMARY.md`
- **Topology PoC: hub-and-spoke transit verification 2026-05-10**（documentation）：Topology PoC: hub-and-spoke transit verification 2026-05-10 证据：`docs/poc-reports/topology-2026-05-10.md`
- **Init**（source_file）：version = version 'kioku-mesh' ⋮---- version = '0.0.0+unknown' all = ' version ' 证据：`src/mesh_mem/__init__.py`
- **The pre- 66 hard cap is gone; surface the same "large set"**（source_file）：argcomplete = None ⋮---- SEARCH FORMATS = 'text', 'markdown', 'json' def parse csv value: str - list str def parse iso or none value: str - datetime None ⋮---- dt = datetime.fromisoformat value.replace 'Z', '+00:00' ⋮---- dt = dt.replace tzinfo=timezone.utc ⋮---- def delete has bulk selector args: argparse.Namespace - bool def positive int value: str - int ⋮---- parsed = int value ⋮---- def iter delete targets args: argparse.Namespace, , batch size: int - Iterator Observation ⋮---- page size = max 1, min batch size, MAX SEARCH until cursor = args.until or '' cursor obs id = '' ⋮---- page = get backend .search observations ⋮---- last = page -1 until cursor = last.created at cursor obs id = l… 证据：`src/mesh_mem/__main__.py`
- **Config**（source_file）：yaml = None def config dir - Path ⋮---- base = os.environ.get 'XDG CONFIG HOME' or str Path.home / '.config' ⋮---- def config path - Path PROJECT CONFIG NAME = '.kioku-mesh.yaml' def find project config start: Path None = None - Path None ⋮---- cur = start or Path.cwd .resolve ⋮---- candidate = directory / PROJECT CONFIG NAME ⋮---- def read project config - dict ⋮---- path = find project config ⋮---- def read yaml path: Path - dict ⋮---- out: dict = {} ⋮---- line = line.strip ⋮---- data = yaml.safe load path.read text encoding='utf-8' ⋮---- def get user id - str ⋮---- env = os.environ.get 'MESH MEM USER ID', '' .strip ⋮---- cfg = read yaml config path ⋮---- def get team id - str ⋮---- """Re… 证据：`src/mesh_mem/core/config.py`
- **Keyspace**（source_file）：OBS MARKER = 'obs' TOMB MARKER = 'tomb' OBS READ KEY EXPR = 'mem/ /obs/ ' TOMB READ KEY EXPR = 'mem/ /tomb/ ' SCOPED TIERS = 'user', 'team' UNSCOPED TIERS = 'mesh', IDENTITY SEGMENTS = 4 VALID VISIBILITIES: frozenset str = frozenset {'', 'mesh', 'user', 'team'} SCOPE SLUG RE = re.compile r'^ A-Za-z0-9 A-Za-z0-9. - {0,63}$' def validate scope slug visibility: str, scope id: str - None ⋮---- """Reject scope ids that would break the key structure. The scope id becomes one Zenoh key chunk, so it must be a plain slug: 1-64 chars of A-Za-z0-9. - starting alphanumeric. Validated both at config resolution time so a bad MESH MEM USER ID fails the save with an actionable message instead of crashing i… 证据：`src/mesh_mem/core/keyspace.py`
- **ADR-0019 Phase B: replication scope. '' = legacy layout mem/obs/... .**（source_file）：log = logging.getLogger name def utc now iso - str def from dict compat cls: type, data: dict str, Any - Any ⋮---- known field names = {f.name for f in fields cls } known data = {k: v for k, v in data.items if k in known field names} extras = {k: v for k, v in data.items if k not in known field names} inst = cls known data ⋮---- VALID MEMORY TYPES: frozenset str = frozenset {'note', 'decision', 'bug', 'pattern', 'config', 'summary'} ⋮---- @dataclass class Observation ⋮---- content: str agent family: str = field default factory=get agent family client id: str = field default factory=get client id pc id: str = field default factory=get pc id session id: str = field default factory=get session… 证据：`src/mesh_mem/core/models.py`
- **Tls**（source_file）：DEFAULT CA DAYS = 3650 DEFAULT CERT DAYS = 825 CURVE = ec.SECP256R1 def tls dir - Path ⋮---- base = os.environ.get 'XDG CONFIG HOME' or str Path.home / '.config' ⋮---- def ca cert path - Path def ca key path - Path def peer key path - Path def peer csr path - Path def peer cert path - Path def utcnow - datetime def write secret path: Path, data: bytes - None ⋮---- fd = os.open str path , os.O WRONLY os.O CREAT os.O TRUNC, 0o600 ⋮---- def write public path: Path, data: bytes - None def build san values: list str - x509.SubjectAlternativeName ⋮---- names: list x509.GeneralName = ⋮---- v = raw.strip ⋮---- def create ca common name: str = 'kioku-mesh-ca', days: int = DEFAULT CA DAYS - tuple byt… 证据：`src/mesh_mem/core/tls.py`
- **97 .**（source_file）：class MCPClient str, Enum ⋮---- CLAUDE CODE = 'claude-code' CODEX CLI = 'codex-cli' DEFAULT FAMILY: dict MCPClient, str = { DEFAULT CLIENT ID: dict MCPClient, str = { DEFAULT REGISTRY NAME = 'kioku mesh' DEFAULT ZENOH CONNECT = 'tcp/127.0.0.1:7447' ⋮---- @dataclass frozen=True class InstallPlan ⋮---- client: MCPClient name: str command: str env: dict str, str = field default factory=dict VALID REGISTRY NAME RE = re.compile r'^ A-Za-z0-9 - +$' def validate registry name name: str - None ⋮---- """Reject registry keys that wouldn't survive both TOML and Claude CLI safely. Surfaces the rejection as ValueError so the CLI layer maps it to a documented exit code rather than mcp servers.foo.bar sil… 证据：`src/mesh_mem/mcp_install.py`
- **Check if it was already tombstoned has deleted at in payload is not reliable;**（source_file）：log = logging.getLogger name backend cache: 'MemoryBackend None' = None ⋮---- @dataclasses.dataclass frozen=True class BackendStatus ⋮---- mode: str live: int = 0 tombstoned: int = 0 shadowed: int = 0 zenoh session: str = 'n/a' last put at iso: str = '' last put status: str = 'n/a' pending puts: int = 0 ⋮---- @runtime checkable class MemoryBackend Protocol ⋮---- def put observation self, obs: Observation - None: ... def put tombstone self, obs: Observation, reason: str = '' - None: ... ⋮---- def find observation by id self, observation id: str - Observation None: ... def physical delete observation self, observation id: str - tuple bool, bool : ... def get status self - BackendStatus: ... d… 证据：`src/mesh_mem/memory/backend.py`
- **Strict-tuple cursor for bulk-delete pagination 66 : exclude**（source_file）：log = logging.getLogger name SCHEMA VERSION = 2 CHECKPOINT EVERY N UPSERTS = 256 ⋮---- @dataclasses.dataclass class RebuildStats ⋮---- added: int = 0 marked deleted: int = 0 shadowed: int = 0 unchanged: int = 0 ⋮---- @dataclasses.dataclass frozen=True class VisibilityCounts ⋮---- live: int = 0 tombstoned: int = 0 ⋮---- SCHEMA SQL = """ UPSERT SQL = MARK DELETED SQL = 'UPDATE obs index SET deleted at = ?, shadowed at = NULL WHERE observation id = ?' MARK SHADOWED SQL = def disabled via env - bool def shadow now iso - str def resolve db path - str ⋮---- override = os.environ.get 'MESH MEM INDEX DB', '' .strip ⋮---- def open connection path: str - sqlite3.Connection ⋮---- parent = Path path .p… 证据：`src/mesh_mem/memory/local_index.py`
- **Pending Queue**（source_file）：log = logging.getLogger name PENDING PUTS LIMIT = 1000 PENDING DRAIN BATCH = 10 PENDING DRAIN JOIN TIMEOUT = 0.2 pending drain lock = threading.Lock drain state lock = threading.Lock pending drain thread: threading.Thread None = None pending drain stop event: threading.Event None = None def store - ModuleType def pending puts db path - str def open pending puts db - sqlite3.Connection ⋮---- conn = sqlite3.connect pending puts db path , timeout=5.0 ⋮---- def trim pending puts locked conn: sqlite3.Connection - None ⋮---- row count = conn.execute 'SELECT COUNT FROM pending puts' .fetchone 0 overflow = row count - PENDING PUTS LIMIT ⋮---- def enqueue pending put kind: str, key expr: str, observ… 证据：`src/mesh_mem/memory/pending_queue.py`
- **Rolling-upgrade safety net: tomb/obs replicas may sit under other**（source_file）：log = logging.getLogger name def store - ModuleType ⋮---- @with retry def delete key key expr: str - None def broadcast delete best effort key expr: str - bool ⋮---- @with retry def list tombstones - list tuple str, Tombstone ⋮---- session = store .get session out: list tuple str, Tombstone = ⋮---- key = str ok.key expr ⋮---- tomb = Tombstone.from json ok.payload.to string ⋮---- def delete all keys for id observation id: str - tuple int, int ⋮---- obs deleted = 0 tomb deleted = 0 ⋮---- keys: list str = ⋮---- def physical delete observation observation id: str - tuple bool, bool ⋮---- store = store ⋮---- obs removed = obs deleted 0 ⋮---- @dataclass class BulkPurgeResult ⋮---- matches: list t… 证据：`src/mesh_mem/memory/purge.py`
- **Replication**（source_file）：log = logging.getLogger name rebuild on init default: bool = True rebuild explicit override: bool None = None def store - ModuleType def set rebuild on init default rebuild: bool - None ⋮---- rebuild on init default = rebuild def set rebuild on init explicit rebuild: bool None - None ⋮---- rebuild explicit override = rebuild def reset rebuild policy - None ⋮---- rebuild on init default = True rebuild explicit override = None def should rebuild on init - bool def empty index rebuild allowed - bool obs id from key = obs id from key def start index subscriber session: zenoh.Session - list ⋮---- idx = store .get index ⋮---- def on obs sample: Any - None ⋮---- obs id = obs id from key str sample… 证据：`src/mesh_mem/memory/replication.py`
- **ADR-0019 Phase A: selectors cover legacy + tiered namespaces.**（source_file）：log = logging.getLogger name MAX SEARCH = 10 000 index: LocalIndex None = None subscribers: list None = None def get index - LocalIndex ⋮---- index = LocalIndex.connect ⋮---- session = get session rebuild = should rebuild on init ⋮---- counts = index.visibility counts ⋮---- rebuild = True ⋮---- stats = index.rebuild from zenoh session ⋮---- subscribers = start index subscriber session ⋮---- def reset subscribers - None ⋮---- subscribers = None def reset index - None ⋮---- index = None ⋮---- def parse iso s: str - datetime None ⋮---- s = s :-1 + '+00:00' ⋮---- dt = datetime.fromisoformat s ⋮---- dt = dt.replace tzinfo=timezone.utc ⋮---- @with retry def put observation obs: Observation - None… 证据：`src/mesh_mem/memory/store.py`
- **Init**（source_file）：all = 证据：`src/mesh_mem/messaging/__init__.py`
- **Keyspace**（source_file）：def mesh broadcast key msg id: str - str def team key team id: str, msg id: str - str ⋮---- """Key for a team-scoped message body.""" ⋮---- def user key user id: str, msg id: str - str ⋮---- """Key for a user-scoped message body.""" ⋮---- def session inbox key scope: str, recipient session id: str, msg id: str - str ⋮---- """Key for a session-targeted direct inbox entry. Follows the design memo pattern: msg/{scope}/inbox/session/{recipient session id}/{msg id} so Phase 2 can use the selector msg/ /inbox/session/{current session id}/ to receive. """ ⋮---- def agent inbox key scope: str, recipient agent id: str, msg id: str - str ⋮---- """Key for an agent-targeted direct inbox entry. Follows… 证据：`src/mesh_mem/messaging/keyspace.py`
- **Local Index**（source_file）：def iso dt: datetime - str ⋮---- dt = dt.replace tzinfo=timezone.utc ⋮---- DDL = """ class LocalMessageIndex ⋮---- def init self, db path: str Path - None ⋮---- @contextmanager def connect self - Generator sqlite3.Connection, None, None ⋮---- conn = sqlite3.connect self. db path ⋮---- def register self, msg: Message, recipient session id: str - bool def record ack self, ack: Ack - None ⋮---- row = conn.execute ⋮---- def is acked self, msg id: str, recipient session id: str - bool ⋮---- """Return True if this msg id, session pair has been acked.""" ⋮---- def list unacked self, recipient session id: str, scope: str None = None - list str ⋮---- """Return msg ids of unacked messages for a recip… 证据：`src/mesh_mem/messaging/local_index.py`
- **Models**（source_file）：def utc now - datetime def iso dt: datetime - str ⋮---- dt = dt.replace tzinfo=timezone.utc ⋮---- def parse dt value: str datetime None - datetime None ⋮---- s = value.rstrip 'Z' dt = datetime.fromisoformat s ⋮---- @dataclass class Message ⋮---- sender id: str scope: str payload: dict str, Any msg id: str = field default factory=lambda: uuid.uuid4 .hex created at: datetime = field default factory= utc now expires at: datetime None = None ttl sec: int None = None sender seq: int None = None schema version: str = '1.0' kind: str = 'direct' sender: dict str, Any = field default factory=dict recipient: dict str, Any = field default factory=dict body: dict str, Any str = field default factory=di… 证据：`src/mesh_mem/messaging/models.py`
- 其余 7 条证据见 `AI_CONTEXT_PACK.json` 或 `EVIDENCE_INDEX.json`。

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

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

- **Overview and System Architecture**：importance `high`
  - source_paths: README.md, src/mesh_mem/__init__.py, src/mesh_mem/__main__.py, src/mesh_mem/core/__init__.py, src/mesh_mem/memory/__init__.py
- **Memory Store: Storage, Replication, and Visibility Tiers**：importance `high`
  - source_paths: src/mesh_mem/memory/store.py, src/mesh_mem/memory/backend.py, src/mesh_mem/memory/local_index.py, src/mesh_mem/memory/replication.py, src/mesh_mem/memory/pending_queue.py
- **Security, Identity, and Configuration**：importance `high`
  - source_paths: src/mesh_mem/core/identity.py, src/mesh_mem/core/config.py, src/mesh_mem/core/paths.py, src/mesh_mem/core/tls.py, src/mesh_mem/tls.py
- **MCP Integration, CLI, Messaging, and Operations**：importance `high`
  - source_paths: src/mesh_mem/__main__.py, src/mesh_mem/mcp_server.py, src/mesh_mem/mcp_install.py, src/mesh_mem/doctor.py, src/mesh_mem/backend.py

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

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `a9327ee4673d4e6572f539e3764f42c17d6a804a`
- inspected_files: `README.md`, `pyproject.toml`, `docs/Spec.md`, `docs/adr/0001-zenoh-rocksdb-transport.md`, `docs/adr/0002-existence-based-tombstone.md`, `docs/adr/0003-python-side-filter-before-fts5.md`, `docs/adr/0004-identity-env-and-persistent-file.md`, `docs/adr/0005-gc-project-agnostic-scope.md`, `docs/adr/0006-hub-and-spoke-mesh-topology.md`, `docs/adr/0007-sqlite-local-index-sidecar.md`, `docs/adr/0008-gc-project-aware-and-o-n.md`, `docs/adr/0009-mcp-server-instructions-protocol.md`, `docs/adr/0010-zenoh-as-source-of-truth.md`, `docs/adr/0011-rebuild-shadow-delete-reconcile.md`, `docs/adr/0012-forward-compat-extras-side-channel.md`, `docs/adr/0013-drop-tier-1-from-public-architecture.md`, `docs/adr/0014-mtls-via-csr-private-ca.md`, `docs/adr/0015-cert-enrollment-copy-paste-default.md`, `docs/adr/0016-remove-localhost-init-mode.md`, `docs/adr/0017-dual-hub-spoke-topology.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: 失败模式：installation: mesh-mem v0.2.4

- Trigger: Developers should check this installation risk before relying on the project: mesh-mem v0.2.4
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: mesh-mem v0.2.4. Context: Observed when using python, windows
- Why it matters: Upgrade or migration may change expected behavior: mesh-mem v0.2.4
- Evidence: failure_mode_cluster:github_release | https://github.com/h-wata/kioku-mesh/releases/tag/v0.2.4 | mesh-mem v0.2.4
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 2: 失败模式：installation: mesh-mem v0.2.5

- Trigger: Developers should check this installation risk before relying on the project: mesh-mem v0.2.5
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: mesh-mem v0.2.5. Context: Observed when using python
- Why it matters: Upgrade or migration may change expected behavior: mesh-mem v0.2.5
- Evidence: failure_mode_cluster:github_release | https://github.com/h-wata/kioku-mesh/releases/tag/v0.2.5 | mesh-mem v0.2.5
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 3: 失败模式：installation: mesh-mem v0.3.0

- Trigger: Developers should check this installation risk before relying on the project: mesh-mem v0.3.0
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: mesh-mem v0.3.0. Context: Observed when using python, macos, linux
- Why it matters: Upgrade or migration may change expected behavior: mesh-mem v0.3.0
- Evidence: failure_mode_cluster:github_release | https://github.com/h-wata/kioku-mesh/releases/tag/v0.3.0 | mesh-mem v0.3.0
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 4: 失败模式：installation: v0.3.1

- Trigger: Developers should check this installation risk before relying on the project: v0.3.1
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: v0.3.1. Context: Observed when using python
- Why it matters: Upgrade or migration may change expected behavior: v0.3.1
- Evidence: failure_mode_cluster:github_release | https://github.com/h-wata/kioku-mesh/releases/tag/v0.3.1 | v0.3.1
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 5: 失败模式：installation: v0.3.2

- Trigger: Developers should check this installation risk before relying on the project: v0.3.2
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: v0.3.2. Context: Observed when using python
- Why it matters: Upgrade or migration may change expected behavior: v0.3.2
- Evidence: failure_mode_cluster:github_release | https://github.com/h-wata/kioku-mesh/releases/tag/v0.3.2 | v0.3.2
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 6: 失败模式：installation: v0.3.3

- Trigger: Developers should check this installation risk before relying on the project: v0.3.3
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: v0.3.3. Context: Observed during installation or first-run setup.
- Why it matters: Upgrade or migration may change expected behavior: v0.3.3
- Evidence: failure_mode_cluster:github_release | https://github.com/h-wata/kioku-mesh/releases/tag/v0.3.3 | v0.3.3
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 7: 失败模式：installation: v0.4.0 — Mutual TLS for the mesh

- Trigger: Developers should check this installation risk before relying on the project: v0.4.0 — Mutual TLS for the mesh
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: v0.4.0 — Mutual TLS for the mesh. Context: Observed when using python
- Why it matters: Upgrade or migration may change expected behavior: v0.4.0 — Mutual TLS for the mesh
- Evidence: failure_mode_cluster:github_release | https://github.com/h-wata/kioku-mesh/releases/tag/v0.4.0 | v0.4.0 — Mutual TLS for the mesh
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 8: 来源证据：refactor: split store.py monolith before ADR-0019 visibility work

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：refactor: split store.py monolith before ADR-0019 visibility work
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/h-wata/kioku-mesh/issues/167 | 来源类型 github_issue 暴露的待验证使用条件。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

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

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

### Constraint 10: 失败模式：configuration: design: hard authorization — mTLS cert subject ↔ Zenoh ACL for team/user scope (#185 follow-up)

- Trigger: Developers should check this configuration risk before relying on the project: design: hard authorization — mTLS cert subject ↔ Zenoh ACL for team/user scope (#185 follow-up)
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: design: hard authorization — mTLS cert subject ↔ Zenoh ACL for team/user scope (#185 follow-up). Context: Source discussion did not expose a precise runtime context.
- Why it matters: Developers may misconfigure credentials, environment, or host setup: design: hard authorization — mTLS cert subject ↔ Zenoh ACL for team/user scope (#185 follow-up)
- Evidence: failure_mode_cluster:github_issue | https://github.com/h-wata/kioku-mesh/issues/191 | design: hard authorization — mTLS cert subject ↔ Zenoh ACL for team/user scope (#185 follow-up)
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。
