建立 Watchman 规划基线,并接入 Marionettist Cursor 工作流。
公司规范只约束代码内容,门禁仍按插件执行;MCP token 不入库。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
8b2a809f06
73 files changed
+8661
No files matched your search
@@ -0,0 +1,82 @@
|
||||
# 多 Agent 协作、模型与审查门禁
|
||||
|
||||
## 1. 角色职责
|
||||
|
||||
| 角色 | 做什么 | 不做什么 |
|
||||
|---|---|---|
|
||||
| 主 Agent/协调者 | 拆分、提问、锁定契约、委派、集成结果、核对证据、更新 docs | 不亲自实现业务代码;不把自己审查冒充独立 review |
|
||||
| 实现子 Agent | 承接模块内步骤,实现、补测试、自测和返回结果 | 不扩范围、不改决策、不判模块 DONE |
|
||||
| 审查子 Agent | 看差异及必要上下文、数据/安全/测试/需求评审 | 默认不改代码;不审自己写的实现 |
|
||||
| 测试子 Agent | 执行正式测试、记录命令和真实输出、识别失败 | 不改产品绕过失败;不将未执行写成通过 |
|
||||
| 浏览器子 Agent | Playwright 操作、断言、截图、报告样式问题 | 不裁决权限、事务或业务口径,不代替单元测试 |
|
||||
|
||||
主 Agent 可写任务和进度文档。子 Agent 证据可写入获分配的任务目录,主 Agent 汇总状态。一次只有一个实现写入者;review 和正式测试在候选冻结后进行,避免读到中途代码。
|
||||
|
||||
2026-11-17 起以模块大任务为单位,一个会话聚焦一个 Mxx。主 Agent 自主拆内部步骤并连续委派,不逐接口向用户要“继续”。同模块可以多次派发短上下文给实现子 Agent;用户不需要管理它们。内部高风险步骤可先审,但交付需模块整体 review 和集成测试;无需每个字段建独立任务与报告。
|
||||
|
||||
## 2. 模型配置先发现、后选择
|
||||
|
||||
下表是角色要求,不是已经配置的模型。
|
||||
|
||||
| 角色 | 选择标准 | 当前真实模型 ID |
|
||||
|---|---|---|
|
||||
| 主 Agent | 长上下文、计划、工具及可靠委派 | 未确认 |
|
||||
| 实现 | 当前环境可用的主流强编码模型;若用户限定 Grok 则选其已获准可用版本 | 未确认 |
|
||||
| Reviewer | 与实现**不同系列**,擅长推理/编码/安全;不能只是同系列不同大小 | 未确认 |
|
||||
| 正式后端测试 | 能准确执行和解释输出,适配测试工具 | 未确认 |
|
||||
| Playwright 执行 | 快速低成本、有工具能力,需要看图时具视觉能力 | 未确认 |
|
||||
|
||||
必须先确认 Cursor 版本/套餐的子 Agent 与模型路由能力。OpenCode 的可用模型列表不代表 Cursor 的可用列表;不得写入猜测的 provider/model ID。无法指定子模型时可请求用户人工开两个不同模型会话,或批准其他工具方案。未经用户同意不能退化为同一个 Agent 的自我审查。
|
||||
|
||||
“最出名”不是可执行验收标准。以用户可用、数据授权、任务能力和成本为准,技术验证后记录。不同系列不强制不同服务商,但不同服务商必须另核验资料授权。
|
||||
|
||||
## 3. 资料与模型权限
|
||||
|
||||
资料:交接需求和规划、未来源码、合成样例、真实业务数据、日志截图、凭证分开授权。原来对 OpenAI 处理会议的授权不等于允许发送给 Grok、其他 reviewer 或浏览器云服务。
|
||||
|
||||
默认只传当前任务所需的交接文档片段和获准代码,不传完整会议;无明确授权不读取参考绝对路径的内部原始文件。凭证一律不进入模型上下文;真实 UI 截图也要脱敏。只运行本地或获准测试工具,不默认上传第三方。
|
||||
|
||||
## 4. 模块任务与内部派发包
|
||||
|
||||
主 Agent 必须给子 Agent:
|
||||
|
||||
1. 大任务 Mxx、当前内部步骤、目标行为和明确不做事项。
|
||||
2. 需求条款、已定决策及不能擅自确定的问题。
|
||||
3. 当前可依赖的代码/接口和候选版本。
|
||||
4. 允许写文件、禁止改文件、共享文件预约。
|
||||
5. 正常、边界、失败、权限和重复用例;UI 则给视口和交互。
|
||||
6. 预期结果格式、证据目录、当前真实/Mock 条件。
|
||||
7. 不明即提问的规则;不得凭空补充接口或调用不存在服务。
|
||||
|
||||
## 5. Reviewer 清单
|
||||
|
||||
- 是否只完成本片,是否遗漏用户已确认条件;有没有客户专用硬编码。
|
||||
- 事务、唯一约束、防重、并发、版本引用、重启恢复是否正确。
|
||||
- 只读和查询范围、OIDC 与数据授权、秘密和错误日志是否安全。
|
||||
- Cron 语义是否前后端一致;输入身份、业务次数与重试是否混淆。
|
||||
- 返回值是否区分失败、空数据、UNKNOWN 和发送结果不明。
|
||||
- 测试是否真正断言行为,有无跳过、只测 Mock 或删除失败用例。
|
||||
- UI 是否处理加载、空、失败、无权限和窄视口,文本是否溢出。
|
||||
- 是否引入无用框架、隐含服务、无限重试或超范围重构。
|
||||
|
||||
问题分:阻断/高/中/低,写文件位置、影响、证据、建议。阻断及高风险未解决不通过。中低问题要有明确处置,不能“先放着”无记录。
|
||||
|
||||
## 6. 正式测试顺序
|
||||
|
||||
实现自测可以在 review 前;**正式门禁在 review 通过后**执行:静态/类型 → 单元 → 所需数据库/队列集成 → API → UI Playwright+截图 → 主 Agent 核验证据。纯文档或组件研究用适用的检查替代,不编造 pytest。
|
||||
|
||||
修复产品、测试、配置或依赖后,重新冻结候选并复审、重跑相关用例。测试失败不可由测试 Agent 顺手改产品;交还实现 Agent。
|
||||
|
||||
## 7. 证据和状态
|
||||
|
||||
建议路径:`docs/reviews/<ID>-r1.md`,`docs/evidence/<ID>/summary.md`,`docs/evidence/<ID>/screenshots/`,`docs/evidence/<ID>/traces/`。后二者默认不进 Git,摘要记录本地路径及内容;必须提供可查看证据,不能只写“截图已保存”。
|
||||
|
||||
候选有 commit 用 hash;用户未授权自动 commit 时用父 commit+diff 文件/内容 hash+环境锁定信息。不能只写模糊的“最新代码”。测试或 review 期间禁止并行修改候选共享文件。
|
||||
|
||||
主 Agent 在 progress 改模块状态;`tasks/Mxx.md` 记录内部步骤和详细结果。证据按 `Mxx/step-name` 需要归档,不必每步出一套正式报告;最终审查覆盖整个模块。真实系统未验收时只记本地结果,使用不同模型、工具、截图必须真实执行。
|
||||
|
||||
## 8. 恢复与异常
|
||||
|
||||
上下文中断后读取根 AGENTS、progress、decisions、当前卡及最新 handoff,先看工作区差异,再重派最小任务。不要重新初始化已有工程、覆盖用户改动或重复实际企微发送。
|
||||
|
||||
子 Agent 超时、不可用、模型不支持工具、权限不足或测试环境缺失时标阻塞并说明。主 Agent 不为赶进度悄悄代做。用户改变需求时先记录影响片再继续,不让不同 Agent 按不同版本并行实现。
|
||||
@@ -0,0 +1,60 @@
|
||||
# Cron 与调度复用方案(2026-11-17)
|
||||
|
||||
## 1. 结论
|
||||
|
||||
不自研 Cron 编辑器、表达式解析器、日期枚举算法或通用任务调度框架。优先复用开源组件,本项目只负责场景配置、权限、版本、任务身份、启停、防重及记录等必要衔接。以下是公开文档初筛,未安装、运行或完成兼容验证,不宣称库已选定。
|
||||
|
||||
## 2. 候选与职责
|
||||
|
||||
| 能力 | 优先候选 | 边界 |
|
||||
|---|---|---|
|
||||
| Vue3+Element Plus 可视化编辑 | `@vue-js-cron/element-plus` | 提供现成编辑 UI、v-model 和错误事件;仍保留文本输入及后端校验,不复制其源码重做组件 |
|
||||
| 后端表达式校验/下一时刻预览 | croniter | 解析和计算,不执行任务。支持语法可能多于本平台批准范围,应做轻量白名单/字段数限制,不重写解析器 |
|
||||
| 周期任务触发/排入队列 | Celery Beat | 已与 Celery/RabbitMQ 方向一致;优先原生周期与已维护的动态计划扩展/适配 |
|
||||
| 可替代调度框架 | APScheduler | 自带 CronTrigger、持久化、暂停、修改、misfire等;仅在评估替代调度角色时使用,不在 Beat 之外再叠一套同职责调度器 |
|
||||
|
||||
## 3. 计划如何做得简单
|
||||
|
||||
M08 内先做小范围兼容验证,然后在以下两条中选满足已确认需求的最简单方案,记录 ADR,不默认全部同时实施:
|
||||
|
||||
1. **库主导调度**:复用 Celery Beat 及合适的计划存储/schedule 适配。确认动态配置、版本、启停、时区、幂等身份均能衔接,再选用。不能因 FastAPI 项目而直接引入依赖 Django 的管理扩展或新数据库/Redis 服务。
|
||||
2. **Beat+成熟解析库+薄业务扫描**:Beat 定时触发统一业务检查;croniter 只计算已发布场景的下一时刻,PostgreSQL 记录计划身份与进度,Celery 执行任务。这不是自研 Cron 引擎,但确实有场景到期与事务衔接代码;只有原生/成熟扩展不适合动态配置时采用,不为架构好看扩大为通用 scheduler。
|
||||
|
||||
原规划把统一扫描写得过于固定,本次改成“优先成熟库、先验证后选最薄适配”。若评估选择 APScheduler 替代 Beat 的调度角色,需要告知用户及更新技术决策;不要悄悄同时运行两套系统。
|
||||
|
||||
## 4. 仍由本项目负责的业务逻辑
|
||||
|
||||
- 场景发布版本及动态计划同步;草稿不影响运行。
|
||||
- 正式/样例/历史运行的许可和副作用隔离。
|
||||
- 计划时刻与执行时刻、数据统计周期分开。
|
||||
- 业务唯一约束、执行重叠、重投与重启后的任务身份。
|
||||
- 停用/关闭后的未执行意图处理、运行与发送结果。
|
||||
|
||||
这些是业务衔接,不是重新造解析器。框架已有的暂停、重试、并发控制等优先配置复用,但要验证其语义是否覆盖本平台,而非再造同名能力。
|
||||
|
||||
## 5. 语义兼容验证
|
||||
|
||||
前端、解析器和真正调度不得各解释一套 Cron。Unix 与 Quartz 字段数、日与星期组合、星期起点及时区可能不同。
|
||||
|
||||
查阅资料可见:croniter 默认 DOM/DOW 使用 OR,并支持设置 AND;Celery crontab 文档要求相关日期字段共同匹配;APScheduler CronTrigger 也不应未经测试就当作 Unix OR。不能让预览采用 OR、执行采用 AND。若候选不支持所选语义,可限定输入组合、换 schedule 适配或统一采用经用户批准的方言,不能静默改变含义。
|
||||
|
||||
库的全部扩展能力不自动成为需求。表达式字段数、时区、DOM/DOW、漏跑及补跑仍按 `decisions.md` 确认;不用让用户选择库内部方法。对合法但稀疏或不存在的日期限制预览计算,避免无界搜索。
|
||||
|
||||
## 6. 选择验收
|
||||
|
||||
1. Vue3/Element Plus/TS 版本兼容、文本与可视化回显一致、中文可用性和许可证。
|
||||
2. 后端校验/预览/实际触发使用相同含义;月末、闰日、DOM/DOW 和时区有具体样例。
|
||||
3. 场景新增、修改、发布、停用能够动态生效,无需维护两份人工日程。
|
||||
4. 重复 tick/重启不盲目重复业务副作用;单 scheduler 实例不等于幂等保证。
|
||||
5. 锁定采用版本及依赖;不要按远端 `latest`/`main` 文档随意使用本地版本不存在的 API。
|
||||
|
||||
## 7. 公开来源
|
||||
|
||||
- Vue-js-cron Element Plus:https://abichinger.github.io/vue-js-cron/guide/getting-started-element-plus
|
||||
- 组件仓库:https://github.com/abichinger/vue-js-cron
|
||||
- Celery 周期任务:https://docs.celeryq.dev/en/stable/userguide/periodic-tasks.html
|
||||
- Celery crontab:https://docs.celeryq.dev/en/stable/reference/celery.schedules.html
|
||||
- croniter:https://github.com/pallets-eco/croniter
|
||||
- APScheduler 3.x 用户指南:https://apscheduler.readthedocs.io/en/3.x/userguide.html
|
||||
|
||||
查阅时间 2026-11-17。版本锁定和实际测试在获开工授权后进行;本次未安装任何依赖。
|
||||
@@ -0,0 +1,38 @@
|
||||
# Current System Map
|
||||
|
||||
记录 Watchman 今天的实际状态。这不是目标架构。
|
||||
|
||||
## Scope
|
||||
|
||||
- Area: 整个仓库的当前进度
|
||||
- Why this document exists: 避免把规划文档当成已经实现的系统
|
||||
- Last substantial verification date: 2026-11-17
|
||||
- Related rules: `AGENTS.md` 项目本地段
|
||||
|
||||
## Knowledge Status
|
||||
|
||||
- Facts confirmed:
|
||||
- 仓库目前是需求与开发规划,业务编码、依赖安装、数据库迁移和真实联调都还没开始
|
||||
- 已有进度、决策、开发计划、任务索引、测试计划和多 Agent 协作说明
|
||||
- 项目级公司规范 MCP 配在 `.cursor/mcp.json`,该文件被 gitignore
|
||||
- Cursor 侧已安装 Marionettist pathway:`.cursor/skills`、`.cursor/rules`、`.cursor/agents`、`.cursor/commands`
|
||||
- Inferences needing confirmation:
|
||||
- 无。技术选型已写在规划里,但仓库里还没有对应实现可以核对
|
||||
- Unknowns or missing evidence:
|
||||
- 尚无运行中的服务、数据表或页面可以观察
|
||||
|
||||
## Entrypoints
|
||||
|
||||
- Fact:
|
||||
- 开工前先读 `docs/progress.md`、`需求冻结文档_V1.1_交接稿.md`、`docs/decisions.md`
|
||||
- Unknown:
|
||||
- 还没有 API、页面、worker 或 CLI 入口
|
||||
|
||||
## Main Call Paths
|
||||
|
||||
1. Unknown: 业务调用链尚未实现。不要根据 `docs/development-plan.md` 描述当前运行路径。
|
||||
|
||||
## Safe Change Notes
|
||||
|
||||
- 可以改规划文档、交接记录和 Agent 规则
|
||||
- 没有明确开工指令时,不新增业务代码、依赖、迁移或联调
|
||||
@@ -0,0 +1,47 @@
|
||||
# 决策与阻塞
|
||||
|
||||
状态只有 CONFIRMED(用户已明确确认)、PROPOSED(建议)、OPEN(待问)、TECH_PENDING(实施验证)。主 Agent 负责更新,保存来源和历史,不把技术建议写成用户决定。
|
||||
|
||||
## 已确认
|
||||
|
||||
| ID | 结论 | 来源 |
|
||||
|---|---|---|
|
||||
| D01 | FastAPI/Pydantic,SQLAlchemy/Alembic,PostgreSQL,Celery/RabbitMQ,Vue3/TS/Vite/Element Plus,Pinia/Router,Casdoor,pytest/Playwright,Docker Compose | 2026-11-16 用户答复“技术没啥问题” |
|
||||
| D02 | Cron 直接配置,前端可有辅助编辑器,后端独立校验 | 用户本轮第 2 点 |
|
||||
| D03 | 先做次数升级,超时等其他升级后置 | 用户本轮第 3 点 |
|
||||
| D04 | B 阶段规则原因分析与 AI 并列;C 内置只读工具;不做 MCP 或微服务 | 本轮及之前明确答复 |
|
||||
| D05 | 同一输入不重新触发;关闭后新统计周期/新独立事件可新建并关联历史 | 本轮第 5 点 |
|
||||
| D06 | 目录 D:\PROJECT\watchman,授权 git init;本轮先规划不写业务代码 | 本轮第 6 点及任务要求 |
|
||||
| D07 | 主 Agent 把控,子 Agent 开发、独立 review 和测试;过程在 docs。原小片粒度由 D10 调整 | 用户补充要求及后续修订 |
|
||||
| D08 | 实现用强编码模型,review 用不同系列强模型,浏览器可快速便宜模型 | 用户补充方向,具体型号尚未指定 |
|
||||
| D09 | MES 通过配置,不做客户核心定制;大屏独立、能力模块为流程/指标/视频 | 前轮用户明确答复 |
|
||||
| D10 | 以功能模块为大任务,一个会话聚焦一个大任务;Agent 可自主拆小步骤逐步实现,不再由用户管理 133 小片 | 2026-11-17 用户修正 |
|
||||
| D11 | Cron 编辑和调度优先复用开源库/框架,不自行开发通用编辑器和调度引擎 | 2026-11-17 用户要求及本轮公开资料核查 |
|
||||
|
||||
## 冻结前/相关模块实现前必须确认
|
||||
|
||||
下表保留旧细项编号用于历史定位;当前阻塞单位按映射为:O01/O07→M08,O02/O03→M09,O04→M06/M09,O05→M06,O06→M05/M06,O08→M01及所有委派,O09→M01/M07/M08/M13,O10→M02。旧依赖不是当前大任务流程。
|
||||
|
||||
| ID | 状态 | 问题 | 建议供选择,非默认已批准 | 阻塞 |
|
||||
|---|---|---|---|---|
|
||||
| O01 | OPEN | Cron 方言、日期和星期组合语义、场景时区 | 建议 5 字段 Unix 分钟级,不支持秒/年/Quartz 特殊符号;DOM/DOW 按标准 Unix OR;显式 IANA 时区,项目可选 Asia/Shanghai。后端唯一解析,所有时区策略测试 | P-004、A-030~A-034 |
|
||||
| O02 | OPEN | 次数按什么分组、什么窗口、何时重置? | 只计去重后的独立 FAIL 输入。建议阶段 A 先固定日/周/月等窗口;窗口内按场景+对象+异常类别累计,跨周期或规则配置版本如何继承需确认;不把 Cron 每次执行直接算新错误 | P-005、A-048~A-054 |
|
||||
| O03 | OPEN | 每一级阈值是累加接收人还是替换?一次越过多级如何发? | 用户举例甲→甲乙→甲乙丙,建议显式配置每级最终目标;默认执行最高新命中级或逐级分别执行需用户选择;达到阈值触发,每级每窗口一次 | P-005、A-050~A-054 |
|
||||
| O04 | OPEN | 已关闭后新事件继续计入窗口吗?关闭时尚未发送的通知怎么办? | 建议关闭终结该报警未执行意图,新事件可新建但窗口次数不被人工关闭清零;任务必须绑定新报警身份;已受理消息不能撤回 | P-006、A-043、A-049、A-051 |
|
||||
| O05 | OPEN | 接手/关闭权限及关闭结果枚举 | 建议范围内处理者可接手,当前处理人或管理者可关闭,结果“已处理/误报”,说明必填;不做转派/重开 | P-006、A-041~A-043 |
|
||||
| O06 | OPEN | 同周期值更正是否更新原报警、是否允许新报警? | 同一输入身份重读不重报已确认;“版本变更”不能随意当新业务事件。建议保留修订记录,不自动重发,实际规则需批准 | P-006、A-023、A-039 |
|
||||
| O07 | OPEN | 停机漏跑、跨周期任务重叠、启停及改 Cron 后的旧任务 | 建议每场景不并发推进进度,逾期运行有界跳过/显式补跑且不自动补发历史消息;用户需确认具体业务行为 | P-004、A-033~A-036 |
|
||||
| O08 | OPEN | Cursor/Grok 等实际服务商能处理哪些项目资料?能否跨系列子 Agent? | 先确认交接文档、未来源码、合成数据和截图授权;默认不读取原会议或 MES 原始资料,不发真实凭证。用可用模型目录填写角色映射,不能默认已获所有服务商授权 | 所有实际模型委派 |
|
||||
| O09 | TECH_PENDING | Python/Node/依赖版本,Cron 解析器和编辑组件,AI SDK,企微库 | 由子 Agent 查官方资料做小验证,主 Agent 记录版本和理由;涉及新服务商或重大基础设施须问用户 | P-002、P-004、A-056、B-001 |
|
||||
| O10 | TECH_PENDING | Casdoor issuer/client/audience、角色和数据范围映射 | 使用隔离测试租户/合成身份,正式配置需维护方提供;签名、issuer、audience、有效期和权限都检验 | A-008~A-010、A-074 |
|
||||
|
||||
O01~O07 不要求全在第一天解决,但其依赖切片不能带着猜测宣布完成。用户可一次批准建议,也可逐项给不同口径。无关切片在授权开工后仍可推进。
|
||||
|
||||
## 技术计划(未冒充业务确认)
|
||||
|
||||
- PostgreSQL 持久记录事实及任务,RabbitMQ 仅分发,Celery result backend 不作为业务记录;暂不引入 Redis。
|
||||
- 调度先评估 Celery Beat 原生及成熟扩展/薄适配;统一业务扫描仅作为已维护库无法直接适配动态场景时的简化路径,不强制自研一套调度器。Cron 组件候选和公开来源见 `cron-reuse.md`。
|
||||
- 推荐事务 Outbox+业务唯一约束;投递可能重复,外部发送结果可不确定,不承诺严格一次。
|
||||
- Cron 预览和到期计算共用后端实现;不能前端 Unix OR、后端 Celery crontab AND 各解释一套。
|
||||
|
||||
以上在规划技术验证片确认可行性后记录实施决策;无需让用户选择不影响业务含义的内部函数或库名。
|
||||
@@ -0,0 +1,192 @@
|
||||
# Watchman 开发任务规划书 V2.0
|
||||
|
||||
**修订日期:2026-11-17|状态:模块级规划交接稿,不是开工指令**
|
||||
|
||||
本书与根目录需求交接稿、`decisions.md` 配套使用。本文给技术路线和任务方法;当前任务是 `tasks/INDEX.md` 中 15 个模块级大任务,一个会话聚焦一个模块,内部步骤由 Agent 自行拆解。原 133 小片改为 `tasks/CHECKLIST-v1.md` 覆盖参考,不再逐项对外管理。未读过对话的 Agent 从根 AGENTS 和 progress 开始。
|
||||
|
||||
## 1. 目标与优先级
|
||||
|
||||
首个交付是在隔离环境可运行、具备真实接入适配条件的规则监控链路;真实接入是否通过另行验收。MES 指标由配置实现,不修改 MES 作为运行前提,也不做客户专用核心分支。
|
||||
|
||||
| 顺序 | 交付 | 明确排除 |
|
||||
|---|---|---|
|
||||
| P:计划与技术验证 | 模型和授权、版本、契约、Cron、次数与关闭语义、UI 基线、测试基线 | 不是整个平台实现 |
|
||||
| A:规则闭环 | 数据库、Cron、规则、报警、三状态、次数升级、企微、配置 UI 与记录 | AI、工具、超时升级、生产大屏 |
|
||||
| B:分析 | 规则原因分析和 AI;模型、提示词、结果和故障 | MCP、自主写库、完整 Agent 框架 |
|
||||
| C:内置只读工具 | 受控明细查询、范围授权、AI 使用和证据 | 微服务/MCP、设备控制 |
|
||||
|
||||
独立大屏、流程实时应用、视频、历史主动分析以及其他升级策略后续独立评审,不按旧 HTML 的菜单全部实现。
|
||||
|
||||
## 2. 技术栈与实施约束
|
||||
|
||||
| 部分 | 已确认方向 | 计划用法与验证 |
|
||||
|---|---|---|
|
||||
| API | FastAPI、Pydantic | 明确输入/输出 schema、错误码和 OpenAPI;外部调用不占长期请求 |
|
||||
| 持久化 | PostgreSQL、SQLAlchemy、Alembic | 推荐同步 SQLAlchemy session 起步,进程/任务独立 session,不混用不受控 async/sync;锁定版本验证 |
|
||||
| 队列 | Celery、RabbitMQ | 采集、判定、发送、分析异步;数据库记录业务结果,不额外为任务结果引入 Redis |
|
||||
| 周期 | 开源 Cron 编辑/解析+Celery Beat | 优先成熟能力及薄适配;不手写 Cron 引擎,不预设必须自研统一调度器,详见 cron-reuse.md |
|
||||
| 前端 | Vue3、TS、Vite、Element Plus | 分页表格、表单、详情、加载/空/失败状态;UI 不直接持有凭证 |
|
||||
| 状态与路由 | Pinia、Vue Router | 用户会话、权限和必要 UI 状态;列表数据不全量存本地 |
|
||||
| 认证 | Casdoor/OIDC | 后端签名、issuer、audience、期限和业务范围校验,不能只验证前端登录 |
|
||||
| AI | 官方 SDK 或受控 HTTP 适配 | 先一种获准模型接入;提示词版本和结果结构,不引入编排框架 |
|
||||
| 通知 | 企微应用及机器人 | Apprise 验证后可复用,不满足错误粒度就直接官方接口;统一适配边界 |
|
||||
| 测试 | pytest、Playwright | 后端分层,关键集成用 PostgreSQL;UI 行为断言和截图 |
|
||||
| 运行 | Docker Compose | 开发和验收环境先行;API/worker/beat 分进程,不称微服务 |
|
||||
|
||||
不现在指定具体版本号。M01 内依据官方资料及最小兼容验证确定版本矩阵,随工程生成依赖锁文件,先提供隔离 Postgres/RabbitMQ 和测试命令。M11 整合全部业务运行环境,不在没有工程时要求所有 lockfile。
|
||||
|
||||
### 2.1 推荐目录(后续任务建立,本次未创建业务目录)
|
||||
|
||||
```text
|
||||
watchman/
|
||||
AGENTS.md
|
||||
README.md
|
||||
需求冻结文档_V1.1_交接稿.md
|
||||
docs/
|
||||
development-plan.md / decisions.md / progress.md
|
||||
agent-workflow.md / testing-plan.md
|
||||
tasks/INDEX.md / TEMPLATE.md / <task-id>.md
|
||||
handoffs/ / reviews/ / evidence/ / adr/
|
||||
backend/ # 后续片创建
|
||||
app/ # API、领域服务、适配和任务入口
|
||||
migrations/ / tests/
|
||||
frontend/ # 后续片创建
|
||||
src/ / tests/
|
||||
infra/ # 后续片创建:开发 Compose 等
|
||||
```
|
||||
|
||||
不另建 `customer_hexin` 核心链路;隔离样例放 fixtures,不带真实客户姓名、工单或凭证。
|
||||
|
||||
### 2.2 模块建议
|
||||
|
||||
identity、sources、queries、scenarios、scheduling、mapping、rules、alarms、escalation、notifications、runs、audit;B 增加 analysis;C 增加 tools。这是逻辑边界,不要求每个模块独立仓库、数据库、HTTP 服务或队列。
|
||||
|
||||
## 3. 先锁定契约,再逐模块实现
|
||||
|
||||
M01 写入 `docs/contracts.md` 的基础部分,各模块按需要补充,至少定义:
|
||||
|
||||
- 输入身份与对象身份、观测时间和数据周期;采样/重试不得变新输入。
|
||||
- 场景草稿与不可变发布版本,查询/映射/规则/输出引用方式。
|
||||
- Run、Decision、Alarm、HandlingRecord、Occurrence、EscalationStep、DeliveryTask、DeliveryAttempt、Outbox 的关系。
|
||||
- 状态枚举及合法转换:判定、处理、执行、通知、分析相互独立。
|
||||
- 错误结构、分页排序、ID 和时间表示、授权上下文、测试运行标记。
|
||||
- 接口操作清单及前后端契约,数据库唯一约束及事务拥有者。
|
||||
|
||||
只先定义骨架,不一次创建所有模块实现和数据表。每个模型随对应模块提交迁移;接口契约修改先主 Agent 协调,避免前端、worker、review 各自解释。完整模块包含需要的接口、页面和测试,不按技术层让用户分别开启会话。
|
||||
|
||||
## 4. 关键运行设计
|
||||
|
||||
### 4.1 Cron 调度
|
||||
|
||||
用户确认使用 Cron,而非几个固定周期按钮。前端辅助组件必须与服务端方言兼容;服务端独立校验、生成下一执行时间,前端仅展示结果。Cron 表达式说明“何时运行”,**不自动定义被查询的数据统计周期**。
|
||||
|
||||
前端优先评估 `@vue-js-cron/element-plus`,后端复用 Celery Beat 和成熟 Cron 解析库(如 croniter);M08 内验证版本和时区,不手写编辑器/解析器/日历算法。不能同时用前端 Quartz、后端 Celery crontab 解释同一字符串。字段数、DOM/DOW、DST、无下一时间和最小间隔在 O01 确认后测试。APScheduler 是备选而非叠加必装,完整依据见 `cron-reuse.md`。
|
||||
|
||||
优先验证成熟框架或扩展能否承担场景动态调度;若不合适,再使用 Beat 固定触发+成熟解析库+薄业务到期适配。无论哪种实现,计划身份明确,版本/启停与业务运行关联;重复触发由约束和事务控制,Beat 单实例不是幂等保证。记录计划运行、Outbox 与推进进度要一致,不因外部发布中断丢事实。不得为满足这些业务要求另外造一个通用调度框架。
|
||||
|
||||
重启遗漏、跨周期重叠、停用和配置修改的旧任务按 O07 执行。队列任务启动时核对版本和许可;扫描故障、来源故障与业务异常分开。
|
||||
|
||||
### 4.2 输入幂等和报警生命周期
|
||||
|
||||
输入身份与计划运行身份不同;查询重跑不能仅因新 Run ID 把旧数据变成新事件。哈希可以辅助判断,但不能只按整行内容相同就丢弃跨周期合法事件。
|
||||
|
||||
有效 FAIL → 写判定 → 在合并范围内创建/关联报警 → 写有效发生记录。存在输入唯一约束;每个输入对规则版本的判定身份明确。新配置版本能否产生新的报警不等同于新增业务错误,按契约处理。
|
||||
|
||||
人工状态为待处理→处理中→已关闭,接手/关闭原子条件更新或版本锁,历史操作追加不覆盖。关闭不改判定,也不自动恢复。
|
||||
|
||||
已确认:同一输入不重触发;关闭后新周期或独立事件可新建并关联。旧周期更正和持续异常未明确部分按 O06 阻塞,不让实现者自行重开。
|
||||
|
||||
### 4.3 次数升级(本期)
|
||||
|
||||
计数来源是去重后的独立业务异常发生,不是调度次数、通知次数或重试次数。窗口可能跨多个已关闭报警,统计聚合不能只读取某条报警的命中次数。
|
||||
|
||||
M09 前确认窗口、分组、首次是否计 1、阈值达到、同级只一次、跳级、目标及版本影响;M06/M09 确认关闭和新事件交互。未确认不实现隐含默认值。
|
||||
|
||||
并发发生时:唯一 Occurrence → 原子更新窗口计数 → 阈值判断 → 唯一升级步骤意图 → Outbox,避免先查再加导致丢次数或重发。每级幂等键包含策略版本、统计分组、窗口和级别;具体字段在契约中写清,禁止通过消息文本去重。
|
||||
|
||||
关闭对旧报警待发首轮/升级意图的影响、窗口次数是否继续影响新报警,均按 O04 最终决定实现。建议关闭取消旧报警未执行步骤但不清空窗口历史次数,尚未获批准,不能写成默认实现或测试期望。旧任务和新事件必须有独立身份,避免误取消新报警通知。
|
||||
|
||||
### 4.4 可靠通知
|
||||
|
||||
业务事务内保存发送意图和 Outbox;投递器认领并发布 Celery 任务;重复队列消息由稳定任务身份兜底。数据库记录是事实来源,Celery task state 仅用于执行,不替代业务结果。
|
||||
|
||||
每个可独立重试的目标有 DeliveryTask;批量发送必须分解返回结果。重试可恢复错误,失败不重发受理目标,超时保留 UNKNOWN_RESULT。外部不提供幂等时,成功后进程崩溃仍可能重复,必须记录限制,不能宣称恰好一次。
|
||||
|
||||
静默、关闭、停用在真正执行前再校验;内容采用意图产生时的版本快照,链接展示当前状态。首轮通知不等待 AI,分析追加默认关闭。
|
||||
|
||||
### 4.5 查询与安全
|
||||
|
||||
源查询账号只读、参数绑定、对象/时间/行数及字段限制;不靠 SELECT 前缀防注入。连接池和查询超时控制来源负担,敏感结果不进普通日志。平台库事务与源库查询分开,不将源库变更作为预警前提。
|
||||
|
||||
Casdoor 后端验签及范围;JWT 的未验签 decode 只能用于诊断不能授权。没有真实测试租户时使用严格隔离身份桩并标注未验真。外部源和模型地址受控,防任意内网访问。
|
||||
|
||||
### 4.6 B/C 分析
|
||||
|
||||
B 先规则原因分析,再模型连接、提示词、已有上下文分析及失败控制,不要求 AI 调查尚未提供的数据;无工具时不得声称查过明细。C 后续提供工具 registry 和受控查询,由后端约束模型参数及访问范围,返回事实和证据引用,数据不能成为授予权限的指令。
|
||||
|
||||
不将原始日志自动当训练集,不引入 Langfuse 作为本期强制依赖;基础模型与工具记录先落本平台,后续观测另评审。
|
||||
|
||||
## 5. 大任务与内部小步骤
|
||||
|
||||
- 一个大任务对应一个完整模块,例如基础框架、数据源配置、查询采集、报警处理;一个会话聚焦一个 Mxx。
|
||||
- 主 Agent 可在模块范围内自主拆成模型、迁移、接口、前端、集成、测试等步骤,再委派子 Agent 逐步实现,无需用户逐步批准或开新会话。
|
||||
- 内部步骤只维护在模块任务卡,不要求 133 个独立卡、逐片正式 review 和进度打卡;原细项仅防漏覆盖。
|
||||
- 模块必须包含必要 UI 和后端的集成结果。实现中持续自测,高风险步骤可提前 review,模块交付前进行整体独立 review 和正式测试。
|
||||
- 不要求一次性盲写完整模块,也不以拆分细碎、反复等待用户“继续”代替自主推进。
|
||||
- 默认逐模块,内部独立工作可并行;迁移、共享 schema、依赖锁串行。跨模块职责变更先问用户。
|
||||
- 上下文不足或外部条件阻塞时记录当前内部步骤和恢复点,不强行 DONE 或转下一个模块。
|
||||
|
||||
## 6. 每个大任务的开发步骤
|
||||
|
||||
1. 主 Agent 确认模块依赖与授权,建立 `tasks/Mxx.md`,列内部步骤、完成边界和可复用组件。
|
||||
2. 逐步委派实现:最小必要上下文、明确写范围、按步骤集成和自测;主 Agent 不代写代码。
|
||||
3. 模块集成后固定候选,由不同系列强模型子 Agent 整体 code review;高风险问题交实现者修复并复审。
|
||||
4. 测试子 Agent 正式执行适用的单元、数据库、队列和 API 测试;涉及 UI 由快速模型做 Playwright 断言和截图。
|
||||
5. 视觉问题仍需检查,截图存在不等于合格;后端事务不靠截图证明。
|
||||
6. 主 Agent 验收整个模块、更新 docs 和交接。模块未完就记录未完,不把已完成内部步骤冒充模块完成。
|
||||
|
||||
主 Agent 仅能修改文档和状态,不亲自代写业务修复。测试过程中如产品代码变动,受影响 review 和正式测试失效,必须重做。
|
||||
|
||||
## 7. 里程碑与门禁
|
||||
|
||||
| 门禁 | 组成 | 验证方式 |
|
||||
|---|---|---|
|
||||
| G0 可开工 | M01 内的授权/版本/基础契约确认 | 可追溯,不阻止无关工作先推进 |
|
||||
| G1 最小计算链 | M01~M05 | 手动样例取数→映射→判定,无真实通知 |
|
||||
| G2 报警与基础通知 | M06~M08 | 处理、首次通知、场景周期执行和配置完整 |
|
||||
| G3 次数升级与追溯 | M09~M10 | 独立事件计数、分层通知、运行记录 |
|
||||
| G4 规则应用交付 | M11 | 正式集成、故障/权限/UI回归,本地和真实分开 |
|
||||
| G5 分析交付 | M12~M14 | 规则/AI证据及失败不阻塞 |
|
||||
| G6 只读工具交付 | M15 | 授权范围、真实证据、越权拒绝 |
|
||||
|
||||
INDEX 的模块依赖是当前执行顺序,原细项依赖已降级为历史参考。基础通知不能反向依赖后续次数统计;模块通过稳定意图接口衔接,端到端组合在 M08/M09/M11 验证。事务及外部发送不确定性必须实际测试,不用大屏截图代替。
|
||||
|
||||
真实 Casdoor/MES/企微验收为 G4 附加真实门禁,对应模块内记录 BLOCKED 时可记录 G4-LOCAL,不宣称 G4-REAL。M12 的前提为 G4-LOCAL,不用把外部阻塞假标通过。
|
||||
|
||||
## 8. 开发与测试环境
|
||||
|
||||
后续建立 Compose 开发环境:平台 Postgres、RabbitMQ、API、worker、beat、前端;源测试数据使用隔离库或独立只读账号。Casdoor 可接批准测试租户;不因方便关闭认证。真实企微/模型测试为显式开关,默认使用 Mock。
|
||||
|
||||
数据库测试必须与生产方向一致;SQLite 不能证明 PostgreSQL 唯一、锁和事务正确。每轮测试标注数据库迁移、时区、模型/渠道 Mock 或真实、浏览器版本和视口。
|
||||
|
||||
测试命令由相应骨架片建立后写 `docs/runbook.md`。当前不提供假装可执行的 `pytest`/`npm` 成功记录,也不安装依赖。
|
||||
|
||||
## 9. Agent 与模型
|
||||
|
||||
详见 `agent-workflow.md`。按角色选择实际可调用模型,不能只按流行度。没有不同系列 reviewer、没有子 Agent、不能配置浏览器模型时报告限制,不能标“多模型审查通过”。用户使用 Grok 也需确认文档/源码处理授权,不自动读取源会议。
|
||||
|
||||
## 10. 文档交付与恢复
|
||||
|
||||
每个模块:一份任务卡及内部步骤、整体 review 报告、测试摘要、候选版本、必要 UI 截图和受限说明。进度仅在 progress 维护 Mxx 状态;不为 133 细项维护另一套任务表。每会话一份交接,下一 Agent 可恢复同模块内部步骤。
|
||||
|
||||
证据路径按任务隔离。原始截图/trace 可能含敏感数据,默认本地保存并被 Git 忽略;脱敏摘要可以纳入 Git。不要靠 commit 保存凭证或内部原始数据。
|
||||
|
||||
## 11. 变更与提问
|
||||
|
||||
不知道首先查冻结文档、决策和官方资料;仍不明白立即向用户提问,说明影响、选项和推荐,不以“模型自己觉得”定业务规则。用户回答由主 Agent 更新决策和受影响任务卡,必要时追加需求变更。
|
||||
|
||||
技术版本、可维护库选取可在已授权范围研究;跨服务商数据授权、新外部服务、实际发送/生产访问、需求范围改变及破坏性操作必须询问。
|
||||
|
||||
## 12. 本次交付范围
|
||||
|
||||
本次仅调整文档和规划,之前已 Git 初始化。未创建 backend/frontend/infra 实现、未安装 Cron 等依赖、未运行产品测试。后续用户明确开工后从 M01 开始,不自动连做所有模块。
|
||||
@@ -0,0 +1,32 @@
|
||||
# 规划初始化交接|2026-11-16-001
|
||||
|
||||
## 当前事实
|
||||
|
||||
- 用户要求先规划,不编写业务代码。
|
||||
- 目录为 `D:\PROJECT\watchman`,初始化前为空。
|
||||
- 已写需求 V1.1 交接稿、技术任务规划、Agent 规范、切片索引、测试计划、决策和进度模板。
|
||||
- 已执行 `git init` 成功;未提交、未设置远程、未推送。
|
||||
- 未创建业务源码、安装依赖、启动服务或运行产品测试。
|
||||
|
||||
## 本轮用户确认
|
||||
|
||||
技术栈方向接受;直接 Cron 表达式配置;次数升级优先、时间升级后置;规则原因分析放 B;同一输入不重报、新周期/独立事件可新建;代码目录和 Git 初始化明确。主 Agent 只协调,子 Agent 实现、异系列 review 和测试,低成本模型可执行浏览器验证;docs 留进度。
|
||||
|
||||
## 本轮规划检查
|
||||
|
||||
由另一个子 Agent 只读检查文档,指出正式运行集成、最小测试环境前置、局部业务口径、真实依赖阻塞及测试 ID 错配。主 Agent 修改了规划文档:增加 A-081~A-085 小片,区分本地/真实验收,收回未批准业务断言并修正 ID。
|
||||
|
||||
这只是规划一致性检查,不是产品代码 review;未核验不同系列模型路由,不宣称已达到将来跨系列 code review 要求。
|
||||
|
||||
本地只读脚本检查:133 个任务(P8/A85/B22/C18),编号不重复、依赖引用存在、无依赖环;所有文档任务引用有定义;规划了 68 个 V 用例和 12 个 UI 用例;无替换字符、无业务源码文件。详细记录见 `docs/planning-check.md`。
|
||||
|
||||
## 未解决事项与下一动作
|
||||
|
||||
1. 用户尚未授权本轮业务开工,不自动开始实现。
|
||||
2. 阅读 `docs/decisions.md`,向用户确认 O01~O07 的具体 Cron/计数/权限边界。
|
||||
3. 核实接收 Agent 所用 Grok/review/浏览器模型和服务商的数据授权、实际 Cursor 委派能力;不自动加载源会议与 MES 原件。
|
||||
4. 获开工授权后,主 Agent 先委派 P-001,填角色能力表,不能默默用单模型自我审查代替。
|
||||
|
||||
## 文件和副作用
|
||||
|
||||
全部文件为新建或修改本次新建的交接稿。FDE 原方案、PPT 和 HTML 未修改。Git 文档未提交。真实数据库/企微/模型业务调用均未发生,无真实通知需要重复或撤回。
|
||||
@@ -0,0 +1,27 @@
|
||||
# 模块级任务修订交接|2026-11-17-001
|
||||
|
||||
## 当前状态
|
||||
|
||||
仍为规划阶段,未写业务代码、未安装依赖、未启动服务、未进行产品测试;Git 已初始化,无 commit/远程/push。
|
||||
|
||||
## 用户最新要求
|
||||
|
||||
任务粒度从 133 个细片改为模块大任务,例如基础框架、数据源配置。一个会话聚焦一个大任务,Agent 可自主拆小步骤推进。Cron 前后端应复用开源库/框架,不重新开发通用能力。
|
||||
|
||||
## 文档变化
|
||||
|
||||
- INDEX 改为 M01~M15 模块级任务,含模块范围、依赖、内部步骤例子、验收和原细项覆盖映射。
|
||||
- 原 INDEX 保存为 CHECKLIST-v1,仅覆盖参考,旧硬依赖和逐片任务卡要求不再生效。
|
||||
- AGENTS、任务规划、代理规范、模板、测试和进度同步改成模块单位;整体 review/测试不省略。
|
||||
- 增加 cron-reuse,公开资料核查前端 `@vue-js-cron/element-plus`、后端 Celery Beat、croniter 和 APScheduler。仅初筛未安装验证;选型和方言未冒充已定。
|
||||
- 修订项目内需求交接稿的工作方式说明,未修改 FDE 原文档、HTML 和 PPT。
|
||||
|
||||
## 下一步
|
||||
|
||||
用户给开工指令后从 M01 委派,先核实实际模型及授权、版本和基础契约。各模块遇到对应业务待决策项再问,不把全部不相关问题挡在第一步,也不默认批准次数窗口等规则。
|
||||
|
||||
一个会话原则不允许伪造完成;如上下文或外部条件不足,保持当前 Mxx,写明确内部恢复点。无需逐个接口要求用户新会话或说“继续”。
|
||||
|
||||
## 验证与限制
|
||||
|
||||
本轮只做文档和公开资料检查。模块依赖/原细项覆盖检查另见 planning-check;产品单元测试和 Playwright 未执行。模型具体 ID 与异系列能力仍未知,不声称多模型产品审查已完成。
|
||||
@@ -0,0 +1,16 @@
|
||||
# 会话交接 <日期-序号>
|
||||
|
||||
- 开始读取的版本/工作区状态:
|
||||
- 本次用户指令及授权变动:
|
||||
- 当前大任务及内部步骤/状态:
|
||||
- 已完成的模块行为/仍缺什么:
|
||||
- 实现/review/测试子 Agent 实际角色模型:
|
||||
- 修改文件、候选版本及未提交变更:
|
||||
- 已执行命令、失败与未执行项:
|
||||
- 证据及截图:
|
||||
- 决策编号、阻塞问题和已问未答事项:
|
||||
- 不可重复的真实副作用:
|
||||
- 下次第一精确动作(若模块未完,继续同一 Mxx 的明确内部步骤,不另启新模块):
|
||||
- 不得触碰的用户/其他 Agent 工作:
|
||||
|
||||
不要保存凭证或完整对话;需恢复上下文的事实必须在项目文档中可回查。
|
||||
@@ -0,0 +1,42 @@
|
||||
# 规划文档检查记录(历史与当前分开)
|
||||
|
||||
## 当前检查:2026-11-17 模块级修订
|
||||
|
||||
- 当前执行单位是 15 个模块级大任务,原 133 项迁入 CHECKLIST-v1,仅作覆盖参考。
|
||||
- 实际只读检查模块依赖:15 个模块、引用均存在、无环。
|
||||
- 展开历史映射后核对:133 项全部覆盖,无遗漏、无多余、无重复归属。
|
||||
- 初次映射脚本因 PowerShell 向 Python 传递全角范围符号失败而报错;改用 Unicode 码点后重跑通过,未据失败脚本误改任务表。
|
||||
- 独立子会话只读复核当前 AGENTS、模块索引、规划、代理规范、Cron 复用说明和进度,未发现重要矛盾;该检查不是不同系列产品 code review。
|
||||
- 公开文档确认 Cron 有现成前端组件、解析库和调度框架;本轮未安装或实测依赖,实际兼容性仍需开工后验证。
|
||||
- 未创建 Python/TS/JS/Vue 业务源码,未运行产品测试。
|
||||
|
||||
以下为 2026-11-16 历史检查,不是要求继续逐项管理 133 小片。
|
||||
|
||||
日期:2026-11-16。以下记录只验证当时规划资料,不是产品功能、代码审查或测试通过报告。
|
||||
|
||||
## 实际执行
|
||||
|
||||
1. 只读检查切片索引,解析每行任务编号和依赖并做依赖图检查。
|
||||
2. 检查文档中引用的任务编号是否均在 INDEX 定义。
|
||||
3. 统计细化验收用例,检查替换字符及业务源码文件。
|
||||
4. 执行 `git init`,结果:成功初始化空仓库。
|
||||
5. 执行 `git status --short`,确认新文档未跟踪;未自动提交。
|
||||
|
||||
## 结果
|
||||
|
||||
| 检查 | 结果 |
|
||||
|---|---|
|
||||
| 任务总数 | 133:P 8、A 85、B 22、C 18 |
|
||||
| 重复任务 ID | 无 |
|
||||
| 未定义依赖 | 无 |
|
||||
| 依赖循环 | 无 |
|
||||
| 全部文档的未定义任务引用 | 无 |
|
||||
| 细化 V 用例 | 68(计划,未执行) |
|
||||
| UI 用例 | 12(计划,未执行) |
|
||||
| 文档编码替换字符 | 无 |
|
||||
| Python/TS/JS/Vue 业务源码文件 | 无 |
|
||||
| 单元/API/Playwright 功能测试 | 未执行:业务实现尚不存在 |
|
||||
|
||||
## 审查限制
|
||||
|
||||
进行了独立子会话的规划一致性检查,未声称不同模型系列的产品 code review 已执行。模型 ID、跨服务商授权和 Cursor 子 Agent 路由仍待实际环境核实。任务图检查只能验证引用和无环,不能证明业务设计已确认或代码可运行。
|
||||
@@ -0,0 +1,32 @@
|
||||
# 开发进度(唯一状态台账)
|
||||
|
||||
## 当前快照
|
||||
|
||||
- 当前阶段:规划/文档初始化;业务开发未开始。
|
||||
- 当前大任务:无;当前内部步骤:无。
|
||||
- 用户授权:编制规划、初始化 AGENTS 和 Git;尚未授权本轮开始业务编码。
|
||||
- 已有成果:需求交接稿、模块级任务规划、15 个模块索引、测试计划和代理规范;133 个旧细项改为覆盖参考。
|
||||
- 业务源代码、依赖、数据库、Docker 服务:均未创建/安装/启动。
|
||||
- Git 初始化结果:已于 2026-11-16 执行 `git init`,创建本地空仓库;未 commit、未添加远程、未 push。
|
||||
- 模型配置:未知,待接手环境发现与用户授权;不得编造 Cursor 支持自动多模型子 Agent。
|
||||
- 下一步:按所属模块确认相关业务决策,获开工指令后从 M01 开始,主 Agent 在会话内拆步骤并委派。
|
||||
- 当前规划检查:15 个模块依赖无环,133 个旧细项全量映射且无重漏;见 planning-check。68 个 V 用例和 12 个 UI 用例仍是计划,未执行。
|
||||
- 最近交接:`handoffs/2026-11-17-001.md`。
|
||||
|
||||
## 大任务状态
|
||||
|
||||
M01~M15 全部初始 TODO,未列于下表者仍 TODO;不再管理旧 P/A/B/C 编号的单独状态。内部步骤放当前模块任务卡,主 Agent 可自行推进,不逐步等用户审批。不要根据文档存在推断已经实现。
|
||||
|
||||
| 大任务/当前内部步骤 | 状态 | 负责人角色/实际模型 | 候选版本标识 | Review | 测试/UI 证据 | 阻塞/下一步 |
|
||||
|---|---|---|---|---|---|---|
|
||||
| — | NOT_STARTED | — | — | 未执行 | 未执行 | 规划阶段 |
|
||||
|
||||
状态:TODO → READY → IN_PROGRESS → IN_REVIEW → IN_TEST → DONE_LOCAL。可转 BLOCKED;验收失败转回 IN_PROGRESS。真实接入验收单列 REAL_ACCEPTED,不用 DONE_LOCAL 冒充。
|
||||
|
||||
## 当前阻塞
|
||||
|
||||
详见决策表。Cron 方言、次数窗口及升级动作语义影响相关切片;真实访问条件只阻塞真实联调,不阻塞合成数据基础开发。不同服务商资料授权、子 Agent 能力和实际模型 ID 是委派前置条件。
|
||||
|
||||
## 会话结束前
|
||||
|
||||
更新本快照及台账;新增 `docs/handoffs/<日期>-<序号>.md`,使用模板。不保留完整对话,不写凭证。记录当前差异、最新审查结论、失败命令、下一精确动作及不能重复执行的副作用。
|
||||
@@ -0,0 +1,188 @@
|
||||
# Knowledge Map
|
||||
|
||||
This file routes agents and humans to project knowledge.
|
||||
|
||||
It must not become a code index. Do not list every file, class, function, or symbol here.
|
||||
|
||||
Docs explain context. Rules enforce constraints. Keep them separate and update this file whenever docs or rules are added, moved, renamed, or deleted.
|
||||
|
||||
Rule files may also record rule metadata such as `type`, `confidence`, and `source`. Read those semantics from `AGENTS.md` and the rule files themselves; do not treat every rule entry as equally strong by default.
|
||||
|
||||
When `marionettist.config.yaml` exists, read `knowledge.mode` and `knowledge.maturity` before deciding how much knowledge to load or create.
|
||||
|
||||
## Project Overview
|
||||
|
||||
- Knowledge Docs:
|
||||
- `docs/project/` for repository-wide workflow and routing
|
||||
- `docs/project/tier-policy-workflow-design.md` for installed future-facing Tier-policy workflow research boundaries and roadmap context
|
||||
- `docs/current/` for current-state knowledge about how the project works today
|
||||
- `docs/target/` for desired future design, migration direction, or proposed architecture
|
||||
- Rule Files:
|
||||
- `AGENTS.md`
|
||||
- `.aiassistant/rules/*.md`
|
||||
- Scope:
|
||||
- route readers to the smallest relevant set of docs and rules
|
||||
- keep current fact separate from target intent
|
||||
- When To Read:
|
||||
- before loading detailed docs for a non-trivial task
|
||||
- whenever docs, rules, or file roles change
|
||||
- Boundary Notes:
|
||||
- `docs/current/` is for observed reality first
|
||||
- `docs/target/` is for future intent, not current fact
|
||||
- label knowledge as fact, inference, or unknown inside detailed docs
|
||||
- keep rule-strength metadata in rule files, not in knowledge docs
|
||||
|
||||
## Current-State-First Routing
|
||||
|
||||
For mixed-responsibility, legacy-heavy, or mudball projects, start with `docs/current/` unless the task is explicitly about future design.
|
||||
|
||||
Use this order:
|
||||
|
||||
1. read `AGENTS.md` and relevant rules first
|
||||
2. read `docs/project/knowledge-map.md` to choose the smallest relevant knowledge area
|
||||
3. read `docs/current/...` for how the project works today
|
||||
4. read `docs/target/...` only when the task involves planned changes, migration direction, or intentional future-state design
|
||||
|
||||
If the current state is unclear, document the uncertainty as an unknown instead of filling the gap with target design.
|
||||
|
||||
## Project Workflow Design
|
||||
|
||||
- Areas: Marionettist task flow, Tier-based routing, gate boundaries, future workflow configurability
|
||||
- Tags: workflow, tier, gate-policy, task-state, research
|
||||
- Docs:
|
||||
- Current: `docs/project/marionettist-workflow.md`
|
||||
- Target: `docs/project/tier-policy-workflow-design.md`
|
||||
- Rules:
|
||||
- `AGENTS.md`
|
||||
- Read When:
|
||||
- working on Marionettist execution flow, Tier policy, gate behavior, or future workflow design boundaries
|
||||
- Boundaries:
|
||||
- keep `gatePolicy` semantics unchanged
|
||||
- treat Tier policy as classification/workflow-hint logic until a later approved design says otherwise
|
||||
- do not treat the design draft as implemented behavior
|
||||
- use the design draft to understand deferred hardening and future-engine boundaries, not current execution rules
|
||||
- Validation:
|
||||
- confirm project-neutral language
|
||||
- confirm proposed workflow configurability remains design-only unless explicitly implemented in an approved slice
|
||||
|
||||
## Knowledge Maturity Routing
|
||||
|
||||
Use `knowledge.maturity` to scale routing depth and governance expectations:
|
||||
|
||||
- **L0**: route only the minimum docs and rules needed for the task; prefer explicit unknowns over broad discovery
|
||||
- **L1**: prioritize `docs/current/` coverage for entrypoints, major flows, risk zones, and safe-change advice
|
||||
- **L2**: maintain reusable routing for important areas and load both current and target docs only when they materially affect the task
|
||||
- **L3**: expect stronger routing discipline, clearer ownership notes, and docs/rules sync when meaning changes
|
||||
- **L4**: expect high-trust curated routing, stronger confirmed/hard rule usage, and careful separation of current fact vs target intent
|
||||
|
||||
Use maturity as a scaling guide, not as a reason to load all docs.
|
||||
|
||||
For `knowledge.mode: mudball`:
|
||||
|
||||
- default to `docs/current/` first at every maturity level
|
||||
- keep target docs optional and future-facing
|
||||
- treat L0-L1 as valid operating levels
|
||||
- do not assume L3/L4 governance unless the project explicitly chose it
|
||||
|
||||
## Knowledge Labels
|
||||
|
||||
Detailed docs should distinguish:
|
||||
|
||||
- **Fact**: directly observed in code, config, runtime behavior, logs, or confirmed repository docs
|
||||
- **Inference**: likely interpretation of current behavior that still needs confirmation
|
||||
- **Unknown**: unresolved question, missing evidence, or area not yet inspected
|
||||
- **Target**: desired future behavior or design direction; keep this in `docs/target/` unless a current-state doc must reference it for contrast
|
||||
|
||||
Do not silently upgrade inference or target guidance into present-day fact.
|
||||
Do not silently upgrade `observed` or `target` rules into enforceable hard constraints.
|
||||
|
||||
## How To Use This File
|
||||
|
||||
- Use this file to choose a small set of relevant docs and rules.
|
||||
- Match the task to one or more knowledge areas by purpose, workflow, ownership, validation needs, or change surface.
|
||||
- Read only the entries that match the current task.
|
||||
- Prefer `docs/current/` for real behavior and `docs/target/` for intended future behavior.
|
||||
- Prefer rule files for constraints, and check rule metadata before treating a rule as a blocker.
|
||||
- Use repository search or source inspection for file and symbol lookup.
|
||||
- Do not list the whole repository here.
|
||||
|
||||
## Knowledge Area Template
|
||||
|
||||
Copy this block for each major project area:
|
||||
|
||||
```md
|
||||
### <Area Name>
|
||||
|
||||
- Areas:
|
||||
- Tags:
|
||||
- Docs:
|
||||
- Current: `docs/current/...`
|
||||
- Target: `docs/target/...`
|
||||
- Rules:
|
||||
- `.aiassistant/rules/...`
|
||||
- `AGENTS.md`
|
||||
- Read When:
|
||||
- Boundaries:
|
||||
- Validation:
|
||||
```
|
||||
|
||||
## Watchman
|
||||
|
||||
业务文档仍以仓库原有文档为准。本文件只做路由,不复制需求正文。
|
||||
|
||||
### 产品范围与进度
|
||||
|
||||
- Areas: 预警平台规划、模块任务、当前进度
|
||||
- Tags: watchman, planning, progress, tasks
|
||||
- Docs:
|
||||
- Current: `docs/progress.md`、`docs/decisions.md`、`docs/current/system-map.md`
|
||||
- Target: `docs/development-plan.md`、`需求冻结文档_V1.1_交接稿.md`、`docs/target/architecture-intent.md`
|
||||
- Rules:
|
||||
- `AGENTS.md` 项目本地段
|
||||
- Read When:
|
||||
- 判断现在做到哪、哪个模块可以做、哪些决策还没确认
|
||||
- Boundaries:
|
||||
- 规划文档存在不等于可以开始业务编码
|
||||
- `docs/tasks/INDEX.md` 是模块计划;`.task/` 不替换它
|
||||
- Validation:
|
||||
- 以 `docs/testing-plan.md` 和当前任务卡里的证据为准
|
||||
|
||||
### 公司规范与 Marionettist
|
||||
|
||||
- Areas: 编码约束、门禁、Cursor 规则
|
||||
- Tags: sy-standards, gate, cursor
|
||||
- Docs:
|
||||
- Current: `docs/agent-workflow.md`
|
||||
- Target: `docs/project/marionettist-workflow.md`
|
||||
- Rules:
|
||||
- `.cursor/rules/workflow-rules.mdc`
|
||||
- `.cursor/rules/sy-standards.mdc`
|
||||
- `.cursor/rules/00-repository-rules.mdc`
|
||||
- Read When:
|
||||
- 准备写代码,或需要判断该停下来还是该查公司规范
|
||||
- Boundaries:
|
||||
- 门禁听 Marionettist
|
||||
- API、前端、注释、提交、密钥听 sy-standards
|
||||
- 不把 MCP token 写入仓库
|
||||
- Validation:
|
||||
- 改动平台代码前能指出对应的 `standards://` 篇目和版本
|
||||
|
||||
## Mudball-Friendly Documentation Guidance
|
||||
|
||||
For codebases with unclear boundaries or mixed responsibilities:
|
||||
|
||||
- document current entrypoints, call paths, risk zones, and safe-change advice before proposing cleanup
|
||||
- keep related-file notes small and purpose-based, not exhaustive
|
||||
- prefer facts and unknowns over polished architecture language
|
||||
- prefer gradual maturity growth over immediate governance escalation
|
||||
- add target-state docs only when they help explain a proposed improvement or migration path
|
||||
|
||||
## Path-Proximity Rule Reminder
|
||||
|
||||
When target files are known, agents should also look upward from those paths for local rule files such as:
|
||||
|
||||
- `MODULE_RULES.md`
|
||||
- `AGENTS.md`
|
||||
- `HARNESS_RULES.md`
|
||||
|
||||
Local path rules narrow area-specific behavior, but repository-global safety and boundary rules still take precedence if there is a conflict.
|
||||
@@ -0,0 +1,588 @@
|
||||
# Marionettist Workflow
|
||||
|
||||
This project uses a lightweight file-based Marionettist workflow so requirements, knowledge routing, implementation slices, and execution context stay visible in normal repository files. The goal is to keep repository-agent work reproducible without adding a separate workflow system.
|
||||
|
||||
When `marionettist.config.yaml` exists, read `knowledge.mode` and `knowledge.maturity` before deciding how much documentation, governance, and validation ceremony to apply.
|
||||
|
||||
## Standard Task Flow
|
||||
|
||||
This project uses a branched Marionettist workflow based on task complexity:
|
||||
|
||||
1. **Tier S (Minor)**: Clearly scoped localized low-risk work. Skip `.task/` documents and gates. Direct coding and review.
|
||||
2. **Tier M (Standard)**: Analysis plus task-scoped `.task/<task-id>/context-pack.md` before coding. `requirement-freezer` is optional and only used when behavior or business rules are unclear.
|
||||
3. **Tier L (Complex)**: Large, cross-boundary, compatibility/security/production-sensitive, or genuinely ambiguous work. Full mandatory Marionettist flow with analysis, approved slice execution, automatic slice review, and finalization.
|
||||
|
||||
For Tier M and L, the agent must complete phases in order. They must not automatically cross the analysis gate, and they must not automatically cross an inter-slice gate unless the selected gate policy explicitly permits that continuation and no mandatory stop applies.
|
||||
|
||||
Critic defaults by tier are:
|
||||
- **Tier S**: no critic by default
|
||||
- **Tier M**: critic optional, but recommended for risky or boundary-sensitive work
|
||||
- **Tier L**: critic required before coding and before declaring approved work done
|
||||
|
||||
Treat a task as high-risk when it includes sensitive refactors, workflow-sensitive changes, boundary ambiguity, unusual validation uncertainty, or explicit high-risk wording in the task artifacts.
|
||||
|
||||
In this file, `<task-id>` means the active `taskId` value from `.task/active.json`.
|
||||
|
||||
`.task/active.json` is a local singleton pointer for one repository root or checked-out worktree. It is safe as a per-root or per-worktree selector, but it must not be treated as implicit cross-worktree delegation context.
|
||||
|
||||
## Gate Policy Defaults
|
||||
|
||||
When `marionettist.config.yaml` defines `gatePolicy`, it sets the repository default gate posture for non-trivial work:
|
||||
|
||||
```yaml
|
||||
gatePolicy:
|
||||
defaultMode: "balanced" # strict | balanced | autonomous
|
||||
finalApprovalRequired: true
|
||||
allowTaskOverride: true
|
||||
```
|
||||
|
||||
Mode semantics:
|
||||
|
||||
- `strict`: stop at the analysis-to-coding gate and after every approved coding slice or approved parallel group.
|
||||
- `balanced`: preserve the analysis gate and final approval by default; allow continuation for already-approved `simple` slices and low/moderate-risk `standard` slices with `risk_score <= 3`, and only when the approved plan and selected policy explicitly permit that continuation and no mandatory stop applies.
|
||||
- `autonomous`: preserve the analysis gate and final approval by default; allow continuation only for already-approved next slices or approved parallel groups whose frozen `gateClass` is `simple` or `standard`, whose supplemental `risk_score` is `3` or lower, and for which no mandatory stop applies; still stop mid-task for `gateClass: high-risk`, `gateClass: boundary-sensitive`, critic-required, explicit gates or stop conditions, protected-area or dangerous-command work, or any slice whose supplemental `risk_score` requires a stronger pause than `gateClass` alone.
|
||||
|
||||
`allowTaskOverride: true` means task-local artifacts may choose a different gate mode than `defaultMode` for that task. It does not let task-local artifacts bypass higher-priority user instructions, required analysis gates, required final approval, or any other explicit stop condition in this workflow.
|
||||
|
||||
Selecting a task-local override is a policy choice for that task, not a bypass of required gates. A task may become more or less interruption-tolerant within the allowed workflow, but it must still stop wherever this workflow or the user explicitly requires a stop.
|
||||
|
||||
Policy precedence for the current task is:
|
||||
|
||||
1. explicit user instruction and task-local `gatePolicy.selected`
|
||||
2. `marionettist.config.yaml` `gatePolicy.defaultMode` as fallback when no task-local selection exists
|
||||
3. `recommended` values from tier hints or task artifacts as advisory context only
|
||||
|
||||
In other words, `defaultMode` sets repository default posture, not an override of a selected task policy. A `recommended` value may explain why `strict` is safer for a task, but it must not replace an explicit task-local `selected` mode.
|
||||
|
||||
Template default is `balanced` for general target-project usability. Tier L or otherwise high-risk tasks may recommend `strict`, but an explicit task-local `gatePolicy.selected` value remains controlling for continuation posture and must not be overwritten by the recommendation.
|
||||
|
||||
`gatePolicy` does not replace normal stop conditions. Human confirmation is still required for protected-area changes, requirement ambiguity, compatibility tradeoffs, or any other explicitly blocked decision.
|
||||
|
||||
## Gate Class Vocabulary
|
||||
|
||||
For this workflow, `gateClass` is a non-replaced hint vocabulary frozen to:
|
||||
|
||||
- `simple`
|
||||
- `standard`
|
||||
- `boundary-sensitive`
|
||||
- `high-risk`
|
||||
|
||||
`risk_score` is supplemental per-slice gate metadata with an integer range from `1` to `5`:
|
||||
|
||||
- `1`: very low additional risk signal
|
||||
- `2`: low additional risk signal
|
||||
- `3`: moderate additional risk signal; common for bounded `standard` slices
|
||||
- `4`: elevated additional risk signal; use only when concrete risk or uncertainty requires a stronger pause
|
||||
- `5`: highest additional risk signal
|
||||
|
||||
`risk_score` does not replace `gateClass`, invent new gate classes, or weaken any pause that `gateClass`, critic requirements, or explicit gate reasons already require.
|
||||
|
||||
Use `risk_score` only to preserve or strengthen the safer pause behavior relative to `gateClass`. Do not inflate `risk_score` merely because work is non-trivial; ordinary bounded `standard` slices should usually remain at 2-3 unless concrete elevated impact, reversibility concern, or validation uncertainty exists. If the numeric score indicates higher risk than `gateClass` alone, agents must keep the stricter stop.
|
||||
|
||||
Treat these as common higher-risk inputs when assigning or explaining `risk_score`:
|
||||
|
||||
- database schema updates
|
||||
- permissions or security logic
|
||||
- device communication
|
||||
- scheduling
|
||||
- externally committed public API compatibility
|
||||
- build or release scripts
|
||||
- code deletion
|
||||
- dependency upgrades
|
||||
- production configuration
|
||||
|
||||
In `balanced` mode, continuation remains limited to already-approved `simple` slices and low/moderate-risk `standard` slices with `risk_score <= 3`, and only when no explicit gate reason or task instruction requires a pause.
|
||||
|
||||
In selected `autonomous` mode, continuation to the next already-approved slice or approved parallel group is allowed without extra slice confirmation only when all of the following are true:
|
||||
|
||||
- the next approved work has frozen `gateClass: simple` or `gateClass: standard`
|
||||
- the next approved work has `risk_score <= 3`
|
||||
- the next approved work is not critic-required
|
||||
- no explicit gate reason or stop condition requires a pause
|
||||
- no protected-area decision or dangerous command requires a pause
|
||||
|
||||
Selected `autonomous` never weakens mandatory stops. The workflow must still pause for the analysis-to-coding gate, final approval when required, `gateClass: boundary-sensitive`, `gateClass: high-risk`, critic-required work, explicit gates or stop conditions, protected-area or dangerous-command decisions, and any approved work with `risk_score >= 4`.
|
||||
|
||||
## Tier Policy And Future Workflow Configuration
|
||||
|
||||
Tier policy is intended to guide task classification and workflow hints. It must not replace this workflow definition, change mandatory gate behavior, or redefine `gatePolicy` semantics.
|
||||
|
||||
If the project later adopts configurable Tier policy, treat the executable flow in this document as the MVP source of truth unless a future approved design explicitly introduces a broader workflow engine. For the deferred-design boundary of that future work, see `docs/project/tier-policy-workflow-design.md`.
|
||||
|
||||
When `.marionettist/tier-policy.yml` exists, use it as the project-local source for Tier descriptions, match-rule text, workflow hints, review hints, and model-profile hints during task intake.
|
||||
|
||||
The installed `.marionettist/tier-policy.yml` file is a safe managed starting point:
|
||||
|
||||
- `marionettist init` may install it as framework-managed project scaffolding
|
||||
- `marionettist diff` and `marionettist sync` must preserve project-local edits instead of silently overwriting them
|
||||
- task intake should explain whether it is using the project-local file, framework defaults, or a safe fallback after parse/validation problems
|
||||
|
||||
Precedence for the MVP is:
|
||||
|
||||
1. this workflow document and `gatePolicy` remain the source of executable gate behavior
|
||||
2. built-in framework Tier defaults apply when `.marionettist/tier-policy.yml` is missing
|
||||
3. project-local `.marionettist/tier-policy.yml` may refine Tier classification and hint text within the fixed Tier `S` / `M` / `L` vocabulary
|
||||
4. refinements may be auto-accepted with explanation, explicit overrides should be marked clearly, and unsafe downgrades must fall back to safer framework defaults instead of silently relaxing them
|
||||
|
||||
In `.marionettist/tier-policy.yml`, `tiers.<tier>.gateHint` is advisory only. It may suggest labels such as `default` or `prefer-strict`, but it does not replace `gatePolicy.defaultMode`, does not change the selected task-local gate mode, and does not bypass any required stop in this workflow.
|
||||
|
||||
In `.marionettist/tier-policy.yml`, `tiers.<tier>.modelProfileHint` must reference an existing profile role or name from `.marionettist/model-profiles.yml`. It must not embed provider IDs or model IDs directly.
|
||||
|
||||
For the current MVP, this is a documented authoring constraint and advisory hint. Automatic cross-validation of `modelProfileHint` against `.marionettist/model-profiles.yml` is deferred future hardening, so agents should explain uncertainty instead of inventing or silently accepting raw provider/model IDs.
|
||||
|
||||
Current schema boundary for `.marionettist/tier-policy.yml`:
|
||||
|
||||
- root keys: `schemaVersion`, `tiers`
|
||||
- required tier entries: `S`, `M`, `L`
|
||||
- required fields inside each tier: `description`, `matchRules`, `workflowHint`, `gateHint`, `reviewLevel`, `modelProfileHint`
|
||||
- optional fields inside each tier: `minTier`, `maxTier`
|
||||
- allowed scalar values for `minTier` and `maxTier`: `S`, `M`, `L`, or `null`
|
||||
- `matchRules` is a list of plain strings only
|
||||
|
||||
Do not use anchors, merge keys, inline objects, or multi-document YAML in this file for the current MVP.
|
||||
|
||||
Unknown or unsupported ordered-field values should be treated conservatively and explained clearly. Stricter automatic rejection behavior for those cases is deferred future hardening rather than part of the current MVP contract.
|
||||
|
||||
### Implemented MVP Vs Deferred Hardening
|
||||
|
||||
Implemented now:
|
||||
|
||||
- managed install path at `.marionettist/tier-policy.yml`
|
||||
- framework defaults when the project-local file is missing
|
||||
- parse/validation feedback with safe fallback where needed
|
||||
- advisory hints for `workflowHint`, `gateHint`, `reviewLevel`, and `modelProfileHint`
|
||||
- conflict handling that distinguishes refinement, explicit override, soft conflict, and unsafe downgrade
|
||||
- natural-language candidate authoring with diff-before-write and explicit confirmation before persistence
|
||||
|
||||
Deferred future hardening:
|
||||
|
||||
- automatic cross-validation that every `modelProfileHint` resolves in `.marionettist/model-profiles.yml`
|
||||
- stricter handling for unknown ordered-field values beyond the current conservative explanation/fallback posture
|
||||
- any configurable workflow-DAG or broader workflow-engine behavior
|
||||
|
||||
### Natural-Language Tier Policy Editing
|
||||
|
||||
Projects may ask the builder/config workflow to update `.marionettist/tier-policy.yml` from natural-language instructions.
|
||||
|
||||
For this MVP, the safe authoring flow is:
|
||||
|
||||
1. interpret the user's prose as a candidate Tier-policy change
|
||||
2. draft candidate YAML in the current schema only
|
||||
3. compare the candidate against the current `.marionettist/tier-policy.yml`, or against framework defaults when the file does not exist yet
|
||||
4. show the candidate YAML and a diff before any write
|
||||
5. surface any already-available Tier-policy explanation, refinement, override, or conflict notes
|
||||
6. require explicit user confirmation before persisting the candidate
|
||||
|
||||
The agent must not silently write Tier-policy changes from prose alone. If the user requests revisions, update the candidate and show the revised diff again before persistence.
|
||||
|
||||
### Analysis Phase
|
||||
|
||||
The agent may perform any of the following as needed:
|
||||
- use `task-intake` to classify the task and identify the next Marionettist step
|
||||
- use `requirement-freezer` when business rules, expected behavior, compatibility, or scope need stabilization
|
||||
- use `workflow-inspector` when execution flow or workflow impact is important
|
||||
- use `module-inspector` when module ownership, modifiability, or dependency direction is unclear
|
||||
- use `implementation-slicer` to convert requirements or goals into slices
|
||||
- use `context-pack-builder` to create `.task/<task-id>/context-pack.md` before coding
|
||||
|
||||
**Bugfix Fast-Track**: For bug fixes, the analysis phase is considered complete once a failing test case or clear reproduction steps are confirmed. Formal requirement freezing is usually bypassed unless expected behavior is unclear.
|
||||
|
||||
The analysis phase may produce:
|
||||
- `.task/active.json`
|
||||
- `.task/<task-id>/requirement.md`
|
||||
- `.task/<task-id>/implementation-plan.md`
|
||||
- `.task/<task-id>/context-pack.md`
|
||||
- `.task/<task-id>/state.json`
|
||||
|
||||
When building `.task/<task-id>/context-pack.md`, route context in this order:
|
||||
1. load global rules and task artifacts first
|
||||
2. use `docs/project/knowledge-map.md` to match only the relevant knowledge areas
|
||||
3. prefer `docs/current/...` for actual present-day behavior and use `docs/target/...` only when future design matters to the task
|
||||
4. if target files are known, walk upward from those paths to load nearby `MODULE_RULES.md`, `AGENTS.md`, and `HARNESS_RULES.md`
|
||||
5. exclude unrelated docs and note the exclusion briefly
|
||||
|
||||
For incident or bugfix work, include `.task/<task-id>/incident.md` when it exists and is relevant.
|
||||
|
||||
### Knowledge Mode And Maturity
|
||||
|
||||
Use `marionettist.config.yaml` as the local default when it defines:
|
||||
|
||||
- `knowledge.mode`: `standard` or `mudball`
|
||||
- `knowledge.maturity`: `L0`, `L1`, `L2`, `L3`, or `L4`
|
||||
|
||||
Knowledge mode sets the starting posture:
|
||||
|
||||
- `standard`: balance current-state understanding with design intent
|
||||
- `mudball`: start from present-day behavior, risk, and safe-change advice; do not assume clean boundaries
|
||||
|
||||
Knowledge maturity scales how much documentation depth and governance the agent should expect:
|
||||
|
||||
- **L0 — Minimal capture**: task-local context, sparse docs, explicit unknowns, low ceremony
|
||||
- **L1 — Current-state map**: capture entrypoints, major flows, risk zones, unknowns, and safe-change notes first
|
||||
- **L2 — Reusable area knowledge**: maintain stable routing, important current/target docs, and reviewed rule metadata for important areas
|
||||
- **L3 — Governed knowledge**: stronger docs/rules sync, clearer ownership, and regular drift checks between current and target knowledge
|
||||
- **L4 — Strict governance**: curated high-trust knowledge, explicit hard/confirmed constraints, and strong validation/review expectations for boundary-sensitive change
|
||||
|
||||
Scaling guidance:
|
||||
|
||||
- At **L0-L1**, do not require broad documentation before small safe changes.
|
||||
- At **L2**, expect meaningful docs updates when design understanding changes.
|
||||
- At **L3-L4**, expect stronger docs/rules synchronization and clearer validation evidence for architecture or boundary changes.
|
||||
- In `mudball` mode, default to current-state-first behavior even when maturity is higher, and do not pressure the project toward L3/L4 unless users explicitly choose that posture.
|
||||
|
||||
When analysis is complete, the agent must stop and wait for explicit user confirmation before starting coding, except Tier S.
|
||||
|
||||
### Critic Gates
|
||||
|
||||
The critic gate is a risk-control checkpoint, not a coding authorization.
|
||||
|
||||
1. **Plan-review critic gate**
|
||||
- Runs after the relevant requirement, implementation plan, and context pack exist.
|
||||
- Required for Tier L and high-risk work before coding starts.
|
||||
- Optional for Tier M when the work is straightforward and low-risk.
|
||||
- A critic `PASS` may satisfy `criticPassed`, but it does not bypass `allowedToCode`, the current phase, or human confirmation.
|
||||
|
||||
2. **Pre-done critic gate**
|
||||
- Runs after coding and review for Tier L or high-risk approved work.
|
||||
- Checks gate evidence before the agent declares the approved work done: reviewer verdict, validation result, unresolved blockers, changed-file inventory, forbidden-file status, and state/gate consistency.
|
||||
- Does not replace `marionettist-reviewer`, validation, or the normal slice gate.
|
||||
- Must not repeat full code review or broad repository discovery. If evidence is missing, report the missing evidence instead of rediscovering the repository.
|
||||
|
||||
### Coding Phase
|
||||
|
||||
The agent must code only from the approved context pack and approved implementation slice or approved parallel slice group.
|
||||
|
||||
For complex tasks, the approved implementation plan may define `parallel-capable` slices or approved parallel slice groups. This is optional planning metadata, not a requirement that every agent must run in parallel.
|
||||
|
||||
The agent may complete temporary substeps inside the current approved slice or group without asking again, for example:
|
||||
- editing multiple files inside the same approved slice
|
||||
- local refactoring required only for that slice
|
||||
- running validation commands for that slice
|
||||
- fixing slice-local test failures
|
||||
|
||||
When a confirmed parallel slice group is active:
|
||||
- agents with subagent or safe parallel execution support may execute the group members concurrently
|
||||
- agents without that capability must execute the same group members sequentially in the declared fallback order
|
||||
- the primary agent remains responsible for merging results, resolving conflicts, and running group validation
|
||||
|
||||
When the current coding slice is complete, the agent must automatically perform review for that same slice before stopping at the slice gate.
|
||||
|
||||
For Tier L or high-risk work, the agent should also run the pre-done critic gate after coding and review, then include the result in the slice or final summary.
|
||||
|
||||
When the current approved work is a parallel slice group, the agent must stop only after the whole approved group is complete, merged, validated, and reviewed, then wait for explicit user confirmation before the next slice or group unless the selected gate policy explicitly allows continuation for the next already-approved slice or group and no mandatory stop applies.
|
||||
|
||||
If review fails for the current slice or group, the agent may plan the smallest slice-local fix, apply it, and re-run review. Stop for user decision if the same slice or group is still blocked after 3 total review attempts.
|
||||
|
||||
When all approved coding slices and groups are complete, the agent must stop with a final validation and review summary.
|
||||
|
||||
Even in selected `autonomous`, completing one slice never authorizes unapproved future work. Continuation applies only to the next already-approved slice or approved parallel group that remains eligible under the mandatory-stop rules above.
|
||||
|
||||
Validation levels are:
|
||||
- slice validation: checks the current slice only
|
||||
- group validation: checks all members of the approved parallel group after merge or sequential fallback execution
|
||||
- final validation: checks the full approved implementation after slice review is complete
|
||||
- review validation: records boundary-reviewer findings and any remaining validation gaps
|
||||
|
||||
### Review Phase
|
||||
|
||||
Review for the current approved slice or group starts automatically after implementation. A separate user confirmation is not required between coding and review for the same approved slice or group.
|
||||
|
||||
Review includes:
|
||||
- boundary review
|
||||
- scope check against allowed and forbidden modifications
|
||||
- rule conflict check
|
||||
- validation status check
|
||||
- docs, rules, and knowledge-map sync decision
|
||||
|
||||
Review is diff-first and bounded to the current approved slice or group. The reviewer starts from the changed-file inventory and reads only changed files plus directly required context. Repository-wide search is exceptional and should be tied to a specific unresolved risk.
|
||||
|
||||
The coding agent may perform lightweight self-check to report changed files and obvious forbidden-scope issues, but independent diff review belongs to `marionettist-reviewer`. The pre-done critic gate audits evidence and gate readiness; it does not redo the reviewer role.
|
||||
|
||||
For critic-gated work, review remains mandatory even if the critic already passed.
|
||||
|
||||
## Human Confirmation
|
||||
|
||||
Humans must confirm blocking business questions, scope tradeoffs, protected-area changes, compatibility breaks, and any requirement that cannot be inferred from existing code, docs, or rules.
|
||||
|
||||
The agent must also stop at these Marionettist gates:
|
||||
- after the analysis phase is complete, before coding starts
|
||||
- after each coding slice or approved parallel group has completed coding and review, before the next slice or group starts, unless the selected gate policy explicitly allows continuation for the next already-approved slice or group and no mandatory stop applies
|
||||
|
||||
Do not stop between small analysis steps such as intake, requirement freezing, inspection, slicing, and context-pack creation. Do not stop for temporary implementation substeps inside a coding slice, such as file batches, local test fixes, or slice-local refactoring.
|
||||
|
||||
## Mandatory Gate Behavior
|
||||
|
||||
At each Marionettist gate, the agent must output a short gate report with all of the following fields:
|
||||
- `Phase`
|
||||
- `Completed Work`
|
||||
- `Files Created or Changed`
|
||||
- `Validation Status`
|
||||
- `Recommended Next Step`
|
||||
- `User Confirmation Required`
|
||||
|
||||
When the completed work is a parallel slice group, the gate report must also state the group name, member slices, execution mode used, fallback order if used, shared files, and merge owner.
|
||||
|
||||
The final line must be exactly:
|
||||
|
||||
`User confirmation required to continue.`
|
||||
|
||||
## Priority Rule
|
||||
|
||||
This Marionettist workflow overrides any general default behavior that would otherwise continue automatically from analysis to coding or from one coding slice to the next. Coding may continue automatically into review only for the currently approved slice or group. Inter-slice continuation depends on the selected task policy and still cannot bypass any mandatory stop.
|
||||
|
||||
If instructions conflict, the agent must follow the Marionettist gates unless the user explicitly overrides them.
|
||||
|
||||
## Trivial Task Exception (Tier S)
|
||||
|
||||
A task may be Tier S when it is clearly scoped, localized, low-risk, and has no boundary ambiguity, compatibility concern, workflow impact, or need for task documents. It may include small docs-only corrections, typo/comment fixes, small tests or examples, harmless config text changes, or a localized one-file fix. If those low-risk conditions are not clearly true, treat the task as non-trivial.
|
||||
|
||||
## Agent Automation
|
||||
|
||||
Repository agents may inspect files, classify questions, write task docs, build context packs, slice implementation work, apply scoped code changes, run validation commands, and review diffs against allowed scope within the currently confirmed phase. They must not automatically cross from analysis to coding. They must not automatically cross from one coding slice or group to the next unless the selected gate policy explicitly allows continuation and no mandatory stop applies. They may automatically cross from coding into review only for the current approved slice or group.
|
||||
|
||||
## Agent Capability And Parallel Fallback
|
||||
|
||||
Parallel execution is optional and capability-dependent. For single-agent environments, it refers to processing independent file groups continuously within one approved coding phase.
|
||||
|
||||
Preferred uses for parallel execution:
|
||||
- parallel exploration during analysis
|
||||
- independent module or workflow inspection
|
||||
- independent investigation of logs, tests, or call paths
|
||||
- implementation of disjoint files inside an approved parallel slice group
|
||||
|
||||
Do not use parallel execution for:
|
||||
- trivial or low-risk tasks
|
||||
- shared-file edits without a clear merge owner
|
||||
- SQL or data migration steps that require strict ordering
|
||||
- public API or contract changes without an explicit serial owner
|
||||
- architecture-sensitive refactors without a dependency graph
|
||||
|
||||
If the current agent does not support subagents, or cannot safely coordinate parallel execution, it must execute the same approved work sequentially in dependency order.
|
||||
|
||||
`parallel-capable` means optional parallelism with a required sequential fallback, not a mandatory parallel execution model.
|
||||
|
||||
## Knowledge Policy
|
||||
|
||||
Docs explain design, architecture, functional behavior, workflow, and boundaries.
|
||||
|
||||
For current-vs-target knowledge:
|
||||
- `docs/current/` records observed current-state behavior, risk, and safe-change guidance
|
||||
- `docs/target/` records desired future design and migration intent
|
||||
- current-state docs should label fact, inference, and unknown when certainty matters
|
||||
- target-state guidance must not be treated as proof of current behavior
|
||||
|
||||
Use maturity to scale expectations, not to force unnecessary document volume:
|
||||
|
||||
- `L0-L1`: compact docs are acceptable if unknowns and risks are made explicit
|
||||
- `L2`: keep reusable area docs and routing reasonably current
|
||||
- `L3-L4`: keep docs, rules, and validation evidence more tightly aligned
|
||||
|
||||
For `knowledge.mode: mudball`, current-state capture is the default. L0 or L1 may be a valid steady state, and L2 is a reasonable gradual improvement point.
|
||||
|
||||
Docs must not become source-code indexes. Use IDE tools or local search for code navigation.
|
||||
|
||||
Context packs should record loaded context compactly under categories such as:
|
||||
- Global Rules
|
||||
- Knowledge Map Matches
|
||||
- Path-Proximity Rules
|
||||
- Excluded Context
|
||||
|
||||
When local path-proximity rules conflict with repository-global safety or boundary rules, the global rules win.
|
||||
|
||||
Rules define enforceable constraints. When adding, moving, renaming, or deleting docs or rules, update `docs/project/knowledge-map.md`.
|
||||
|
||||
## File Roles
|
||||
|
||||
- `AGENTS.md` defines repository-level workflow and constraint priority.
|
||||
- `.aiassistant/rules/*.md` contains enforceable agent constraints.
|
||||
- `docs/**/*.md` contains project knowledge and architecture explanations.
|
||||
- `docs/project/knowledge-map.md` is the routing index for ownership, docs, rules, and boundary notes.
|
||||
- `docs/current/**/*.md` contains current-state knowledge about how the project works today.
|
||||
- `docs/target/**/*.md` contains desired future design, migration direction, and proposed boundaries.
|
||||
- `.task/active.json` selects the current task and records phase, gate, and next-command summary.
|
||||
- `.task/<task-id>/requirement.md` freezes task requirements.
|
||||
- `.task/<task-id>/implementation-plan.md` defines executable implementation slices.
|
||||
- `.task/<task-id>/state.json` records durable task phase, status, gates, files, and current slice.
|
||||
- `.task/<task-id>/context-pack.md` contains the compact context for the current coding slice or approved parallel group.
|
||||
|
||||
Use the local task date for `<yyyy-MM-dd>`, for example `.task/2026-04-28/`. Keep task docs concise. Prefer references and distilled summaries over copying full source documents.
|
||||
|
||||
Legacy `.task/context-pack.md` is supported only as a migration fallback. Prefer the active task directory for all new context packs.
|
||||
|
||||
## Task State Contract
|
||||
|
||||
`taskId` is a relative task path under `.task/`, using `yyyy-MM-dd/task-slug` such as `2026-05-27/add-login`.
|
||||
|
||||
### `.task/active.json`
|
||||
|
||||
`active.json` is a flat pointer to the current task.
|
||||
|
||||
Support boundary:
|
||||
|
||||
- treat `active.json` as local to the current repository root or checked-out worktree
|
||||
- do not rely on implicit active-task lookup as cross-worktree subagent delegation context
|
||||
- this workflow does not by itself implement full runtime git-worktree scheduling
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `taskId` | string | yes | Active task path. |
|
||||
| `type` | string | no | Task classification: `feature`, `bugfix`, `refactor`, `documentation`, or `investigation`. |
|
||||
| `phase` | string | no | Current phase: `analysis`, `coding`, `review`, or `finalization`. |
|
||||
| `allowedToCode` | boolean | no | Whether the analysis-to-coding gate has been confirmed. |
|
||||
| `currentSlice` | string \| null | no | Currently approved slice identifier. |
|
||||
| `lastGate` | string \| null | no | Last gate where the agent stopped. |
|
||||
| `nextCommand` | string | no | Recommended next CLI command or skill action. |
|
||||
| `updatedAt` | string | no | Last update timestamp in ISO-8601 format. |
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"taskId": "2026-05-27/example-task",
|
||||
"type": "feature",
|
||||
"phase": "analysis",
|
||||
"allowedToCode": false,
|
||||
"currentSlice": null,
|
||||
"lastGate": null,
|
||||
"nextCommand": "/marionettist-context",
|
||||
"updatedAt": "2026-05-27T00:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
### `.task/<task-id>/state.json`
|
||||
|
||||
`state.json` records durable task execution state. Its `taskId` must match `.task/active.json.taskId`.
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `taskId` | string | yes | Same value as `.task/active.json.taskId`. |
|
||||
| `type` | string | no | Task classification: `feature`, `bugfix`, `refactor`, `documentation`, or `investigation`. |
|
||||
| `phase` | string | no | Current phase: `analysis`, `coding`, `review`, or `finalization`. |
|
||||
| `status` | string | no | Task status: `in_progress`, `completed`, or `blocked`. |
|
||||
| `allowedToCode` | boolean | no | Whether the analysis-to-coding gate has been confirmed. |
|
||||
| `currentSlice` | string \| null | no | Currently approved slice identifier. |
|
||||
| `gatePolicy` | object | no | Task-local gate policy record with fields such as `recommended`, `selected`, `reason`, and `finalApprovalRequired`. A task-local override changes the task's default gate posture only; it does not bypass required gates or explicit stop conditions. |
|
||||
| `slices` | object[] | no | Planned slices or approved groups for this task. |
|
||||
| `gates` | object | no | Gate booleans such as `requirementFrozen`, `planApproved`, `contextPackReady`, `criticPassed`, `implementationDone`, `reviewPassed`, and `validationPassed`. `criticPassed` records the plan-review critic gate, not permission to code by itself. |
|
||||
| `files` | object | no | Task artifact paths such as `requirement`, `implementationPlan`, and `contextPack`. |
|
||||
| `updatedAt` | string | no | Last update timestamp in ISO-8601 format. |
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"taskId": "2026-05-27/example-task",
|
||||
"type": "feature",
|
||||
"phase": "analysis",
|
||||
"status": "in_progress",
|
||||
"allowedToCode": false,
|
||||
"currentSlice": null,
|
||||
"gatePolicy": {
|
||||
"recommended": "balanced",
|
||||
"selected": null,
|
||||
"reason": "Default non-trivial task posture until a task-specific override is chosen.",
|
||||
"finalApprovalRequired": true
|
||||
},
|
||||
"slices": [],
|
||||
"gates": {
|
||||
"requirementFrozen": false,
|
||||
"planApproved": false,
|
||||
"contextPackReady": false,
|
||||
"criticPassed": false,
|
||||
"implementationDone": false,
|
||||
"reviewPassed": false,
|
||||
"validationPassed": false
|
||||
},
|
||||
"files": {
|
||||
"requirement": ".task/2026-05-27/example-task/requirement.md",
|
||||
"implementationPlan": ".task/2026-05-27/example-task/implementation-plan.md",
|
||||
"contextPack": ".task/2026-05-27/example-task/context-pack.md"
|
||||
},
|
||||
"updatedAt": "2026-05-27T00:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
### `state.json` slice entry shape
|
||||
|
||||
When `state.json.slices` is used, each slice entry may record gate-policy hints for that slice or approved group.
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `id` | string | yes | Slice or approved group identifier. |
|
||||
| `status` | string | no | Slice status such as `pending`, `in_progress`, `completed`, or `blocked`. |
|
||||
| `gateClass` | string | no | Frozen gate hint vocabulary. Use only `simple`, `standard`, `boundary-sensitive`, or `high-risk`. |
|
||||
| `risk_score` | integer | no | Supplemental per-slice risk score from `1` to `5`. It may preserve or strengthen a pause relative to `gateClass`, but must not weaken required stops or replace `gateClass`. |
|
||||
| `gateReasons` | string[] | no | Short reason labels that explain the gate posture for the slice or group, including any stricter pause signaled by `risk_score` when relevant. |
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "slice-2-policy-aware-task-artifacts-skills",
|
||||
"status": "in_progress",
|
||||
"gateClass": "boundary-sensitive",
|
||||
"risk_score": 4,
|
||||
"gateReasons": ["agent-instructions", "task-state-contract"]
|
||||
}
|
||||
```
|
||||
|
||||
Agents may preserve extra project-local fields, but must not change the meaning of the fields above.
|
||||
|
||||
### Delegation Boundary For Parallel Or Worktree-Aware Execution
|
||||
|
||||
When a builder, orchestrator, or primary agent delegates work across subagents, especially with parallel execution or multiple worktrees, it should preflight task context once before delegation.
|
||||
|
||||
Cross-worktree delegation should use an explicit compact `taskEnvelope` instead of asking delegated agents to rediscover context through implicit `.task/active.json` lookup. That `taskEnvelope` should include at least:
|
||||
|
||||
- `worktreeRoot`
|
||||
- `taskId`
|
||||
- `phase`
|
||||
- `allowedToCode`
|
||||
- `currentSlice` or approved parallel group
|
||||
- `artifactPaths`
|
||||
- allowed scope and forbidden scope when relevant
|
||||
|
||||
Delegated agents should then:
|
||||
|
||||
- use the provided `taskEnvelope` as the task-context source
|
||||
- read only the referenced artifacts with bounded reads
|
||||
- return `CONTEXT_UNAVAILABLE` when context is missing, inaccessible, stale, or ambiguous
|
||||
- treat empty or cancelled delegation as a bounded stop condition rather than retrying in a loop
|
||||
|
||||
The primary agent remains responsible for surfacing bounded delegation failure clearly and stopping for user or orchestrator handling when safe context cannot be established.
|
||||
|
||||
## Framework-Managed Install And OpenCode Notes
|
||||
|
||||
When this project was installed or upgraded through Marionettist, `.marionettist/manifest.json` is the ownership record for framework-managed files.
|
||||
|
||||
Install/distribution modes:
|
||||
|
||||
- `embedded` — default for new installs and the closest match to legacy behavior
|
||||
- `hybrid` — local install with explicit adapter-aware distribution metadata
|
||||
- `adapter` — adapter-oriented install while keeping local manifest-based safety checks
|
||||
|
||||
When recorded, the mode appears in `.marionettist/manifest.json` as `distributionMode`. `marionettist.config.yaml` may mirror it under `distribution.mode` for readability. Legacy installs without manifest `distributionMode` remain valid; `marionettist diff`, `marionettist sync`, and `marionettist doctor` may report or infer the effective mode. The field is written only when the user explicitly selects or provides a mode, when the manifest already contains `distributionMode`, or when `marionettist.config.yaml` specifies `distribution.mode`.
|
||||
|
||||
For optional OpenCode assets:
|
||||
|
||||
- the framework OpenCode template source of truth is `templates/pathways/opencode/**` in the framework distribution
|
||||
- managed entries may record metadata such as `adapter`, `commandSurface`, `templateHash`, `renderedHash`, and legacy `hash`
|
||||
- safe comparison uses `renderedHash ?? hash` for compatibility with older manifests
|
||||
- local edits, missing files, conflicts, and orphaned managed entries are reported rather than silently overwritten
|
||||
- force-style replacement must be explicit
|
||||
|
||||
Canonical model profile source:
|
||||
|
||||
- `.marionettist/model-profiles.yml` is the canonical source when present
|
||||
- `marionettist.config.yaml` `models.profiles.*` is legacy fallback only when the canonical file is absent
|
||||
- `marionettist sync` may restore or re-render the canonical file and OpenCode agent files from effective profile values
|
||||
- `marionettist doctor` reports drift and whether expected model values came from the canonical file or the legacy fallback
|
||||
|
||||
OpenCode command surfaces:
|
||||
|
||||
- `minimal` — `/marionettist`, `/marionettist-dev`, `/marionettist-incident`, `/marionettist-docs`, `/marionettist-config`
|
||||
- `standard` — minimal plus `/marionettist-context`, `/marionettist-status`, `/marionettist-continue`
|
||||
- `advanced` — standard plus `/marionettist-feature`, `/marionettist-bugfix`, `/marionettist-refactor`
|
||||
- legacy `full` is a compatibility alias for `advanced`
|
||||
|
||||
The intended default is builder-first usage through `/marionettist`; broader command surfaces are optional ergonomics layers.
|
||||
@@ -0,0 +1,220 @@
|
||||
# Tier Policy Workflow Design Draft
|
||||
|
||||
This document is an installed target-project design note for deferred workflow research. It is intentionally kept in core templates so projects can see the boundary between the implemented Tier-policy MVP and future workflow-engine ideas without mistaking the future design for active behavior.
|
||||
|
||||
It defines an MVP boundary for configurable Tier policy without implementing a general workflow DAG engine.
|
||||
|
||||
## Purpose
|
||||
|
||||
- keep Tier policy focused on task classification and workflow hints
|
||||
- preserve current gate vocabulary and gate-policy semantics
|
||||
- record where future workflow configurability would interact with existing Marionettist flow
|
||||
- give target projects a stable place to record future workflow questions without rewriting current Marionettist behavior docs
|
||||
|
||||
## Why This Document Is Installed
|
||||
|
||||
This file stays in the core installed docs set for now because it serves a project-neutral documentation role:
|
||||
|
||||
- it explains why `.marionettist/tier-policy.yml` exists without implying that Tier policy can already rewire execution
|
||||
- it separates current implemented workflow rules from deferred workflow-engine ideas
|
||||
- it gives target projects a safe reference when they want to discuss future extensibility or roadmap questions
|
||||
|
||||
Projects should treat this file as a target/future-facing design note, not as executable current-state behavior. The current source of truth for actual Marionettist execution remains `docs/project/marionettist-workflow.md` plus `marionettist.config.yaml` `gatePolicy`.
|
||||
|
||||
## Current Workflow Nodes
|
||||
|
||||
The current Marionettist workflow is a mostly fixed directed flow with a few policy-driven branches:
|
||||
|
||||
1. task intake and Tier classification
|
||||
2. analysis helpers as needed
|
||||
- requirement freezing when needed
|
||||
- workflow or module inspection when needed
|
||||
- implementation slicing when needed
|
||||
- context-pack creation
|
||||
3. analysis-to-coding gate
|
||||
4. approved slice execution
|
||||
5. automatic review for that same slice or approved group
|
||||
6. critic gates when required by Tier or risk
|
||||
7. slice gate or final gate
|
||||
|
||||
The existing Tier split is coarse-grained:
|
||||
|
||||
- Tier S: direct coding and review
|
||||
- Tier M: analysis plus context pack before coding
|
||||
- Tier L: full Marionettist flow with stricter gating and critic expectations
|
||||
|
||||
## Conceptual Agent And Skill I/O
|
||||
|
||||
Current workflow behavior can be described as node contracts rather than a configurable engine:
|
||||
|
||||
| Node | Inputs | Outputs |
|
||||
| --- | --- | --- |
|
||||
| Task intake | user request, repo rules, local config | Tier suggestion, task type, next Marionettist step |
|
||||
| Requirement freeze | unclear behavior or scope | requirement artifact or clarified stop condition |
|
||||
| Inspection | selected files, docs, rules | workflow/module findings and risk notes |
|
||||
| Implementation slicing | requirements, findings | approved slices or groups with gate hints |
|
||||
| Context-pack build | active task artifacts, relevant docs/rules | `.task/<task-id>/context-pack.md` |
|
||||
| Coding | approved slice, context pack | scoped file changes and slice validation evidence |
|
||||
| Review | changed-file inventory, approved scope | scope verdict, risk notes, follow-up actions |
|
||||
| Critic gate | task artifacts, review/validation evidence | gate verdict and missing-evidence report |
|
||||
|
||||
This framing keeps node responsibilities stable even if later Tier policy adds more configurable routing hints.
|
||||
|
||||
## Where Tier Policy Can Safely Influence Flow
|
||||
|
||||
An MVP Tier policy can safely influence only advisory decisions such as:
|
||||
|
||||
- how a task is classified by Tier
|
||||
- what level of analysis is recommended
|
||||
- whether critic use is suggested or expected
|
||||
- what model profile role is preferred
|
||||
- what workflow hint label best matches the task
|
||||
|
||||
The MVP should not let Tier policy directly redefine gates, invent new gate classes, or bypass required human confirmation.
|
||||
|
||||
## Workflow DAG Configuration Complexity
|
||||
|
||||
Full workflow DAG configurability is deferred because it introduces multiple coupled concerns at once:
|
||||
|
||||
1. **Node contract stability**: configurable edges require stable, documented input/output contracts for every skill and agent handoff.
|
||||
2. **Safety invariants**: some edges are not optional, such as analysis before non-trivial coding and human confirmation at mandatory gates.
|
||||
3. **Conflict handling**: user-configured routing could contradict safer defaults or create ambiguous paths.
|
||||
4. **Execution semantics**: optional, required, repeated, and parallel nodes need a clear state model.
|
||||
5. **Validation semantics**: different paths would need explicit rules for what counts as sufficient review, critic evidence, and final validation.
|
||||
6. **Template portability**: a project-neutral framework must avoid encoding stack-specific workflows while still remaining understandable.
|
||||
|
||||
Because these concerns are intertwined, a full DAG engine would be a separate design and implementation track, not an incidental extension of Tier policy.
|
||||
|
||||
## MVP Proposal
|
||||
|
||||
For the configurable Tier policy MVP:
|
||||
|
||||
- keep the executable workflow fixed as documented in `docs/project/marionettist-workflow.md`
|
||||
- allow Tier policy to provide **workflow hints**, not executable graph rewrites
|
||||
- keep gate behavior under `gatePolicy` and existing workflow rules
|
||||
- keep critic requirements expressed as current workflow expectations, not arbitrary user-defined nodes
|
||||
- allow builder/config flows to explain which current path was chosen and why
|
||||
- allow builder/config flows to turn natural-language policy requests into candidate YAML only after showing a diff and waiting for explicit persistence confirmation
|
||||
|
||||
Recommended hint categories for later implementation work:
|
||||
|
||||
- `workflowHint`: labels such as direct, analysis-context, or full-marionettist
|
||||
- `reviewLevel`: labels such as standard or critic-required
|
||||
- `modelProfileHint`: existing model profile role/name only
|
||||
- `gateHint`: advisory only; must not replace `gatePolicy`
|
||||
|
||||
## Implemented MVP Boundary Vs Deferred Hardening
|
||||
|
||||
Implemented MVP behavior today:
|
||||
|
||||
- `.marionettist/tier-policy.yml` is the installed project-local Tier-policy file
|
||||
- framework defaults remain available when the project file is missing
|
||||
- parse and validation problems fall back to safer framework behavior with explanation
|
||||
- conflict handling distinguishes refinements, explicit overrides, soft conflicts, and unsafe downgrades
|
||||
- natural-language policy requests go through candidate YAML, diff display, and explicit confirmation before persistence
|
||||
|
||||
Deferred future hardening beyond the MVP:
|
||||
|
||||
- cross-validating every `modelProfileHint` against `.marionettist/model-profiles.yml`
|
||||
- stricter automatic rejection of unknown ordered-field values instead of the current conservative explanation/fallback posture
|
||||
- a full configurable workflow DAG or workflow-engine state model
|
||||
|
||||
## Concrete MVP Schema Freeze
|
||||
|
||||
The current MVP freezes the project-local Tier policy file as `.marionettist/tier-policy.yml` with this shape:
|
||||
|
||||
```yaml
|
||||
schemaVersion: "1"
|
||||
tiers:
|
||||
S:
|
||||
description: "..."
|
||||
matchRules:
|
||||
- "..."
|
||||
minTier: null
|
||||
maxTier: "S"
|
||||
workflowHint: "direct"
|
||||
gateHint: "default"
|
||||
reviewLevel: "standard"
|
||||
modelProfileHint: "build"
|
||||
M:
|
||||
description: "..."
|
||||
matchRules:
|
||||
- "..."
|
||||
minTier: "M"
|
||||
maxTier: "M"
|
||||
workflowHint: "analysis-context"
|
||||
gateHint: "default"
|
||||
reviewLevel: "standard"
|
||||
modelProfileHint: "build"
|
||||
L:
|
||||
description: "..."
|
||||
matchRules:
|
||||
- "..."
|
||||
minTier: "L"
|
||||
maxTier: null
|
||||
workflowHint: "full-marionettist"
|
||||
gateHint: "prefer-strict"
|
||||
reviewLevel: "critic-required"
|
||||
modelProfileHint: "think"
|
||||
```
|
||||
|
||||
Schema rules for dependent slices:
|
||||
|
||||
- `schemaVersion` is required and currently fixed to string `"1"`
|
||||
- `tiers` is required
|
||||
- tier keys are fixed to `S`, `M`, and `L`; the MVP does not add custom tier names
|
||||
- `description`, `matchRules`, `workflowHint`, `gateHint`, `reviewLevel`, and `modelProfileHint` are required for each tier
|
||||
- `minTier` and `maxTier` are optional and may be `S`, `M`, `L`, or `null`
|
||||
- `matchRules` is a plain string list; no inline maps or nested rule objects
|
||||
|
||||
Precedence and boundary notes:
|
||||
|
||||
- framework defaults remain the fallback when the file is missing
|
||||
- project-local file content is an override/refinement layer for Tier classification and hints only
|
||||
- `tiers.<tier>.gateHint` is advisory and must not replace `gatePolicy.defaultMode` or the selected task gate policy
|
||||
- `tiers.<tier>.modelProfileHint` must reference an existing model-profile role/name and must not carry provider/model IDs
|
||||
- refinements should be auto-accepted with rationale, explicit overrides should be surfaced clearly, and unsafe downgrades should fall back to framework defaults rather than silently accepted
|
||||
|
||||
## Natural-Language Candidate Workflow Boundary
|
||||
|
||||
The MVP natural-language authoring path is intentionally narrow:
|
||||
|
||||
1. user describes desired Tier-policy changes in prose
|
||||
2. builder/config workflow drafts candidate `.marionettist/tier-policy.yml` content
|
||||
3. builder shows the candidate and a diff against the current file or framework defaults
|
||||
4. builder includes any already-available conflict or override explanation relevant to the candidate
|
||||
5. builder stops for explicit confirmation before writing
|
||||
|
||||
This is a guided config-authoring workflow, not a new standalone CLI command and not a general workflow-DAG editor.
|
||||
|
||||
Parser-compatibility boundary for this schema:
|
||||
|
||||
- no anchors
|
||||
- no merge keys
|
||||
- no multi-document YAML
|
||||
- no complex inline YAML structures
|
||||
|
||||
## Deferred Boundaries
|
||||
|
||||
The following remain out of scope for the MVP and should be deferred beyond Tier-policy basics:
|
||||
|
||||
- user-defined workflow nodes
|
||||
- arbitrary edge rewiring between existing nodes
|
||||
- per-project replacement of mandatory Marionettist gates
|
||||
- new gate vocabulary or numeric workflow scoring
|
||||
- a standalone workflow-DAG execution engine
|
||||
- automatic persistence of natural-language workflow changes without explicit confirmation
|
||||
|
||||
## Suggested Future Design Questions
|
||||
|
||||
If a later slice explicitly explores configurable workflow execution, it should answer:
|
||||
|
||||
1. Which workflow edges are hard invariants versus configurable suggestions?
|
||||
2. Which node contracts are stable enough to expose in project-neutral templates?
|
||||
3. How are invalid or unsafe workflow graphs detected and explained?
|
||||
4. How does task state record active path selection without making `state.json` engine-specific too early?
|
||||
5. How do parallel groups interact with configurable routing while preserving sequential fallback?
|
||||
|
||||
## Summary
|
||||
|
||||
Tier policy should first become a safe classification-and-hints layer. A full configurable workflow DAG is a separate future capability that should begin only after the framework freezes node contracts, safety invariants, and validation semantics.
|
||||
@@ -0,0 +1,41 @@
|
||||
# Target Architecture Intent
|
||||
|
||||
目标方向已经写在现有规划里。本文件只标明读哪一份,不另写一套架构。
|
||||
|
||||
## Scope
|
||||
|
||||
- Area: Watchman 预警平台
|
||||
- Why a target-state document is needed: 把「打算做成什么样」和「现在还没有代码」分开
|
||||
- Status: 规划已写入仓库,业务实现尚未开始
|
||||
- Related current docs: `docs/current/system-map.md`、`docs/progress.md`
|
||||
|
||||
## Desired Outcomes
|
||||
|
||||
- 可配置预警:Cron、次数升级、报警三状态、企微通知
|
||||
- 模块化单体,不拆微服务
|
||||
|
||||
## Proposed Future Shape
|
||||
|
||||
- Target:
|
||||
- 后端 Python FastAPI、SQLAlchemy/Alembic、PostgreSQL、Celery/RabbitMQ
|
||||
- 前端 Vue 3、TypeScript、Vite、Element Plus、Pinia
|
||||
- 身份用 Casdoor
|
||||
- 详细模块切分以 `docs/development-plan.md` 和 `docs/tasks/INDEX.md` 为准
|
||||
- Open design questions:
|
||||
- 以 `docs/decisions.md` 里尚未确认的项为准,不在这里提前拍板
|
||||
|
||||
## Differences From Current State
|
||||
|
||||
- Current fact:
|
||||
- 只有文档和 Agent 规则,没有业务实现
|
||||
- Target:
|
||||
- 按冻结需求实现阶段 A,再进入后续阶段
|
||||
- Migration note:
|
||||
- 目录落位、API 信封、前端选型和密钥纪律在开工写代码时查 sy-standards,不提前在本文件里改写公司规范
|
||||
|
||||
## Assumptions And Tradeoffs
|
||||
|
||||
- Assumption:
|
||||
- 技术方向以 `AGENTS.md` 项目本地段和开发计划为准
|
||||
- Tradeoff:
|
||||
- 公司前端与 API 规范只在真正写平台代码时生效;现在不为了对齐规范去生成空业务工程
|
||||
@@ -0,0 +1,214 @@
|
||||
# 历史功能检查清单 V1(原 133 小片)
|
||||
|
||||
**2026-11-17 起仅作覆盖参考,不再作为执行任务、会话单位或硬依赖图。** 当前以 `INDEX.md` 的 M01~M15 大任务为准;以下历史引导中的“逐片任务卡、逐片审批和依赖”不再生效。保留原编号便于追踪测试,不逐项管理开发进度。
|
||||
|
||||
每行是一个可独立审查和验证的小功能,不是允许顺带实现整个模块。正式开始时主 Agent 用 TEMPLATE 为当前行创建单独任务卡,补齐实际文件、契约、用例和角色模型后才委派。这样无需为尚未开工的百余片预造空实现。
|
||||
|
||||
**全部初始 TODO,状态只见 `../progress.md`。** 先决决策见 `../decisions.md`。依赖列为显式前置,未满足不实施;同阶段并非必须同时开工。所有片须独立 review 后正式验证。
|
||||
|
||||
测试标记:DOC 文档/契约检查,UT 单元,DB 真实 PostgreSQL 集成,API 接口,MQ 队列故障,UI Playwright+截图,EXT 需批准的真实外部测试。每行给最低断言,详见 testing-plan;不适用项明确写 N/A。
|
||||
|
||||
## P:准备与决策(8 片)
|
||||
|
||||
| ID | 单一功能与交付 | 依赖 | 最低验收 |
|
||||
|---|---|---|---|
|
||||
| P-001 | 代理能力、实际角色模型和资料授权映射 | 用户开工授权 | DOC:实际模型 ID、不同系列 reviewer、授权范围;能力不足明确阻塞 |
|
||||
| P-002 | 技术依赖版本与锁定方案验证 | P-001 | DOC/验证:官方兼容依据,Python/Node/依赖版本,不凭空指定最新版 |
|
||||
| P-003 | 核心对象、状态和接口契约文档 | P-002 | DOC:输入身份、周期、状态、错误、事务、唯一约束互相一致 |
|
||||
| P-004 | Cron 方言和解析/编辑组件选择 | P-003;O01/O07 | UT 验证:同表达式预览与计算一致,DOM/DOW、时区、月末;无业务默认猜测 |
|
||||
| P-005 | 次数窗口与升级行为契约 | P-003;O02/O03 | DOC:重复采样不加次数,阈值、跳级、目标和重置均有具体例子 |
|
||||
| P-006 | 关闭、新输入及人工权限契约 | P-003;O04/O05/O06 | DOC:关闭后旧/新周期、修订、未发送意图、并发处理例子 |
|
||||
| P-007 | UI 设计基线与页面状态规范 | P-003 | DOC:导航、字体、间距、表格、空/错/无权状态和视口,不专门做大屏 |
|
||||
| P-008 | 测试环境、样例和证据规范 | P-003 | DOC:合成数据、真实集成边界、Mock 标识、命令和截图追踪方式 |
|
||||
|
||||
## A:规则监控、次数升级与企微(85 片)
|
||||
|
||||
### 工程、认证和运行记录
|
||||
|
||||
| ID | 单一功能与交付 | 依赖 | 最低验收 |
|
||||
|---|---|---|---|
|
||||
| A-001 | Python API 最小骨架与非敏感健康检查 | P-002、P-003、P-008 | API:健康响应、异常不回显配置;pytest 可运行 |
|
||||
| A-002 | 前端最小骨架与路由壳 | P-002、P-007 | UI:页面打开、路由回退正常、无报错和溢出 |
|
||||
| A-003 | 环境变量加载与秘密脱敏 | A-001 | UT:缺必填配置明确失败,秘密不出日志/接口 |
|
||||
| A-004 | 平台数据库连接和事务边界 | A-003、A-082 | DB:提交/回滚、独立 session、连接释放 |
|
||||
| A-005 | Alembic 初始迁移运行机制 | A-004 | DB:空库升级可重现,版本可查,禁止自动改生产库 |
|
||||
| A-006 | 统一 API 错误与请求关联 ID | A-001、P-003 | API:校验、权限、故障分开;日志可关联且脱敏 |
|
||||
| A-007 | 最小操作审计写入能力 | A-005、A-006 | DB:操作者、对象、动作、时间可查,不写秘密 |
|
||||
| A-008 | OIDC 令牌验证后端边界 | A-003、P-003 | UT/API:签名、issuer、audience、过期错误拒绝;Mock 与真实明确 |
|
||||
| A-009 | 用户权限与场景范围检查 | A-008、A-007 | API:读写分离,跨范围 ID 直接访问拒绝 |
|
||||
| A-010 | 登录回调、退出和前端鉴权壳 | A-002、A-008、A-009 | UI:登录/失败/过期/退出流程,后端仍独立校验 |
|
||||
| A-011 | 运行记录创建与状态查询 | A-005、P-003 | DB/API:状态合法、错误有阶段、输入与版本关联 |
|
||||
|
||||
### 数据源与获准查询
|
||||
|
||||
| ID | 单一功能与交付 | 依赖 | 最低验收 |
|
||||
|---|---|---|---|
|
||||
| A-012 | 数据源元数据 CRUD API | A-009、A-005 | API:权限、类型校验、凭证仅引用、停用可查 |
|
||||
| A-013 | 数据源连接测试操作 | A-012、A-003 | UT/DB:成功、认证失败、超时分别返回,不泄漏秘密 |
|
||||
| A-014 | 数据源列表与编辑 UI | A-012、A-010 | UI:新增/编辑/停用、错误和引用提示 |
|
||||
| A-015 | 数据源连接测试 UI | A-013、A-014 | UI:测试中/成功/失败,不显示口令 |
|
||||
| A-016 | 查询定义及参数 schema API | A-012、A-009 | API:用途、输出、参数限制,未知字段拒绝 |
|
||||
| A-017 | 只读查询执行适配器 | A-016、A-013 | DB:参数绑定、只读账户、超时和返回量限制;不靠 SQL 前缀 |
|
||||
| A-018 | 查询预览 API 与空数据契约 | A-017、A-011 | API/DB:空、失败、非法类型分别呈现,样例脱敏 |
|
||||
| A-019 | 查询定义列表与编辑 UI | A-016、A-014 | UI:参数和输出契约维护,越权不可保存 |
|
||||
| A-020 | 查询试运行预览 UI | A-018、A-019 | UI:限制参数、结果、空/错状态,不进入正式报警 |
|
||||
|
||||
### 映射、规则和场景版本
|
||||
|
||||
| ID | 单一功能与交付 | 依赖 | 最低验收 |
|
||||
|---|---|---|---|
|
||||
| A-021 | 字段映射 schema 与类型转换 | A-016、P-003 | UT:空值、非法数值、单位、时间和对象键明确 |
|
||||
| A-022 | 映射预览 UI | A-021、A-020 | UI:原始/标准字段对应,缺失高亮,不静默转零 |
|
||||
| A-023 | 标准输入身份与持久化去重 | A-021、A-005、P-006 | DB:同一输入唯一,跨周期合法事件保留,修订按契约 |
|
||||
| A-024 | 条件规则 schema 与后端校验 | A-021、P-003 | UT:运算符/类型白名单、深度限制、非法代码拒绝 |
|
||||
| A-025 | PASS/FAIL/UNKNOWN 规则计算 | A-024 | UT:比较边界和 AND/OR 缺失真值表,不执行任意代码 |
|
||||
| A-026 | 规则编辑与样例测试 UI | A-025、A-022 | UI:条件保存/重开一致,命中原因和未知可见 |
|
||||
| A-027 | 场景草稿管理 API | A-016、A-024、A-009 | API:名称、模块、引用、草稿可不完整但不能运行;UI 在 A-083 |
|
||||
| A-028 | 场景发布校验与不可变版本 | A-027、A-021、A-024 | DB/API:无权限/缺字段拒绝;编辑草稿不改发布快照 |
|
||||
| A-029 | 手动无副作用运行与判定留存 | A-028、A-023、A-025、A-011、A-017 | DB/API:取数→映射→判定,多对象,默认不发真实消息 |
|
||||
|
||||
### Cron 与异步可靠性
|
||||
|
||||
| ID | 单一功能与交付 | 依赖 | 最低验收 |
|
||||
|---|---|---|---|
|
||||
| A-030 | Cron 后端校验及下一时刻 API | P-004、A-006 | UT/API:合法/非法/无下一时间、时区、DOM/DOW 一致 |
|
||||
| A-031 | Cron 输入及辅助编辑 UI | A-030、A-083 | UI:直接输入和组件双向一致,预览后端结果,不生成不支持方言 |
|
||||
| A-032 | 已发布场景计划和启停持久化 | A-028、A-030 | DB/API:Cron、时区、next_due、版本可查,草稿不影响执行 |
|
||||
| A-033 | 到期计划认领与计划运行唯一性 | A-032、A-011、P-004 | DB:并发扫描只产生一次计划身份,进度事务一致 |
|
||||
| A-034 | 系统 Beat 统一扫描触发器 | A-033、A-035 | MQ:不每场景生成 Beat 配置;重启/重复 tick 不重复事实 |
|
||||
| A-035 | Outbox 保存、认领与投递机制 | A-005、A-011、P-003 | DB/MQ:提交后未投递可恢复,重复投递不盲目副作用 |
|
||||
| A-036 | Celery 规则任务及重叠/旧版本校验 | A-029、A-033、A-035 | MQ/DB:状态、重投、停用、改版、超时;不隐式补发历史消息 |
|
||||
|
||||
### 报警与三状态
|
||||
|
||||
| ID | 单一功能与交付 | 依赖 | 最低验收 |
|
||||
|---|---|---|---|
|
||||
| A-037 | 首次有效 FAIL 创建报警 | A-023、A-025、A-028、P-006 | DB:首次原子创建;PASS/UNKNOWN 不默认报警 |
|
||||
| A-038 | 持续异常关联与有限范围合并 | A-037 | DB:范围内留判定,范围外可新建,不按文本永久合并 |
|
||||
| A-039 | 关闭后新周期/独立事件关联 | A-038、P-006 | DB:旧输入不重报,新身份新建并关联历史;修订按决定 |
|
||||
| A-040 | 报警列表/详情只读 API | A-038、A-009 | API:分页、筛选、对象依据、权限,不显示假恢复 |
|
||||
| A-041 | 接手报警与并发保护 | A-040、P-006、A-007 | DB/API:正向转换、唯一当前处理人、越权与重复操作 |
|
||||
| A-042 | 追加处理进展 | A-041 | DB/API:操作者和时间追加,不能改旧记录或判定 |
|
||||
| A-043 | 关闭报警与结果/依据校验 | A-042、P-006 | DB/API:权限、必填结果、并发关闭、旧状态留存 |
|
||||
| A-044 | 报警筛选列表 UI | A-040、A-010 | UI:模块/场景/时间/状态筛选,空、加载、失败 |
|
||||
| A-045 | 报警详情及判定依据 UI | A-040、A-044 | UI:观测/计划时间分开,多条判定可查 |
|
||||
| A-046 | 接手及进展 UI | A-041、A-042、A-045 | UI:接手冲突、权限、进展保存和刷新正确 |
|
||||
| A-047 | 关闭操作及历史 UI | A-043、A-046 | UI:结果/说明校验,关闭后不可误操作,不显示已恢复 |
|
||||
|
||||
### 次数升级(不做时间升级)
|
||||
|
||||
| ID | 单一功能与交付 | 依赖 | 最低验收 |
|
||||
|---|---|---|---|
|
||||
| A-048 | 次数策略 schema 与纯校验 | P-005、A-024 | UT:分组、窗口、阈值顺序与目标结构;持久 API 在 A-084 |
|
||||
| A-049 | 有效异常 occurrence 与窗口计数 | A-023、A-038、A-084、P-006 | DB:每独立事件一次,并发不丢,重试不加,窗口边界明确 |
|
||||
| A-050 | 阈值命中与步骤幂等 | A-049 | DB/UT:恰好达到、重复、跳级按决定,每窗口每级一次 |
|
||||
| A-051 | 升级意图事务生成与关闭校验 | A-050、A-043、A-035 | DB/MQ:原子意图,不因关闭吞新事件;无超时升级 |
|
||||
| A-052 | 次数策略配置 UI | A-084、A-031 | UI:窗口、级别和最终目标清楚;未定组合不可发布 |
|
||||
| A-053 | 次数升级无发送模拟预览 | A-050、A-052 | API/UI:给事件序列展示计数、命中步骤,重复样本不加 |
|
||||
| A-054 | 报警升级记录 UI | A-051、A-045 | UI:显示次数依据、级别、目标,不把投递失败算新错误 |
|
||||
|
||||
### 企业微信与发送
|
||||
|
||||
| ID | 单一功能与交付 | 依赖 | 最低验收 |
|
||||
|---|---|---|---|
|
||||
| A-055 | 通道及目标 CRUD API | A-009、A-003 | API:应用/机器人分别绑定,秘密引用、测试/正式范围 |
|
||||
| A-056 | 企微发送库选择验证 | P-002、A-055 | UT/批准 EXT:Apprise 或官方接口格式、部分失败、重试能力;未验真明示 |
|
||||
| A-057 | 企微应用消息适配器 | A-056 | UT/EXT:令牌、业务错误、成员部分失败、超时不确定 |
|
||||
| A-058 | 企微群机器人适配器 | A-056 | UT/EXT:群目标、文本/Markdown、限流,密钥不泄漏 |
|
||||
| A-059 | 模板变量校验与预览 API | A-055、P-003 | UT/API:未知变量、必填、格式、长度和缺分析字段降级 |
|
||||
| A-060 | 输出项到逐目标任务展开 | A-059、A-037、A-051 | DB:同场景多渠道无笛卡尔误发,首次与升级意图区分 |
|
||||
| A-061 | 单目标发送执行及结果留存 | A-060、A-057、A-058、A-035 | DB/MQ:受理/失败/不明及消息 ID,执行前许可检查 |
|
||||
| A-062 | 有限自动重试与失败目标手动重试 | A-061、A-007 | DB/MQ/API:只重试可重试目标,不重发已受理目标 |
|
||||
| A-063 | 独立试发操作及测试目标隔离 | A-061、A-009 | API:显式确认和测试目标,样例预览不真实发送 |
|
||||
| A-064 | 通道与目标管理 UI | A-055、A-010 | UI:渠道分开、秘密不回显,权限与验证提示 |
|
||||
| A-065 | 模板预览及显式试发 UI | A-059、A-063、A-064 | UI:预览无副作用;试发确认和测试目标可见 |
|
||||
| A-066 | 场景多输出项编辑 UI | A-060、A-065、A-027 | UI:每项独立渠道/目标/模板,重新打开一致 |
|
||||
| A-067 | 发送记录及失败重试 UI | A-062、A-045 | UI:部分失败逐目标查,只重试选定失败任务 |
|
||||
|
||||
### 链路、发布体验及验收
|
||||
|
||||
| ID | 单一功能与交付 | 依赖 | 最低验收 |
|
||||
|---|---|---|---|
|
||||
| A-068 | 采集到通知关联查询 API | A-036、A-040、A-061 | API:Run→输入→判定→报警→步骤→目标可追踪 |
|
||||
| A-069 | 运行链路与故障详情 UI | A-068、A-067 | UI:空数据/技术故障/正常分开,失败节点可定位 |
|
||||
| A-070 | 场景样例测试和预计输出预览 UI | A-029、A-031、A-053、A-066 | UI/API:预计判定与目标,无隐式真实通知;正式发布操作见 A-085 |
|
||||
| A-071 | 按能力模块门户入口 | A-044、A-010、P-007 | UI:指标可用,流程/视频未实现明确;不做生产指标大屏 |
|
||||
| A-072 | 开发 Compose 与运行手册 | A-036、A-061、A-002 | 环境:API/worker/beat/DB/MQ 可复现,密钥不进文件,非生产保证 |
|
||||
| A-073 | 故障重启与幂等专项验收 | A-039、A-051、A-062、A-072、A-081、A-034 | MQ/DB:实际周期触发与正式链路,提交/发布/发送/重启断点可恢复并说明外部不确定 |
|
||||
| A-074 | 真实 Casdoor 联调验收 | A-010、A-072;获准测试租户 | EXT/API/UI:真实令牌与业务越权;无租户则 BLOCKED 非通过 |
|
||||
| A-075 | 真实 MES 指标配置验收 | A-085、A-081、A-072;用户指标及只读许可 | EXT/DB:不改核心配置新增指标,对数一致;无条件标阻塞 |
|
||||
| A-076 | 真实企微应用与群试发验收 | A-065、A-072;批准目标 | EXT:实际渠道业务结果留存,无已读伪结论 |
|
||||
| A-077 | 本地权限与凭证泄漏专项回归 | A-009、A-067、A-068 | API/UI:受控签名身份/隔离范围拒绝;真实认证单列 A-074,不受其阻塞 |
|
||||
| A-078 | 前端关键链路与视觉回归 | A-069、A-085、A-071、A-047、A-081 | UI:配置→样例→发布→报警→处理,三视口断言和截图 |
|
||||
| A-079 | 第二个样例场景通用性验收 | A-085、A-073 | API/UI:新查询/规则配置,不增客户专用核心分支 |
|
||||
| A-080 | A 阶段交付与限制清单 | A-073、A-077、A-078、A-079;实际外部阻塞单列 | DOC:需求/用例对照、真实和 Mock、部署说明;不吞 BLOCKED |
|
||||
|
||||
### 补充的细化片与集成片(按依赖安排,不按末尾编号等待)
|
||||
|
||||
| ID | 单一功能与交付 | 依赖 | 最低验收 |
|
||||
|---|---|---|---|
|
||||
| A-081 | 正式规则运行接入报警和通知意图 | A-036、A-039、A-051、A-060 | DB/MQ:正式 FAIL 原子关联判定/报警/occurrence/首轮或升级意图;样例无副作用,重投不重发 |
|
||||
| A-082 | 最小隔离数据库与队列测试环境 | P-002、P-008 | 环境:仅测试 Postgres/RabbitMQ,基础运行命令落 runbook;无业务服务,不删除未知卷 |
|
||||
| A-083 | 场景草稿列表和基本信息编辑 UI | A-027、A-010 | UI:创建/编辑/列表/未完成提示,不在此片实现正式发布 |
|
||||
| A-084 | 次数策略持久化和版本 API | A-048、A-028、A-009 | DB/API:策略草稿/发布引用和权限,旧运行仍绑定原策略版本 |
|
||||
| A-085 | 场景正式发布和启停 UI | A-070、A-028、A-032、A-083 | UI:确认、校验、发布版本、启停和草稿差异,不重新实现样例链 |
|
||||
|
||||
## B:规则原因分析和 AI(22 片)
|
||||
|
||||
进入 B 依赖 A-080 的本地验收结论;真实接入片另列 BLOCKED 和真实门禁,不阻塞合成数据上的 B,也不能假标通过。A-080 若本地功能也未通过则不得越过。
|
||||
|
||||
| ID | 单一功能与交付 | 依赖 | 最低验收 |
|
||||
|---|---|---|---|
|
||||
| B-001 | 分析输入输出和模型 SDK 契约 | A-080、P-002 | DOC/UT:事实、推测、证据、缺失字段;锁模型适配版本 |
|
||||
| B-002 | 规则原因条目 schema 与 CRUD API | B-001、A-009 | API:条件、原因、建议、排序和版本,不混异常判定 |
|
||||
| B-003 | 规则原因匹配执行 | B-002、A-025 | UT/DB:多命中有序,无匹配如实返回 |
|
||||
| B-004 | 规则原因编辑和样例 UI | B-003、A-026 | UI:维护、预览、无匹配状态及权限 |
|
||||
| B-005 | 模型连接引用及授权 API | B-001、A-003 | API:秘密、外发范围、地址限制;无数据授权拒绝 |
|
||||
| B-006 | 模型连接管理和显式测试 UI | B-005、A-010 | UI:调用确认、用途、失败及秘密不回显 |
|
||||
| B-007 | 提示词变量与版本 API | B-001、A-009 | API:变量校验、不可变发布、引用可查 |
|
||||
| B-008 | 提示词编辑与样例预览 UI | B-007 | UI:保存/重开一致,预览不隐式外发 |
|
||||
| B-009 | 场景分析绑定与输入范围 API | B-003、B-005、B-007、A-028 | API:不分析/规则/AI,有效版本与获准上下文 |
|
||||
| B-010 | 场景分析配置 UI | B-009、B-008、B-004 | UI:选择方式、范围、版本;未开发工具不可启用 |
|
||||
| B-011 | 分析运行持久化和触发去重 | B-009、A-035 | DB:持续 FAIL 不每次调用,触发快照和分析身份明确 |
|
||||
| B-012 | AI 已有上下文分析适配器 | B-011 | UT:无工具时不声称查库,输入最小化,Mock 分明 |
|
||||
| B-013 | 结构化分析结果及证据校验 | B-012 | UT/DB:拒伪造引用、结构错误,事实与候选分开 |
|
||||
| B-014 | 分析超时、预算和失败出口 | B-013、A-036 | MQ/UT:有限调用、不阻塞首轮报警、不无限重试 |
|
||||
| B-015 | 授权重分析操作与历史留存 | B-014、A-007 | API/DB:新运行不覆盖旧,原因及范围检查 |
|
||||
| B-016 | 分析结果及重分析 UI | B-015、A-045 | UI:事实、线索、缺失、版本、失败、历史明确 |
|
||||
| B-017 | 分析完成追加通知后端 | B-014、A-060 | DB/MQ:默认关闭,独立意图与模板,防重复 |
|
||||
| B-018 | 分析追加通知配置 UI | B-017、B-010 | UI:显式开启,目标预览,不重复首轮通知 |
|
||||
| B-019 | 分析执行审计与用量摘要 | B-014、A-068 | API/DB:模型/提示词版本、时间、可得用量,未知不编造 |
|
||||
| B-020 | 真实获准模型小范围验收 | B-016、B-019;数据和模型授权 | EXT:真实/Mock 标识、无明细时承认不足,首轮仍正常 |
|
||||
| B-021 | 分析界面与故障专项回归 | B-016、B-018、B-019 | UT/MQ/UI:超时、结构错、越权、布局三视口 |
|
||||
| B-022 | B 阶段交付和限制清单 | B-020、B-021;外部阻塞单列 | DOC:规则/AI 两方式证据、受限与授权说明 |
|
||||
|
||||
## C:本项目内只读工具(18 片)
|
||||
|
||||
| ID | 单一功能与交付 | 依赖 | 最低验收 |
|
||||
|---|---|---|---|
|
||||
| C-001 | 工具输入输出及证据契约 | B-022 | DOC/UT:对象/时间范围、行数、状态,不使用 MCP |
|
||||
| C-002 | 内置工具定义 CRUD API | C-001、A-009 | API:用途、版本、数据源和参数,不允许任意启动命令 |
|
||||
| C-003 | 工具定义列表与编辑 UI | C-002 | UI:字段、范围、引用及权限,未实现工具不可启用 |
|
||||
| C-004 | 获准只读明细查询实现 | C-002、A-017 | DB:只读身份、绑定参数、字段/行数/超时约束 |
|
||||
| C-005 | 工具调用后端授权与参数范围 | C-004、A-009 | UT/API:组织/对象/时间不可扩大,不能只信模型 |
|
||||
| C-006 | 场景工具绑定 API | C-005、B-009 | API:仅已批准定义与版本,未绑定不可调用 |
|
||||
| C-007 | 场景工具绑定 UI | C-006、B-010 | UI:用途和访问范围清楚,拒越权选择 |
|
||||
| C-008 | 显式工具样例测试 API | C-005、A-011 | API/DB:测试范围受控,失败/无数据区分 |
|
||||
| C-009 | 工具测试及预览 UI | C-008、C-003 | UI:参数限制、脱敏样例、超时错误明确 |
|
||||
| C-010 | AI 调用内置工具适配 | C-006、B-012 | UT:仅 registry 白名单、参数校验,不引入 MCP |
|
||||
| C-011 | 工具调用次数/预算与异常控制 | C-010、B-014 | UT/MQ:无限循环阻断、超时、无权限不被模型绕过 |
|
||||
| C-012 | 工具执行记录和证据引用持久化 | C-011、B-013 | DB:版本、参数摘要、结果、错误与分析关联 |
|
||||
| C-013 | 分析详情中的工具证据 UI | C-012、B-016 | UI:点击证据查对应查询,过期清理明确不完整 |
|
||||
| C-014 | 运行链路中的工具节点 UI | C-012、A-069 | UI:状态、权限、错误和引用,不回显秘密 |
|
||||
| C-015 | 只读越权及提示注入专项回归 | C-011、C-012 | DB/UT:写入拒绝、扩范围拒绝、结果文字不授权动作 |
|
||||
| C-016 | 获准明细查询真实联调 | C-012;源权限及样例 | EXT/DB:真实证据,失败不能当不存在;条件缺失标阻塞 |
|
||||
| C-017 | 分析+工具端到端与视觉回归 | C-013、C-014、C-015 | API/UI:原报警→工具→证据→分析,三视口、无源数据泄漏 |
|
||||
| C-018 | C 阶段交付和最终追踪矩阵 | C-016、C-017;外部阻塞单列 | DOC:工具目录、权限、测试、未做 MCP 及后续边界 |
|
||||
|
||||
## 拆分和依赖例外
|
||||
|
||||
- 每一片都带 review 和测试,不把它们拖到 A-073 或阶段末才做;专项回归是额外门禁。
|
||||
- 若单片超出模型可可靠处理范围,主 Agent 新建 `<ID>a/b` 子片并保持父片未完成,记录依赖,不私自一次性整模块实现。
|
||||
- 用户可以批准先 Mock 后真实的条件交付;相关外部片保持 BLOCKED,阶段成果标“本地验证通过/真实受限”,不能把它们改 DONE 掩盖。
|
||||
- 任务编号不同不意味着可同时写共享文件;迁移、契约、锁文件和公共 schema 预约串行。
|
||||
- 图表和全页大屏不在本索引;不要按旧 PPT 或 HTML 自动加功能。
|
||||
@@ -0,0 +1,140 @@
|
||||
# 模块级开发任务索引 V2.0
|
||||
|
||||
**修订:2026-11-17。** 当前以 15 个模块级大任务作为开发、会话、进度和验收单位,不再让用户逐个管理 133 个小片。旧细项保留在 `CHECKLIST-v1.md`,仅用于检查覆盖,旧依赖图不再约束实施顺序。
|
||||
|
||||
一个会话聚焦一个 Mxx,主 Agent 在该任务卡内部自行拆步骤、委派、检查和集成。范围内步骤可连续推进,不需每完成一个接口就询问用户;业务决策、权限、真实外发与超范围改动仍需确认。每个大任务至少一次整体独立 review,之后正式测试,涉及界面加 Playwright 和截图。
|
||||
|
||||
任务编号表示模块,不保证相同工作量或固定耗时。若会话不足或外部阻塞,记录内部恢复点,不能为了“本次必须完成”跳过验证。源码尚未开始,全部初始 TODO;唯一进度台账为 `../progress.md`。
|
||||
|
||||
## 1. 总体任务和依赖
|
||||
|
||||
| ID | 大任务 | 模块前置 | 本会话完成边界 |
|
||||
|---|---|---|---|
|
||||
| M01 | 搭建基础框架和开发环境 | 用户开工授权 | 后端/前端骨架、平台库迁移、任务队列与测试环境、错误/审计/运行记录基础和契约;不实现完整业务 |
|
||||
| M02 | 统一登录与权限模块 | M01 | Casdoor/OIDC 接入、后端授权、前端会话、范围及权限测试;真实配置缺失单列 |
|
||||
| M03 | 数据源配置模块 | M02 | 数据源 API+列表/编辑+连接测试、凭证保护及引用提示 |
|
||||
| M04 | 查询定义与采集模块 | M03 | 受控查询、参数与输出契约、只读执行、预览和配套界面;不开放任意脚本 |
|
||||
| M05 | 字段映射与规则判断模块 | M04 | 映射预览、类型/空值、输入身份、结构化规则编辑、PASS/FAIL/UNKNOWN、测试 |
|
||||
| M06 | 报警中心与人工处理模块 | M05 | 报警创建/合并、详情/列表、接手、进展、关闭、新周期规则与 UI;不发送真实消息 |
|
||||
| M07 | 企业微信通知模块 | M06 | 应用和机器人、目标/模板、多目标任务、试发、结果和失败重试、完整 UI |
|
||||
| M08 | 场景配置与 Cron 调度模块 | M05、M07 | 组合场景、草稿/发布/启停、开源 Cron 编辑/解析/定时触发、样例运行;基础正式链可验证 |
|
||||
| M09 | 次数统计与分层通知模块 | M06、M07、M08;次数口径已定 | 计数窗口、阈值及步骤、升级意图、配置预览与记录;不做时间升级 |
|
||||
| M10 | 模块门户与运行追溯模块 | M08、M09 | 能力模块入口、输入到发送链路、故障详情;不做完整生产看板 |
|
||||
| M11 | 规则监控集成与阶段 A 验收 | M01~M10 | 补全正式链集成、重启/并发/权限/UI 回归、第二样例、运行手册和真实接入台账 |
|
||||
| M12 | 规则原因分析模块 | M11 本地验收 | 原因规则、版本、匹配、排序、无匹配、样例及配置/结果 UI |
|
||||
| M13 | AI 模型与提示词配置模块 | M12 | 获准模型连接、测试、提示词版本和变量、场景绑定与 UI |
|
||||
| M14 | AI 分析执行与工作台模块 | M13 | 异步分析、结构结果和证据、预算/失败、重分析、追加通知、结果 UI 和阶段 B 验收 |
|
||||
| M15 | 内置只读工具模块 | M14 本地验收 | 定义、获准查询、授权、绑定、AI 调用、证据及 UI、阶段 C 验收;不实现 MCP |
|
||||
|
||||
M01 基础框架中包含最小授权接口契约,正式登录在 M02;不允许为方便临时开放生产操作。模块内部可用明确标识的合成 fixtures 验证契约,不谎称后续模块已经实现。
|
||||
|
||||
## 2. 每个大任务的内部步骤和验收重点
|
||||
|
||||
### M01 搭建基础框架和开发环境
|
||||
|
||||
- 内部分解示例:角色与授权核实 → 版本/复用方案 → 核心契约 → 后端骨架 → 前端壳 → 隔离 Postgres/RabbitMQ → 迁移和事务 → 错误、审计和运行基础 → 测试命令/手册。
|
||||
- 验收:新环境按实际手册启动;依赖锁定;健康检查不泄漏;迁移和回滚边界;测试命令真实可运行。只建立需要的基础表,不一次建所有空模块。
|
||||
- 复用:FastAPI、Pydantic、SQLAlchemy、Alembic、Celery、Vite、Element Plus;不要重做 ORM、队列或通用组件库。
|
||||
|
||||
### M02 统一登录与权限
|
||||
|
||||
- 内部分解示例:身份验证适配 → 数据范围和操作权限 → 登录回调/退出 → 过期/无权限 UI → 接口绕过测试。
|
||||
- 验收:后端验证签名、issuer、audience、期限和业务授权;不同对象 ID 不能越权。无 Casdoor 实际配置时仅本地身份验证测试通过,真实联调明确 BLOCKED。
|
||||
|
||||
### M03 数据源配置
|
||||
|
||||
- 内部分解示例:元数据和凭证引用 → CRUD → 连接测试 → 列表/编辑/引用 → 权限和故障验证。
|
||||
- 验收:新增到连接测试完整可用,源库类型不写死 MES;失败、超时和秘密保护正确。使用成熟数据库驱动/连接池。
|
||||
|
||||
### M04 查询定义与采集
|
||||
|
||||
- 内部分解示例:参数/输出契约 → 查询维护 → 只读执行器 → 限制和空数据语义 → 预览 API/UI。
|
||||
- 验收:多对象、绑定参数、只读账户、返回量与时间限制;空结果/非法值/失败分开;不通过检查 SELECT 前缀冒充安全。
|
||||
|
||||
### M05 字段映射与规则判断
|
||||
|
||||
- 内部分解示例:映射与转换 → 输入身份 → 条件 schema → 计算器 → 编辑/样例 UI → 边界测试。
|
||||
- 验收:比较边界、AND/OR 缺失真值表、重复输入与新周期;UNKNOWN 不默认报警。规则原因分析不在此模块。
|
||||
|
||||
### M06 报警中心与人工处理
|
||||
|
||||
- 内部分解示例:报警模型与合并 → 状态服务及权限 → 处理历史 → API/列表/详情 → 接手/关闭 UI → 并发和新周期测试。
|
||||
- 验收:待处理→处理中→已关闭;关闭有结果说明;不改原始 FAIL,不伪称恢复;重复事件不重复报,新周期可关联新报警。
|
||||
- 依赖场景发布版本时用 M01 契约中的合成发布快照,不在此顺手实现 M08;整体发布链在 M08/M11 联调。
|
||||
|
||||
### M07 企业微信通知
|
||||
|
||||
- 内部分解示例:适配库验证 → 通道/目标/模板 → 任务与结果 → 企微应用/机器人 → 重试/试发 → 配置和记录 UI。
|
||||
- 验收:首次通知、多目标、格式与业务响应、部分失败、结果不明、试发隔离及凭证保护。无批准目标只验 Mock,真实发送单列。
|
||||
- 通知模块接收稳定“发送意图”,不依赖次数计数器。M09 将升级意图接入同一发送边界,不能沿用旧细项 A-060 对 A-051 的硬依赖。
|
||||
|
||||
### M08 场景配置与 Cron 调度
|
||||
|
||||
- 内部分解示例:复用组件验证 → 草稿/不可变发布 → 组合映射/规则/输出 → Cron 辅助输入/后端预览 → 调度接入 → 启停/重投 → 样例及基础正式运行。
|
||||
- 验收:从配置到周期判定及基础通知;前后端 Cron 同语义,配置动态生效,旧任务许可与版本可查;不自动补发历史消息。
|
||||
- 必须先看 `../cron-reuse.md`:编辑器、解析器、定时框架均优先复用;只写场景与库之间必要适配。不强制实现新的通用调度器。
|
||||
- 次数策略尚未完成时明确不可启用;本模块的基础首次通知不依赖 M09。M09 增加次数配置和无发送模拟预览;M11 统一验证两条路径。
|
||||
|
||||
### M09 次数统计与分层通知
|
||||
|
||||
- 内部分解示例:明确窗口/分组/跳级 → 策略和版本 → occurrence/并发计数 → 步骤意图与关闭联动 → 配置/模拟/记录 UI → 事件序列测试。
|
||||
- 验收:有效独立错误才加次数,达到阈值正确,窗口边界、重复、并发、关闭和新事件不混淆;只接通知模块,不写第二套发送器。
|
||||
|
||||
### M10 模块门户与运行追溯
|
||||
|
||||
- 内部分解示例:链路查询 → 模块入口 → 运行与故障 UI → 依据跳转及权限。
|
||||
- 验收:指标模块可用,流程/视频未实现有说明;输入、判定、报警、升级、发送关联可查,故障不被当作正常。UI 保持真实软件风格,不做完整业务大屏。
|
||||
|
||||
### M11 阶段 A 集成验收
|
||||
|
||||
- 内部分解示例:正式运行组合 → Cron触发至首次/升级通知 → 停用/重启/并发 → 配置第二样例 → UI视觉/安全 → 完整Compose/手册 → 真实条件验收。
|
||||
- 验收:模块整体依赖全部可用,重试防重和外部不确定性有证据;Casdoor/MES/企微真实验收各自单列,不用 Mock 冒充。
|
||||
- 本地阶段 A 通过可进入 M12;真实访问缺失仍记 BLOCKED,不把阶段本地通过改称上线验收通过。
|
||||
|
||||
### M12 规则原因分析
|
||||
|
||||
- 内部分解示例:分析契约 → 原因规则管理 → 匹配和排序 → 场景选择 → 样例/结果 UI。
|
||||
- 验收:与是否异常判断分离,有依据、无匹配不编造;本模块不等待 AI 模型接入才可使用。
|
||||
|
||||
### M13 AI 模型与提示词配置
|
||||
|
||||
- 内部分解示例:获准模型适配 → 连接与显式测试 → 提示词变量/版本 → 场景输入授权 → UI。
|
||||
- 验收:秘密不回显,预览不隐式外发,模型/提示词/场景引用版本可查;不引入 Agent 通用编排框架。
|
||||
|
||||
### M14 AI 分析执行与工作台
|
||||
|
||||
- 内部分解示例:触发去重 → 异步执行 → 结构/证据校验 → 预算和失败 → 重分析 → 追加通知 → 结果/用量 UI → 阶段 B 验收。
|
||||
- 验收:无工具时不声称查询未提供明细,失败不阻塞首轮报警,事实/推测/缺失分开。真实模型未获准则保持明确阻塞。
|
||||
|
||||
### M15 内置只读工具
|
||||
|
||||
- 内部分解示例:定义与registry → 受控查询 → 范围授权/绑定 → 显式试用 → AI调用/预算 → 证据UI → 越权/注入测试 → 阶段 C 验收。
|
||||
- 验收:未绑定及越范围拒绝、只读凭证生效、失败和无数据区分、证据可回查;不加入 MCP、任意命令或设备操作。
|
||||
|
||||
## 3. 历史细项覆盖映射
|
||||
|
||||
仅用于复用原细项与测试覆盖;不是外部任务状态或内部强制顺序。旧项描述中的“完成该小片”“先独立验收下个小片”等执行指令已被本文件和新 AGENTS 取代。
|
||||
|
||||
| 大任务 | 原细项覆盖 |
|
||||
|---|---|
|
||||
| M01 | P-001~P-003、P-007~P-008;A-001~A-007、A-011、A-035、A-082 |
|
||||
| M02 | A-008~A-010、A-074 |
|
||||
| M03 | A-012~A-015 |
|
||||
| M04 | A-016~A-020 |
|
||||
| M05 | A-021~A-026 |
|
||||
| M06 | P-006;A-037~A-047 |
|
||||
| M07 | A-055~A-065、A-067 |
|
||||
| M08 | P-004;A-027~A-034、A-036、A-066、A-070、A-083、A-085 |
|
||||
| M09 | P-005;A-048~A-054、A-084 |
|
||||
| M10 | A-068~A-069、A-071 |
|
||||
| M11 | A-072~A-073、A-075~A-081 |
|
||||
| M12 | B-001~B-004 |
|
||||
| M13 | B-005~B-010 |
|
||||
| M14 | B-011~B-022 |
|
||||
| M15 | C-001~C-018 |
|
||||
|
||||
## 4. 任务卡与进度
|
||||
|
||||
每会话创建或更新一个 `Mxx.md`,用 TEMPLATE。卡内维护内部步骤、当前子 Agent、候选版本、review、正式测试和恢复点;不为每个函数生成独立文档。`progress.md` 只跟踪大任务状态,原 P/A/B/C 编号不再逐行记进度。
|
||||
|
||||
主 Agent 可按真实实现调整模块内部步骤。需要改模块职责或依赖、改变需求或增加外部服务时先询问并记录。最终验收需确认模块集成,不是“内部步骤均勾上”即自动通过。
|
||||
@@ -0,0 +1,49 @@
|
||||
# <Mxx> <完整功能模块>
|
||||
|
||||
一个会话聚焦本模块;以下内部步骤由 Agent 自行拆解和委派,不单独要求用户开启会话或审批每个接口。
|
||||
|
||||
## 内部步骤(主 Agent 根据现有代码安排)
|
||||
- [ ] 明确边界、依赖和复用方案。
|
||||
- [ ] 数据模型/迁移与契约。
|
||||
- [ ] 后端与适配。
|
||||
- [ ] 前端与接口联调(适用)。
|
||||
- [ ] 模块整体独立 review、修复和复审。
|
||||
- [ ] 正式自动测试及 UI Playwright/截图(适用)。
|
||||
- [ ] 主 Agent 验收、进度和交接。
|
||||
|
||||
步骤可按模块增删并注明当前负责人/恢复点;不把勾选完内部清单直接当作模块验收通过。
|
||||
|
||||
## 目标与边界
|
||||
- 阶段/需求编号:
|
||||
- 依赖及当前状态:
|
||||
- 必须已确认的决策:
|
||||
- 模块可验收行为:
|
||||
- 明确不做:
|
||||
- 输入/输出契约及失败语义:
|
||||
- 权限、事务、唯一约束和幂等键:
|
||||
|
||||
## 实施委派(主 Agent 填写)
|
||||
- 实现子 Agent:实际模型 ID/服务商/授权范围。
|
||||
- 审查子 Agent:不同系列的实际模型 ID。
|
||||
- 测试/浏览器子 Agent:模型 ID、执行工具与环境。
|
||||
- 允许写文件/禁止写文件:
|
||||
- 公共契约或迁移预约:
|
||||
- 计划修改和测试:
|
||||
|
||||
## 模块验收
|
||||
- 正常:Given / When / Then。
|
||||
- 边界:
|
||||
- 故障/权限/重复:
|
||||
- 回归范围:
|
||||
- UI 视口、交互断言及截图(无 UI 写不适用):
|
||||
|
||||
## 证据与结论(主 Agent 汇总)
|
||||
- 实现结果及实际文件:
|
||||
- 候选 commit 或 hash 清单:
|
||||
- Review 报告、问题、修复和复审:
|
||||
- 实际命令/退出码/环境/结果/测试证据路径:
|
||||
- Playwright 断言、截图路径、视觉问题及修订(如适用):
|
||||
- 未执行/受限/真实联调阻塞:
|
||||
- 最终状态及下一步:
|
||||
|
||||
未填 evidence 不允许 DONE_LOCAL。代码改动使受影响旧证据失效。不能为一个会话结束伪造通过,未完保持同一模块并写恢复点。
|
||||
@@ -0,0 +1,186 @@
|
||||
# Watchman 测试、截图和验收计划
|
||||
|
||||
**本文件是计划,不是已执行报告。当前未实现业务代码,未执行单元、集成或 Playwright 功能测试。**
|
||||
|
||||
2026-11-17 调整:测试以 M01~M15 模块任务为正式验收单位,内部持续自测,高风险步骤可提前审查;整体 code review 后运行该模块适用测试及回归。下面 P/A/B/C 编号仅保留为历史覆盖定位,使用 INDEX 映射到当前模块,不再逐细项单独出正式报告。
|
||||
|
||||
Cron 用例验证“动态配置、正确触发、停用和防重”等业务结果。若选用成熟框架而没有自写扫描器,表中“扫描器/认领”的实现名可映射为该框架的对应触发/适配机制,不能为了匹配旧测试描述重写一套调度器;业务幂等和事务一致性仍须验证。
|
||||
|
||||
## 1. 测试层级与门禁
|
||||
|
||||
| 层级 | 工具方向 | 要证明什么 |
|
||||
|---|---|---|
|
||||
| 静态/类型/构建 | Python 和 TS 工具,版本在 P-002 固定 | 导入、类型、构建、禁止简单低级错误;不能替代行为测试 |
|
||||
| 单元 | pytest;前端必要时使用经确认的组件测试工具 | 纯规则、映射、Cron、状态、计数、模板和适配错误解析 |
|
||||
| 数据库集成 | pytest+隔离 PostgreSQL | 迁移、事务、唯一约束、锁和并发;不使用 SQLite 替代 |
|
||||
| 队列集成 | Celery+RabbitMQ 测试实例 | Outbox、重投、worker 中断、状态恢复;eager 模式不替代 |
|
||||
| API | FastAPI 测试客户端或测试环境 HTTP | 契约、权限、分页、操作状态及失败语义 |
|
||||
| UI 行为 | Playwright | 真实前后端或明确 Mock 下的操作、网络错误、权限与状态 |
|
||||
| 视觉检查 | Playwright 截图+有视觉能力的审阅者 | 裁切、重叠、字体、布局、空错状态;截图存在不等于通过 |
|
||||
| 真实接口 | 获准源、Casdoor、企微、模型 | 外部实际可用性,不以 Mock 冒充 |
|
||||
|
||||
内部步骤实现中持续自测;模块整体独立 review 后执行正式测试,修复后复审/重测。无需每个函数运行所有层或单独报告,模块卡说明适用层及理由,不漏模块集成。
|
||||
|
||||
## 2. 测试环境与数据
|
||||
|
||||
- 合成场景:指标 A、对象 M-01/M-02、日/周/月周期、少量独立事件和重复输入;所有阈值标测试设定。
|
||||
- 分离平台库和只读测试源账号,验证写入确实拒绝;不在真实 MES 中造记录。
|
||||
- 时间使用可控时钟,不在测试中长时间 sleep;计时测试可注入时刻,正式浏览器等待使用断言/网络状态。
|
||||
- Cron 方言、窗口及关闭规则必须等决策通过再固化期望值,不能把库现有行为当需求。
|
||||
- 对外企微和模型使用可控 fake:成功、业务失败、限流、部分目标失败、响应丢失、超时。真实发消息单独显式批准。
|
||||
- 记录 Python/Node/DB/队列/浏览器版本、时区、迁移号和候选版本;测试数据库清理只限命名明确的隔离资源,不删除用户卷。
|
||||
- 不运行真实企业群、全员 @、部门广播等副作用用例。密钥不出截图或报告。
|
||||
|
||||
## 3. 全局用例目录
|
||||
|
||||
冻结文档 T01~T33 保留为需求追踪编号;这里的 V 编号为细化实现用例。每任务卡引用适用 V 和 T,完成后由主 Agent 将实际命令及结果填证据摘要,不再复制一套进度。
|
||||
|
||||
### 3.1 环境、身份与契约
|
||||
|
||||
| ID | Given / When | Then | 切片 |
|
||||
|---|---|---|---|
|
||||
| V001 | 缺少必需环境配置启动 | 明确失败,错误不显示秘密 | A-003 |
|
||||
| V002 | 空平台库执行迁移并重新升级 | 达当前版本,重复不破坏结构 | A-005 |
|
||||
| V003 | 事务中途抛异常 | 状态和相关记录回滚一致 | A-004 |
|
||||
| V004 | 请求带坏签名/错 issuer/audience/过期 token | 后端拒绝,不能只信前端 | A-008 |
|
||||
| V005 | 合法登录但无场景数据范围,直接请求 ID | 详情和操作均拒绝 | A-009、A-077 |
|
||||
| V006 | 两个账号操作同一对象 | 审计有正确操作者、时间和动作 | A-007 |
|
||||
| V007 | 未经批准跳转外部源或模型地址 | 拒绝或限制,不可任意扫描内网 | A-013、B-005 |
|
||||
| V008 | 页面退出/token 过期 | 会话清理或重新认证,敏感结果不继续暴露 | A-010 |
|
||||
|
||||
### 3.2 数据与规则
|
||||
|
||||
| ID | Given / When | Then | 切片 |
|
||||
|---|---|---|---|
|
||||
| V009 | 查询返回两个不同对象 | 对象身份、判断和报警不串联 | A-017、A-023、A-029 |
|
||||
| V010 | 参数含 SQL 片段 | 参数绑定,无结构注入;只读账号不能写 | A-017 |
|
||||
| V011 | 源空结果/指标为空/连接失败 | 三种返回按契约分开 | A-018 |
|
||||
| V012 | 非法数值、缺对象键、时间错误 | 不静默转零或错误归属 | A-021 |
|
||||
| V013 | 相同独立事件重复读取,跨周期又有相同数值 | 前者去重,后者保留合法新事件 | A-023 |
|
||||
| V014 | 比较值等于阈值 | GT/GTE/LT/LTE 边界分别正确 | A-025 |
|
||||
| V015 | AND/OR 混合有效值与缺失 | 按固定真值表输出,技术错误另记 | A-025 |
|
||||
| V016 | 含未知运算符、字段、过深条件或代码 | 后端拒绝配置,不能 eval | A-024 |
|
||||
| V017 | 修改草稿时旧版本运行 | 执行旧快照,历史不变 | A-028 |
|
||||
| V018 | 场景引用无权来源或未实现分析 | 发布拒绝,错误定位字段 | A-028 |
|
||||
| V019 | 样例取数/映射/判定 | 可查依据,无正式发送 | A-029 |
|
||||
|
||||
### 3.3 Cron 和计划执行
|
||||
|
||||
| ID | Given / When | Then | 切片 |
|
||||
|---|---|---|---|
|
||||
| V020 | 合法 Cron 预览下一批时刻 | 前后端使用同一结果和显式时区 | A-030、A-031 |
|
||||
| V021 | 秒/年字段或 Quartz 扩展与所选方言不符 | 明确拒绝,不默默截断 | A-030 |
|
||||
| V022 | 月末、闰日、DOM/DOW 同时限制 | 与确认方言一致;无未来时刻有明确反馈 | A-030 |
|
||||
| V023 | 跨 UTC 日期,支持 DST 时区的缺失/重复本地时刻 | 按已确认时区策略,不多跑或漏跑而无记录 | A-030 |
|
||||
| V024 | 两个扫描器同时认领同一到期计划 | 唯一计划运行和进度一致 | A-033 |
|
||||
| V025 | 扫描事务提交后、发布前进程停止 | Outbox 可恢复,不丢业务事实 | A-035 |
|
||||
| V026 | 相同 Celery 消息多次到达 | 不重复生成报警或通知副作用 | A-036 |
|
||||
| V027 | 上周期未完又到下一周期 | 按 O07 策略处理,不无界堆积 | A-036 |
|
||||
| V028 | 停用/改 Cron/改版本后旧任务启动 | 检查许可版本,结果可解释 | A-032、A-036 |
|
||||
| V029 | 停机漏过多个周期再启动 | 按批准补跑/跳过规则,不补发未批准历史消息 | A-034、A-073 |
|
||||
|
||||
### 3.4 报警、人工状态和次数
|
||||
|
||||
| ID | Given / When | Then | 切片 |
|
||||
|---|---|---|---|
|
||||
| V030 | 首次 FAIL;PASS/UNKNOWN 作为对照 | FAIL 报警,对照不默认报警 | A-037 |
|
||||
| V031 | 同合并范围持续 FAIL,之后跨范围 | 范围内关联,范围外可新建,历史依据留存 | A-038 |
|
||||
| V032 | 关闭后旧输入重投、新周期新事件到达 | 旧不重报,新可新建并关联历史 | A-039 |
|
||||
| V033 | 同周期源值更正 | 按 O06 最终口径,不因 payload hash 改变乱报 | A-039 |
|
||||
| V034 | 两人同时接手/重复接手 | 唯一处理人,后到返回冲突或幂等结果 | A-041 |
|
||||
| V035 | 追加进展后再查询 | 原文、操作者、时间不可覆盖 | A-042 |
|
||||
| V036 | 非处理人关闭、缺结果或依据、并发关闭 | 按权限拒绝/提示,只有一个合法终态 | A-043 |
|
||||
| V037 | 关闭后出现 PASS/UNKNOWN 或发送失败 | 不回写原始 FAIL,不伪装恢复 | A-043 |
|
||||
| V038 | 同一 occurrence 重复、队列重试和人工重发 | 业务计数只增加一次 | A-049 |
|
||||
| V039 | 两个独立事件并发达到阈值 | 不丢计数,恰好一个同级意图 | A-049、A-050 |
|
||||
| V040 | N-1、N、N+1 次及一次越过多级 | 达到阈值、跳级/逐级按 O03,每级不重复 | A-050 |
|
||||
| V041 | 固定或滑动窗口边界、规则版本变更 | 按批准口径,分组不混、重置有依据 | A-049 |
|
||||
| V042 | 关闭旧报警后窗口内有新事件 | 严格按 O04 最终决定执行;不预设窗口是否清零,旧报警和新报警的任务身份不能混淆 | A-051 |
|
||||
| V043 | 未满足次数条件但无人响应很久 | 不触发后置的时间升级 | A-050 |
|
||||
| V044 | 预览模拟重复/独立事件序列 | 计数和预计目标清晰,绝无真实发送 | A-053 |
|
||||
|
||||
### 3.5 通知、故障和通用性
|
||||
|
||||
| ID | Given / When | Then | 切片 |
|
||||
|---|---|---|---|
|
||||
| V045 | 应用多个成员+机器人多个群 | 按输出项展开,不跨渠道误发 | A-060 |
|
||||
| V046 | HTTP 200 但企微业务码失败 | 不能标受理成功 | A-057、A-058 |
|
||||
| V047 | 批量中部分成员非法 | 成功/失败目标分别留存 | A-057、A-061 |
|
||||
| V048 | 外部已受理但响应丢失、worker 崩溃 | 保留不确定性并说明重复风险,不声称恰好一次 | A-061、A-073 |
|
||||
| V049 | 限流/临时错误/永久错误 | 有限退避;只重试适合错误 | A-062 |
|
||||
| V050 | 部分失败后授权手动重试 | 仅失败目标,原尝试可查,不新增 occurrence | A-062 |
|
||||
| V051 | 试发/正式/历史重算 | 目标和运行模式分开,默认无正式副作用 | A-063、A-070 |
|
||||
| V052 | 关闭/停用与待发送任务竞态 | 执行前检查,已受理不伪称撤回 | A-061 |
|
||||
| V053 | 模板缺变量、含未完成分析字段、消息超长 | 明确校验或批准降级,不发送错误内容 | A-059 |
|
||||
| V054 | 第二个样例指标接入 | 不改核心业务逻辑即可配置运行 | A-079 |
|
||||
| V055 | 日志/API/导出/截图检查 | 无明文秘密和未获准敏感数据 | A-077 |
|
||||
| V056 | 从报警追到输入和每个目标 | 各关联 ID、版本、时间、失败依据完整 | A-068 |
|
||||
|
||||
### 3.6 B/C 分析和工具
|
||||
|
||||
| ID | Given / When | Then | 切片 |
|
||||
|---|---|---|---|
|
||||
| V057 | 多条原因规则命中/无匹配 | 排序与依据明确;无匹配不造原因 | B-003 |
|
||||
| V058 | AI 输入只有报警摘要、没有明细 | 不声称查过数据,说明缺失 | B-012 |
|
||||
| V059 | 模型编造证据 ID/结构错误 | 拒绝或标无效,不能当已验证事实 | B-013 |
|
||||
| V060 | AI 超时、服务不可用、预算耗尽 | 分析失败/跳过可查,首次报警不被阻塞 | B-014 |
|
||||
| V061 | 持续异常、手动重分析 | 频率有限,新运行不覆盖旧结论 | B-015 |
|
||||
| V062 | 分析追加默认关,显式打开 | 独立意图和目标,防重不重发首轮 | B-017、B-018 |
|
||||
| V063 | 非授权场景调用未绑定工具 | 后端拒绝,即使模型传入合法工具名 | C-005、C-006 |
|
||||
| V064 | 模型扩大对象/组织/时间/行数 | 后端范围限制,参数不能逃逸 | C-005 |
|
||||
| V065 | 只读工具尝试写入 | 数据库凭证和实现拒绝,不靠提示词 | C-004 |
|
||||
| V066 | 结果中含“忽略权限”之类文本 | 仅当数据,不扩大调用或发送权限 | C-010、C-011、C-015 |
|
||||
| V067 | 工具无数据/超时/失败 | 独立状态,不伪称没有业务记录 | C-011 |
|
||||
| V068 | 分析引用工具结果 | 查询参数、版本、证据可回查 | C-012、C-014 |
|
||||
|
||||
## 4. 前端和视觉用例
|
||||
|
||||
每个 UI 片至少覆盖:正常、加载、空数据、后端错误、无权、输入校验;若该片不涉及某状态,要明确说明。组件数据 API Mock 测试与真实前后端联调截图分开标记。
|
||||
|
||||
推荐视口(测试设置,不是生产性能要求):1440×900 主桌面、1280×800 较窄桌面、1920×1080 汇报桌面;本期不承诺移动端完整适配。关键文本不裁切,表格过宽提供可理解滚动,不重叠按钮;错误和状态不能只靠颜色。
|
||||
|
||||
| UI 编号 | 行为 |
|
||||
|---|---|
|
||||
| U01 | 登录→模块门户→指标监控;未实现入口明确禁用或说明 |
|
||||
| U02 | 数据源/查询维护和测试预览,秘密不回显 |
|
||||
| U03 | 映射→规则条件→样例结果,空值与失败区分 |
|
||||
| U04 | Cron 直接输入、辅助编辑、后端预览、非法表达式 |
|
||||
| U05 | 场景草稿→发布→启停,运行版和草稿可区分 |
|
||||
| U06 | 报警筛选→详情→接手→进展→关闭,刷新后状态正确 |
|
||||
| U07 | 次数窗口和多级目标→模拟序列→升级记录 |
|
||||
| U08 | 模板预览不发送;显式试发确认;目标范围可见 |
|
||||
| U09 | 多目标发送部分失败→仅重试失败;无虚假已读 |
|
||||
| U10 | 运行链路展开故障节点及对应版本和输入 |
|
||||
| U11 | 规则原因/模型/提示词维护和分析结果事实推测分开 |
|
||||
| U12 | 工具配置授权→测试→调用证据,拒绝范围扩大 |
|
||||
|
||||
不用完整大屏作为本期视觉验收。截图每个重要状态命名,例如 `U06-close-validation-1440x900.png`,摘要记录用例、预期、实际与候选版本。发生样式修复后重新截图检查,不沿用旧图。
|
||||
|
||||
## 5. 自动化执行约定
|
||||
|
||||
- 不写死不存在的 npm script/pytest 路径。骨架片创建真实命令后登记 `docs/runbook.md`,主 Agent 再引用。
|
||||
- 测试子 Agent 返回命令、工作目录、退出码、通过/失败/跳过数、环境及日志路径。不能仅“运行成功”。
|
||||
- Playwright 使用语义定位和可观测等待,不用长时间固定 sleep 掩盖问题;截图补充断言而不是取代断言。
|
||||
- 被跳过、Mock、外部阻塞、未执行分别记,不算真实通过;错误不能通过降低断言或屏蔽安全功能修复。
|
||||
- 外部真实发送有专用批准目标及标识;失败后不要重复盲发。
|
||||
- 每个数据库并发、唯一约束及 Outbox 场景必须有实际 PostgreSQL 测试;只有 Mock 不足以通过。
|
||||
|
||||
## 6. 测试证据模板
|
||||
|
||||
每个模块 `docs/evidence/Mxx/summary.md` 至少包含(内部步骤必要时附子路径,不重复出正式报告):
|
||||
|
||||
1. 候选 commit 或 diff/hash、对应 review 报告及结论。
|
||||
2. 需求 T、细化 V/U 编号和本片验收点。
|
||||
3. 实际执行者角色、模型 ID、日期、环境和工具版本。
|
||||
4. 每条命令及退出码,关键断言、通过/失败/跳过和未执行项。
|
||||
5. 截图及 trace 路径、检查者和发现问题,是否使用合成数据。
|
||||
6. 问题修复后的复审/重测,新旧证据不可混淆。
|
||||
7. 真实依赖阻塞、安全限制及最终主 Agent 验收结论。
|
||||
|
||||
原始日志和截图可能含资料,默认 raw/screenshots/traces 本地且 Git 忽略。脱敏后需要提交证据时,用户确认范围并更新规则,不能为证明测试自动上传图床。
|
||||
|
||||
## 7. 完成定义
|
||||
|
||||
模块 DONE_LOCAL:模块集成实现符合卡片+整体独立 review 通过+适用测试真实通过+UI 视觉检查通过(适用)+证据可回查+进度和交接更新。用户要求的不同系列 review 未满足时不能标为已满足该门禁。
|
||||
|
||||
阶段真实验收额外需要实际源、认证、企微/模型的批准条件和结果。无条件就 BLOCKED,不用隔离通过覆盖。当前项目只生成规划文档,不存在已通过业务测试的任务。
|
||||
Reference in new issue
Block a user