Просмотр исходного кода

阶段策略:用 Goal 不变量替代写死的七步教程

Phase 2 Host 策略只保留单 Portfolio、Direction 固定引用、Goal 集、adoption closure、scope/write-scope 和阶段边界等强约束。

删除内部 E2E、固定段落数量和逐步操作脚本,允许 Planner 按内容需要动态安排创作任务;Root 增加稳定的 direction-goals-satisfied 验收项。
SamLee 23 часов назад
Родитель
Сommit
1810501480

+ 8 - 5
script_build_host/src/script_build_host/agents/prompts/script_planner.md

@@ -25,6 +25,9 @@ in `input_decision_refs` and use `script-build://...` URIs for `scope_ref` and
 `script-direction/v1`; structure, paragraph, element-set, compare, compose, and
 `script-direction/v1`; structure, paragraph, element-set, compare, compose, and
 candidate-portfolio produce their correspondingly named v1 schema shown by the
 candidate-portfolio produce their correspondingly named v1 schema shown by the
 tool. Include all empty arrays and nullable fields required by the schema.
 tool. Include all empty arrays and nullable fields required by the schema.
+In Phase 1 use an empty `goal_ids` array. In Phase 2, copy only active Direction
+Goal IDs: siblings may overlap, children stay within their parent's Goal set,
+Compare uses the union of its candidates, and Compose/Portfolio use every Goal.
 
 
 Respect the hierarchy and lifecycle supplied by the Host's signed phase policy.
 Respect the hierarchy and lifecycle supplied by the Host's signed phase policy.
 Create every parent before its children, use the returned Task identity, and
 Create every parent before its children, use the returned Task identity, and
@@ -55,11 +58,11 @@ ACCEPTed Task. Copy that whole object unchanged into `input_decision_refs`,
 candidate closures, and comparison references; never reconstruct it from a
 candidate closures, and comparison references; never reconstruct it from a
 Task ID or an artifact URI.
 Task ID or an artifact URI.
 
 
-Every Phase2 Paragraph must include its accepted Structure's whole
-`accepted_decision_ref` unchanged in `input_decision_refs` and must copy that
-reference's whole `artifact_ref` unchanged into `base_artifact_ref`. Supplying
-only the Structure artifact URI, or a base without the Structure Decision, is
-invalid.
+A Phase2 Paragraph may begin independently with `base_artifact_ref: null`.
+When it patches a Structure, include that Structure's whole
+`accepted_decision_ref` and copy its artifact_ref unchanged into
+`base_artifact_ref`. Compose may adopt a Paragraph only together with a
+Structure that covers its scope.
 
 
 Use `max_tokens: 1000000` for every Task contract because real Qwen Worker plus
 Use `max_tokens: 1000000` for every Task contract because real Qwen Worker plus
 Validator attempts can exceed 500k cumulative input and output tokens. A REVISE of a failed or inconclusive
 Validator attempts can exceed 500k cumulative input and output tokens. A REVISE of a failed or inconclusive

+ 23 - 52
script_build_host/src/script_build_host/application/mission_factory.py

@@ -45,6 +45,11 @@ class ScriptMissionFactory:
                 "description": "使用已验证并接受的创作方向",
                 "description": "使用已验证并接受的创作方向",
                 "hard": True,
                 "hard": True,
             },
             },
