# statewave - Doramagic AI Context Pack

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

## 充分原则

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

## 给宿主 AI 的使用方式

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

## 怎么开始

- `pip install -e ".[dev,llm]"` 证据：`README.md` Claim：`clm_0003` supported 0.86
- `npm install @statewavedev/connectors-github` 证据：`README.md` Claim：`clm_0004` supported 0.86
- `npm install @statewavedev/connectors-markdown` 证据：`README.md` Claim：`clm_0005` supported 0.86
- `npm install @statewavedev/connectors-slack` 证据：`README.md` Claim：`clm_0006` supported 0.86
- `npm install @statewavedev/connectors-n8n` 证据：`README.md` Claim：`clm_0007` supported 0.86
- `npm install @statewavedev/connectors-zapier` 证据：`README.md` Claim：`clm_0008` supported 0.86
- `npm install @statewavedev/mcp-server` 证据：`README.md` Claim：`clm_0009` supported 0.86

## 继续前判断卡

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

### 30 秒判断

- **现在怎么做**：需要管理员/安全审批
- **最小安全下一步**：先跑 Prompt Preview；若涉及凭证或企业环境，先审批再试装
- **先别相信**：工具权限边界不能在安装前相信。
- **继续会触碰**：命令执行、本地环境或项目文件、环境变量 / API Key

### 现在可以相信

- **适合人群线索：正在使用 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）：MCP/tool 类项目通常会触碰文件、网络、浏览器或外部 API，必须真实检查权限和日志。
- **真实输出质量不能在安装前相信。**（unverified）：Prompt Preview 只能展示引导方式，不能证明真实项目中的结果质量。
- **宿主 AI 版本兼容性不能在安装前相信。**（unverified）：Claude、Cursor、Codex、Gemini 等宿主加载规则和版本差异必须在真实环境验证。
- **不会污染现有宿主 AI 行为，不能直接相信。**（inferred）：Skill、plugin、AGENTS/CLAUDE/GEMINI 指令可能改变宿主 AI 的默认行为。
- **可安全回滚不能默认相信。**（unverified）：除非项目明确提供卸载和恢复说明，否则必须先在隔离环境验证。
- **真实安装后是否与用户当前宿主 AI 版本兼容？**（unverified）：兼容性只能通过实际宿主环境验证。
- **项目输出质量是否满足用户具体任务？**（unverified）：安装前预览只能展示流程和边界，不能替代真实评测。
- **安装命令是否需要网络、权限或全局写入？**（unverified）：这影响企业环境和个人环境的安装风险。 证据：`README.md`

### 继续会触碰什么

- **命令执行**：包管理器、网络下载、本地插件目录、项目配置或用户主目录。 原因：运行第一条命令就可能产生环境改动；必须先判断是否值得跑。 证据：`README.md`
- **本地环境或项目文件**：安装结果、插件缓存、项目配置或本地依赖目录。 原因：安装前无法证明写入范围和回滚方式，需要隔离验证。 证据：`README.md`
- **环境变量 / API Key**：项目入口文档明确出现 API key、token、secret 或账号凭证配置。 原因：如果真实安装需要凭证，应先使用测试凭证并经过权限/合规判断。 证据：`DOCKER.md`, `README.md`, `helm/statewave/README.md`, `infra/postgres-pgvector/README.md` 等
- **宿主 AI 上下文**：AI Context Pack、Prompt Preview、Skill 路由、风险规则和项目事实。 原因：导入上下文会影响宿主 AI 后续判断，必须避免把未验证项包装成事实。

### 最小安全下一步

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

### 退出方式

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

## 哪些只能预览

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

## 哪些必须安装后验证

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

## 边界与风险判断卡

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

### 上下文规模

- 文件总数：230
- 重要文件覆盖：40/230
- 证据索引条目：50
- 角色 / Skill 条目：17

### 证据不足时的处理

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

## Prompt Recipes

### 适配判断

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

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

### 安装前体验

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

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

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


## 角色 / Skill 索引

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

