enterprise-agent-designer 0.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/.codebuddy-plugin/plugin.json +66 -0
  2. package/CHANGELOG.md +729 -0
  3. package/DESIGN_NOTE.md +101 -0
  4. package/LICENSE +21 -0
  5. package/PACKAGE.yaml +209 -0
  6. package/README.md +109 -0
  7. package/RETROSPECTIVE_v0.1-v0.10.md +67 -0
  8. package/RUNTIME_ASSEMBLY.md +134 -0
  9. package/SYSTEM_PROMPT.md +139 -0
  10. package/agents/agent-designer.md +151 -0
  11. package/avatars/.gitkeep +0 -0
  12. package/avatars/expert.png +0 -0
  13. package/evaluation/README.md +60 -0
  14. package/evaluation/cases.json +2045 -0
  15. package/evaluation/document-reviewer-holdout.md +24 -0
  16. package/package.json +33 -0
  17. package/references/optional-host-workflow.md +105 -0
  18. package/scripts/check_agent_delivery.py +202 -0
  19. package/scripts/optional/workflow_controller.py +478 -0
  20. package/scripts/validate.py +437 -0
  21. package/scripts/verify_v0321_guards.py +410 -0
  22. package/skills/design-enterprise-agent/SKILL.md +131 -0
  23. package/skills/design-enterprise-agent/references/41-performance-worked-example.md +199 -0
  24. package/skills/design-enterprise-agent/references/cold-start-and-writing.md +163 -0
  25. package/skills/design-enterprise-agent/references/requirements-grilling.md +40 -0
  26. package/skills/design-enterprise-agent/references/runtime-and-integration.md +102 -0
  27. package/skills/design-enterprise-agent/references/task-adaptive-runtime.md +70 -0
  28. package/skills/design-enterprise-agent/scripts/finalize_agent_delivery.py +748 -0
  29. package/skills/grill-with-docs/SKILL.md +58 -0
  30. package/skills/grill-with-docs/references/design-context-format.md +101 -0
  31. package/skills/grilling/SKILL.md +62 -0
  32. package/skills/review-enterprise-agent/SKILL.md +86 -0
  33. package/skills/review-enterprise-agent/references/isolated-review-contract.md +154 -0
  34. package/skills/review-enterprise-agent/scripts/validate_review_receipt.py +338 -0
