# localharness - Doramagic AI Context Pack

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

## 充分原则

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

## 给宿主 AI 的使用方式

你正在读取 Doramagic 为 localharness 编译的 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

## 怎么开始

- `git clone https://github.com/ahwurm/localharness.git` 证据：`README.md` Claim：`clm_0003` supported 0.86

## 继续前判断卡

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

### 30 秒判断

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

### 现在可以相信

- **适合人群线索：正在使用 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 的默认行为。
- **可安全回滚不能默认相信。**（unverified）：除非项目明确提供卸载和恢复说明，否则必须先在隔离环境验证。
- **真实安装后是否与用户当前宿主 AI 版本兼容？**（unverified）：兼容性只能通过实际宿主环境验证。
- **项目输出质量是否满足用户具体任务？**（unverified）：安装前预览只能展示流程和边界，不能替代真实评测。

### 继续会触碰什么

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

### 最小安全下一步

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

### 退出方式

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

## 哪些只能预览

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

## 哪些必须安装后验证

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

## 边界与风险判断卡

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

### 上下文规模

- 文件总数：202
- 重要文件覆盖：40/202
- 证据索引条目：71
- 角色 / Skill 条目：25

### 证据不足时的处理

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

## Prompt Recipes

### 适配判断

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

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

### 安装前体验

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

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

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

## 角色 / Skill 索引

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

