muse-agent-example/docs/2026-07-20-正文智能体正式优化架构.html

137 lines
10 KiB
HTML
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.

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>正文智能体正式优化架构</title>
<style>
:root {
color-scheme: light;
--ink: #182128;
--muted: #596872;
--line: #c8d0d6;
--paper: #f5f7f8;
--blue: #dcecff;
--green: #ddf2e5;
--amber: #fff0c7;
--violet: #ebe3f8;
--red: #f8dddd;
--cyan: #def0f1;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: 0; }
main { width: min(1240px, calc(100% - 32px)); margin: 28px auto 48px; }
h1 { margin: 0 0 8px; font-size: 28px; }
.lead { margin: 0 0 26px; color: var(--muted); line-height: 1.6; }
section { margin-top: 30px; }
h2 { margin: 0 0 12px; font-size: 19px; }
.lane { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 12px; align-items: stretch; }
.node { min-height: 112px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: white; position: relative; }
.node:not(:last-child)::after { content: "→"; position: absolute; right: -13px; top: 42px; z-index: 2; font-size: 18px; color: #53616c; }
.node strong { display: block; margin-bottom: 7px; font-size: 15px; }
.node span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.outline { background: var(--blue); }
.cards { background: var(--green); }
.prose { background: var(--amber); }
.writer { background: var(--violet); }
.detector { background: var(--red); }
.decision { background: var(--cyan); }
.loops { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.loop { padding: 14px 16px; border-left: 4px solid #687d8a; background: white; }
.loop b { display: block; margin-bottom: 6px; }
.loop p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.eval { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.runtime { display: grid; grid-template-columns: 1fr 1.35fr 1fr; gap: 14px; align-items: stretch; }
.runtime-group { display: grid; gap: 10px; }
.runtime > .node, .runtime-group .node { min-height: 0; }
.runtime > .node::after, .runtime-group .node::after { display: none; }
.orchestrator { background: var(--cyan); border-width: 2px; }
.vault { background: var(--amber); }
.closed { background: var(--red); }
.contract { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.contract article { padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.contract h3 { margin: 0 0 7px; font-size: 15px; }
.contract p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.evidence, .orders { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.evidence article, .orders article { padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.evidence h3, .orders h3 { margin: 0 0 7px; font-size: 15px; }
.evidence p, .orders p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
@media (max-width: 980px) { .lane, .eval, .runtime { grid-template-columns: 1fr 1fr; } .node::after { display: none; } .loops, .contract, .evidence, .orders { grid-template-columns: 1fr; } }
@media (max-width: 540px) { .lane, .eval, .runtime { grid-template-columns: 1fr; } }
</style>
</head>
<body>
<main>
<h1>正文智能体正式优化架构</h1>
<p class="lead">卡只负责定位原文,writer 不读取卡语义。Gate A 尚未 real-run;Gate B 通过前只实现离线评测闭环。</p>
<section>
<h2>两个方向不能混用</h2>
<div class="orders">
<article><h3>能力验证</h3><p>正文智能体 → 细纲智能体 → 大纲+设定智能体。自底向上隔离变量。</p></article>
<article><h3>正式生产</h3><p>大纲+设定 → 细纲 → 正文智能体。自顶向下提供创作输入。</p></article>
</div>
</section>
<section>
<h2>产品化生产链(Gate B 通过后)</h2>
<div class="lane">
<div class="node outline"><strong>1. 已确认细纲</strong><span>硬事件、可调节拍、伏笔、钩子和新设定声明。</span></div>
<div class="node cards"><strong>2. 检索规划与卡索引</strong><span>按 asOf 重建当前态,带出历史来源指针。</span></div>
<div class="node prose"><strong>3. 连续四章 + 原文回读</strong><span>事实证据与表现证据分开装配,生成确定性 manifest。</span></div>
<div class="node writer"><strong>4. 无工具 Writer</strong><span>只接收 WriterContext;可按预算请求补证。</span></div>
<div class="node detector"><strong>5. Detector 硬门</strong><span>核细纲、事实、证据、时间线和输出合同,最多返修两轮。</span></div>
<div class="node decision"><strong>6. Shadow 与用户三决策</strong><span>第二阶段才实现。通过 accept_preflight 后 confirm,不属于 Gate A/B 前置范围。</span></div>
</div>
<div class="loops">
<div class="loop"><b>补证环</b><p>Writer 可返回结构化 evidenceRequests;最多 3 次,累计新增上下文不超过检索预算 30%。</p></div>
<div class="loop"><b>返修环</b><p>Detector 只阻断可验证硬错误;Writer 最多自动返修 2 轮,仍失败则交用户。</p></div>
<div class="loop"><b>创作自由边界</b><p>硬事件、结果和伏笔不可改;场景可拆并调序,可创造环境、动作、过渡和对白;新增 Canonical 事实必须申报。</p></div>
</div>
</section>
<section>
<h2>双证据模型</h2>
<div class="evidence">
<article><h3>Fact Evidence</h3><p>正式设定、Canonical 卡、状态台账、已确认正文和细纲声明的新事实,负责“写得对”。没有可靠事实来源的硬结论必须阻断。</p></article>
<article><h3>Prose Evidence</h3><p>历史原文场景,负责人物声音、动作习惯、能力表现、段落节奏和章末钩子,回答“怎么写得像”。</p></article>
</div>
</section>
<section>
<h2>离线评测链</h2>
<div class="eval">
<div class="node outline"><strong>A/C 核心比较 + B 负对照</strong><span>A=通用原文检索;C=卡索引后回读原文;同字符预算。B=card-only,仅诊断。全评测集统一分配顺序并平衡位置。</span></div>
<div class="node writer"><strong>隔离 Writer</strong><span>A/C 只看到统一事实约束和选中原文,看不到卡、检索策略或轨迹。完整上下文只允许原文与派生 hash 不同。</span></div>
<div class="node detector"><strong>统一 Detector</strong><span>严格真实报告逐项计算高严重度与硬约束覆盖率,禁止常量。</span></div>
<div class="node writer"><strong>Oracle 盲评</strong><span>五维评分之外,逐 assertionId/constraintId 输出 pass/fail/unknown verdict;绑定 candidate hash 与受控证据,unknown 或 ID 不全即失败。</span></div>
<div class="node prose"><strong>唯一 GateInputBuilder</strong><span>只比较 detector/judge 同类同 ID verdict,禁止用分数推 verdict;只从 manifest、receipts 和严格报告生成 gate-input.json。</span></div>
<div class="node decision"><strong>Gate A / Gate B</strong><span>系统/schema/hash/泄漏/judge 异常先判 failed;只有预注册集合自身不足才是 insufficient。B 不进 Gate B 阈值,按新角色比例分层报告。</span></div>
</div>
</section>
<section>
<h2>agent-example 离线评测 adapter</h2>
<div class="runtime">
<div class="node orchestrator"><strong>可信编排器</strong><span>唯一持有授权、臂映射、顺序表、oracle 和预算。直连固定 Claude CLI 是离线例外,不写 New-API 共享账本,也不是产品运行时方案。</span></div>
<div class="runtime-group">
<div class="node writer"><strong>隔离模型进程</strong><span>绝对 CLI 路径 + sha256 + 2.1.211 + 完整 model ID;stdin-only、fresh process、无工具/会话/hooks/plugins/MCP。</span></div>
<div class="node detector"><strong>隔离 Semantic Detector 进程</strong><span>候选与硬约束 → 严格语义报告。报告绑定 candidate hash,指标由逐项结果计算。</span></div>
<div class="node outline"><strong>sandbox-exec 边界</strong><span>cwd/HOME/TMPDIR 位于隔离目录;目录外文件读写拒绝,仅允许模型调用所需网络,环境字段白名单。</span></div>
</div>
<div class="runtime-group">
<div class="node vault"><strong>vault lease → /private/tmp</strong><span>用户/创始人批准;先写非敏感 lease,再写 0700/0600 raw。恢复扫描 lease 清孤儿,防 symlink/path escape。</span></div>
<div class="node decision"><strong>gate-report → passed receipt</strong><span>writer_gate.py 是唯一签发者;同一文件 CAS journal 中先落报告,只有 passed 才签 receipt,细纲入口验完整 hash 链。</span></div>
<div class="node closed"><strong>任一异常失败关闭</strong><span>timeout、nonzero、schema、budget、model mismatch、invalid judge、unstable judge 都使样本 ok=false,禁止换模或跳臂。</span></div>
</div>
</div>
<div class="contract">
<article><h3>固定调用面</h3><p>print、bare、完整 model ID、effort、预算、deadline、JSON schema、无工具/会话,空 MCP 固定为 {"mcpServers":{}}。temperature/topP/seed 不作支持声明。</p></article>
<article><h3>联合成功判定</h3><p>exit=0、is_error=false、正常 terminal reason、完整 model 匹配、usage 可核账且 structured_output 合法才成功;result 不作业务 fallback。仍需一次成功探测。</p></article>
<article><h3>两阶段硬边界</h3><p>第一阶段实现 receipt 签发器与细纲入口守卫;第二阶段才用已验签 receipt 启动细纲 real-run。拒绝自算 JSON,dry-run 豁免。</p></article>
</div>
</section>
</main>
</body>
</html>