@@ -0,0 +1,410 @@
1
+ #!/usr/bin/env python3
2
+ """Regression checks for v0.32 review, workflow, and evidence guards."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import copy
8
+ import importlib.util
9
+ import json
10
+ import subprocess
11
+ import sys
12
+ import tempfile
13
+ from pathlib import Path
14
+ from types import SimpleNamespace
15
+
16
+
17
+ ROOT = Path(__file__).resolve().parents[1]
18
+
19
+
20
+ def load_module(name: str, path: Path):
21
+ spec = importlib.util.spec_from_file_location(name, path)
22
+ if spec is None or spec.loader is None:
23
+ raise RuntimeError(f"cannot load module: {path}")
24
+ module = importlib.util.module_from_spec(spec)
25
+ spec.loader.exec_module(module)
26
+ return module
27
+
28
+
29
+ def validate_receipt(module, receipt: dict[str, object], expected_snapshot: str | None = None) -> list[str]:
30
+ mode = str(receipt["review_mode"])
31
+ args = SimpleNamespace(
32
+ expected_mode=mode,
33
+ expected_round=receipt["review_round"],
34
+ expected_snapshot=expected_snapshot if mode == "source-gate" else None,
35
+ )
36
+ errors: list[str] = []
37
+ module.validate_common(receipt, args, errors)
38
+ if mode == "grounding-gate":
39
+ module.validate_grounding(receipt, errors)
40
+ else:
41
+ module.validate_source(receipt, args, errors)
42
+ return errors
43
+
44
+
45
+ def all_mock_receipts() -> list[dict[str, object]]:
46
+ payload = json.loads((ROOT / "evaluation/cases.json").read_text(encoding="utf-8"))
47
+ receipts: list[dict[str, object]] = []
48
+ for case in payload["cases"]:
49
+ for mock in case.get("mock_tools", []):
50
+ result = mock.get("result")
51
+ if isinstance(result, dict) and result.get("review_mode") in {
52
+ "grounding-gate",
53
+ "source-gate",
54
+ }:
55
+ receipts.append(result)
56
+ return receipts
57
+
58
+
59
+ def run_controller(*arguments: str) -> subprocess.CompletedProcess[str]:
60
+ return subprocess.run(
61
+ [sys.executable, str(ROOT / "scripts/optional/workflow_controller.py"), *arguments],
62
+ text=True,
63
+ capture_output=True,
64
+ encoding="utf-8",
65
+ )
66
+
67
+
68
+ def main() -> int:
69
+ receipt_module = load_module(
70
+ "validate_review_receipt",
71
+ ROOT / "skills/review-enterprise-agent/scripts/validate_review_receipt.py",
72
+ )
73
+ finalizer = load_module(
74
+ "finalize_agent_delivery",
75
+ ROOT / "skills/design-enterprise-agent/scripts/finalize_agent_delivery.py",
76
+ )
77
+
78
+ receipts = all_mock_receipts()
79
+ for receipt in receipts:
80
+ snapshot = (
81
+ str(receipt["reviewed_snapshot_id"])
82
+ if receipt["review_mode"] == "source-gate"
83
+ else None
84
+ )
85
+ errors = validate_receipt(receipt_module, receipt, snapshot)
86
+ if errors:
87
+ raise AssertionError(f"mock receipt failed: {errors}")
88
+
89
+ round_four = next(
90
+ item
91
+ for item in receipts
92
+ if item["review_mode"] == "source-gate" and item["review_round"] == 4
93
+ )
94
+ invalid_late_round = copy.deepcopy(round_four)
95
+ invalid_late_round["materiality_audit"][
96
+ "late_round_blocking_justification"
97
+ ] = "not_applicable"
98
+ if not validate_receipt(
99
+ receipt_module,
100
+ invalid_late_round,
101
+ str(invalid_late_round["reviewed_snapshot_id"]),
102
+ ):
103
+ raise AssertionError("late-round blocker without justification was accepted")
104
+ material_same_family = copy.deepcopy(round_four)
105
+ material_same_family["materiality_audit"][
106
+ "late_round_blocking_justification"
107
+ ] = "material-same-family-missed-instance"
108
+ if validate_receipt(
109
+ receipt_module,
110
+ material_same_family,
111
+ str(material_same_family["reviewed_snapshot_id"]),
112
+ ):
113
+ raise AssertionError("material same-family late-round blocker was rejected")
114
+
115
+ source_non_pass = next(
116
+ item
117
+ for item in receipts
118
+ if item["review_mode"] == "source-gate" and item["verdict"] != "pass"
119
+ )
120
+ if not validate_receipt(receipt_module, source_non_pass, "sha256:different"):
121
+ raise AssertionError("source non-pass with wrong host snapshot was accepted")
122
+
123
+ grounding = next(item for item in receipts if item["review_mode"] == "grounding-gate")
124
+ invalid_grounding = copy.deepcopy(grounding)
125
+ invalid_grounding["reviewed_snapshot_id"] = "sha256:not-allowed"
126
+ if not validate_receipt(receipt_module, invalid_grounding):
127
+ raise AssertionError("grounding receipt with source snapshot was accepted")
128
+
129
+ invalid_enum = copy.deepcopy(grounding)
130
+ invalid_enum["lowest_failed_layer"] = "unknown-layer"
131
+ invalid_enum["return_to"] = "unknown-target"
132
+ if not validate_receipt(receipt_module, invalid_enum):
133
+ raise AssertionError("receipt with invalid routing enums was accepted")
134
+
135
+ files = [ROOT / "SYSTEM_PROMPT.md"]
136
+ mobile = finalizer.normalize_forbidden_evaluation_terms([" 移动端 ", "移动端"])
137
+ offline = finalizer.normalize_forbidden_evaluation_terms(["离线"])
138
+ mobile_manifest = finalizer.build_manifest(ROOT, "SYSTEM_PROMPT.md", files, 2, mobile)
139
+ mobile_manifest_again = finalizer.build_manifest(
140
+ ROOT,
141
+ "SYSTEM_PROMPT.md",
142
+ files,
143
+ 2,
144
+ finalizer.normalize_forbidden_evaluation_terms(["移动端"]),
145
+ )
146
+ offline_manifest = finalizer.build_manifest(ROOT, "SYSTEM_PROMPT.md", files, 2, offline)
147
+ if mobile_manifest["source_snapshot_id"] != mobile_manifest_again["source_snapshot_id"]:
148
+ raise AssertionError("equivalent forbidden terms produced different snapshots")
149
+ if mobile_manifest["source_snapshot_id"] == offline_manifest["source_snapshot_id"]:
150
+ raise AssertionError("different forbidden terms produced the same snapshot")
151
+
152
+ with tempfile.TemporaryDirectory() as temp_dir:
153
+ temp_root = Path(temp_dir)
154
+ evaluation = temp_root / "evaluation.md"
155
+ evaluation.write_text("移动端", encoding="utf-8")
156
+ errors: list[str] = []
157
+ finalizer.validate_forbidden_evaluation_terms(
158
+ [evaluation], temp_root, mobile, errors
159
+ )
160
+ if not errors:
161
+ raise AssertionError("normalized forbidden term did not reach scanner")
162
+
163
+ grounding_pass = next(
164
+ item
165
+ for item in receipts
166
+ if item["review_mode"] == "grounding-gate" and item["verdict"] == "pass"
167
+ )
168
+ source_pass = next(
169
+ item
170
+ for item in receipts
171
+ if item["review_mode"] == "source-gate" and item["verdict"] == "pass"
172
+ )
173
+
174
+ with tempfile.TemporaryDirectory() as temp_dir:
175
+ temp_root = Path(temp_dir)
176
+ state_path = temp_root / "workflow-state.json"
177
+ goal_path = temp_root / "DESIGN_CONTEXT.md"
178
+ goal_path.write_text("overall goal", encoding="utf-8")
179
+ grounding_receipt = temp_root / "grounding-round-1.json"
180
+ grounding_receipt.write_text(
181
+ json.dumps(grounding_pass, ensure_ascii=False), encoding="utf-8"
182
+ )
183
+
184
+ for arguments in (
185
+ ("init", str(state_path), "--overall-goal-ref", str(goal_path)),
186
+ ("event", str(state_path), "candidate-grounded"),
187
+ ("event", str(state_path), "grounding-gate-started"),
188
+ (
189
+ "gate",
190
+ str(state_path),
191
+ "--gate",
192
+ "grounding-gate",
193
+ "--receipt",
194
+ str(grounding_receipt),
195
+ "--expected-round",
196
+ str(grounding_pass["review_round"]),
197
+ ),
198
+ ("event", str(state_path), "source-written"),
199
+ ):
200
+ result = run_controller(*arguments)
201
+ if result.returncode != 0:
202
+ raise AssertionError(f"workflow setup failed: {result.stdout}{result.stderr}")
203
+
204
+ state = json.loads(state_path.read_text(encoding="utf-8"))
205
+ if (
206
+ state.get("workflow_mode") != "reference_only"
207
+ or state.get("enforcement_level") != "callable_reference_only"
208
+ ):
209
+ raise AssertionError("default workflow mode overstated host integration")
210
+ if state["phase"] != "source_review" or state["allowed_actions"] != [
211
+ "prepare-source-review"
212
+ ]:
213
+ raise AssertionError("source-written did not force source review preparation")
214
+ if run_controller("check-terminal", str(state_path)).returncode == 0:
215
+ raise AssertionError("source-written was incorrectly accepted as terminal")
216
+
217
+ snapshot = str(source_pass["reviewed_snapshot_id"])
218
+ manifest = temp_root / "manifest.json"
219
+ manifest.write_text(
220
+ json.dumps({"source_snapshot_id": snapshot}), encoding="utf-8"
221
+ )
222
+ for arguments in (
223
+ (
224
+ "event",
225
+ str(state_path),
226
+ "source-review-prepared",
227
+ "--manifest",
228
+ str(manifest),
229
+ ),
230
+ ("event", str(state_path), "source-gate-started"),
231
+ ):
232
+ result = run_controller(*arguments)
233
+ if result.returncode != 0:
234
+ raise AssertionError(f"source review setup failed: {result.stdout}{result.stderr}")
235
+
236
+ invalid_receipt = temp_root / "source-attempt-invalid.txt"
237
+ invalid_receipt.write_text("not json", encoding="utf-8")
238
+ first_invalid = run_controller(
239
+ "gate",
240
+ str(state_path),
241
+ "--gate",
242
+ "source-gate",
243
+ "--receipt",
244
+ str(invalid_receipt),
245
+ "--expected-round",
246
+ str(source_pass["review_round"]),
247
+ )
248
+ if first_invalid.returncode != 2:
249
+ raise AssertionError("first invalid receipt did not enter retryable state")
250
+ state = json.loads(state_path.read_text(encoding="utf-8"))
251
+ if state["phase"] != "source_review" or state["allowed_actions"] != [
252
+ "retry-source-gate"
253
+ ]:
254
+ raise AssertionError("invalid receipt did not preserve source review retry")
255
+
256
+ retry_start = run_controller("event", str(state_path), "source-gate-started")
257
+ if retry_start.returncode != 0:
258
+ raise AssertionError("source gate retry was not allowed")
259
+ second_invalid = run_controller(
260
+ "gate",
261
+ str(state_path),
262
+ "--gate",
263
+ "source-gate",
264
+ "--receipt",
265
+ str(invalid_receipt),
266
+ "--expected-round",
267
+ str(source_pass["review_round"]),
268
+ )
269
+ if second_invalid.returncode != 2:
270
+ raise AssertionError("second invalid receipt did not stop normally")
271
+ state = json.loads(state_path.read_text(encoding="utf-8"))
272
+ if state["phase"] != "blocked" or state["package_status"] != "not_started":
273
+ raise AssertionError("invalid receipt exhaustion unlocked packaging")
274
+
275
+ with tempfile.TemporaryDirectory() as temp_dir:
276
+ temp_root = Path(temp_dir)
277
+ state_path = temp_root / "workflow-state.json"
278
+ goal_path = temp_root / "DESIGN_CONTEXT.md"
279
+ goal_path.write_text("overall goal", encoding="utf-8")
280
+ grounding_receipt = temp_root / "grounding-round.json"
281
+ grounding_receipt.write_text(
282
+ json.dumps(grounding_pass, ensure_ascii=False), encoding="utf-8"
283
+ )
284
+ source_receipt = temp_root / "source-round.json"
285
+ source_receipt.write_text(
286
+ json.dumps(source_pass, ensure_ascii=False), encoding="utf-8"
287
+ )
288
+ snapshot = str(source_pass["reviewed_snapshot_id"])
289
+ manifest = temp_root / "manifest.json"
290
+ manifest.write_text(
291
+ json.dumps({"source_snapshot_id": snapshot}), encoding="utf-8"
292
+ )
293
+
294
+ successful_path = (
295
+ ("init", str(state_path), "--overall-goal-ref", str(goal_path)),
296
+ ("event", str(state_path), "candidate-grounded"),
297
+ ("event", str(state_path), "grounding-gate-started"),
298
+ (
299
+ "gate",
300
+ str(state_path),
301
+ "--gate",
302
+ "grounding-gate",
303
+ "--receipt",
304
+ str(grounding_receipt),
305
+ "--expected-round",
306
+ str(grounding_pass["review_round"]),
307
+ ),
308
+ ("event", str(state_path), "source-written"),
309
+ (
310
+ "event",
311
+ str(state_path),
312
+ "source-review-prepared",
313
+ "--manifest",
314
+ str(manifest),
315
+ ),
316
+ ("event", str(state_path), "source-gate-started"),
317
+ (
318
+ "gate",
319
+ str(state_path),
320
+ "--gate",
321
+ "source-gate",
322
+ "--receipt",
323
+ str(source_receipt),
324
+ "--expected-round",
325
+ str(source_pass["review_round"]),
326
+ ),
327
+ )
328
+ for arguments in successful_path:
329
+ result = run_controller(*arguments)
330
+ if result.returncode != 0:
331
+ raise AssertionError(f"workflow pass path failed: {result.stdout}{result.stderr}")
332
+
333
+ mutation = run_controller("event", str(state_path), "source-changed")
334
+ if mutation.returncode != 0:
335
+ raise AssertionError("source mutation event failed")
336
+ state = json.loads(state_path.read_text(encoding="utf-8"))
337
+ if (
338
+ state["phase"] != "source_review"
339
+ or state["source_gate_status"] != "not_attempted"
340
+ or state["source_snapshot_id"] is not None
341
+ ):
342
+ raise AssertionError("source mutation did not invalidate the review grant")
343
+
344
+ performance_markers = {
345
+ "skills/design-enterprise-agent/SKILL.md": [
346
+ "tool_evidence_status",
347
+ "contract_only",
348
+ "callable_or_trace",
349
+ "runtime_design.performance",
350
+ ],
351
+ "skills/design-enterprise-agent/references/runtime-and-integration.md": [
352
+ "性能证据与 Tool 接口",
353
+ "not_exposed",
354
+ ],
355
+ "skills/design-enterprise-agent/references/41-performance-worked-example.md": [
356
+ "necessary_path_events",
357
+ "first_divergence",
358
+ "使用本案例时的停止条件",
359
+ ],
360
+ "skills/review-enterprise-agent/SKILL.md": [
361
+ "条件核验性能设计与声明",
362
+ "contract_only",
363
+ "callable_or_trace",
364
+ ],
365
+ "RUNTIME_ASSEMBLY.md": [
366
+ "41-performance-worked-example.md",
367
+ "tool_evidence_status = contract_only",
368
+ ],
369
+ }
370
+ for relative, markers in performance_markers.items():
371
+ text = (ROOT / relative).read_text(encoding="utf-8")
372
+ for marker in markers:
373
+ if marker not in text:
374
+ raise AssertionError(f"performance marker missing: {relative} -> {marker}")
375
+
376
+ categories = {
377
+ case["category"]
378
+ for case in json.loads((ROOT / "evaluation/cases.json").read_text(encoding="utf-8"))["cases"]
379
+ }
380
+ required_performance_categories = {
381
+ "performance_no_tool_prospective_design",
382
+ "performance_contract_only_static_analysis",
383
+ "performance_trace_bound_measured_claim",
384
+ }
385
+ if not required_performance_categories.issubset(categories):
386
+ raise AssertionError("performance evidence-tier cases are incomplete")
387
+
388
+ contract_only_case = next(
389
+ case
390
+ for case in json.loads((ROOT / "evaluation/cases.json").read_text(encoding="utf-8"))["cases"]
391
+ if case["category"] == "task_rubric_contract_only_not_blocked"
392
+ )
393
+ grounding_receipt = contract_only_case["mock_tools"][0]["result"]
394
+ if (
395
+ grounding_receipt["verdict"] != "pass"
396
+ or grounding_receipt["grounding_audit"]["standard_mode"]
397
+ != "runtime-input-only"
398
+ ):
399
+ raise AssertionError("runtime-input-only rubric was still treated as a universal blocker")
400
+
401
+ print(
402
+ f"V0321_GUARDS_PASS receipts={len(receipts)} "
403
+ "workflow_cases=3 performance_cases=3 standard_routes=3"
404
+ )
405
+ return 0
406
+
407
+
408
+ if __name__ == "__main__":
409
+ raise SystemExit(main())
410
+
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: design-enterprise-agent
3
+ description: 设计、新建、整体优化、重构、修改、生成或测试企业领域 Agent;从已经通过 Grounding Gate 的首版专业任务建立职业内核、七层联合行为和最小责任拓扑,写出自然高质量的 System Prompt、真正需要的 Skills、诚实的依赖契约与行为评测,并在完整源码任务中完成冻结、Source Gate 和可验证交付。用户只要分析或只读裁决时使用 review-enterprise-agent。
4
+ ---
5
+
6
+ # 设计企业 Agent
7
+
8
+ Skill-Version: 0.34.1
9
+
10
+ ## 入口与交付责任
11
+
12
+ 本 Skill 把已经充分理解的专业任务编译成真实 Agent。完整源码任务先核对调研交接、原始材料和 Grounding Gate 收据;限定局部修改只核对受影响事实与责任,不因入口检查要求重新取得完整调研收据。当前平台没有已核证的生命周期 Hook;完整交付由 Agent 主动走完,不能把内部自检称为独立通过,也不能把主动执行声称为宿主强制。
13
+
14
+ 交付形态由你裁决,不询问业务用户:
15
+
16
+ - `full_agent_source`:新建、整体优化、重设计或用户要求完整 Agent,默认交付;
17
+ - `local_asset_edit`:用户只授权修改指定 Prompt、Skill 或相邻资产;
18
+ - `design_only`:用户明确只要方案或禁止写文件。
19
+
20
+ 完整源码至少有独立 System Prompt、每个真实 Skill 的源码、确有必要的依赖契约、正常任务和最高风险任务评测。文件数量不预设。
21
+
22
+ 若当前交接仍存在无法通过安全限制、暂定基线、平台待接入或延期扩展处理的高影响业务决定,返回相应调研 Skill。不要在本 Skill 里另建问卷;也不要因为真实 rubric、API 或校准样本尚未接入而自动退回,只要首版能够诚实按 `contract_only` 或安全限制设计。
23
+
24
+ ## 形成总体设计判断
25
+
26
+ 先独立回答,不沿用旧目录:
27
+
28
+ - 用户真正需要改善什么业务结果,主要消费者依据结果做什么;
29
+ - 为什么需要 Agent,而不是 Prompt、单一 Skill 或确定性程序;
30
+ - Agent 代表谁观察,对哪一种判断质量负责,误判的实际后果是什么;
31
+ - 正常和最高风险任务中,专家先看什么、怎样比较、哪些证据会改变策略;
32
+ - 旧设计哪些行为已经有效,哪些只是文件或方法假设;
33
+ - 当前理解来自哪些工作经历、产物和例外,用户的表面诉求与实际需要是否存在差别;材料不足以定义专业任务时返回访谈,不用预设方案选择代替需求探索;
34
+ - 推荐的首版边界、主要代价和什么事实会改变方案。
35
+
36
+ 给用户的解释使用业务语言。设计师可以挑战旧稿和用户提出的错误架构,但用户对业务方向和最终取舍有最终决定权。
37
+
38
+ ## 设计职业内核和七层联合行为
39
+
40
+ 选择一个正常任务或联合压力事件,先写可观察行为,再让七层共同控制:
41
+
42
+ - 底线保护什么,越权后怎样合法继续;
43
+ - 岗位处理什么、转交什么,代表谁判断;
44
+ - 原则怎样比较合法方案,任务目标怎样随证据和授权变化;
45
+ - 专业方法怎样观察、比较、反证和形成结论;
46
+ - Tool 与知识提供什么事实,失败怎样返回 Agent 重判;
47
+ - Output 怎样让消费者行动,责任怎样交接;
48
+ - Trace 怎样支持争议复审和真实能力范围内的恢复。
49
+
50
+ 目标 Agent 必须有职业差异。把岗位名换成相邻岗位后仍成立,说明专业观察和判断方法尚未建立。写出至少一个“表面合格但实质不可用”和一个“表达粗糙但专业上仍可用”的正反比较,让判断标准可以被理解和复审。
51
+
52
+ ## 推导最小责任拓扑
53
+
54
+ 先决定谁形成最终专业结论,再决定是否需要 Skill。Agent 保留总体意图、跨 Skill 综合和最终责任;Skill 承担可独立触发、可复用、可验收的专业判断闭环;Tool 负责确定读取、计算和动作;Output 投影同一事实;运行环境承担真实存在的状态、调度、审批与恢复;人承担正式政策、授权和最终业务责任。
55
+
56
+ 满足以下全部条件才拆 Skill:
57
+
58
+ 1. 有独立业务意图,而不只是流水线步骤;
59
+ 2. 需要自己的专业证据和判断;
60
+ 3. 有独立成功、停止和恢复;
61
+ 4. 可以单独测试;
62
+ 5. 不与 Agent 或其他 Skill 重复形成同一总评、风险或建议。
63
+
64
+ 解析、格式化、消费者投影、纯路由、写入、去重、统计聚合和固定状态转换通常不是 Skill。相似能力优先合并;“职责需要被说明”不等于“职责需要成为 Skill”。
65
+
66
+ ## 设计知识、Tool 和运行接入
67
+
68
+ 逐项说明哪种专业判断依赖哪种知识、现场数据或动作。记录证据状态:
69
+
70
+ - `connected`:当前环境可调用并有真实返回;
71
+ - `contract_only`:只有有权接口定义,可设计调用语义和模拟行为;
72
+ - `required_not_connected`:能力必要但尚无接口证据;
73
+ - `not_required`:首版不依赖。
74
+
75
+ 没有真实平台文档时,契约只写业务目的、必要语义、权限与副作用、成功/部分成功/失败类别、平台待回答问题和安全降级。不得补端点、字段、错误码、重试次数、阈值、哈希和幂等默认。契约存在只能证明设计路径,不得标成 Tool 已接入或数据已取得。
76
+
77
+ 输出效力也是依赖。若 Agent 要形成总评、等级、评级草案、准入建议或流程状态,必须逐项追溯其名称、维度关系、权重、阈值、映射和批准效力由谁提供;只有分项锚点而没有有权聚合/评级规则时,只能交付分项结论、缺口与冲突,不能因为“草案”二字就自行生成正式等级。
78
+
79
+ 需要设计 Tool 路径、交互前沿、恢复或性能时,读取 [references/runtime-and-integration.md](references/runtime-and-integration.md)。只有用户明确要求性能设计,或真实轨迹显示重复理解、发现、构造、执行时,再读取 [references/41-performance-worked-example.md](references/41-performance-worked-example.md)。记录 `tool_evidence_status = none / contract_only / callable_or_trace` 并据此选择声明强度,没有轨迹不填写真实性能收益;需要时把路径分析写入 `runtime_design.performance`,不把案例数字复制到目标 Agent。
80
+
81
+ 同一岗位有显著不同的任务结构、长任务上下文/恢复问题、模型或 Tool 变化,或用户要求 Harness 适配时,先读取 [references/task-adaptive-runtime.md](references/task-adaptive-runtime.md)。先判断现有路径是否足够,再在稳定责任与当前权限内调整运行方法;四个运行视角不拆成四个 Skill。普通一次性任务不触发该路线。所需依据复用已有运行契约,不额外制造运行档案。
82
+
83
+ ## 编译高质量生产 Prompt 与 Skills
84
+
85
+ 写 Prompt 前读取 [references/cold-start-and-writing.md](references/cold-start-and-writing.md)。生产 Prompt 默认用七个自然中文业务标题承载七层,并在短段落中说明联合控制,但不能露出设计协议章节、L1—L4、内部门禁编号或开发期状态。
86
+
87
+ 完成三遍编译:
88
+
89
+ 1. **职业内核**:身份张力、消费者决定、专业观察、比较方法、误判后果、表面与实质;
90
+ 2. **条件运行**:证据、风险、授权和 Tool 返回变化时怎样直接推进、询问、拒绝、转交、降级和恢复;
91
+ 3. **管理可信**:质量优先级、边界保护对象、责任交接、自然解释和可复审输出。
92
+
93
+ 再去规格化:删除方法术语、设计痕迹、空洞口号、字段堆叠和对业务员工无意义的内部状态。关键策略先写给模型使用的业务目的、因果依据和边界,再让它结合当前事实推导动作;这些依据必须进入目标 Prompt/Skill,不能只留在设计说明,也不能退化成“完成后解释理由”。只保留真实依赖、安全与易错操作必需的固定顺序。向用户解释的是决定性依据与代价,不是隐藏思维链,也不要求每个动作都写理由。
94
+
95
+ 每个 Skill 写成“业务意图 × 当前状态 → 专业路径”:意图包含结果用途与结论强度,状态来自当前有效证据、成果、冲突和授权。先说明什么决定证据是否充分、动作是否有用,以及误判会损害什么,再给必要的方法与例子;模型可在边界内推导未列出的合法路径,不把例子编译成封闭菜单。相同意图在不同证据下、相同事实用于不同决定时可能需要不同做法;不穷举矩阵,简单确定任务可保持单一路径。
96
+
97
+ 把协作能力编译到目标岗位自身:需求尚未成形时用经历回放、专业追问或对照帮助用户理解问题;事实明确时直接完成;缺事实时最小澄清;有真实取舍时给有依据的建议;实际行动另核授权。不能只要求“少问问题”,也不把所有岗位变成访谈员。用户纠正后识别影响范围,保留有效成果,改正受影响结论并继续原任务;跨会话保存只由真实授权载体承担。
98
+
99
+ 同一决策事实只由有权来源或工具提供,交接保留终局意图、当前有效结果、未决事项及必要入口。不要让 Agent 重新拼装可由确定性工具给出的状态,也不能把工具建议当成行动授权。这些内容进入实际 Prompt/Skill/必要契约,不仅写在设计说明。
100
+
101
+ ## 写入、回读与内部反证
102
+
103
+ 写入前冻结最小资产计划:每个文件的独立责任、为什么不能与其他文件合并、由什么行为验收。`full_agent_source` 写入独立源码根目录;汇总设计稿只能额外生成。
104
+
105
+ 写入顺序以质量为中心:System Prompt → 核心 Skills → 必要契约 → 评测 → README。逐份回读并回答:
106
+
107
+ - Prompt 是否比设计说明更聪明、更自然;
108
+ - Skill 是否真有独立专业闭环;
109
+ - 正常和最高风险任务是否可以走通;
110
+ - 无权政策、猜测接口和未验证能力是否进入生产资产;
111
+ - 同一结论是否被多处重复形成;
112
+ - 依赖状态是否区分契约、接入和真实返回;
113
+ - 评测是否检查行为,而不是标题和关键词。
114
+
115
+ 行为评测必须可独立回放核心判断:正常任务至少给出足够具体的对象片段或结构化事实、适用锚点/规则、模拟 Tool 返回(如有)和逐项预期证据关系;“有一份文档、有三个锚点、应正确评审”不构成可复演 fixture。
116
+
117
+ 对确有策略分叉或交互承诺的岗位,在上述正常/风险案例内选择最能证伪设计的对照,不额外穷举测试集:同意图不同状态、同状态不同意图,或中途纠正/新证据后的接续。必要时实际运行生成的 Prompt 和 Skill,观察取证、提问、工具动作与终止,而不只让设计师解释应该怎样做。开放访谈看是否沿回答深化理解并能收敛,明确任务看是否免于无效访谈;不按问题数量少、回答短或出现关键词判通过。模拟与真实运行分别记录,未执行保持 not_run。
118
+
119
+ 内部反证发现问题直接修订,但不能签发 Grounding Gate 或 Source Gate 通过。
120
+
121
+ ## Source Gate 与交付
122
+
123
+ 完整源码内部回读后,调用终结器的 `--prepare-source-review` 在源码根目录之外生成冻结清单。只有清单成功并取得 `source_snapshot_id` 后,才能启动新的隔离 `source-gate`;未冻结源码上的评审只能算内部意见,不能保存为正式 Source Gate 轮次。
124
+
125
+ Source Gate 每轮都重新检查总体目标、职业质量、最小拓扑、权威与证据、生产行文和跨资产一致性。有效 `revision_required` 返回本 Skill,只修订裁决指出的决定性失败族;修订后重新冻结。无效返回由宿主保存为 invalid attempt,不修改源码、不占用正式轮次。
126
+
127
+ 只有绑定当前快照的有效 `pass` 才调用 `finalize_agent_delivery.py`。终结器核对入口、Skill 身份、评测、源码未变化、收据绑定和 ZIP 回读一致性;它不评价职业设计、模型行为或平台可用。
128
+
129
+ 当前默认是 `agent_driven`:源码写入后不要结束,继续冻结、调用新的隔离 Source Gate、按裁决修订、重新冻结,并在有效 `pass` 后运行终结器和回读 ZIP。若真实失败使下一动作不可执行,保存依据并报告阻塞。可选宿主控制参考不进入默认装配;本轮主动完成不能宣称为平台自动闭环。
130
+
131
+ 最终先说明岗位与主设计判断,再列真实源码和 ZIP。分别报告设计质量、源码/包、独立评审、行为证据、工作流装配和平台接入。新增检查已经不会改变这些判断时停止。