+            {
+                "criterion_id": "direction-goals-satisfied",
+                "description": "全部父子 Goal 及其成功标准均有独立证据并得到满足",
+                "hard": True,
+            },
             {
             {
                 "criterion_id": "structure-complete",
                 "criterion_id": "structure-complete",
                 "description": "段落、元素、关系完整且引用有效",
                 "description": "段落、元素、关系完整且引用有效",
@@ -144,58 +149,24 @@ class ScriptMissionFactory:
                 "input_snapshot_ref": f"script-build://inputs/{snapshot.snapshot_id}",
                 "input_snapshot_ref": f"script-build://inputs/{snapshot.snapshot_id}",
                 "input_sha256": snapshot.canonical_sha256,
                 "input_sha256": snapshot.canonical_sha256,
                 "instruction": (
                 "instruction": (
-                    "Follow the phase-two lifecycle exactly: (1) create the single "
-                    "CandidatePortfolio under Root with a scope_ref below the accepted "
-                    "Direction scope (for example <direction-scope>/portfolio/main); its "
-                    "initial input_decision_refs are "
-                    "empty because the accepted Direction is already frozen in the Phase2 "
-                    "Host context; "
-                    "(2) create a non-executable Compose child; (3) create and ACCEPT "
-                    "Structure, then Paragraph Tasks whose parent_task_id remains the open "
-                    "Compose Task while each Paragraph scope_ref is below the accepted "
-                    "Structure scope (completed Structure Tasks cannot receive framework "
-                    "children), plus "
-                    "optional ElementSet, "
-                    "Compare, or Retrieval increments; (4) REVISE Compose with the exact "
-                    "accepted closure and adoption order; (5) dispatch, validate, and "
-                    "ACCEPT Compose; (6) REVISE CandidatePortfolio with the accepted "
-                    "Compose closure; (7) dispatch, validate, ACCEPT CandidatePortfolio, "
-                    "then BLOCK Root at PHASE_TWO_CANDIDATE_PORTFOLIO_READY. Never "
-                    "dispatch an empty adoption container or cancel the unique portfolio. "
-                    "Keep business hierarchy in scope_ref, but use capability URIs in "
-                    "write_scope: CandidatePortfolio and Compose must use the exact parent "
-                    "capability script-build://writes; every Structure or Paragraph that "
-                    "creates paragraphs must "
-                    "include script-build://writes/paragraphs/<stable-selector>; every "
-                    "ElementSet that creates or links elements must include "
-                    "script-build://writes/elements/<stable-selector>. Never copy scope_ref "
-                    "into write_scope for workspace-writing Tasks. A Paragraph refining an "
-                    "accepted Structure must copy the whole Structure accepted_decision_ref "
-                    "unchanged into input_decision_refs and copy its whole artifact_ref "
-                    "unchanged into base_artifact_ref. "
-                    "Never place a Paragraph as a sibling of its Structure. "
-                    "Each Paragraph write_scope must also be below its Structure write_scope, "
-                    "for example Structure script-build://writes/paragraphs/main and Paragraph "
-                    "script-build://writes/paragraphs/main/opening. "
-                    "Dispatch at most "
-                    "four Tasks in one call because the concurrent Operation limit is four. "
-                    "When revising Compose for execution, include exactly one whole accepted "
-                    "Direction decision in input_decision_refs in addition to the candidate "
-                    "closure. Immediately before that REVISE, inspect the plan again and copy "
-                    "every accepted Structure and Paragraph decision under the Compose into "
-                    "candidate_decision_ids. The union of adopted_decision_ids and "
-                    "held_or_rejected_decision_ids must partition that complete candidate list; "
-                    "when adopting all candidates the held list is empty and compose_order lists "
-                    "every adopted Decision ID in intended script order. "
-                    "When revising CandidatePortfolio, input_decision_refs and the candidate "
-                    "closure contain only accepted Compose decisions, and compose_order must "
-                    "list the adopted Compose decision IDs exactly, including the single-ID "
-                    "case. With one accepted Compose, candidate_decision_ids, "
-                    "adopted_decision_ids, and compose_order are the same one-item list and "
-                    "held_or_rejected_decision_ids is empty; do not add Direction to Portfolio "
-                    "inputs. "
-                    "A Compose adopting any Paragraph must also include and adopt its covering "
-                    "Structure in the same candidate closure."
+                    "Create exactly one CandidatePortfolio as Root's Phase2 child. Plan any "
+                    "number and order of Structure, Paragraph, ElementSet, Retrieval and Compare "
+                    "increments demanded by the active Direction Goals; siblings may cover "
+                    "overlapping Goals. Every Phase2 contract has nonempty goal_ids, every "
+                    "creative Task pins the exact accepted Direction DecisionRef, and Compose "
+                    "and CandidatePortfolio carry all Direction Goal IDs. Retrieval needs valid "
+                    "goal_ids but need not read the whole Direction. Paragraph-first exploration "
+                    "may use a null base; a Paragraph patch must pin its accepted Structure, and "
+                    "Compose may adopt any Paragraph only with a Structure covering its scope. "
+                    "Compose and Portfolio remain non-executable containers until a REVISE "
+                    "partitions their complete accepted candidate closure and sets compose_order. "
+                    "Compose adopts the creative frontier; Portfolio adopts exactly one accepted "
+                    "StructuredScript. Both container input_decision_refs also pin the active "
+                    "Direction. CandidatePortfolio and Compose write only script-build://writes; "
+                    "paragraph writers stay below script-build://writes/paragraphs and element "
+                    "writers below script-build://writes/elements. Respect the Host concurrency "
+                    "limit. After the unique Portfolio is validated and ACCEPTed, BLOCK Root "
+                    "with PHASE_TWO_CANDIDATE_PORTFOLIO_READY."
                 ),
                 ),
             },
             },
             ensure_ascii=False,
             ensure_ascii=False,