- **Reference Architectures**（project_doc）：LocalHarness is developed and tested against two concrete hardware targets. Every harness default should work out of the box on both; per-hardware setup and tuning notes are in gaps.md gaps.md . 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/reference-architectures/README.md`
- **LocalHarness**（project_doc）：! GitHub stars https://img.shields.io/github/stars/ahwurm/localharness?style=social https://github.com/ahwurm/localharness/stargazers ! License: MIT https://img.shields.io/badge/License-MIT-blue.svg LICENSE 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`README.md`
- **Examples**（project_doc）：Runnable, validated examples of LocalHarness configuration. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`examples/README.md`
- **Contributing**（project_doc）：Thanks for considering a contribution to LocalHarness. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`CONTRIBUTING.md`
- **Running agents locally: where LocalHarness fits**（project_doc）：Running agents locally: where LocalHarness fits 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/running-agents-locally.md`
- **Reference Architecture A — NVIDIA DGX Spark**（project_doc）：Reference Architecture A — NVIDIA DGX Spark 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/reference-architectures/dgx-spark.md`
- **Setup & Tuning Notes — Reference Architectures**（project_doc）：Setup & Tuning Notes — Reference Architectures 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/reference-architectures/gaps.md`
- **Reference Architecture B — Base Mac mini**（project_doc）：Reference Architecture B — Base Mac mini 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/reference-architectures/mac-mini.md`
- **Spec 00: Architecture Overview**（project_doc）：Project: LocalHarness Version: v1 Status: Authoritative — implement against this document Last updated: 2026-05-23 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/specs/00-architecture-overview.md`
- **Spec 01: Event Bus**（project_doc）：Project: LocalHarness Component: core/events.py , core/bus.py , core/types.py Layer: 1 Foundation Status: Authoritative — implement against this document Last updated: 2026-05-23 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/specs/01-event-bus.md`
- **Spec 02: LLM Provider Layer**（project_doc）：Component: src/localharness/provider/ Requirements: PROV-01, PROV-02, PROV-03, PROV-04, SETUP-01, SETUP-02, SETUP-03 Dependencies: core/types.py , config/models.py 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/specs/02-provider.md`
- **Spec 03: Agent Loop**（project_doc）：Component: src/localharness/agent/loop.py Requirements: LOOP-01, LOOP-02, LOOP-03, LOOP-04, LOOP-05 Dependencies: core/events.py , core/bus.py , core/types.py , config/models.py , provider/client.py , tools/registry.py , tools/hooks.py , agent/context.py , agent/permissions.py , memory/history.py 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/specs/03-agent-loop.md`
- **Spec 04: Tool System**（project_doc）：Component: src/localharness/tools/ Requirements covered: TOOL-01, TOOL-02, TOOL-03, TOOL-04 Dependencies: core/events.py , config/models.py Stability: UNSTABLE v1 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/specs/04-tool-system.md`
- **Spec 04b: MCP Integration**（project_doc）：Component: src/localharness/tools/mcp.py Requirements covered: TOOL-05 Dependencies: tools/registry.py spec 04 , config/models.py , core/events.py Library: mcp official Python SDK , Python 3.12+ Stability: UNSTABLE v1 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/specs/04b-mcp-integration.md`
- **Spec 05: Memory System**（project_doc）：Component: src/localharness/memory/ + cli/session accumulator.py Requirements: MEM-01..04, WRITE-01..06, RANK-01..05, HIER-02..04, CONS-01..06, COLL-01..04, PGATE-01..04, SESS-02..05, TIME-01..04 Status: v2 predictive — supersedes the v1 three-tier-scope spec 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/specs/05-memory.md`
- **Spec 06: Configuration System**（project_doc）：Project: LocalHarness Component: config/models.py , config/loader.py , config/defaults.py Layer: 1 models + 2 loader Status: Authoritative — implement against this document Last updated: 2026-05-23 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/specs/06-config.md`
- **Spec 07: Orchestrator**（project_doc）：Component: src/localharness/orchestrator/ Requirements: ORCH-01, ORCH-02, ORCH-03, ORCH-04 Status: v1 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/specs/07-orchestrator.md`
- **Spec 08: Context Management**（project_doc）：Component: src/localharness/agent/context.py Requirements: CTX-01, CTX-02, CTX-03, LOOP-02 Dependencies: core/types.py , config/models.py , provider/client.py 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/specs/08-context-management.md`
- **Spec 09: Hooks and Plugins**（project_doc）：Component: src/localharness/tools/hooks.py , src/localharness/plugins/ Requirements covered: HOOK-01, HOOK-02, HOOK-03 Dependencies: tools/registry.py spec 04 , core/events.py Library: pluggy 1.6.0, importlib.metadata stdlib Stability: UNSTABLE v1 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/specs/09-hooks-plugins.md`
- **Spec 10: CLI**（project_doc）：Component: src/localharness/cli/ Requirements: CLI-01, CLI-02, CLI-03, CLI-04, CLI-05, CLI-06, SETUP-01, SETUP-02, SETUP-03, SETUP-04, CHAN-01, CHAN-02 Status: v1 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/specs/10-cli.md`
- **Spec 11: Channel System**（project_doc）：Component: src/localharness/channels/ Requirements: CHAN-01, CHAN-02, CHAN-03 Status: v1 TerminalChannel only; Discord/Slack/webhook deferred to v2 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/specs/11-channels.md`
- **Spec 12: Audit & Observability**（project_doc）：Component: src/localharness/audit/ Requirements: v1 structlog JSONL , v2 hash-chained audit, GUARDRAILS.md Status: v1 core + v2 design spec 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/specs/12-audit.md`
- **Changelog**（project_doc）：All notable changes to LocalHarness are documented here. The format follows Keep a Changelog https://keepachangelog.com/ , and the project adheres to Semantic Versioning https://semver.org/ pre-1.0: interfaces may change . 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`CHANGELOG.md`
- **Code of Conduct**（project_doc）：LocalHarness adopts the Contributor Covenant https://www.contributor-covenant.org , version 2.1, as its Code of Conduct. The full text is published at . 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`CODE_OF_CONDUCT.md`
- **Security Policy**（project_doc）：LocalHarness is early-stage v0.x . Security fixes land on the latest main ; there are no long-term-support branches yet. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`SECURITY.md`

## 证据索引

- 共索引 71 条证据。

- **Reference Architectures**（documentation）：LocalHarness is developed and tested against two concrete hardware targets. Every harness default should work out of the box on both; per-hardware setup and tuning notes are in gaps.md gaps.md . 证据：`docs/reference-architectures/README.md`
- **LocalHarness**（documentation）：! GitHub stars https://img.shields.io/github/stars/ahwurm/localharness?style=social https://github.com/ahwurm/localharness/stargazers ! License: MIT https://img.shields.io/badge/License-MIT-blue.svg LICENSE 证据：`README.md`
- **Examples**（documentation）：Runnable, validated examples of LocalHarness configuration. 证据：`examples/README.md`
- **Contributing**（documentation）：Thanks for considering a contribution to LocalHarness. 证据：`CONTRIBUTING.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`
- **Running agents locally: where LocalHarness fits**（documentation）：Running agents locally: where LocalHarness fits 证据：`docs/running-agents-locally.md`
- **Reference Architecture A — NVIDIA DGX Spark**（documentation）：Reference Architecture A — NVIDIA DGX Spark 证据：`docs/reference-architectures/dgx-spark.md`
- **Setup & Tuning Notes — Reference Architectures**（documentation）：Setup & Tuning Notes — Reference Architectures 证据：`docs/reference-architectures/gaps.md`
- **Reference Architecture B — Base Mac mini**（documentation）：Reference Architecture B — Base Mac mini 证据：`docs/reference-architectures/mac-mini.md`
- **Spec 00: Architecture Overview**（documentation）：Project: LocalHarness Version: v1 Status: Authoritative — implement against this document Last updated: 2026-05-23 证据：`docs/specs/00-architecture-overview.md`
- **Spec 01: Event Bus**（documentation）：Project: LocalHarness Component: core/events.py , core/bus.py , core/types.py Layer: 1 Foundation Status: Authoritative — implement against this document Last updated: 2026-05-23 证据：`docs/specs/01-event-bus.md`
- **Spec 02: LLM Provider Layer**（documentation）：Component: src/localharness/provider/ Requirements: PROV-01, PROV-02, PROV-03, PROV-04, SETUP-01, SETUP-02, SETUP-03 Dependencies: core/types.py , config/models.py 证据：`docs/specs/02-provider.md`
- **Spec 03: Agent Loop**（documentation）：Component: src/localharness/agent/loop.py Requirements: LOOP-01, LOOP-02, LOOP-03, LOOP-04, LOOP-05 Dependencies: core/events.py , core/bus.py , core/types.py , config/models.py , provider/client.py , tools/registry.py , tools/hooks.py , agent/context.py , agent/permissions.py , memory/history.py 证据：`docs/specs/03-agent-loop.md`
- **Spec 04: Tool System**（documentation）：Component: src/localharness/tools/ Requirements covered: TOOL-01, TOOL-02, TOOL-03, TOOL-04 Dependencies: core/events.py , config/models.py Stability: UNSTABLE v1 证据：`docs/specs/04-tool-system.md`
- **Spec 04b: MCP Integration**（documentation）：Component: src/localharness/tools/mcp.py Requirements covered: TOOL-05 Dependencies: tools/registry.py spec 04 , config/models.py , core/events.py Library: mcp official Python SDK , Python 3.12+ Stability: UNSTABLE v1 证据：`docs/specs/04b-mcp-integration.md`
- **Spec 05: Memory System**（documentation）：Component: src/localharness/memory/ + cli/session accumulator.py Requirements: MEM-01..04, WRITE-01..06, RANK-01..05, HIER-02..04, CONS-01..06, COLL-01..04, PGATE-01..04, SESS-02..05, TIME-01..04 Status: v2 predictive — supersedes the v1 three-tier-scope spec 证据：`docs/specs/05-memory.md`
- **Spec 06: Configuration System**（documentation）：Project: LocalHarness Component: config/models.py , config/loader.py , config/defaults.py Layer: 1 models + 2 loader Status: Authoritative — implement against this document Last updated: 2026-05-23 证据：`docs/specs/06-config.md`
- **Spec 07: Orchestrator**（documentation）：Component: src/localharness/orchestrator/ Requirements: ORCH-01, ORCH-02, ORCH-03, ORCH-04 Status: v1 证据：`docs/specs/07-orchestrator.md`
- **Spec 08: Context Management**（documentation）：Component: src/localharness/agent/context.py Requirements: CTX-01, CTX-02, CTX-03, LOOP-02 Dependencies: core/types.py , config/models.py , provider/client.py 证据：`docs/specs/08-context-management.md`
- **Spec 09: Hooks and Plugins**（documentation）：Component: src/localharness/tools/hooks.py , src/localharness/plugins/ Requirements covered: HOOK-01, HOOK-02, HOOK-03 Dependencies: tools/registry.py spec 04 , core/events.py Library: pluggy 1.6.0, importlib.metadata stdlib Stability: UNSTABLE v1 证据：`docs/specs/09-hooks-plugins.md`
- **Spec 10: CLI**（documentation）：Component: src/localharness/cli/ Requirements: CLI-01, CLI-02, CLI-03, CLI-04, CLI-05, CLI-06, SETUP-01, SETUP-02, SETUP-03, SETUP-04, CHAN-01, CHAN-02 Status: v1 证据：`docs/specs/10-cli.md`
- **Spec 11: Channel System**（documentation）：Component: src/localharness/channels/ Requirements: CHAN-01, CHAN-02, CHAN-03 Status: v1 TerminalChannel only; Discord/Slack/webhook deferred to v2 证据：`docs/specs/11-channels.md`
- **Spec 12: Audit & Observability**（documentation）：Component: src/localharness/audit/ Requirements: v1 structlog JSONL , v2 hash-chained audit, GUARDRAILS.md Status: v1 core + v2 design spec 证据：`docs/specs/12-audit.md`
- **Tag-graph discovery's embedding-proximity leg. OPTIONAL: without it, discovery uses the**（source_file）：project name = "localharness" version = "0.9.23" description = "Model-agnostic hierarchical agent harness for local LLMs" requires-python = " =3.12" license = { text = "MIT" } readme = "README.md" authors = { name = "ahwurm" } keywords = "llm", "agents", "local-llm", "agent-harness", "vllm", "ollama" classifiers = "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Scientific/Engineering :: Artificial Intelligence", dependencies =… 证据：`pyproject.toml`
- **Init**（source_file）：version = "0.9.23" ⋮---- def resolved version - str 证据：`src/localharness/__init__.py`
- **Init**（source_file）：all = 证据：`src/localharness/agent/__init__.py`
- **91: index into messages where THIS turn's assistant replies begin set right after the**（source_file）：log = logging.getLogger "localharness.agent.loop" ⋮---- @dataclass class Session ⋮---- agent id: str session id: str messages: list Message iteration: int = 0 actions taken: int = 0 start time: float = field default factory=time.monotonic tool call log: list dict str, Any = field default factory=list summary: str = "" terminated reason: str None = None parse retries: int = 0 input tokens: int = 0 output tokens: int = 0 tokens estimated: bool = False act nudge used: bool = False 91: index into messages where THIS turn's assistant replies begin set right after the turn's user task is pushed . The CONFIRMED-sentinel summary fallback searches ONLY messages turn start idx: , so it can never spli… 证据：`src/localharness/agent/loop.py`
- **Bare tool name pattern — any call to this tool is denied**（source_file）：@dataclass class PermissionResult ⋮---- denied: bool reason: str = "" ⋮---- class PermissionEvaluator ⋮---- """Evaluates tool calls against deny patterns from PermissionConfig.""" ⋮---- def evaluate self, tool call: ToolCall, permissions: object - PermissionResult ⋮---- """Return PermissionResult denied=True if any deny pattern matches. Pattern format: 'tool name' or 'tool name arg glob ' Matching: tool name must match exactly; if arg glob present, any string value in tool call.arguments must match via fnmatch. """ deny patterns: list str = getattr permissions, "deny patterns", ⋮---- match = re.match r"^ a-z a-z0-9 ?:\ .+ \ ?$", pattern ⋮---- Bare tool name pattern — any call to this tool i… 证据：`src/localharness/agent/permissions.py`
- **--- Cruncher J3 : faithful over-window reduce via harness-orchestrated map + model reduce -------**（source_file）：log = logging.getLogger "localharness.agent.subagent" ⋮---- EXPLORE TOOLS: list str = "read", "glob", "grep" ⋮---- EXPLORE MAX ACTIONS = 8 EXPLORE MAX TOOL CALLS = EXPLORE MAX ACTIONS + 1 EXPLORE MAX DURATION MINUTES = 3.0 ⋮---- MAX DEPTH = 1 ⋮---- NON LEAF AGENTS: dict str, list str = {"web-researcher": "search-verifier" } ⋮---- EXPLORE ROLE = ⋮---- WEB TOOLS: list str = "web search", "web fetch", "web page query" ⋮---- WEB MAX ACTIONS = 56 WEB MAX TOOL CALLS = WEB MAX ACTIONS + 1 WEB MAX DURATION MINUTES = 20.0 ⋮---- WEB RESEARCHER ROLE BASE = ⋮---- WEB RESEARCHER VERIFY ADDENDUM = ⋮---- WEB RESEARCHER VERIFY ON REQUEST ADDENDUM = ⋮---- WEB RESEARCHER ROLE = WEB RESEARCHER ROLE BASE ⋮----… 证据：`src/localharness/agent/subagent.py`
- **Init**（source_file）：all = "ArchiveStore", "ArchiveEntry", "ArchiveQuery" 证据：`src/localharness/autoresearch/__init__.py`
- **---------------------------------------------------------------------------**（source_file）：CIRCUIT BREAKER N = 4 ⋮---- DEFAULT MAX ITERATIONS = 1000 ⋮---- def interpret exit code: int, entry, min lift: float None - tuple str, str ⋮---- lift = entry.train score if entry is not None else None ⋮---- @dataclass class RunSummary ⋮---- """The terminal artifact of a run: counts + consumption + the journal path. halt reason is one of "budget" "circuit breaker" "interrupt" "complete". top wins is a list of archive id, component, train score for the run-complete report. """ ⋮---- run id: str iterations: int = 0 adopted: int = 0 held: int = 0 rejected: int = 0 skipped: int = 0 failures: int = 0 seconds elapsed: float = 0.0 tokens spent: int = 0 top wins: list = field default factory=list jo… 证据：`src/localharness/autoresearch/loop.py`
- **Orchestrator**（source_file）：log = logging.getLogger name ⋮---- def discover scenarios corpus path: Path - list Path ⋮---- def load scenarios from paths scenario paths: list Path - list ScenarioSpec ⋮---- out: list ScenarioSpec = ⋮---- def filter scenarios by name scenarios: list ScenarioSpec , name: str - list ScenarioSpec ⋮---- def filter scenarios by slice scenarios: list ScenarioSpec , slice : str - list ScenarioSpec ⋮---- DEFAULT BASE URLS: dict str, str = { ⋮---- def build bench client entry: MatrixEntry - Any ⋮---- base url = entry.base url or DEFAULT BASE URLS.get entry.provider ⋮---- cfg = LLMConfig ⋮---- def build llm client factory entry: MatrixEntry - Callable ScenarioSpec , Any ⋮---- def factory scen: Scen… 证据：`src/localharness/bench/orchestrator.py`
- **Init**（source_file）：all = 证据：`src/localharness/channels/__init__.py`
- **Input Router**（source_file）：log = logging.getLogger name ⋮---- CompleteFn = Callable list dict , Awaitable str ⋮---- class Route str, Enum ⋮---- NUDGE = "nudge" QUEUE = "queue" ⋮---- @dataclass frozen=True class Decision ⋮---- route: Route tier: str reason: str ⋮---- FORCE PREFIX = "!" ⋮---- def strip force text: str - tuple str, bool ⋮---- FILLERS = frozenset {"ok", "okay", "hey", "please", "um", "uh", "yeah", "so", "hmm", "well"} ⋮---- NUDGE INITIAL = frozenset { ⋮---- QUEUE INITIAL = frozenset { ⋮---- CORRECTION RE = re.compile ⋮---- NEG AUX = frozenset { ⋮---- def has correction low: str - bool ⋮---- words = re.findall r" \w'./- +", low ⋮---- QUEUE PHRASE RE = re.compile ⋮---- def content words low: str - list str… 证据：`src/localharness/channels/input_router.py`
- **App**（source_file）：app = typer.Typer ⋮---- def version callback value: bool - None ⋮---- def main - None 证据：`src/localharness/cli/app.py`
- **38: reached but the reply isn't a model list — its OWN message, not "Is it running?".**（source_file）：console = Console err console = Console stderr=True ⋮---- loader = ConfigLoader config dir=config dir ⋮---- harness = loader.load harness ⋮---- provider = harness.provider ⋮---- 38: reached but the reply isn't a model list — its OWN message, not "Is it running?". ⋮---- downloaded: list str = ⋮---- downloaded = m for m in managed server.list cached models if m not in live choices = live + downloaded current = provider.default model ⋮---- --- List --- ⋮---- mark = " active " if m == current else "" ⋮---- 50: a reachable server whose served/downloaded set omits the configured default otherwise shows NO active marker and no other signal — the moment of highest risk checking in on an unverified… 证据：`src/localharness/cli/model_cmd.py`
- **Model Ops**（source_file）：AGENT KEY = "agent" ⋮---- class MalformedModelListError Exception ⋮---- def list live models base url: str, timeout: float = 3.0 - tuple list str , bool ⋮---- resp = httpx.get f"{base url.rstrip '/' }/models", timeout=timeout ⋮---- def merged available models harness: Any, existing overlay: dict, model: str - list str ⋮---- """Union every known model name. The overlay's deep merge REPLACES lists wholesale config/overlay.py , so writing a bare model would DROP the rest — read-merge the in-memory harness list, the overlay's current list, and the new model, order-preserving.""" out: list str = overlay avail = existing overlay.get "provider" or {} .get "available models" or ⋮---- before provide… 证据：`src/localharness/cli/model_ops.py`
- **93: bounded grace on exit for an in-flight turn to reach its own finalization**（source_file）：log = logging.getLogger name ⋮---- HELP TEXT = help text ⋮---- CREATION TRIGGERS = "create an agent", "create agent", "make an agent", ⋮---- def literal values annotation: Any - list str ⋮---- args = typing.get args annotation ⋮---- def generation system prompt - str ⋮---- fields = AgentConfig.model fields required = ", ".join n for n, f in fields.items if f.is required allowed = ", ".join fields tool keys = ", ".join ToolConfig.model fields perm keys = ", ".join PermissionConfig.model fields ⋮---- mode values = ", ".join literal values PermissionConfig.model fields "mode" .annotation inherit values = ", ".join literal values ToolConfig.model fields "inherit" .annotation ⋮---- class Orchest… 证据：`src/localharness/cli/repl.py`
- **Init**（source_file）：all = 证据：`src/localharness/core/__init__.py`
- **Init**（source_file）：all = 证据：`src/localharness/memory/__init__.py`
- **Run-2 ruling 4 observability : EVERY chapter-writer attempt written or rejected, with**（source_file）：log = logging.getLogger name ⋮---- WATERMARK KEY = "consolidation/last run" DEMOTED RS = 0.15 PROMOTED CONFIDENCE = 0.8 CLASSIFY BACKFILL CAP = 10 MICRO CLASSIFY CAP = 5 MICRO NAME CAP = 2 ⋮---- @dataclass class ConsolidationReport ⋮---- folded: int = 0 promoted: int = 0 decayed: int = 0 demoted: int = 0 replayed claims: int = 0 schemas written: int = 0 ⋮---- chapters folded: int = 0 chapters superseded by containment: int = 0 ⋮---- chapters absorption refused: int = 0 ⋮---- chapters revalidated: int = 0 chapters redrafted stale: int = 0 chapters retired stale: int = 0 ⋮---- chapters skipped stale: int = 0 reconciled: int = 0 mined: int = 0 tags proposed: int = 0 tags incorporated: int = 0… 证据：`src/localharness/memory/consolidation.py`
- **Rename the candidate in place AND replace the "discovery candidate unincorporated "**（source_file）：log = logging.getLogger name ⋮---- NAME MARKER = "Name this group of related memories" ⋮---- EMBED SIM = 0.55 MIN FACTORS = 2 FLOOR MEMBERS = 2 FLOOR SITTINGS = 2 INCORPORATE SCORE = 3.0 DECAY HALF LIFE S = 14 86400 PRUNE REUSE FLOOR = 0.5 PRUNE AGE S = 21 86400 MATCH JACCARD = 0.5 NAME MEMBERS SHOWN = 8 ⋮---- TRACE FANOUT CAP = 10 ⋮---- @dataclass class DiscoveryReport ⋮---- proposed: list str = field default factory=list incorporated: list str = field default factory=list merged: list str = field default factory=list pruned: list str = field default factory=list ⋮---- def is sitting prov: str - bool ⋮---- def cosine u: list float , v: list float - float ⋮---- dot = sum a b for a, b in zip… 证据：`src/localharness/memory/discovery.py`
- **Hierarchy**（source_file）：log = logging.getLogger name ⋮---- GIST CONFIDENCE = 0.6 ⋮---- def h8 parts: str - str ⋮---- def flag unverified figures text: str, sources: list str - list str ⋮---- run = h8 question, session id or "", e :500 for e in leaf extracts :8 prov = f"session:{session id};handles:{','.join source handles :4 }" ⋮---- schema = await store.store fact written = 1 ⋮---- prev out ids: dict str, list int = {} ⋮---- this ids: dict str, list int = {} ⋮---- flags = flag unverified figures out, lvl.batches i tags = "gist", f"level:{lvl.level}" + "unverified-figures" if flags else ⋮---- gist = await store.store fact ⋮---- prev out ids = this ids ⋮---- flags = flag unverified figures final answer, leaf extrac… 证据：`src/localharness/memory/hierarchy.py`
- **STAGE 1 extraction science plan : coverage/residue — recall observability, no behavior**（source_file）：log = logging.getLogger name ⋮---- MINING WATERMARK KEY = "mining/last ts" PER RECORD CHARS = 400 KNOWN ATOMS CAP = 50 ⋮---- RETRY MIN RECORDS = 3 ⋮---- OPERATIVE MESSAGE TYPES = "user message", "assistant message" ⋮---- PROMPT = ⋮---- def h8 claim: str - str ⋮---- def slug topic: str - str ⋮---- s = re.sub r" ^a-z0-9 +", "-", topic.lower .strip "-" ⋮---- def slug of key key: str - str ⋮---- parts = key.split "/" ⋮---- def norm value: str - str ⋮---- def coerce key topic topic: str, known keys: set str - tuple str None, str None ⋮---- def tokens text: str, , min len: int = 5 - list str ⋮---- def parse atoms raw: str - list tuple str, str, str, str None ⋮---- """Parse topic claim evidence li… 证据：`src/localharness/memory/mining.py`
- **BUG 45 relatedness floor: a correction may only dispute a STAGED fact it is actually ABOUT —**（source_file）：log = logging.getLogger name ⋮---- STAT WRITE QUADRANT = "surprising failure" CORRECTION WRITE FAMILIES = frozenset {"negation", "correction phrase"} ⋮---- def should write stat quadrant: str - bool ⋮---- def graded confidence score: float - float ⋮---- def correction in scope family: str None - bool ⋮---- STAT TIER TAG = "tier:surprising failure" CORRECTION TIER TAG = "tier:correction pending" SUSPECT SUPERSEDE CONFIDENCE = 0.6 QUARANTINE CONFIDENCE = 0.65 ⋮---- DISPUTE MARKER = " disputed by user correction — pending reconciliation " ⋮---- def h8 parts: str - str ⋮---- def preview text: str None, n: int = 180 - str ⋮---- one = " ".join text or "" .split ⋮---- BUG 45 relatedness floor: a c… 证据：`src/localharness/memory/predictive_write_gate.py`
- **v2 supersede-not-overwrite : 'active' 'superseded'; superseded rows stay queryable**（source_file）：log = logging.getLogger name ⋮---- @dataclass frozen=True class Fact ⋮---- key: str value: str agent id: str division id: str = "" org id: str = "" tags: list str = field default factory=list confidence: float = 1.0 source: str = "" created at: int = 0 updated at: int = 0 expires at: int None = None v2 supersede-not-overwrite : 'active' 'superseded'; superseded rows stay queryable via get fact history / include superseded but leave every hot path. status: str = "active" superseded by: int None = None ⋮---- provenance: str = "" id: int = 0 v3 RANK : trust/accessibility split + ACT-R use-counters + graph node kind. retrieval strength: float = 0.5 importance: float = 0.0 access count: int = 0… 证据：`src/localharness/memory/sqlite.py`
- **Router**（source_file）：class AgentCreationFlow ⋮---- def init self, card registry: AgentCardRegistry - None ⋮---- @staticmethod def no config message - str ⋮---- def begin agent creation self, config dir: Path None = None - "AgentCreationWorkflow" ⋮---- @property def active workflow self - "AgentCreationWorkflow None" 证据：`src/localharness/orchestrator/router.py`
- **Init**（source_file）：all = 证据：`src/localharness/provider/__init__.py`
- **---------------------------------------------------------------------------**（source_file）：log = logging.getLogger name ⋮---- DEFAULT PORTS: list int = 8081, 8000, 11434, 1234, 8080 ⋮---- LOCAL INFERENCE TIMEOUT MIN: float = 300.0 ⋮---- LOCAL PATTERNS = re.compile ⋮---- ProviderType = Literal "ollama", "vllm", "llamacpp", "lmstudio", "unknown" ⋮---- @dataclass class DetectorResult ⋮---- found: bool provider type: ProviderType base url: str models: list str suggested model: str probe duration ms: float raw response: dict = field default factory=dict ⋮---- probe ports = ports if ports is not None else DEFAULT PORTS start = time.monotonic ⋮---- probe coros = probe port client, port, timeout seconds for port in probe ports results = await asyncio.gather probe coros, return exceptions… 证据：`src/localharness/provider/detector.py`
- **---------------------------------------------------------------------------**（source_file）：DOCKER CONTAINER NAME = "localharness-vllm" ⋮---- def server dir config dir: Path - Path ⋮---- def log path config dir: Path - Path ⋮---- def pid path config dir: Path - Path ⋮---- def venv vllm bin config dir: Path - Path ⋮---- def find vllm config dir: Path - str None ⋮---- venv bin = venv vllm bin config dir ⋮---- def install vllm venv config dir: Path, package: str - str ⋮---- venv = server dir config dir / "venv" ⋮---- uv = shutil.which "uv" ⋮---- install = uv, "pip", "install", "--python", str venv / "bin" / "python" , package ⋮---- bin path = venv vllm bin config dir ⋮---- def run streaming cmd: list str - None ⋮---- rc = subprocess.run cmd .returncode ⋮---- -------------------------… 证据：`src/localharness/provider/server.py`
- **Init**（source_file）：all = 证据：`src/localharness/registry/__init__.py`
- **Init**（source_file）：all = 证据：`src/localharness/tools/__init__.py`
- **Init**（source_file）：def bind agent store tools registry: ToolRegistry, store: Any - None 证据：`src/localharness/tools/builtin/__init__.py`
- **Discover tools**（source_file）：class MCPError Exception ⋮---- class MCPConnectionError MCPError ⋮---- class MCPTransportError MCPError ⋮---- class MCPProtocolError MCPError ⋮---- class MCPToolNotFound MCPError ⋮---- class MCPToolWrapper Tool ⋮---- def info self - ToolSchema ⋮---- async def execute self, kwargs: Any - ToolResult ⋮---- start = time.monotonic ⋮---- result = await self. session.call tool self. raw name, arguments=kwargs output parts: list str = ⋮---- output = "\n".join output parts or " empty response " is error = getattr result, "isError", False ⋮---- async def run self, kwargs: Any - ToolResult ⋮---- class MCPServerClient ⋮---- def init self, config: "MCPServerConfig" - None ⋮---- @property def connected s… 证据：`src/localharness/tools/mcp.py`
- **Changelog**（documentation）：All notable changes to LocalHarness are documented here. The format follows Keep a Changelog https://keepachangelog.com/ , and the project adheres to Semantic Versioning https://semver.org/ pre-1.0: interfaces may change . 证据：`CHANGELOG.md`
- **Code of Conduct**（documentation）：LocalHarness adopts the Contributor Covenant https://www.contributor-covenant.org , version 2.1, as its Code of Conduct. The full text is published at . 证据：`CODE_OF_CONDUCT.md`
- **Security Policy**（documentation）：LocalHarness is early-stage v0.x . Security fixes land on the latest main ; there are no long-term-support branches yet. 证据：`SECURITY.md`
- **Sema05 Designed Month Manifest**（structured_config）：{ "version": 1, "description": "36.1 designed-month eval: 6 synthetic topics with known expected grouping across 3 sittings. Grading: designed-month grading protocol internal, pre-committed . No PII; topics mirror real usage SHAPES, not content.", "days": "day1", "day2", "day3" , "topics": { "subagents": { "expected chapter": true, "days": "day1", "day2", "day3" , "keywords": "subagent", "summarizer", "screenshot", "read-only", "yaml" }, "harness arch": { "expected chapter": false, "days": "day1", "day3" , "keywords": "event bus", "SQLite", "memory", "orchestrator", "Typer" , "note": "ask-only negative control amendment v2 : pure questions must NOT form a chapter" }, "markets": { "expected… 证据：`scripts/sema05_designed_month_manifest.json`
- **Local runtime state autoresearch mutation archive, etc.**（source_file）：pycache / .py cod .pyo .venv/ dist/ .egg-info/ .mypy cache/ .ruff cache/ .pytest cache/ bench/results/ 证据：`.gitignore`
- **Bench**（source_file）：corpus path: bench/scenarios results path: bench/results matrix: - name: qwen-3.6-27b provider: vllm model id: qwen3.6-27b base url: http://localhost:8000/v1 - name: gpt-oss-120b provider: ollama model id: gpt-oss:120b - name: qwen-7b provider: ollama model id: qwen2.5:7b sampling: tolerance: 0.10 min runs: 3 max runs: 20 confidence: 0.95 thresholds: latency total: { type: relative, value: 0.15 } latency ttft: { type: relative, value: 0.10 } tokens out: { type: relative, value: 0.10 } tokens in: { type: relative, value: 0.10 } success rate: { type: absolute pp, value: -0.05 } iterations: { type: relative, value: 0.20 } parse failures: { type: absolute, value: 1 } stuck recoveries: { type: a… 证据：`bench/bench.yaml`
- 其余 11 条证据见 `AI_CONTEXT_PACK.json` 或 `EVIDENCE_INDEX.json`。

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

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

- **项目概览与快速上手**：importance `high`
  - source_paths: README.md, pyproject.toml, src/localharness/__init__.py, src/localharness/cli/app.py, docs/reference-architectures/README.md
- **代理运行时、工具与权限**：importance `high`
  - source_paths: src/localharness/agent/loop.py, src/localharness/agent/permissions.py, src/localharness/agent/subagent.py, src/localharness/orchestrator/router.py, src/localharness/tools/builtin/__init__.py
- **SQLite 记忆系统与写入门控**：importance `high`
  - source_paths: src/localharness/memory/sqlite.py, src/localharness/memory/predictive_write_gate.py, src/localharness/memory/discovery.py, src/localharness/memory/consolidation.py, src/localharness/memory/mining.py
- **推理服务器生命周期、基准与已知故障模式**：importance `high`
  - source_paths: src/localharness/provider/server.py, src/localharness/provider/detector.py, src/localharness/cli/model_cmd.py, src/localharness/cli/model_ops.py, src/localharness/cli/repl.py

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

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `e248e31f7bd0e0c8e0dbe686ea023b9a02c79bbc`
- inspected_files: `README.md`, `pyproject.toml`, `uv.lock`, `docs/reference-architectures/README.md`, `docs/reference-architectures/dgx-spark.md`, `docs/reference-architectures/gaps.md`, `docs/reference-architectures/mac-mini.md`, `docs/running-agents-locally.md`, `docs/specs/00-architecture-overview.md`, `docs/specs/01-event-bus.md`, `docs/specs/02-provider.md`, `docs/specs/03-agent-loop.md`, `docs/specs/04-tool-system.md`, `docs/specs/04b-mcp-integration.md`, `docs/specs/05-memory.md`, `docs/specs/06-config.md`, `docs/specs/07-orchestrator.md`, `docs/specs/08-context-management.md`, `docs/specs/09-hooks-plugins.md`, `docs/specs/10-cli.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: Version banner reads stale install metadata on editable installs — shows old version after ev...

