# codealmanac - Doramagic AI Context Pack

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

## 充分原则

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

## 给宿主 AI 的使用方式

你正在读取 Doramagic 为 codealmanac 编译的 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_0003` supported 0.86
- **希望把专业流程带进宿主 AI 的用户**：仓库包含 Skill 文档。 证据：`.agents/skills/cleanslate/SKILL.md`, `.agents/skills/deep-refactor-audit/SKILL.md`, `.claude/skills/deep-refactor-audit/SKILL.md` Claim：`clm_0004` supported 0.86

## 它能做什么

- **AI Skill / Agent 指令资产库**（可做安装前预览）：项目包含可被宿主 AI 读取的 Skill 或 Agent 指令文件，可用于把专业流程带入 Claude、Codex、Cursor 等宿主。 证据：`.agents/skills/cleanslate/SKILL.md`, `.agents/skills/deep-refactor-audit/SKILL.md`, `.claude/skills/deep-refactor-audit/SKILL.md` Claim：`clm_0001` supported 0.86
- **命令行启动或安装流程**（需要安装后验证）：项目文档中存在可执行命令，真实使用需要在本地或宿主环境中运行这些命令。 证据：`README.md` Claim：`clm_0002` supported 0.86

## 怎么开始

- `uv tool install codealmanac@latest` 证据：`README.md` Claim：`clm_0005` supported 0.86
- `npm install -g @openai/codex` 证据：`README.md` Claim：`clm_0006` supported 0.86

## 继续前判断卡

- **当前建议**：仅建议沙盒试装
- **为什么**：项目存在安装命令、宿主配置或本地写入线索，不建议直接进入主力环境，应先在隔离环境试装。

### 30 秒判断

- **现在怎么做**：仅建议沙盒试装
- **最小安全下一步**：先跑 Prompt Preview；若仍要安装，只在隔离环境试装
- **先别相信**：真实输出质量不能在安装前相信。
- **继续会触碰**：命令执行、宿主 AI 配置、本地环境或项目文件

### 现在可以相信

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

### 现在还不能相信

- **真实输出质量不能在安装前相信。**（unverified）：Prompt Preview 只能展示引导方式，不能证明真实项目中的结果质量。
- **宿主 AI 版本兼容性不能在安装前相信。**（unverified）：Claude、Cursor、Codex、Gemini 等宿主加载规则和版本差异必须在真实环境验证。
- **不会污染现有宿主 AI 行为，不能直接相信。**（inferred）：Skill、plugin、AGENTS/CLAUDE/GEMINI 指令可能改变宿主 AI 的默认行为。 证据：`.agents/skills/cleanslate/SKILL.md`, `.agents/skills/deep-refactor-audit/SKILL.md`, `.claude/skills/deep-refactor-audit/SKILL.md`, `CLAUDE.md`
- **可安全回滚不能默认相信。**（unverified）：除非项目明确提供卸载和恢复说明，否则必须先在隔离环境验证。
- **真实安装后是否与用户当前宿主 AI 版本兼容？**（unverified）：兼容性只能通过实际宿主环境验证。
- **项目输出质量是否满足用户具体任务？**（unverified）：安装前预览只能展示流程和边界，不能替代真实评测。
- **安装命令是否需要网络、权限或全局写入？**（unverified）：这影响企业环境和个人环境的安装风险。 证据：`README.md`

### 继续会触碰什么

- **命令执行**：包管理器、网络下载、本地插件目录、项目配置或用户主目录。 原因：运行第一条命令就可能产生环境改动；必须先判断是否值得跑。 证据：`README.md`
- **宿主 AI 配置**：Claude/Codex/Cursor/Gemini/OpenCode 等宿主的 plugin、Skill 或规则加载配置。 原因：宿主配置会改变 AI 后续工作方式，可能和用户已有规则冲突。 证据：`.agents/skills/cleanslate/SKILL.md`, `.agents/skills/deep-refactor-audit/SKILL.md`, `.claude/skills/deep-refactor-audit/SKILL.md`, `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_0007` inferred 0.45
- **命令执行会修改本地环境**：安装命令可能写入用户主目录、宿主插件目录或项目配置。 处理方式：先在隔离环境或测试账号中运行。 证据：`README.md` Claim：`clm_0008` 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。

### 任务路由

- **AI Skill / Agent 指令资产库**：先基于 role_skill_index / evidence_index 帮用户挑选可用角色、Skill 或工作流。 边界：可做安装前 Prompt 体验。 证据：`.agents/skills/cleanslate/SKILL.md`, `.agents/skills/deep-refactor-audit/SKILL.md`, `.claude/skills/deep-refactor-audit/SKILL.md` Claim：`clm_0001` supported 0.86
- **命令行启动或安装流程**：先说明这是安装后验证能力，再给出安装前检查清单。 边界：必须真实安装或运行后验证。 证据：`README.md` Claim：`clm_0002` supported 0.86

### 上下文规模

- 文件总数：1177
- 重要文件覆盖：40/1177
- 证据索引条目：80
- 角色 / Skill 条目：3

### 证据不足时的处理

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

## Prompt Recipes

### 适配判断

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

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

### 安装前体验

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

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

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

## 角色 / Skill 索引

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

- **cleanslate**（skill）：Use when the user asks to run or prepare the Almanac clean-slate workflow, uninstall all local codealmanac/Almanac CLI artifacts, or reset a machine to first-time Almanac install state. 激活提示：当用户任务与“cleanslate”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/cleanslate/SKILL.md`
- **deep-refactor-audit**（skill）：Use when a user asks for a major architecture/refactor audit, codebase smell investigation, boundary critique, feature simplification review, vibe-coded or AI-generated code cleanup assessment, hand-rolled library review, or no-code report on how a codebase should be reshaped. 激活提示：当用户任务与“deep-refactor-audit”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.agents/skills/deep-refactor-audit/SKILL.md`
- **deep-refactor-audit**（skill）：Use when a user asks for a major architecture/refactor audit, codebase smell investigation, boundary critique, feature simplification review, vibe-coded or AI-generated code cleanup assessment, hand-rolled library review, or no-code report on how a codebase should be reshaped. 激活提示：当用户任务与“deep-refactor-audit”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`.claude/skills/deep-refactor-audit/SKILL.md`

## 证据索引

- 共索引 80 条证据。

- **CodeAlmanac Architecture Audit**（documentation）：This folder captures the ongoing architecture audit requested on 2026-06-08. The audit is intentionally critical: existing code shape is treated as provisional until it earns its place. 证据：`docs/architecture-audit-2026-06-08/README.md`
- **codealmanac hosted redesign — 2026-06-27**（documentation）：codealmanac hosted redesign — 2026-06-27 证据：`docs/cli-hosted-redesign-2026-06-27/README.md`
- **Cloud And Local CodeAlmanac Live Agreement**（documentation）：Cloud And Local CodeAlmanac Live Agreement 证据：`docs/hosted-local-live-agreement/README.md`
- **Python Port Steering**（documentation）：This directory is the slow-development steering trail for the Python rewrite. It complements docs/python-port-live-agreement.md , which is the product and architecture contract. 证据：`docs/python-port/README.md`
- **.almanac Garden Refactor Audit**（documentation）：Scope: /Users/rohan/Desktop/Projects/codealmanac/.almanac 证据：`docs/refactor-audit-2026-06-09/README.md`
- **Wiki Quality Audit**（documentation）：Goal: Critically audit the wiki guidance and maintenance mechanism for CodeAlmanac by comparing the current CodeAlmanac wiki, the newer General Almanac / Reverie workspace, and the General Almanac manual work. 证据：`docs/refactor-audit-2026-06-13-wiki-quality/README.md`
- **CodeAlmanac Macro Refactor Audit**（documentation）：Branch: codex/macro-refactor-from-f2eb2c7 证据：`docs/refactor-audit-2026-07-06/README.md`
- **Bulletproof React 🛡️ ⚛️**（documentation）：! MIT License https://img.shields.io/github/license/alan2207/bulletproof-react https://github.com/alan2207/bulletproof-react/blob/master/LICENSE ! Next.js App CI https://github.com/alan2207/bulletproof-react/actions/workflows/nextjs-app-ci.yml/badge.svg https://github.com/alan2207/bulletproof-react/actions/workflows/nextjs-app-ci.yml ! Next.js Pages CI https://github.com/alan2207/bulletproof-react/actions/workflows/nextjs-pages-ci.yml/badge.svg https://github.com/alan2207/bulletproof-react/actions/workflows/nextjs-pages-ci.yml ! React Vite CI https://github.com/alan2207/bulletproof-react/actions/workflows/react-vite-ci.yml/badge.svg https://github.com/alan2207/bulletproof-react/actions/work… 证据：`docs/reference/bulletproof-react/README.md`
- **Book repo**（documentation）：Book Code ---- ---- ! Book Build Status https://travis-ci.org/cosmicpython/book.svg?branch=master https://travis-ci.org/cosmicpython/book ! Code build status https://travis-ci.org/cosmicpython/code.svg?branch=master https://travis-ci.org/cosmicpython/code 证据：`docs/reference/cosmic-python/README.md`
- **CodeAlmanac**（documentation）：A living wiki for your codebase, maintained by AI coding agents. 证据：`README.md`
- **CodeAlmanac Wiki**（documentation）：The CodeAlmanac wiki is the committed knowledge base for this repository. It is a nested Markdown tree under almanac/ , written for future coding agents who need the decisions, flows, invariants, and gotchas that code alone does not explain @repo-readme @kernel-prompt . This wiki routes readers from product concepts to architecture, guides, decisions, and reference pages so they can work in the Python rewrite without rediscovering the same context. 证据：`almanac/README.md`
- **Architecture**（documentation）：Architecture pages explain the system areas that future work must preserve or reshape before adding behavior. The repo manual makes this explicit: implementation work should evolve the codebase so the feature fits, and should stop when the current shape cannot hold the request cleanly @manual . This hub gives the shortest route through the architecture cluster instead of requiring readers to scan every page under architecture/ . 证据：`almanac/architecture/README.md`
- **Agent Runs**（documentation）：Agent runs is the part of CodeAlmanac that executes one build, ingest, or garden task against an external coding agent and turns the result into durable, provider-neutral facts. The neighborhood has two pages: the contract lifecycle workflows depend on, and the one adapter that currently implements it @topics . 证据：`almanac/architecture/agent-runs/README.md`
- **Lifecycle**（documentation）：The lifecycle architecture is the part of CodeAlmanac that creates, improves, queues, and validates wiki-writing work. The lifecycle topic covers build, ingest, garden, sync, queued runs, operation execution, and mutation safety @topics . Read this hub when changing how CodeAlmanac turns local inputs and scheduled triggers into durable wiki changes. 证据：`almanac/architecture/lifecycle/README.md`
- **Wiki Architecture**（documentation）：Wiki architecture is the part of CodeAlmanac that turns the committed almanac/ tree into a navigable local knowledge base. The pages in this folder explain how Markdown paths become page identity, how file evidence becomes searchable references, how the derived index powers read commands, how topics form a DAG, and how health and validation keep the graph trustworthy @page-identity @path-refs @index-search @topics-dag @health-validation . 证据：`almanac/architecture/wiki/README.md`
- **Concepts**（documentation）：Concept pages define CodeAlmanac vocabulary that appears across architecture, guides, decisions, and reference pages. The topic graph defines concepts as the neighborhood for core vocabulary and mental models, and this hub routes readers to the term that explains the subject before they follow implementation details @topics . 证据：`almanac/concepts/README.md`
- **Decisions**（documentation）：Decision pages record architectural choices that future work must respect or explicitly supersede. The topic graph defines decisions as this repository's neighborhood for choices that shape structure, workflows, and product surface @topics . 证据：`almanac/decisions/README.md`
- **Guides**（documentation）：Guides are task procedures for maintainers who already know what outcome they need. The topic graph defines guides as the task-oriented neighborhood, and this hub groups the procedures by the work they unblock @topics . 证据：`almanac/guides/README.md`
- **Reference**（documentation）：Reference pages are exact lookup material for CodeAlmanac commands, page formats, source addresses, run records, config keys, local state, and topic metadata. The topic graph defines reference as the wiki neighborhood for commands, formats, and states, and this hub routes readers to the narrow page that owns each contract @topics . 证据：`almanac/reference/README.md`
- **Sample Almanac Wiki**（documentation）：This sample wiki documents the non-obvious knowledge a future coding agent should read before changing checkout or payment behavior. 证据：`archive/code/examples/sample-repo/.almanac/README.md`
- **Sample Repo**（documentation）：This tiny repo shows what an Almanac wiki looks like after a few useful engineering sessions. 证据：`archive/code/examples/sample-repo/README.md`
- **Manual Overview**（documentation）：This manual defines how agents maintain a CodeAlmanac repo-owned wiki. 证据：`src/codealmanac/manual/README.md`
- **Python rewrite architecture references**（documentation）：COMPULSORY — read MANUAL.md MANUAL.md before implementing any feature. It defines how we build : living architecture the unit of work is "reshape the codebase so the feature fits, then build it" , the seam-vs-machinery rule, the duty to stop and flag when the current shape won't hold a feature cleanly, and the wireframe-in-chat habit. Reason from it; don't bolt features onto a misshapen base. 证据：`CLAUDE.md`
- **CLI Telemetry Implementation Plan**（documentation）：For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. 证据：`docs/plans/2026-07-15-cli-telemetry.md`
- **Slice 110 - Viewer Service Boundaries**（documentation）：Slice 110 - Viewer Service Boundaries 证据：`docs/python-port/slice-110-viewer-service-boundaries.md`
- **Slice 112 - Workspace Service Boundaries**（documentation）：Slice 112 - Workspace Service Boundaries 证据：`docs/python-port/slice-112-workspace-service-boundaries.md`
- **Slice 115: Topic Service Boundaries**（documentation）：Slice 115: Topic Service Boundaries 证据：`docs/python-port/slice-115-topic-service-boundaries.md`
- **Slice 117: Automation Service Boundaries**（documentation）：Slice 117: Automation Service Boundaries 证据：`docs/python-port/slice-117-automation-service-boundaries.md`
- **Slice 131: Setup Service Boundaries**（documentation）：Slice 131: Setup Service Boundaries 证据：`docs/python-port/slice-131-setup-service-boundaries.md`
- **Slice 15: Ingest Mutation Safety**（documentation）：Harden internal ingest before making codealmanac ingest public. 证据：`docs/python-port/slice-15-ingest-mutation-safety.md`
- **Slice 56 - Public Release README**（documentation）：Replace the stale Node/npm public README with the Python local CodeAlmanac contract and make that contract executable through public tests. 证据：`docs/python-port/slice-56-public-release-readme.md`
- **Contributing to CodeAlmanac**（documentation）：CodeAlmanac is a local codebase wiki for AI coding agents. A good contribution keeps the command surface scriptable, the wiki artifact repo-owned, and the code shape easy for the next maintainer to extend. 证据：`CONTRIBUTING.md`
- **Package**（package_manifest）：{ "name": "codealmanac", "version": "0.2.26", "description": "A living wiki for codebases, maintained by AI agents. Documents what the code can't say: decisions, flows, invariants, incidents, gotchas.", "keywords": "wiki", "documentation", "ai", "claude", "codebase", "knowledge-base" , "license": "Apache-2.0", "author": "AlmanacCode", "repository": { "type": "git", "url": "git+https://github.com/AlmanacCode/codealmanac.git" }, "homepage": "https://github.com/AlmanacCode/codealmanac readme", "bugs": { "url": "https://github.com/AlmanacCode/codealmanac/issues" }, "type": "module", "bin": { "codealmanac": "dist/launcher.js", "almanac": "dist/launcher.js", "alm": "dist/launcher.js" }, "files":… 证据：`archive/code/package.json`
- **Almanac Clean Slate**（skill_instruction）：Reset this machine to a first-time Almanac user state, then report exactly what changed. 证据：`.agents/skills/cleanslate/SKILL.md`
- **Deep Refactor Audit**（skill_instruction）：This is a no-code architecture audit for aggressively rethinking a codebase. The job is to ask why the codebase is shaped this way, whether that shape still deserves to exist, and what a strong principal engineer would change before allowing the system to keep growing. 证据：`.agents/skills/deep-refactor-audit/SKILL.md`
- **Deep Refactor Audit**（skill_instruction）：This is a no-code architecture audit for aggressively rethinking a codebase. The job is to ask why the codebase is shaped this way, whether that shape still deserves to exist, and what a strong principal engineer would change before allowing the system to keep growing. 证据：`.claude/skills/deep-refactor-audit/SKILL.md`
- **Getting Started**（documentation）：Getting started is the routing page for this CodeAlmanac wiki. It gives future agents the shortest useful path through the repo knowledge: first understand the local wiki model, then the lifecycle workflows that write pages, then the index and search surface that make the wiki usable day to day. The goal is not to read every page first; it is to build the right mental map before changing the system. 证据：`almanac/getting-started.md`
- **Concepts**（documentation）：CodeAlmanac has five core concepts. 证据：`docs/concepts.md`
- **CodeAlmanac Python Port Live Agreement**（documentation）：CodeAlmanac Python Port Live Agreement 证据：`docs/python-port-live-agreement.md`
- **Requirements Log**（documentation）：Working agreement log for the hosted Almanac GitHub App direction. This file should record settled requirements only; unresolved ideas stay out until we decide them. 证据：`docs/requirements_log.md`
- **Harness Contract**（documentation）：The harness contract is the boundary between lifecycle workflows and external agent providers. Build, ingest, and garden send one normalized RunHarnessRequest to a selected harness and receive one normalized HarnessRunResult back. The workflows do not know whether the provider is Codex or Claude; that provider-specific behavior lives behind the Yoke harness boundary provider-adapters @harness-ports @harness-requests . 证据：`almanac/architecture/agent-runs/harness-contract.md`
- **Yoke Harness Boundary**（documentation）：CodeAlmanac has one provider integration: YokeHarnessAdapter . It implements the service-owned harness port for Claude and Codex, selects CodeAlmanac's Yoke surface and run options, and converts Yoke runs and events into durable product models @adapter @contract . 证据：`almanac/architecture/agent-runs/provider-adapters.md`
- **Composition Root**（documentation）：The composition root is src/codealmanac/app.py . It is the one place that builds the CodeAlmanac application graph: local state paths, stores, services, adapters, operation runners, and lifecycle workflows @app-root . This follows the repo's Cosmic Python translation, where bootstrap lives in the application root so entrypoints do not perform setup themselves @cosmic-translation . 证据：`almanac/architecture/composition-root.md`
- **Mutation Safety**（documentation）：Mutation safety is currently an agent-facing write boundary plus final wiki validation. CodeAlmanac renders a source control policy that tells lifecycle agents which wiki source files they may edit or commit, and the base kernel tells agents to follow that policy @commit-policy @kernel-prompt . The current Python operation runner does not perform a Git-diff mutation preflight or reject files outside almanac/ after the harness returns @operation-service @architecture-tests . 证据：`almanac/architecture/lifecycle/mutation-safety.md`
- **Operation Runner**（documentation）：OperationRunner is the shared execution path for page-writing lifecycle operations. Build, ingest, and garden prepare their own context and prompt, then delegate the common run mechanics to this service @operation-service . The runner owns the sequence from running-state transition through harness execution, transcript and event recording, harness success validation, index refresh, final wiki validation, and terminal run state. 证据：`almanac/architecture/lifecycle/operation-runner.md`
- **Run Queue And Sync**（documentation）：The run queue stores build, ingest, and garden work as durable run records with specs, then starts a local worker to drain queued work @run queue @run models . Sync is a scanner that can enqueue ingest work; it is not itself a page-writing lifecycle operation @sync workflow . 证据：`almanac/architecture/lifecycle/run-queue-and-sync.md`
- **Lifecycle Workflows**（documentation）：Lifecycle workflows are the high-level flows that create or improve a repo wiki. Build creates the first wiki, ingest folds selected source material into pages, and garden improves the existing wiki graph and content @build-workflow @ingest-workflow @garden-workflow . These three are the page-writing operation family described by Lifecycle operation ../../concepts/lifecycle-operation . 证据：`almanac/architecture/lifecycle/workflows.md`
- **Repository Local State**（documentation）：Repository local state is the runtime state CodeAlmanac keeps outside the committed wiki. The authored wiki lives under almanac/ , while the global database, user config, update lock, and per-repository runtime directories live under the product-specific state directory ~/.codealmanac/ @repo-readme @core-paths . This split lets Markdown stay reviewable in Git while search indexes, run records, and other derived state can be rebuilt or managed locally. 证据：`almanac/architecture/repositories/local-state.md`
- **Service Boundaries**（documentation）：CodeAlmanac uses service boundaries to keep product behavior out of adapters and provider code. The intended dependency direction is cli - app - workflows - services - stores/ports - integrations , with src/codealmanac/app.py as the place where those layers are assembled @cosmic-translation @app-root . This means a command, server wrapper, worker, or test should call a service or workflow through a typed request, while provider-specific code stays behind a port. 证据：`almanac/architecture/service-boundaries.md`
- **Setup Automation And Update**（documentation）：Setup, automation, and update form CodeAlmanac's machine-level maintenance layer. setup installs local agent instructions and writes one user configuration update. The config service then makes launchd match that saved automation policy. automation owns recurring launchd jobs, while update owns package-manager upgrades for the installed CLI @setup service @automation service @updates . 证据：`almanac/architecture/setup/automation-and-update.md`
- **Telemetry**（documentation）：Telemetry is CodeAlmanac's narrow remote product-signal layer. The product is still local-first: wiki source, source code, prompts, transcripts, repository identifiers, run identifiers, paths, command arguments, and exception messages stay on the machine, while telemetry may send only allowlisted command outcomes, lifecycle outcomes, and structural unhandled exception shapes @live-agreement @telemetry-models . 证据：`almanac/architecture/telemetry.md`
- **Add A Harness Provider Adapter**（documentation）：Use this guide when CodeAlmanac needs to add a new local agent runner a new HarnessKind , such as a future harness alongside Codex and Claude or change which Yoke surface an existing runner uses. The guide has two parts because the work usually spans two repos: provider or surface support belongs in Yoke, and the CodeAlmanac-side product choice — the HarnessKind , controlled models ../decisions/controlled-model-catalog , and YokeHarnessAdapter registration — belongs here. 证据：`almanac/guides/add-a-harness-provider-adapter.md`
- **Config Keys**（documentation）：Config keys are the user-level TOML surface for lifecycle and machine-automation preferences. CodeAlmanac reads one file at ~/.codealmanac/config.toml ; repository-level config is not supported @readme @config-service . CLI flags still override config for one command. 证据：`almanac/reference/config-keys.md`
- **Harness Event Shape**（documentation）：The harness event shape is CodeAlmanac's normalized transcript format for agent runs. The Yoke harness boundary ../architecture/agent-runs/provider-adapters converts Codex or Claude event streams into HarnessEvent objects, and lifecycle code records those events without parsing provider-specific JSON @harness-events . This page defines the event kinds, optional payload groups, tool display fields, usage counters, failures, actor data, and agent traces used by the harness contract ../architecture/agent-runs/harness-contract . 证据：`almanac/reference/harness-event-shape.md`
- **Local State Layout**（documentation）：Local state layout is the split between committed wiki source and machine-local runtime files. The repository-owned wiki is the almanac/ tree. The local database, user config, per-repository derived indexes, update lock, and scheduler logs live under ~/.codealmanac/ by default @readme @core-paths . 证据：`almanac/reference/local-state-layout.md`
- **Run States And Events**（documentation）：Run states and events are the exact ledger contract for lifecycle work. A run records one build, ingest, or garden operation, while ordered events record status changes, messages, tool activity, output, and errors @run-models . The user-facing jobs commands read this same model through the run ledger ../../concepts/run-ledger . 证据：`almanac/reference/runs/run-states-and-events.md`
- **Completion Audit**（documentation）：This file records how the investigation satisfied the user's read-only audit request. It is not a code validation report because the task explicitly forbade source modifications. 证据：`docs/architecture-audit-2026-06-08/completion-audit.md`
- **Refactor Roadmap**（documentation）：This roadmap assumes source changes happen in later work. No source code was modified during this audit. 证据：`docs/architecture-audit-2026-06-08/refactor-roadmap.md`
- **Facade Boundary Entrypoints Follow-Up**（documentation）：Facade Boundary Entrypoints Follow-Up 证据：`docs/architecture-audit-2026-06-08/reports/facade-boundary-entrypoints.md`
- **Lifecycle Command Ownership And Flow Boundaries Audit**（documentation）：Lifecycle Command Ownership And Flow Boundaries Audit 证据：`docs/architecture-audit-2026-06-08/reports/lifecycle-command-boundaries.md`
- 其余 20 条证据见 `AI_CONTEXT_PACK.json` 或 `EVIDENCE_INDEX.json`。

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

- **把本资产当作开工前上下文，而不是运行环境。**：AI Context Pack 只包含证据化项目理解，不包含目标项目的可执行状态。 证据：`docs/architecture-audit-2026-06-08/README.md`, `docs/cli-hosted-redesign-2026-06-27/README.md`, `docs/hosted-local-live-agreement/README.md`
- **回答用户时区分可预览内容与必须安装后才能验证的内容。**：安装前体验的消费者价值来自降低误装和误判，而不是伪装成真实运行。 证据：`docs/architecture-audit-2026-06-08/README.md`, `docs/cli-hosted-redesign-2026-06-27/README.md`, `docs/hosted-local-live-agreement/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/codealmanac/app.py, src/codealmanac/cli/main.py, src/codealmanac/cli/dispatch/setup.py
- **系统架构、核心概念与生命周期操作**：importance `high`
  - source_paths: almanac/architecture/composition-root.md, almanac/architecture/service-boundaries.md, almanac/architecture/lifecycle/workflows.md, almanac/architecture/lifecycle/operation-runner.md, almanac/architecture/lifecycle/mutation-safety.md
