zizi 091b66a9bb 重构: 收敛 Agent/Skill 运行时与创作质量闭环
将角色与 Skill 从 .claude 迁入 .agent,移除 Claude CLI 运行时并接入固定 Opus 角色 profile、完整 schema、预算 deadline、raw 与回执证据链。

同步拆分 Skill 职责、复利 lesson、Gate 回放、Dashboard 人审入口、数据库登记和机械门禁;候选设计正文不包含在本提交中。
2026-08-22 02:12:32 +08:00

86 lines
5.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: promote-ai-flavor-rule
description: 把已标注的 AI 味案例卡沿 canonical→样例→规则候选→评测→激活的升格链推进,并负责降级。需要确认案例卡、投影四类样例、归纳规则候选、跑合同回放或审批激活时使用;不做案例采集与扫描,也不改正文。
disable-model-invocation: true
---
# 升格 AI 味规则
## 在五技能接力链中的位置
采集归 `capture-ai-flavor-cases`,本 Skill 接在它后面(链路登记见 [`meta/chains/README.md`](../../../meta/chains/README.md) 的 AI 味接力段):
```text
案例卡采集(capture-ai-flavor-cases)
→ 人工标注 → canonical → 四类样例投影 → 规则候选(propose-rule)
→ 合同回放 + holdout 评测 → 人工审批 → humanization/rules active → 技能 2/3 消费
```
采集快,升格慢:本 Skill 的每一步都失败关闭,不会把 shadow 卡或合同回放报告自动变成 active 规则。模型换版本后的 active 规则巡检用 `evaluate-frozen-replay` 回放,失效规则由本 Skill 的 `deprecate-rule` 降级。
## 依赖边界
案例卡的读取、结构校验、来源重验证与样例投影实现归 `capture-ai-flavor-cases/scripts/capture_cases.py`,本 Skill 单向 import,不复制第二份卡合同。规则合同校验与评测算法在 `humanization/src/deai/`。
## 输入
```bash
# Shadow 卡人工标注(默认写回数据库当前投影)
.venv/bin/python .agent/skills/promote-ai-flavor-rule/scripts/mine_ai_flavor.py annotate \
--cards /tmp/cards.yaml --card-id case-... --label sf --carrier narration \
--reviewer qingse --note "当前上下文无叙事功能" --output /tmp/annotated.json
# 来源已 verified 后确认 canonical;数据库再次检查 verified 回执
.venv/bin/python .agent/skills/promote-ai-flavor-rule/scripts/mine_ai_flavor.py confirm \
--cards /tmp/cards.yaml --card-id case-... --verification /tmp/revalidation.json \
--reviewer qingse --note "作者确认" --output /tmp/canonical.json
# canonical 卡投影为四类样例之一
.venv/bin/python .agent/skills/promote-ai-flavor-rule/scripts/mine_ai_flavor.py project-sample \
--cards /tmp/canonical.yaml --card-id case-... --verification /tmp/revalidation.json \
--output /tmp/sample.yaml
# 归纳规则候选;命令永远只产 candidate
.venv/bin/python .agent/skills/promote-ai-flavor-rule/scripts/mine_ai_flavor.py propose-rule \
--cards /tmp/cards-a.yaml /tmp/cards-b.yaml \
--rule-id candidate-lexical-001 --name "空洞元话语" \
--verification /tmp/ai-flavor-revalidation.json --output /tmp/rule-candidate.yaml
# 合同回放;带 holdout 才有资格进入激活门
.venv/bin/python .agent/skills/promote-ai-flavor-rule/scripts/mine_ai_flavor.py evaluate-rule \
--rule humanization/rules/structural/s002.yaml --samples /tmp/projected-samples.yaml \
--cards /tmp/canonical-cards.yaml --verification /tmp/revalidation.json \
--holdout /tmp/holdout.json --output /tmp/rule-evaluation.json
# 人工审批激活 / 降级
.venv/bin/python .agent/skills/promote-ai-flavor-rule/scripts/mine_ai_flavor.py activate-rule \
--rule /tmp/rule-candidate.yaml --contract-report /tmp/rule-evaluation.json \
--holdout-report /tmp/rule-evaluation.json --approver qingse --output /tmp/rule-active.yaml
.venv/bin/python .agent/skills/promote-ai-flavor-rule/scripts/mine_ai_flavor.py deprecate-rule \
--rule humanization/rules/lexical/l007.yaml --approver qingse --reason "换版后失效" \
--output /tmp/rule-deprecated.yaml
```
`--verification` 是 `capture-ai-flavor-cases` 的 `revalidate` 命令生成的来源重验证回执。
## 输出
每个子命令写一个结构化文件并在 stdout 打一行 JSON 摘要:标注/确认产出更新后的卡与落库回执;`project-sample` 产出 `humanization-samples-bundle-v1` 样例;`propose-rule` 产出状态固定为 `candidate` 的规则 YAML;`evaluate-rule` 产出含 `contract_pass`、`holdout`、`eligible` 的评测报告;`activate-rule` / `deprecate-rule` 产出改状态后的规则 YAML。任一步失败输出 `AI_FLAVOR_MINING_CONTRACT_FAILED` 并非零退出。
## 数据边界
- 读取:案例卡与重验证回执文件、`humanization/rules` 规则文件、holdout 数据集。
- 写入:命令指定的输出文件;`annotate` / `confirm` 默认把案例卡当前投影写回 `muse-example`;`evaluate-rule` 把评测结果落成 `example_run` + `example_quality_result` 的质量账(幂等 run_id 由报告哈希派生)。`--offline` 是显式例外,只用于离线合同测试。
- 规则文件本身仍由 Git 管理,评测不改规则文件。
- 运行时规则/样例权威在 `example_ai_flavor_rule` / `example_ai_flavor_sample`(DDL-111);本 Skill 的规则生命周期产出 YAML 变更,经 `humanization/tools/seed_rules_db.py` 单事务同步入库并在 `example_ai_flavor_rule_event` 留痕。未完成同步的规则变更不进入生产读取。
- 不写正文、不写 `knowledge/` 正式资产。
## 红线
- 规则候选状态永远是 `candidate`;`propose-rule` 不产 active。
- 候选至少需要两个不同来源作品,并同时包含一张 `sf` 与一张 `snf/boundary/regression` 卡;所有引用卡必须有 `verified` 回执。
- 没有 holdout 分层计数和人工审批,候选不能写成 active。唯一例外是所有者留痕豁免,激活门代码不放宽,豁免必须在规则 evidence 写明决定、日期与理由。
- 来源重验证是显式 fail-closed 门:`stale`、`unavailable`、`card_mismatch` 都使当前卡在确认、投影与规则消费上失效;来源找不到不等于"仍然有效"。
- 不把正例样本单独归纳成全局规则。
- 不碰本次创作正文。