- Trigger: Developers should check this installation risk before relying on the project: Version banner reads stale install metadata on editable installs — shows old version after every source update
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: Version banner reads stale install metadata on editable installs — shows old version after every source update. Context: Observed when using python
- Why it matters: Developers may fail before the first successful local run: Version banner reads stale install metadata on editable installs — shows old version after every source update
- Evidence: failure_mode_cluster:github_issue | https://github.com/ahwurm/localharness/issues/97 | Version banner reads stale install metadata on editable installs — shows old version after every source update
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 2: 来源证据：Discovery candidate tags never progress past 'proposed' — naming/promotion unobserved for 6+ days

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Discovery candidate tags never progress past 'proposed' — naming/promotion unobserved for 6+ days
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/ahwurm/localharness/issues/90 | 来源类型 github_issue 暴露的待验证使用条件。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 3: 来源证据：Discovery candidates can enter permanent limbo: evidence re-accrual on unchanged clusters defeats staleness pruning

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Discovery candidates can enter permanent limbo: evidence re-accrual on unchanged clusters defeats staleness pruning
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/ahwurm/localharness/issues/94 | 来源类型 github_issue 暴露的待验证使用条件。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 4: 来源证据：Exiting the REPL immediately after an answer skips that turn's end-of-turn bookkeeping

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Exiting the REPL immediately after an answer skips that turn's end-of-turn bookkeeping
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/ahwurm/localharness/issues/93 | 来源类型 github_issue 暴露的待验证使用条件。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 5: 来源证据：Version banner reads stale install metadata on editable installs — shows old version after every source update

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Version banner reads stale install metadata on editable installs — shows old version after every source update
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/ahwurm/localharness/issues/97 | 来源类型 github_issue 暴露的待验证使用条件。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 6: 来源证据：Zombie docker-run client defeats the managed server's dead-process fail-fast

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Zombie docker-run client defeats the managed server's dead-process fail-fast
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能阻塞安装或首次运行。
- Evidence: community_evidence:github | https://github.com/ahwurm/localharness/issues/99 | 来源讨论提到 docker 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

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

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