- **Statewave**（project_doc）：! CI https://github.com/smaramwbc/statewave/workflows/CI/badge.svg https://github.com/smaramwbc/statewave/actions/workflows/ci.yml ! License: AGPL-3.0 + Commercial https://img.shields.io/badge/license-AGPL--3.0%20%2B%20Commercial-blue.svg LICENSING.md ! Python 3.11+ https://img.shields.io/badge/python-3.11%2B-blue.svg https://www.python.org/ 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`README.md`
- **Statewave Helm chart**（project_doc）：Deploys the Statewave API on Kubernetes. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`helm/statewave/README.md`
- **Fly Postgres + pgvector — deployment runbook**（project_doc）：Fly Postgres + pgvector — deployment runbook 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`infra/postgres-pgvector/README.md`
- **Server-side evals**（project_doc）：Internal regression tools for measuring server behaviour. These hit a live Statewave deployment admin endpoints included and are intended for the maintainers of this repo, not for external developers — see statewave-examples https://github.com/smaramwbc/statewave-examples for developer-facing demos. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`scripts/eval/README.md`
- **Contributing to Statewave**（project_doc）：Thanks for your interest in contributing — Statewave is built in the open and external contributions are very welcome. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`CONTRIBUTING.md`
- **Statewave Commercial Licensing — Tiers**（project_doc）：Statewave Commercial Licensing — Tiers 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/licensing.md`
- **Memory portability — admin API reference**（project_doc）：Memory portability — admin API reference 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/memory-portability.md`
- **State-assembly receipts — design & reference**（project_doc）：State-assembly receipts — design & reference 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/state-assembly-receipts.md`
- **Description**（project_doc）：- 🐛 Bug fix non-breaking change that fixes an issue - ✨ New feature non-breaking change that adds functionality - 💥 Breaking change fix or feature that would cause existing functionality to change - 📚 Documentation update - 🔧 Maintenance refactoring, dependencies, CI, etc. - 🧪 Test improvement 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`.github/PULL_REQUEST_TEMPLATE.md`
- **Code of Conduct**（project_doc）：Statewave adopts the Contributor Covenant, version 2.1 as its Code of Conduct. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`CODE_OF_CONDUCT.md`
- **Statewave Commercial License**（project_doc）：Statewave is dual-licensed. You may use it under the terms of the GNU Affero General Public License v3.0 LICENSE , or under a separate commercial license agreement with Statewave. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`COMMERCIAL-LICENSE.md`
- **Statewave server**（project_doc）：Open-source memory runtime for AI agents — episodes in, distilled memories out. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`DOCKER.md`
- **Licensing**（project_doc）：1. Open source — GNU Affero General Public License v3.0 LICENSE AGPLv3 2. Commercial — a separate Statewave Commercial License COMMERCIAL-LICENSE.md for proprietary, SaaS, embedded, hosted, or enterprise use. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`LICENSING.md`
- **NOTICE**（project_doc）：Statewave Copyright c Statewave contributors. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`NOTICE.md`
- **Security Policy**（project_doc）：Version Supported ------- ------------------ latest ✅ < latest ❌ upgrade recommended 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`SECURITY.md`
- **Support**（project_doc）：Welcome to Statewave! Here's how to get help. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`SUPPORT.md`
- **Statewave Trademark Policy**（project_doc）：The name "Statewave" , the Statewave logo, and related branding the "Statewave Marks" are project and company marks. The open-source license that covers the source code of Statewave AGPLv3 does not grant any rights to use the Statewave Marks. This policy describes the limited use we permit without a separate written agreement. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`TRADEMARKS.md`

## 证据索引

- 共索引 50 条证据。

- **Statewave**（documentation）：! CI https://github.com/smaramwbc/statewave/workflows/CI/badge.svg https://github.com/smaramwbc/statewave/actions/workflows/ci.yml ! License: AGPL-3.0 + Commercial https://img.shields.io/badge/license-AGPL--3.0%20%2B%20Commercial-blue.svg LICENSING.md ! Python 3.11+ https://img.shields.io/badge/python-3.11%2B-blue.svg https://www.python.org/ 证据：`README.md`
- **Statewave Helm chart**（documentation）：Deploys the Statewave API on Kubernetes. 证据：`helm/statewave/README.md`
- **Fly Postgres + pgvector — deployment runbook**（documentation）：Fly Postgres + pgvector — deployment runbook 证据：`infra/postgres-pgvector/README.md`
- **Server-side evals**（documentation）：Internal regression tools for measuring server behaviour. These hit a live Statewave deployment admin endpoints included and are intended for the maintainers of this repo, not for external developers — see statewave-examples https://github.com/smaramwbc/statewave-examples for developer-facing demos. 证据：`scripts/eval/README.md`
- **Contributing to Statewave**（documentation）：Thanks for your interest in contributing — Statewave is built in the open and external contributions are very welcome. 证据：`CONTRIBUTING.md`
- **License**（source_file）：GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 证据：`LICENSE`
- **Statewave Commercial Licensing — Tiers**（documentation）：Statewave Commercial Licensing — Tiers 证据：`docs/licensing.md`
- **Memory portability — admin API reference**（documentation）：Memory portability — admin API reference 证据：`docs/memory-portability.md`
- **State-assembly receipts — design & reference**（documentation）：State-assembly receipts — design & reference 证据：`docs/state-assembly-receipts.md`
- **Description**（documentation）：- 🐛 Bug fix non-breaking change that fixes an issue - ✨ New feature non-breaking change that adds functionality - 💥 Breaking change fix or feature that would cause existing functionality to change - 📚 Documentation update - 🔧 Maintenance refactoring, dependencies, CI, etc. - 🧪 Test improvement 证据：`.github/PULL_REQUEST_TEMPLATE.md`
- **Code of Conduct**（documentation）：Statewave adopts the Contributor Covenant, version 2.1 as its Code of Conduct. 证据：`CODE_OF_CONDUCT.md`
- **Statewave Commercial License**（documentation）：Statewave is dual-licensed. You may use it under the terms of the GNU Affero General Public License v3.0 LICENSE , or under a separate commercial license agreement with Statewave. 证据：`COMMERCIAL-LICENSE.md`
- **Statewave server**（documentation）：Open-source memory runtime for AI agents — episodes in, distilled memories out. 证据：`DOCKER.md`
- **Licensing**（documentation）：1. Open source — GNU Affero General Public License v3.0 LICENSE AGPLv3 2. Commercial — a separate Statewave Commercial License COMMERCIAL-LICENSE.md for proprietary, SaaS, embedded, hosted, or enterprise use. 证据：`LICENSING.md`
- **NOTICE**（documentation）：Statewave Copyright c Statewave contributors. 证据：`NOTICE.md`
- **Security Policy**（documentation）：Version Supported ------- ------------------ latest ✅ < latest ❌ upgrade recommended 证据：`SECURITY.md`
- **Support**（documentation）：Welcome to Statewave! Here's how to get help. 证据：`SUPPORT.md`
- **Statewave Trademark Policy**（documentation）：The name "Statewave" , the Statewave logo, and related branding the "Statewave Marks" are project and company marks. The open-source license that covers the source code of Statewave AGPLv3 does not grant any rights to use the Statewave Marks. This policy describes the limited use we permit without a separate written agreement. 证据：`TRADEMARKS.md`
- **Manifest**（structured_config）：{ "format": "statewave-starter-pack", "format version": 1, "pack id": "demo-coding-assistant", "display name": "Coding Assistant", "description": "Coding-assistant showcase pack: a developer Priya working on the Stratus codebase across roughly two months. Captures stack choices TS strict + Tailwind frontend, FastAPI + SQLModel + Pydantic v2 backend , style preferences composition over inheritance, top-level async, conventional-commits , an architecture decision log, an in-flight auth-middleware refactor with a documented blocker, a session-pool race fix that becomes a reusable diagnostic, and a no-mocks test policy traced to a real incident. Demonstrates preference layering, decision proven… 证据：`server/starter_packs/demo-coding-assistant/manifest.json`
- **Manifest**（structured_config）：{ "format": "statewave-starter-pack", "format version": 1, "pack id": "demo-devops-agent", "display name": "DevOps Agent", "description": "DevOps showcase pack: an SRE running the nimbus-api service across three months \u2014 March pool-exhaustion outage with PgBouncer mitigation, secrets/backup/DB-failover runbooks, observability stack decision Datadog over Grafana Cloud , a noisy-alerts post-mortem that rewrote alert thresholds, a TLS rotation incident that split staging/prod issuers, deploy-window and phased-migration policies, and a canary deploy framework that cut rollback time from 6m to 30s. Demonstrates runbook recall, decision provenance, recurring-incident detection, and operation… 证据：`server/starter_packs/demo-devops-agent/manifest.json`
- **Manifest**（structured_config）：{ "format": "statewave-starter-pack", "format version": 1, "pack id": "demo-research-assistant", "display name": "Research Assistant", "description": "Research-assistant showcase pack: a researcher Arushi writing a NeurIPS 2026 submission on agent memory across four months \u2014 citation conventions, an active draft with section-level progress and a settled architectural decision hard temporal-validity cutoffs over sigmoid decay , a co-author dynamic with Dr. Mei Wu at Berkeley, two empirical experiments compiler-density and multi-session-recall that supply paper results, an ICLR 2026 poster acceptance, a tooling stack with explicit anti-preferences, and personal work habits. Demonstrates… 证据：`server/starter_packs/demo-research-assistant/manifest.json`
- **Manifest**（structured_config）：{ "format": "statewave-starter-pack", "format version": 1, "pack id": "demo-sales-copilot", "display name": "Sales Copilot", "description": "Sales-copilot showcase pack: a rep Tom running a four-account pipeline across three months \u2014 Acme Corp closed expansion + Q3 renewal vector , BetaTech SOC 2 cleared, in pricing negotiation , Cirrus Robotics churned then re-engaged with a new VP , and Delta Health HIPAA / BAA prospect . Captures decision-makers, contact preferences, AE routing, competitive positioning vs Mem0, HIPAA procurement order, and a closing-quarter pipeline summary. Demonstrates multi-subject identity, cross-account procedures, deal-stage history, win-back signals, and comp… 证据：`server/starter_packs/demo-sales-copilot/manifest.json`
- **Manifest**（structured_config）：{ "format": "statewave-starter-pack", "format version": 1, "pack id": "demo-support-agent", "display name": "Default Support Agent", "description": "Customer-support showcase pack: a multi-session story arc for one representative customer Northwind Logistics, Team plan, EU region covering onboarding, integration preferences, an SSO incident, repeat-issue detection, billing, an SLA-breached ticket with service credit, and a renewal signal. Demonstrates identity persistence, preference layering, procedure recall, prior-issue surfacing, and SLA awareness.", "version": "2.2026.05.06-focused", "created at": "2026-05-06T15:25:56.070391+00:00", "subject id suggestion": "demo-support-agent", "episo… 证据：`server/starter_packs/demo-support-agent/manifest.json`
- **Index**（structured_config）：{ "format": "statewave-starter-pack-index", "format version": 1, "packs": { "pack id": "statewave-support-agent", "kind": "support docs", "directory": "statewave-support-agent" }, { "pack id": "demo-support-agent", "kind": "demo agent", "directory": "demo-support-agent" }, { "pack id": "demo-coding-assistant", "kind": "demo agent", "directory": "demo-coding-assistant" }, { "pack id": "demo-sales-copilot", "kind": "demo agent", "directory": "demo-sales-copilot" }, { "pack id": "demo-devops-agent", "kind": "demo agent", "directory": "demo-devops-agent" }, { "pack id": "demo-research-assistant", "kind": "demo agent", "directory": "demo-research-assistant" } } 证据：`server/starter_packs/index.json`
- **Manifest**（structured_config）：{ "format": "statewave-starter-pack", "format version": 1, "pack id": "statewave-support-agent", "display name": "Statewave Support", "description": "Full Statewave Support docs pack \u2014 every curated section in statewave-docs chunked at heading boundaries, ingested as episodes, and compiled to memories. Importing this pack into the statewave-support-docs subject powers the docs-grounded support agent on day one with no extra bootstrap step.", "version": "1.2026.05.08", "created at": "2026-05-08T13:35:42.704407+00:00", "subject id suggestion": "statewave-support-docs", "episode count": 276, "memory count": 364, "source count": 0, "tags": "starter-pack", "platform-bundled", "docs-grounded… 证据：`server/starter_packs/statewave-support-agent/manifest.json`
- **Build context exclusions for docker build / docker compose build .**（source_file）：Build context exclusions for docker build / docker compose build . Keeps developer-local config and dev artifacts OUT of the image, so the environment: block in docker-compose.yml is the single source of truth for runtime config — no surprise overrides from a baked-in .env . 证据：`.dockerignore`
- **──────────────────────────────────────────────────**（source_file）：────────────────────────────────────────────────── Statewave — Environment Configuration Quickstart: 1. cp .env.example .env 2. Set STATEWAVE LITELLM API KEY below recommended . 3. docker compose up -d All variables are prefixed STATEWAVE . Values left commented use the defaults baked into server/core/config.py. ────────────────────────────────────────────────── 证据：`.env.example`
- **Funding**（source_file）：github: smaramwbc 证据：`.github/FUNDING.yml`
- **Dependabot**（source_file）：version: 2 updates: - package-ecosystem: "pip" directory: "/" schedule: interval: "weekly" open-pull-requests-limit: 10 labels: - "dependencies" commit-message: prefix: "chore deps :" 证据：`.github/dependabot.yml`
- **.gitignore**（source_file）：pycache / .pyc .env .egg-info/ dist/ .venv/ .pytest cache/ 证据：`.gitignore`
- **Dockerfile**（source_file）：COPY pyproject.toml README.md ./ RUN pip install --no-cache-dir ". llm " 证据：`Dockerfile`
- **Alembic**（source_file）：alembic script location = alembic sqlalchemy.url = postgresql+asyncpg://statewave:statewave@localhost:5432/statewave 证据：`alembic.ini`
- **Override sqlalchemy.url from env. STATEWAVE DATABASE URL is the first-class**（source_file）："""Alembic env — async Postgres migrations.""" 证据：`alembic/env.py`
- **revision identifiers, used by Alembic.**（source_file）：Revision ID: ${up revision} Revises: ${down revision comma,n} Create Date: ${create date} """ from typing import Sequence, Union 证据：`alembic/script.py.mako`
- **Default to the published multi-arch image — docker compose up -d works**（source_file）：services: db: image: pgvector/pgvector:pg16 environment: POSTGRES USER: statewave POSTGRES PASSWORD: statewave POSTGRES DB: statewave ports: - "5432:5432" volumes: - pgdata:/var/lib/postgresql/data healthcheck: test: "CMD-SHELL", "pg isready -U statewave" interval: 2s timeout: 5s retries: 10 证据：`docker-compose.yml`
- **Production seeds the docs pack via the dedicated GitHub Actions**（source_file）：app = 'statewave-api' primary region = 'ord' 证据：`fly.toml`
- **Pyproject**（source_file）：project name = "statewave" version = "0.8.0" description = "Open-source memory runtime for AI agents — durable, structured context with provenance." readme = "README.md" license = {text = "AGPL-3.0-only OR LicenseRef-Statewave-Commercial"} requires-python = " =3.11" dependencies = "fastapi =0.111, =0.29, =2.7, =2.2, =2.0, =0.29, =1.13, =0.3, =0.7, =24.1, =6,<7", 证据：`pyproject.toml`
- **Allow running as python scripts/bootstrap docs pack.py from repo root**（source_file）："""Bootstrap the default Statewave support docs memory pack. 证据：`scripts/bootstrap_docs_pack.py`
- **Each persona has:**（source_file）："""Bootstrap subject snapshots for demo instant seeding. 证据：`scripts/bootstrap_snapshots.py`
- **─── Per-persona expansion content ──────────────────────────────────────────**（source_file）："""Rebuild the 5 bundled demo starter packs with denser, narrative-consistent content that can sustain 8–10 visitor turns of recallable context. 证据：`scripts/build_demo_packs.py`
- **Allow running as python scripts/build support pack.py from repo root**（source_file）："""Build the bundled Statewave Support starter pack from the live docs corpus. 证据：`scripts/build_support_pack.py`
- **!/usr/bin/env python**（source_file）：!/usr/bin/env python """Bump or verify the project version across all user-facing surfaces. 证据：`scripts/bump_version.py`
- **Triple shape: source, type, payload-dict . The payload's content field is**（source_file）："""New-episode content for the 5 demo persona packs. 证据：`scripts/demo_pack_expansions.py`
- **Curated allowlist — see statewave-docs/default-support-docs-pack.md**（source_file）："""Statewave docs → episodes loader. 证据：`scripts/docs_loader.py`
- **!/usr/bin/env python**（source_file）：!/usr/bin/env python """Migration preflight check. 证据：`scripts/preflight.py`
- **─── Narrative seed data ─────────────────────────────────────────────────────**（source_file）："""Re-seed the website demo subjects with rich many-to-one provenance. 证据：`scripts/seed_demo_subjects.py`
- **Compile job retention**（source_file）：import asyncio from contextlib import asynccontextmanager from importlib.metadata import PackageNotFoundError, version 证据：`server/app.py`
- **Main**（source_file）："""Entrypoint for running the server directly.""" 证据：`server/main.py`
- **!/bin/sh**（source_file）：!/bin/sh Boot script for the Fly.io machine. We wait for Postgres to be reachable before running migrations. On Fly especially with auto stop machines=suspend the database can briefly refuse connections during a wake-up, which previously crashed alembic and put the machine in a restart loop. The retry loop turns that into a soft delay instead of a fatal boot. 证据：`start.sh`
- **Dispose engine after test to ensure clean state for next test**（source_file）：import pytest from httpx import ASGITransport, AsyncClient 证据：`tests/conftest.py`

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

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

- **Statewave 简介**：importance `high`
  - source_paths: README.md, server/app.py, server/main.py
- **快速开始**：importance `high`
  - source_paths: docker-compose.yml, DOCKER.md, .env.example, pyproject.toml
- **系统架构概览**：importance `high`
  - source_paths: server/app.py, server/core/config.py, server/core/dependencies.py, server/api/__init__.py, server/db/engine.py
- **数据流与生命周期**：importance `high`
  - source_paths: server/api/episodes.py, server/api/memories.py, server/api/context.py, server/services/context.py, server/services/compiler.py
- **Episode 管理**：importance `high`
  - source_paths: server/api/episodes.py, server/schemas/requests.py, server/schemas/responses.py, server/domain/models.py
- **编译器系统**：importance `high`
  - source_paths: server/services/compiler.py, server/services/compilers/heuristic.py, server/services/compilers/llm.py, server/services/compile_jobs.py, server/services/compile_jobs_durable.py
- **上下文检索与排名**：importance `high`
  - source_paths: server/api/context.py, server/services/context.py, server/services/health.py, server/services/sla.py, server/services/embeddings/litellm.py
- **API 路由参考**：importance `high`
  - source_paths: server/api/episodes.py, server/api/memories.py, server/api/context.py, server/api/subjects.py, server/api/resolutions.py

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

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `b2bd8ef853bfa4894f9575890cf0957882f4526b`
- inspected_files: `pyproject.toml`, `Dockerfile`, `README.md`, `docker-compose.yml`, `docs/state-assembly-receipts.md`, `docs/memory-portability.md`, `docs/licensing.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: 能力判断依赖假设

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

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

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

### Constraint 3: 下游验证发现风险项

- Trigger: no_demo
- Host AI rule: 进入安全/权限治理复核队列。
- Why it matters: 下游已经要求复核，不能在页面中弱化。
- Evidence: downstream_validation.risk_items | github_repo:1219923941 | https://github.com/smaramwbc/statewave | no_demo; severity=medium
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

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

- Trigger: no_demo
- Host AI rule: 把风险写入边界卡，并确认是否需要人工复核。
- Why it matters: 风险会影响是否适合普通用户安装。
- Evidence: risks.scoring_risks | github_repo:1219923941 | https://github.com/smaramwbc/statewave | no_demo; severity=medium
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

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

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

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

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