- **Provider 与 Harness 集成（含 OpenCode 支持议题）**：importance `high`
  - source_paths: almanac/architecture/agent-runs/harness-contract.md, almanac/architecture/agent-runs/provider-adapters.md, almanac/reference/harness-event-shape.md, almanac/guides/add-a-harness-provider-adapter.md, src/codealmanac/integrations/harnesses/yoke/adapter.py
- **作业生命周期、launchd 自动化与本地状态**：importance `high`
  - source_paths: almanac/reference/local-state-layout.md, almanac/reference/runs/run-states-and-events.md, almanac/reference/config-keys.md, almanac/architecture/telemetry.md, almanac/architecture/setup/automation-and-update.md

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

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `0f153501f40a6596fe7c47dc6198eda149363135`
- inspected_files: `README.md`, `pyproject.toml`, `uv.lock`, `docs/architecture-audit-2026-06-08/README.md`, `docs/architecture-audit-2026-06-08/completion-audit.md`, `docs/architecture-audit-2026-06-08/refactor-roadmap.md`, `docs/architecture-audit-2026-06-08/reports/facade-boundary-entrypoints.md`, `docs/architecture-audit-2026-06-08/reports/lifecycle-command-boundaries.md`, `docs/architecture-audit-2026-06-08/reports/prior-art-patterns.md`, `docs/architecture-audit-2026-06-08/reports/provider-harness-boundaries.md`, `docs/architecture-audit-2026-06-08/reports/wiki-storage-query-boundaries.md`, `docs/architecture-audit-2026-06-08/research-notes.md`, `docs/architecture-audit-2026-06-08/smells.md`, `docs/architecture-audit-2026-06-08/source-map.md`, `docs/architecture-audit-2026-06-08/subagent-briefs.md`, `docs/architecture-audit-2026-06-08/target-architecture.md`, `docs/architecture-audit-2026-06-08/worklog.md`, `docs/bugs/codealmanac-install-audit.md`, `docs/bugs/codealmanac-known-bugs.md`, `docs/bugs/codebase-wiki.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: 来源证据：Windows support (Currently errors with No module named 'termios').

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Windows support (Currently errors with No module named 'termios').
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/AlmanacCode/codealmanac/issues/24 | 来源讨论提到 windows 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 2: 来源证据：bug: docs/concepts.md lists build as a public command but codealmanac build is rejected

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：bug: docs/concepts.md lists build as a public command but codealmanac build is rejected
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/AlmanacCode/codealmanac/issues/35 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 3: 来源证据：Not Detecting Codex CLI

- Trigger: GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：Not Detecting Codex CLI
- Why it matters: 可能影响授权、密钥配置或安全边界。
- Evidence: community_evidence:github | https://github.com/AlmanacCode/codealmanac/issues/1 | 来源讨论提到 npm 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 4: 来源证据：bug: dev dependency httpx2 is unused - looks like a typo for httpx

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：bug: dev dependency httpx2 is unused - looks like a typo for httpx
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能影响升级、迁移或版本选择。
- Evidence: community_evidence:github | https://github.com/AlmanacCode/codealmanac/issues/33 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 5: 来源证据：bug: setup --yes crashes on Linux because scheduled automation is macOS/launchd-only

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：bug: setup --yes crashes on Linux because scheduled automation is macOS/launchd-only
- Why it matters: 可能阻塞安装或首次运行。
- Evidence: community_evidence:github | https://github.com/AlmanacCode/codealmanac/issues/31 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 6: 来源证据：bug: two updates can run at the same time and corrupt things

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：bug: two updates can run at the same time and corrupt things
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/AlmanacCode/codealmanac/issues/26 | 来源类型 github_issue 暴露的待验证使用条件。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

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

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

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

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

### Constraint 9: 来源证据：bug: getting error launchctl bootout failed

- Trigger: GitHub 社区证据显示该项目存在一个运行相关的待验证问题：bug: getting error launchctl bootout failed
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/AlmanacCode/codealmanac/issues/30 | 来源讨论提到 linux 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

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

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