### Constraint 8: 失败模式：configuration: Zombie docker-run client defeats the managed server's dead-process fail-fast

- Trigger: Developers should check this configuration risk before relying on the project: Zombie docker-run client defeats the managed server's dead-process fail-fast
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: Zombie docker-run client defeats the managed server's dead-process fail-fast. Context: Observed when using docker
- Why it matters: Developers may misconfigure credentials, environment, or host setup: Zombie docker-run client defeats the managed server's dead-process fail-fast
- Evidence: failure_mode_cluster:github_issue | https://github.com/ahwurm/localharness/issues/99 | Zombie docker-run client defeats the managed server's dead-process fail-fast
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

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

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

### Constraint 10: 失败模式：runtime: Mid-turn tier-2 input classification is starved by the single-flight inference gate, and its...

- Trigger: Developers should check this runtime risk before relying on the project: Mid-turn tier-2 input classification is starved by the single-flight inference gate, and its failure path is silent
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: Mid-turn tier-2 input classification is starved by the single-flight inference gate, and its failure path is silent. Context: Source discussion did not expose a precise runtime context.
- Why it matters: Developers may hit a documented source-backed failure mode: Mid-turn tier-2 input classification is starved by the single-flight inference gate, and its failure path is silent
- Evidence: failure_mode_cluster:github_issue | https://github.com/ahwurm/localharness/issues/92 | Mid-turn tier-2 input classification is starved by the single-flight inference gate, and its failure path is silent
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。
