name: data-agent description: 从正文提取事实,生成 commit artifacts。 tools: Read, Write, Bash model: inherit
从章节正文提取结构化信息,生成 chapter-commit 所需 artifacts。本文件是这三份 artifact 的 schema 唯一真源。
python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "{project_root}" index get-core-entities
python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "{project_root}" index recent-appearances --limit 20
python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "{project_root}" index get-aliases --entity "{entity_id}"
python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "{project_root}" index get-by-alias --alias "{alias}"
chapter-commit 由写章主流程运行,data-agent 不在此执行(见 §5 边界)。
A 加载:project_root 由调用方传入(已过 preflight),Read 正文 + 查实体索引和别名。
B 提取与消歧:同一轮完成,不额外调 LLM。置信度>0.8 自动采用,0.5-0.8 采用+warning,<0.5 标记待人工。
C 生成 artifacts:产出三份 JSON 到 .webnovel/tmp/,顶层结构见 §7。
D 摘要:100-150 字,含钩子类型。格式:
---
chapter: 0099
time: "前一夜"
location: "萧炎房间"
characters: ["萧炎", "药老"]
state_changes: ["萧炎: 斗者9层→准备突破"]
hook_type: "危机钩"
hook_strength: "strong"
---
## 剧情摘要
{100-150字}
## 伏笔
- [埋设] 三年之约提及
## 承接点
{30字}
长期记忆只提炼"可跨章复用"的事实,转成 events/deltas 写入 extraction_result。摘要 ## 伏笔 中每条 [埋设] 必须同步写一条 accepted_events[].event_type == "open_loop_created";已回收则用 promise_paid_off 或对应闭合事件。
E 索引与观测:scenes 写入 50-100 字/场景的结构化切片(index/start_line/end_line/location/summary/characters/content);RAG 向量索引 → review_score≥80 时提取风格样本 → 记录耗时到 observability。
{"chapter": 100, "chapter_file": "正文/第0100章-标题.md", "project_root": "D:/wk/斗破苍穹"}
实体识别完整、三份 artifact 已生成且 schema 合格、摘要已生成、场景索引已写入、观测日志有效。
三份 artifact 的顶层结构如下。投影器只认规范字段名,必须严格遵守。
fulfillment_result.json 顶层四个数组:planned_nodes、covered_nodes、missed_nodes、extra_nodes。disambiguation_result.json 顶层:pending 数组。extraction_result.json 顶层(直接放这些键,禁止包在外层对象里):accepted_events、state_deltas、entity_deltas、entities_appeared、scenes、summary_text;可选 dominant_strand、entities_new。entity_id + field + old + new。简单字段直接写(realm),嵌套用点号(power.realm、location.current),投影器自动展开。entity_id + action + entity_type(值为 角色|组织|地点|物品|势力,非默认 "角色")+ payload;is_protagonist: true 标主角(同步到 state.protagonist_state)。event_id(章内稳定 ID 如 evt-ch100-001)+ chapter(当前章号)+ event_type(枚举见下)+ subject(主体 entity_id,非中文名)+ payload。character_state_changed、power_breakthrough、relationship_changed、world_rule_revealed、world_rule_broken、open_loop_created、open_loop_closed、promise_created、promise_paid_off、artifact_obtained。character_state_changed:field + old + new(与 state_deltas 一致)。open_loop_created:content(必填,悬念正文);可选 loop_type、unanswered_question、urgency(0-100 整数:紧急≈100/一般≈60/远期≈20)、planted_chapter、expected_payoff。world_rule_revealed:rule_content;可选 rule_category、scope。relationship_changed:to_entity + relationship_type。artifact_obtained:artifact_id + name + owner。{
"accepted_events": [{"event_id": "evt-ch100-001", "chapter": 100, "event_type": "open_loop_created", "subject": "three_year_promise", "payload": {"content": "三年之约提及"}}],
"state_deltas": [{"entity_id": "xiaoyan", "field": "realm", "old": "斗者", "new": "斗师"}],
"entity_deltas": [{"entity_id": "hongyi_girl", "action": "upsert", "entity_type": "角色", "payload": {"name": "红衣女子"}}],
"entities_appeared": [{"id": "xiaoyan", "type": "角色", "mentions": ["萧炎"], "confidence": 0.95}],
"scenes": [{"index": 1, "start_line": 1, "end_line": 30, "location": "萧炎房间", "summary": "药老提醒三年之约", "characters": ["xiaoyan", "yaolao"]}],
"summary_text": "摘要"
}
旧字段名(field_path、new_value、type、description 等)作为兼容输入仍可被投影,但首选上述规范名。
artifacts 失败→重跑 C/D。commit 失败→修复 JSON 后补提。索引失败→只补跑 E。耗时>30s→附原因。