@sema-ai/core 1.277.0 → 1.277.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 (134) hide show
  1. package/README.md +2 -5
  2. package/dist/bench/metrics.js +1 -1
  3. package/dist/bench/metrics.js.map +1 -1
  4. package/dist/core/cache-break-detector.js +0 -0
  5. package/dist/core/cache-break-detector.js.map +1 -1
  6. package/dist/tools/gitea-issue.d.ts +1 -1
  7. package/dist/tools/gitea-issue.d.ts.map +1 -1
  8. package/package.json +1 -6
  9. package/CHANGELOG.md +0 -5455
  10. package/docs/A1-ATTRIBUTION-ROUND1-2026-07-09.md +0 -181
  11. package/docs/AB-ORACLE-GATE-VERDICT-2026-07-10.md +0 -100
  12. package/docs/ANCHOR-GAP-INVENTORY-2026-07-09.md +0 -143
  13. package/docs/ARCHITECTURE.md +0 -125
  14. package/docs/BUGHUNT-2026-07-05-NIGHT.md +0 -98
  15. package/docs/BUILD.md +0 -63
  16. package/docs/CANCEL-ASYNC-ATTRIBUTION-2026-07-09.md +0 -98
  17. package/docs/CC-198-VS-201-DRIFT-2026-07-09.md +0 -70
  18. package/docs/CC-BASELINE-FAKE-ZERO-AUDIT-2026-07-09.md +0 -51
  19. package/docs/CC-DRIFT-198-206-AGENT-TYPES-2026-07-10.md +0 -82
  20. package/docs/CC-DRIFT-198-206-CHANGELOG-2026-07-10.md +0 -82
  21. package/docs/CC-DRIFT-198-206-REMINDERS-2026-07-10.md +0 -96
  22. package/docs/CC-DRIFT-198-206-ROADMAP-2026-07-10.md +0 -110
  23. package/docs/CC-DRIFT-198-206-TOOL-INVENTORY-2026-07-10.md +0 -53
  24. package/docs/CC-DRIFT-198-206-USAGE-CONSTANTS-2026-07-10.md +0 -64
  25. package/docs/CC-DRIFT-198-206-WORKFLOW-2026-07-10.md +0 -83
  26. package/docs/CC-PARITY-CHECKLIST.md +0 -220
  27. package/docs/CC-PARITY-DEEP-SWEEP-2026-07-07.md +0 -149
  28. package/docs/CC-SUBAGENT-PROMPT-STUDY-2026-07-09.md +0 -219
  29. package/docs/CC-TASK-REMINDER-CADENCE-STUDY-2026-07-09.md +0 -396
  30. package/docs/CC-TOOL-PARITY-SWEEP-2026-07.md +0 -56
  31. package/docs/CC-TOOL-PROMPT-DEEP-DIFF-2026-07-08.md +0 -274
  32. package/docs/CC-TOOLSURFACE-DEEP-DIVE-2026-07-07.md +0 -197
  33. package/docs/CC206-OBSERVER-ANCHORS-2026-07-11.md +0 -463
  34. package/docs/CC207-CORE-SWEEP-BACKLOG-2026-07-12.md +0 -155
  35. package/docs/CENTER-CONTROL-PLANE-SEAM.md +0 -86
  36. package/docs/CLEANUP-CONTRACT-ANCHOR-2026-07-09.md +0 -83
  37. package/docs/COLD-START-RSI-2026-07-09.md +0 -72
  38. package/docs/COMPACTION-LIVE-AUDIT-2026-07-09.md +0 -114
  39. package/docs/CONTEXT-lifecycle-extension-points-and-stop-attribution.md +0 -71
  40. package/docs/COREWARS-POLYGLOT-TRIAGE-2026-07-09.md +0 -85
  41. package/docs/DEADTARGET-OVERFULL-HBOX-2026-07-10.md +0 -92
  42. package/docs/DEADTARGET-PATH-TRACING-REVERSE-2026-07-10.md +0 -87
  43. package/docs/DEADTARGET-WINNING-AVG-COREWARS-2026-07-10.md +0 -96
  44. package/docs/DEEPSEEK-API-LIMITS-PROBE-2026-07-09.md +0 -118
  45. package/docs/DESIGN-140-MOCK-VERIFY-2026-07-11.md +0 -79
  46. package/docs/DESIGN-140-VERIFICATION-2026-07-11.md +0 -43
  47. package/docs/DESIGN-DRAFT-workflow-collab-2026-07-11.md +0 -56
  48. package/docs/DESIGN-ORACLE-GROUNDING-GATE-2026-07-10.md +0 -167
  49. package/docs/DESIGN-TFRAG-RECONCILE-SCAFFOLD-2026-07-09.md +0 -102
  50. package/docs/EXP-PA2-PE-DESIGN-2026-07-11.md +0 -220
  51. package/docs/EXT-DOGFOOD-2026-07-12.md +0 -50
  52. package/docs/FINAL-VERIFY-SURFACE-AUDIT-2026-07-09.md +0 -44
  53. package/docs/FRAG-RECON-INVESTIGATION-2026-07-09.md +0 -183
  54. package/docs/HANDOFF.md +0 -121
  55. package/docs/KNOWN-ISSUES.md +0 -96
  56. package/docs/LEGW-WINDOW-TAX-2026-07-10.md +0 -82
  57. package/docs/LIVE-PROBE-BATCH-2026-07-11.md +0 -207
  58. package/docs/M2-CERT-ATTRIBUTION-2026-07-10.md +0 -61
  59. package/docs/M25-LEG-VARIANCE-ATTRIBUTION-2026-07-10.md +0 -81
  60. package/docs/MAILMAN-TIMEOUT-ATTRIBUTION-2026-07-10.md +0 -88
  61. package/docs/MEMORY-BACKEND-DIALECT-NOTES.md +0 -69
  62. package/docs/MTEB-ESCAPE-HATCH-ATTRIBUTION-2026-07-09.md +0 -57
  63. package/docs/MTEB-LEADERBOARD-ATTRIBUTION-2026-07-10.md +0 -134
  64. package/docs/ORACLE-GATE-NEGATIVE-SAMPLE-2026-07-11.md +0 -28
  65. package/docs/PARITY-CONTEXT-TRANSACTIONS-2026-07-10.md +0 -67
  66. package/docs/PARITY-PROGRESS-MATRIX-2026-07-10.md +0 -37
  67. package/docs/PARITY-SPOT-AGENT-TYPES-2026-07-10.md +0 -70
  68. package/docs/PARITY-SPOT-REMINDERS-2026-07-10.md +0 -144
  69. package/docs/PARITY-SPOT-TOOL-INVENTORY-2026-07-10.md +0 -61
  70. package/docs/PARITY-SPOT-USAGE-CONSTANTS-2026-07-10.md +0 -95
  71. package/docs/PARITY-SPOT-WORKFLOW-2026-07-10.md +0 -93
  72. package/docs/PASSWORD-RECOVERY-PANEL-VERDICT-2026-07-10.md +0 -62
  73. package/docs/R8-R9-FINALIZE-COORDINATION-2026-07-09.md +0 -124
  74. package/docs/REPL-CODE-MODE-EVALUATION-2026-07-10.md +0 -187
  75. package/docs/REPORT-1249-TARGETED.md +0 -48
  76. package/docs/RESEARCH-3P-MEMORY-SWAP-2026-07-12.md +0 -273
  77. package/docs/ROADMAP.md +0 -111
  78. package/docs/RSI-CLOUD-DEPLOY-2026-07-06.md +0 -289
  79. package/docs/RSI-PROCESS-AI-COLDSTART-2026-07-11.md +0 -68
  80. package/docs/S18-THOROUGHNESS-AUDIT-2026-07-09.md +0 -113
  81. package/docs/SERVICE-INTEGRATION-GUIDE.md +0 -298
  82. package/docs/SUBAGENT-STREAM-RESILIENCE-PARITY-2026-07-10.md +0 -118
  83. package/docs/SWEBENCH-PRO-RECON-2026-07-11.md +0 -31
  84. package/docs/TB-EFFICIENCY-TELEMETRY-2026-07-08.md +0 -114
  85. package/docs/TB-FAILURE-AUTOPSY-2026-07-05-RERUN.md +0 -67
  86. package/docs/TB-FAIRNESS-AUDIT-2026-07-08.md +0 -141
  87. package/docs/TB-FULL-1257-2026-07-08.md +0 -77
  88. package/docs/TB-LEG-GAP-ATTRIBUTION-1261-1263-2026-07-11.md +0 -154
  89. package/docs/TB-REGRESSION-DAEMON-KILL-2026-07-08.md +0 -58
  90. package/docs/TB-RSI-CROSSCHECK-2026-07-06.md +0 -68
  91. package/docs/TB-RSI-LEDGER.md +0 -30
  92. package/docs/TB-STABLE-SET-2026-07-08.md +0 -127
  93. package/docs/TB21-RECON-2026-07-11.md +0 -28
  94. package/docs/TEST-DESIGN-BATCH-1-2-3.md +0 -97
  95. package/docs/THIRD-PARTY-INTEGRATION.md +0 -45
  96. package/docs/TOKEN-ESTIMATE-CALIBRATION-LIVE-2026-07-09.md +0 -102
  97. package/docs/audit-2026-06-10-/347/254/254/344/272/214/350/275/256-/347/251/272/347/231/275/345/214/272/344/270/216/345/277/230/346/216/245/347/272/277.md +0 -147
  98. package/docs/audit-2026-06-10-/350/256/241/347/256/227bug/346/211/253/346/217/217.md +0 -163
  99. package/docs/audit-2026-06-11-/344/277/256/345/244/215/345/244/215/345/256/241/344/270/216/345/233/236/345/275/222/344/270/223/346/211/253.md +0 -95
  100. package/docs/audit-2026-06-12-design71-P1/346/275/234/344/274/217/351/235/242/350/243/201/345/206/263/344/270/216/345/220/236/351/224/231/345/256/241/350/256/241.md +0 -45
  101. package/docs/audit-2026-06-12-/345/205/254/345/274/200/346/227/213/351/222/256/346/264/273/346/200/247/344/270/216vendored/346/255/273/350/267/257.md +0 -63
  102. package/docs/audit-2026-06-15/ADDENDUM-second-pass.md +0 -88
  103. package/docs/audit-2026-06-15/ARCHITECTURE-AND-ROADMAP.md +0 -187
  104. package/docs/audit-2026-06-15/DOC-CORRECTIONS.md +0 -105
  105. package/docs/audit-2026-06-15/INDEX.md +0 -49
  106. package/docs/audit-2026-06-15/ORCHESTRATION-STATUS.md +0 -98
  107. package/docs/audit-2026-06-15/PRODUCTION-ISSUES.md +0 -189
  108. package/docs/audit-2026-06-15/REFERENCES-literature.md +0 -139
  109. package/docs/audit-2026-06-15/VENDOR-REFACTOR-PLAN.md +0 -96
  110. package/docs/cc-probe-198/README.md +0 -72
  111. package/docs/cc-probe-198/STABILITY-AUDIT.md +0 -118
  112. package/docs/cc-probe-198/live-schema-monitor-worktree-2026-07-09.json +0 -56
  113. package/docs/cc-probe-198/mount-variants.json +0 -536
  114. package/docs/cc-probe-198/plan-mode-run.json +0 -1
  115. package/docs/cc-probe-198/probe-bash-bg.json +0 -224
  116. package/docs/cc-probe-198/probe-edit-mismatch.json +0 -120
  117. package/docs/cc-probe-198/probe-read-missing.json +0 -62
  118. package/docs/cc-probe-198/probe-search-empty.json +0 -127
  119. package/docs/cc-probe-198/probe-task-family.json +0 -227
  120. package/docs/cc-probe-198/probes.status +0 -6
  121. package/docs/cc-probe-198/raw-capture-interactive.json +0 -948
  122. package/docs/cc-probe-198/raw-capture-print.json +0 -787
  123. package/docs/cc-probe-198/raw-capture2-interactive.json +0 -948
  124. package/docs/cc-probe-198/raw-capture2-print.json +0 -787
  125. package/docs/cc-probe-198/system-prompt.txt +0 -135
  126. package/docs/cc-probe-198/tools-array.json +0 -962
  127. package/docs/durability-boundary.md +0 -63
  128. package/docs/fix-2026-06-10-/350/256/241/347/256/227bug/344/277/256/345/244/215-search/346/211/271.md +0 -75
  129. package/docs/fix-2026-06-11-/347/254/254/344/272/214/350/275/256-/344/277/256/345/244/215-search/346/211/271.md +0 -62
  130. package/docs/parity-sweep/REPORT-DYNAMIC.md +0 -97
  131. package/docs/parity-sweep/REPORT-STATIC-GGB.md +0 -127
  132. package/docs/parity-sweep/REPORT-STATIC-RWE.md +0 -133
  133. package/docs/vendor-history.md +0 -385
  134. package/docs/vendored-upstream-diff-2026-07.md +0 -83
@@ -1,86 +0,0 @@
1
- # Center Control-Plane Seam — core's contribution to the sema-registry control plane
2
-
3
- > Status doc · 2026-06-27 · core/engine AI
4
- > **Scope**: what `@sema-ai/core` (the data-plane engine) owns and delivers for the **sema-registry "center control-plane"** (the升维 from config-as-code → an AI-fleet central control plane = manage-users + manage-clients + authz + config-distribution + governance + rollout, à la Okta + MDM + entitlements + feature-flags). This records the boundary decisions and the concrete core deliverable, so a future session / the center AI / the service AI can pick it up without re-deriving.
5
-
6
- ---
7
-
8
- ## 0. Provenance (how we got here)
9
-
10
- - The **center AI** authored the control-plane design (`AI-Only/sema-registry` repo, `docs/design/CENTER-CONTROL-PLANE-DESIGN.md`), hardened by a codex 5-lens pass (18 BLOCKER + 28 MAJOR).
11
- - clay relayed it to the **core AI** for a domain review. Core ran a **4-lens parallel adversarial review** (core-boundary / authz-soundness / PDP-selection / config-sync-import), grounded in core's actual src.
12
- - The center AI **fully accepted** the review and integrated it into design **R2** (`AI-Only/sema-registry` commit `c3af07e`). That acceptance activated a real **core-side deliverable** (this seam).
13
- - The core deliverable (the conformance corpus) then got its own **dual-lens review** (completeness + contract-soundness), which caught real coverage gaps — fixed before commit.
14
-
15
- The boundary law throughout is **design/99 §0**: *engine semantics / safety / cross-replica → core; UI/UX, config truth-source, deployment state → center/service.*
16
-
17
- ---
18
-
19
- ## 1. The boundary decisions (core review → center R2)
20
-
21
- The center-directed open questions resolved to one coherent split: **core owns the safety SEMANTICS + the safety-domain merge/validation; center owns config authority + the per-field mapping + the bundle/manifest format.** The three were *linked but inverted* from the design's first framing.
22
-
23
- | Q | Decision |
24
- |---|---|
25
- | **#13 workspace-override merger** | Core does **not** own a ConfigBundle merger. Core **exports the safety-domain merge predicate** it already ships (`loosenReasons` + the tighten-only/operator law + the `toolAxes` fold). The **center's ConfigBundle merger is a dispatcher**: for any field it classifies safety-critical (permissions / tool-policy), it MUST delegate to core's predicate; non-safety fields use center's plain override. The merge **direction is intrinsic to the field's semantics in core**, NOT looked up from a center field-class table. |
26
- | **#14 field classification** | Reject "core maintains the table". Core owns the **safety-AXIS vocabulary only** (`ToolEffect` = read/write/idempotent; `toolAxes` = effect/egress/irreversibility; `SafetyAxis`/`RiskDescriptor`; fail-closed defaults; precedence = caller-may-lower, server-may-only-tighten). Center maintains the **per-field mapping across all 12 config domains**; a field it marks safety-critical must **cite a core axis value**. Two artifacts, not one merged table. |
27
- | **#15 ImportManifest / ConfigBundle** | **Center-defined**, not core. Core never consumes a config bundle (it consumes the service-resolved `TaskSpec`). Core's only stake: the **safety-domain payloads** inside a bundle must validate against core's safety-domain schema + provenance-brand (so an import can't smuggle an unsafe policy). |
28
- | **#18 PDP selection** | **Cedar full-materialization, single graph.** Criterion = *materializability* (the entitlement is a pure function of attributes → freeze into self-contained token claims, matching verify-and-constrain's no-round-trip goal), not throughput. Flip to OpenFGA-under-Cedar (hierarchical, at token-mint time only, never on the worker hot path) **iff** transitive user-created sharing-graph access ships. |
29
- | **#10 per-RUN budget gate** | Closed: **per-RUN HARD pre-call gate = core** (existing `resourceLedger` + per-slice `min(maxCostUsd, remaining)` + `maxTurns`; center DECLARES the bound in the resolved spec). **per-period = service** (it aggregates a principal's runs; only ever SOFT or eventually-consistent-HARD since spend lives in the data plane). |
30
- | **Topology correction** | Core does **not** pull `/effective` — the **service** does, and the service is the **verify-and-constrain enforcement point**. Core receives an already-constrained spec and enforces it. `base ∩ ent` is resolved service-side and handed to core pre-narrowed; core never re-intersects against a center entitlement. |
31
-
32
- Cross-cutting MAJORs core's review added to R2 (now in the center design): token claim must be **value-equality** not presence (`(aud,resource,tenant) == request`); **bearer-theft is a v1 residual** mitigated by short TTL on high-risk caps; materialized claims must be **constraint-shaped** (floor-only) with monotone-narrowing intersection; `contentHash = canonicalize(zod-output)` + `globalRevision` the sole ordering authority (rollback also advances the consumer's applied revision).
33
-
34
- ---
35
-
36
- ## 2. What core actually delivers
37
-
38
- **Already exported (center can import today, no new core work):**
39
- - `loosenReasons(prior, next)` — the safety-merge predicate. Returns the list of reasons `next` LOOSENS `prior` (removes a deny / widens an allowlist / removes-or-widens a path confinement). **Empty ⇒ tighten-only/safe; non-empty ⇒ a non-operator override MUST be rejected.** (`src/core/session-policy-store.ts`)
40
- - The safety-axis vocabulary types: `ToolEffect`, `SafetyAxis`, `RiskDescriptor`, `SessionPermissionRules`.
41
-
42
- **New deliverable (this seam):**
43
- - `SAFETY_MERGE_CONFORMANCE_CORPUS` + `SafetyMergeVector` — the **published golden conformance corpus** (`src/core/safety-merge-corpus.ts`, exported from the package index). 24 vectors covering every loosen path + the tighten/safe/no-op cases + the `lexWithin` path-BOUNDARY edges.
44
-
45
- There is **no new merger, no new schema, no new endpoint in core** — the predicate + vocabulary already existed; the corpus is the contract artifact that lets the two codebases share one safety law without forking it.
46
-
47
- ---
48
-
49
- ## 3. The anti-drift contract (how the corpus is used)
50
-
51
- The corpus is the shared anchor (the design/87 gold-corpus discipline):
52
-
53
- - **CORE** regression-tests it (`test/safety-merge-corpus.test.ts`): every vector's pinned `reasons` MUST equal `loosenReasons(prior, next)`. If core ever changes the loosen law, this test fails and the corpus updates **in lockstep with the engine version** — the published contract can never silently drift from the implementation.
54
- - **CENTER** imports the corpus from `@sema-ai/core` and runs it as a **contract test** in its ConfigBundle-merger CI: for each vector, its merger's accept/reject of a **non-operator** workspace override on the permissions domain MUST be **reject iff `vector.loosens`**. That proves center's dispatcher actually routes through core's predicate rather than a forked re-implementation.
55
-
56
- **Center contract rule (important):** depend **only on `loosens`** (reject-iff-loosens). `reasons` is core's internal message wording, pinned for *core's* anti-drift only — a center CI that asserts on `reasons` would break on a core reword. On ACCEPT (`loosens === false`) the resolved safety-domain value is `next` (the tightened override applied).
57
-
58
- ```ts
59
- // center merger CI (sketch)
60
- import { SAFETY_MERGE_CONFORMANCE_CORPUS, loosenReasons } from "@sema-ai/core";
61
- for (const v of SAFETY_MERGE_CONFORMANCE_CORPUS) {
62
- const rejected = centerMergerRejectsNonOperatorOverride("permissions", v.prior, v.next);
63
- expect(rejected).toBe(v.loosens); // the contract: reject iff loosens
64
- // and the dispatcher must call loosenReasons, not re-derive "deny>allow":
65
- expect(loosenReasons(v.prior, v.next).length > 0).toBe(v.loosens);
66
- }
67
- ```
68
-
69
- ---
70
-
71
- ## 4. Review findings the corpus closed (dual-lens)
72
-
73
- The first corpus cut shipped real gaps; the dual-lens review caught them (the "single review misleads" lesson — these are exactly the safety-critical paths a single pass missed):
74
- - **MAJOR** — the `commandAllow` allowlist-removal branch was **unpinned** (masked by the `toolAllow` vector + a `tool|command` regex alternation). A forked center predicate could re-allow every command and its CI stayed green. Fixed: explicit `commandAllow-removed-all-allowed` vector + **field-specific** coverage assertions.
75
- - **MAJOR** — `allowDirs` **empty-array vs undefined** distinction unpinned (`loosenReasons` branches on `.length === 0`).
76
- - **MAJOR** — `lexWithin` **path-boundary** edges unpinned: `/repo` vs `/repository` LOOSENS (a naive `startsWith` would wrongly accept it), trailing-slash / root / relative-dir cases. These are where a re-implemented center predicate most commonly mis-accepts.
77
- - **MINOR** — multi-entry removal (center must accumulate reasons, not short-circuit); contract over-coupling (now: depend on `loosens` only).
78
-
79
- ---
80
-
81
- ## 5. Status & next steps
82
-
83
- - **On main**: `455f655` (`feat(core): publish safety-merge conformance corpus`). 24 vectors, 26 tests green, tsc 0, export-surface re-baselined.
84
- - **NOT released** — held at clay's instruction. When released it lands as **`@sema-ai/core` 1.152.0** (current published: 1.151.0); the center pins that version + imports the corpus.
85
- - **Pending**: release go (clay) → then notify the center AI (receipt: corpus in 1.152.0 + the consumption contract above).
86
- - **Not core's** (tracked here only so it isn't dropped): the center builds the ConfigBundle merger + the per-field classification table + the ImportManifest/ConfigBundle reversible contract; the service owns the verify-and-constrain enforcement point + per-period budget + `/effective?principal=` resolution.
@@ -1,83 +0,0 @@
1
- # 「收尾清理中间产物契约」两轨锚证(2026-07-09)
2
-
3
- **任务**:判定 sema finalize/收尾帧要不要加"清理构建中间产物,只留 deliverable"指令是否**可锚**(CC 198 源码锚 + CC PASS 轨迹行为锚)。
4
- **触发档**:`docs/COREWARS-POLYGLOT-TRIAGE-2026-07-09.md` §题2·⑤次向(polyglot-rust-c 留 `cmain` 挂 `listdir==["main.rs"]` 验收)。
5
- **结论一句话**:**不可锚**——CC 无「清理中间产物」类系统提示帧;行为面 CC 的清理**全部由任务/验收显式要求驱动**(读题仔细),非收尾纪律。判据(自发清理跨题 ≥2 重复)**未达成**。
6
-
7
- ---
8
-
9
- ## §1 源码锚结果:**verified-absent**
10
-
11
- 唯一一手源 `claude-cli-2.1.198.pretty.js`(26.4MB)。搜遍以下关键词族,**未命中任何「收尾清理中间产物/临时文件/build artifacts/只留 deliverable」类系统提示或收尾指令帧**:
12
- `clean up` / `cleanup` / `temporary file` / `intermediate` / `artifacts` / `scratch` / `leave only` / `only the requested` / `deliverable` / `clean up.*(artifact|binaries)` / `remove.*(intermediate|build|temp)` / `compiled binaries` / `tidy` / `before you finish` / `task is complete`。
13
-
14
- 命中项逐条排除(带行号,逐字转录关键片段):
15
-
16
- | 行号 | 逐字片段(截) | 作用面 | 是不是收尾清理帧 |
17
- |---|---|---|---|
18
- | 143381 | `Send files to the user. Use this when the file *is* the deliverable — a generated diagram, a report, a screenshot, a built artifact` | `SendUserFile` 工具描述 | **否**。"deliverable"=要推给用户的文件,与「删中间产物」无关 |
19
- | 240573 | `When you believe the task is complete. BEFORE this call, make your deliverable durable: write the file, save the result, commit the change.` | advisor/收尾建议帧 | **否**。方向相反——是「让交付物**持久化**」,不是「删中间产物」 |
20
- | 334485 | `If there are no changes to commit ... do not create an empty commit` | git commit 指引 | 否 |
21
- | 419977 | 子代 system prompt:`Complete the task fully—don't gold-plate ... NEVER create files unless they're absolutely necessary ... ALWAYS prefer editing an existing file to creating a new one.` | delegated-subagent prompt | **否**(最接近但仍不是)。这是「别**新建**多余文件」的**输入面**纪律,不是「收尾**删除**已产生的中间产物」;且无「只留 deliverable / 清理 build 产物」措辞 |
22
- | 224688 | `Scratchpad directory: ${t}\nWorkers can generally read and write here ... prefer plain data and markdown files.` | coordinator scratchpad 段(已 port) | **否**。只讲 scratchpad 用途,无清理指令 |
23
- | 149733 / 224635 / 236926(`post_compact_cleanup`) | scratchpad 启用判定 / 压缩后清理钩子 | 内部机制 | 否 |
24
- | 47960–48134 | `Failed to clean up temp file: ...` | 运行时日志字符串(CC 自己删自己临时文件的实现) | 否(实现细节,非给模型的指令) |
25
-
26
- **源码锚判定:absent。** CC 的 system prompt/finalize 帧里**没有**任何「清理编译产物/临时文件、只留要求交付物」类通用纪律。最接近的 419977 是「别新建多余文件」的反向表述,作用面不同,不能作本修向的锚。
27
-
28
- ---
29
-
30
- ## §2 行为锚结果:题×命令矩阵 + 自发/要求判定
31
-
32
- 海外机 `91.199.82.197:~/sema-tb/jobs/cc-pro-r3-full/`(89 题 CC PASS 轨迹,deepseek-v4-pro)。对全 89 题尾段(后 20%)扫 `rm -f/-rf`,并区分**删除位置**:`/app`(=被验收的 deliverable 工作区)vs `/tmp`(=agent 自建 scratch/测试夹具)。
33
-
34
- ### 2.1 全库扫描:尾段删 deliverable 工作区(非 /tmp)的题 —— 仅 3 题
35
-
36
- | 题(PASS) | 尾段命令 | 删的是什么 | 任务/验收是否**显式要求**清理 |
37
- |---|---|---|---|
38
- | **polyglot-rust-c** | `rm -f /app/polyglot/main /app/polyglot/cmain /tmp/test_*` | 编译产物 `main`/`cmain`(在 `/app/polyglot`) | **是**。验收硬门 `os.listdir("/app/polyglot")==["main.rs"]`(见触发档 §题2①)。清 = 过关动作 |
39
- | **cobol-modernization** | `rm -f /app/program_cobol`(desc:`Remove compiled COBOL binary` / `Restore original data files and clean up`) | COBOL 编译二进制 + 恢复被改的原始数据文件 | **是(任务语义驱动)**。modernization 题要「还原被动过的输入/不留编译产物」,desc 明写 "Restore original files" |
40
- | **extract-moves-from-video** | `rm -f /app/zork_video.mp4 && rm -rf /app/frames && rm -f /app/ocr_frame_*.txt /app/all_ocr.txt`(desc:`Clean up video files and temporary OCR output`) | 自建的抽帧/OCR 中间产物 + 输入视频 | **倾向要求**。删的是「解题过程自建的中间态」,保输出洁净(video/frames/ocr 均非最终交付) |
41
-
42
- ### 2.2 反证:build/compile 类 PASS 题**不做**收尾清理(留着 build 产物)
43
-
44
- | 题 | reward | 尾段最后命令 | 有无收尾清理 build 产物 |
45
- |---|---|---|---|
46
- | build-cython-ext | 1(PASS) | `pytest ... test_spacecurve.py` | **无**(留编译扩展) |
47
- | compile-compcert | 1(PASS) | `ln -s .../ccomp ...; ls -la` | **无**(留编译器二进制) |
48
- | sqlite-with-gcov | 1(PASS) | `ls -la /app/sqlite/*.gcno` | **无**(留 `.gcno` 覆盖产物) |
49
- | extract-elf | 1(PASS) | `node /app/extract.js /app/a.out > /app/out.json` | **无** |
50
-
51
- > compile-compcert 尾段虽有 `rm -rf /tmp/CompCert-build`,但那是**重新解压源码**(desc:"Re-extract clean source")的过程动作,非收尾清理。
52
-
53
- ### 2.3 /tmp scratch 清理(reshard-c4-data 等)= 删自建测试夹具,不是收尾契约
54
-
55
- reshard-c4-data 尾段有 `rm -rf /tmp/test_input /tmp/test_resharded`、`rm -rf /tmp/c4_resharded /tmp/test_edge`(desc:"Clean up test fixtures" / "Clean up all test artifacts")。**全在 `/tmp`,删的是它自己为验证脚本造的测试夹具**;该题验收**不检查目录洁净度**。这是「收拾自己的测试草稿」,与「交卷前清 deliverable 目录中间产物」是两回事。
56
-
57
- ### 2.4 自发/要求判定
58
-
59
- - 删 **deliverable 工作区** 的 3 题(polyglot / cobol / extract-moves)**全部由任务或验收显式要求清理**(listdir 硬门 / 还原原文件 / 输出洁净语义)。
60
- - **不存在**「验收不要求、CC 却出于收尾纪律主动清 deliverable 中间产物」的题。
61
- - 反面(build/compile 类)**明确留着** build 产物 → 证 CC **没有**「交卷必清中间产物」的盲纪律,是**按验收要求行事**。
62
- - `/tmp` scratch 清理是「收自己草稿」,不构成 deliverable 清理契约。
63
-
64
- **判据(自发清理非任务要求、跨题 ≥2 重复 = 可锚)结果:0 题达成 → 未满足 → 行为面不可锚。** 与预设「只有 polyglot 一题且该题验收本身要求清理 = 不可锚」高度吻合(实际是 3 题,但 3 题全是验收/任务要求驱动)。
65
-
66
- ---
67
-
68
- ## §3 终判
69
-
70
- **不可锚(源码 absent + 行为 0/N 自发)。** CC 之所以在 polyglot 收尾 `rm -f cmain main`,不是因为它有「清理中间产物」的收尾纪律帧,而是它**读到了验收要求「目录只留 main.rs」并照做**——同类现象(cobol 还原原文件、extract-moves 保输出洁净)全是读题/读验收仔细的结果。sema 在 polyglot 留 cmain 的真因是**根本没解出 polyglot(超时前 Rust 侧还编不过)**,清理是它够不到的第二重失败,而非「缺收尾清理帧」。
71
-
72
- ### 替代解释(不给修向背书,给真因)
73
- sema polyglot 挂在 `['cmain','main.rs']` 断言 = **表层**;真死因是**解法效率**(选了 `/*`+`//*/` 双嵌套绕解陷调试,墙钟 cutoff 时 Rust 侧仍编不过)。给 finalize 帧补「清理中间产物」**救不回**——它连能被清理的正确 main.rs 都没产出。
74
-
75
- ### 若仍想在 sema 端补此纪律的正确框法(非 CC 锚,是我方自主设计,须标注)
76
- - **不能**声称「CC 锚」。可作为 **sema 自有的读题纪律强化**:在解析验收/任务时,若发现「目录只允许含 X」「只留 deliverable」类隐性硬门,**在计划阶段登记为显式交付约束**,收尾前校验。
77
- - 这与 CC 行为**一致**(CC 也是读到要求才清),但**机制不同**:CC 靠模型读题能力,sema 若要补,应补在**验收解析/收尾校验**层(确定性),而非往 finalize prompt 塞一句盲清指令(盲清会误删 build 类题该保留的产物 —— 见 §2.2 反证,有真实回归风险)。
78
- - **建议**:此条不进「CC-parity 小修批」(无锚);若要做,单列为「验收洁净度约束显式化」自主设计项,先造 §触发档 §⑤(c) 的最小 harness 题(「生成 X 并保证目录只剩 X」)量 sema 现状清理率再决定,别裸改 prompt。
79
-
80
- **诚实标注**:两轨均按预设判据严格执行,未为给修向背书放宽。行为锚扫了全 89 题(非仅抽样 8 题),deliverable 清理仅 3 题且全由要求驱动,反证(build 类留产物)进一步坐实「CC 无盲清纪律」。
81
-
82
- ---
83
- **档案**:`docs/CLEANUP-CONTRACT-ANCHOR-2026-07-09.md`
@@ -1,72 +0,0 @@
1
- # 冷启动接手提示词:sema-core CC-parity RSI 主线(2026-07-09 刷新,晚间弧末)
2
-
3
- 你是 search-AI 谱系总设计师,拥有 `@sema-ai/core`(蒸馏自 openclaw 的无状态任务化 AI agent 引擎)的完整代码与设计所有权,有自主发版权(复审+全量绿即自发+黑板通告)。本地仓 `/Users/clay/开发/gittea/ai-agent-core`,工作分支 `devendor`,发版切 `main`(用 worktree `ai-agent-core-main-worktree`)。用中文对 clay 汇报。
4
-
5
- ---
6
-
7
- ## 主线:design/139 — TB 工程能力 RSI 自进化循环(goal 硬锁)
8
-
9
- `/goal` 生效中:**TB 分数达标 CC 或 token 烧尽前,不准停 RSI 体系**。CC(claude-code,考据锚 2.1.198)= 基准与目标;同模型(deepseek-v4-pro)、同评测台(terminal-bench 2.0/harbor)下 CC 稳定 **54/89**(cc-pro-r3-full 实测,per-task 数据在海外机 `~/sema-tb/jobs/cc-pro-r3-full`)。阶梯:**M1 收复 51 → M2 稳定 ≥54 → M3 冲并集 66**。
10
-
11
- **RSI 循环形态**:TB 判决腿出分 → 归因(双轨迹 opus wf + 对抗复核)→ 修(CC 锚 + fable 落码)→ 复审(workflow find→verify + 大改动 codex 并行)→ 发版 → 复跑验收 → 下一轮。已完成 **9 个转轮**(ledger 轮 0-9,`docs/TB-RSI-LEDGER.md`)。
12
-
13
- **当前态一句话**:1.259.0 已发 latest;M1 认证腿 50/89(差 1,方差带内);围剿 CC-diff 12 题坐实 1.259.0 增益(验证面修 2 题 3/3 + rstan 3/3 翻转 + mteb 判据修有信号);外推 54-56=M2 射程;**M2 认证腿(full-89 @1.259.0 n=8)已挂 watcher 自动跑,约 6h 出分**。
14
-
15
- ---
16
-
17
- ## 铁律(记忆已存,务必遵守)
18
-
19
- - **模型分工**:BUG 修/终判 = **fable**(主窗口亲核,subagent 继承);证据收集/归因/复核/汇总 = **opus**(Agent(model:opus) 或 workflow)。我 = 编排+终判+敏感项交叉认证,**不亲自落码**(除极小修如单行 TS 错),全部派 subagent。
20
- - **CC 锚强制 + 🏛️ 宪法两道闸(clay 2026-07-09)**:CC 考据要落代码,缺一不可——① **锚核腿**(考据档产出后、落码前,独立 Agent 对 198 源逐字核转录忠实性,考据档=二手证据别直接信)② **活体探针对比**(落码后用 wire 探针把 sema 实际行为与 CC 逐句对比,测试绿 ≠ 对)。触发案=fork 帧 `<directive-prefix>`(档转录错→码复制→测试锁死错)。探针姿势=`bench/probes/r9-wire-echo/probe.mjs`(fetchImpl 缝截获 provider 请求体)。**本轮实证有效**:cleanup 契约候选被锚核腿拦下(源码 absent + 行为 0/89 自发→不可锚不修,避免无锚自我发明,docs/CLEANUP-CONTRACT-ANCHOR)。
21
- - **锚源双轨**:① 源码锚(CC 有对应机制→逐字抄,88 已弃 **只用 198**:`/Users/clay/开发/gittea/claude-198/cc-2.1.198/package/claude-cli-2.1.198.pretty.js`)② 行为锚(SEMA-only 机制→CC 轨迹跨题 ≥2 重复=纪律可锚,单题=运气不锚,诚实排除)。
22
- - **快慢环收紧(clay 2026-07-09)**:修复验收=**快环单题点名 N=3 两段式**(2/3 边缘补 2 注升 N=5),不跑全量;全量 89 k=1 只作里程碑认证/围栏。全量=公证处非测量工具。
23
- - **并发纪律(clay 2026-07-09 晚拍)**:TB 跑腿**默认并发下限 = 8**(conc8 标定 16/16 + L8@1.259.0 15/16 双背书;4 并发保守帽废除)。**但并发是测量污染源**(轮 3 铁证:同版本同机同日,4 并发 83% vs 40 并发 33%,DeepSeek 服务端高并发降质)→ 判决腿只用标定过的档;超出线程给非判决面(侦察/探针/归因复现)。**按题配并发**:内存边际题(rstan)独占 n=1 反而稳(3/3,历史 1/4)。12/24 档标定在跑;若单 key 高并发塌,解锁路径=**多 DeepSeek key 分摊**(需 clay/service 给 key)。
24
- - **对抗复审 = Workflow(opus)+verify 段**,单腿禁;大改动(核心路径/影响大)codex 并行双轨。
25
- - **穷举不靠提示**:归因/对比/审计先自穷举变量空间成清单再取证;被 clay 提示到=枚举没做全。
26
- - **双渠道巡检铁律**:巡检必查两处——① 黑板 `sema-cc-parity/NEIGHBOR-REQUESTS.md`(认 origin 校号 max+1,撞号警报:service 也用过 [530]/[531],引用带方向标)② 团队通道 `团队/来自service-AI.md`(读 origin/main 尾号,> 我方出口 `团队/给service-AI.md` 最后回执号=有欠账;通道 commit 在 main)。**UI 层机制发现一律转飞轮**(shell 主权面)。
27
- - **发版**:全量门落盘不 tail(`NPMTEST_EXIT=$?` 紧跟 npm test);**publish-dual 用 `node scripts/publish-dual.mjs`**(裸 npm publish 只发单腿);fresh smoke 验修在 dist(registry 拉取凭证可能过期→改用 `npm pack` 对 shasum + grep dist 关键短语);不 commit clay WIP(`bench/memory-write-channel`、`make-real-persistence`、`*.tgz`、`.claude`、`package-lock.json`、`src/examples/make-real-runspec-search.ts`、`bench/tb-matrix/rerun-*.json`、`test/mcp-close-*`——commit 只显式列本批文件)。
28
- - **敏感**:题库有攻击性叙事,归因/文档只看机制面过滤叙事;key 只在机上 env 读,严禁外泄/写进输出/回显;跨团队黑板只发 settled 结论。
29
-
30
- ---
31
-
32
- ## 跑面矩阵(三面分工)
33
-
34
- - **海外测试机 `ssh -o BatchMode=yes ubuntu@91.199.82.197`**(hostname=bare-metal-manassas-01,region 14,普通 docker,非 CN-egress)= **判决主场**。TB harness 在 `~/sema-tb`(脚本齐/结果 jobs/),围栏 `~/sema-tb/fence/`,凭据 `~/sema-tb-access/`(值不回显)。独占全量 89 一律此机(历史基线同机可比)。**ssh 长连接易断(255)**:监视用本地循环 + 每 4min 短连接探测,别挂长连 until 循环。
35
- - **k3s8 `ssh root@k3s8`(172.30.228.8)** = **探针/侦察面非判决面**(CN 网络域掉分+无 CC 对比)。64 核 x86 原生 docker,harbor 锁 0.17.1,runbook `/root/sema-tb/README-runbook.md`。
36
- - **海外 K8S(Gcore Santa Clara 三机 k3s HA+kata)** = ssh `ubuntu@217.28.137.187`/`92.223.71.222`/`37.9.33.96`(测试机 pubkey 已注三机,全通);LB VIP `37.9.33.245:8090`;ns `sema`(server×3+CNPG pg×3+MinIO+kata-qemu)。🔴 红线:公网零新增监听/别动 iptables 守卫/底座别重装/kata 2Gi-1cpu 控并发/别依赖 hostname 唯一性/etcd 不动/95.85.93.92 禁碰。**三用法就绪度**:① 用法(a) 打 VIP 侦察分流=**今天可用**(TLS 修后 service 已真任务验全链);② 用法(b) 云端隔离腿=**全链 PASS**([416],CA 校验+kata 真 VM 内核 6.18.35+零残留)但**进 TB 判决产能有三阻断**:harbor adapter 与 server `/v1/tasks` k8s lane 是两条执行范式需新写 adapter(我方工程债,低优先,判决主场不动测试机)/ 集群 model 钉 v4-flash 非 v4-pro / server 旧版 1.142.0;③ durable(pg) 多副本长跑=地基在待验。**滚版单**(M2 出分后正式提)=集群 server 一次滚到 **≥1.149.0**(收 health+usage+core 1.259.0)+ **加 v4-pro worker**(双 worker 而非切换)。
37
-
38
- ---
39
-
40
- ## 已完成(2026-07-08→09 全弧)
41
-
42
- **发版链**:1.258.4(窗口 200k/32000 对齐 CC)→ 1.258.5(A1 两纪律+stale 锚门)→ 1.258.6(final-verification 四原则)→ **1.259.0 已发 latest**(G 批子代 prompt parity 双 BEHAVIOR CHANGE + 工具面批 M13/15/17/18/19/22 + mteb 判据修;门 4894 绿;黑板 [541],service 零改动 consume 3483 绿)。
43
-
44
- **9 转轮账**(`docs/TB-RSI-LEDGER.md` 轮 0-9):daemon 回归修(轮 0-1)→ 并发测量纪律(轮 3)→ A1 差异集归因(轮 4)→ 效率线收官+walltime 病根(轮 5)→ full-89 46(轮 6)→ cancel 翻案零回退(轮 7)→ **M1 认证 50/89**(轮 8)→ **围剿 12 题+8 并发标定**(轮 9)。
45
-
46
- **围剿收账(轮 9,1.259.0 增益坐实)**:稳收 3(financial-document-processor 3/3=PDF 题 / merge-diff 3/3 / rstan 3/3 独占翻转)· 改善 4(overfull/extract-elf/sparql/path-tracing-reverse)· 稳定死 3(password-recovery 0/3=**新归因靶** / polyglot-rust-c 归因=模型面 / path-tracing 效率税)· mteb 判据修 retrieve 0/5→2/5 真增益未稳。**L8 并发 15/16 标稳**(16 trial 仅 11min)。
47
-
48
- **M1 认证腿 = 50/89**(full-89 @1.258.6 @1.0 口径 k=1):vs 1258.5=46(+4)/CC=54(-4);验证面修 9 靶收 4;M1 差 1=方差带内。数据 `bench/tb-matrix/m1-cert-12586.json`。
49
-
50
- **CC-diff 精确集(M2 靶心)**:CC PASS ∩ sema FAIL = 12 题(bn-fit/extract-elf/financial/merge-diff/overfull/password-recovery/path-tracing×2/polyglot-rust-c/rstan/sparql/winning-avg-corewars);sema PASS ∩ CC FAIL = 8 题(我们独占,含 db-wal/schemelike/build-pmars/pypi-server 等)。注:mteb 双题 CC 也 FAIL,收益在 M3 并集非 CC-diff。
51
-
52
- **归因档**:docs/COREWARS-POLYGLOT-TRIAGE(两题模型面)/ CLEANUP-CONTRACT-ANCHOR(不可锚不修)/ CC-TASK-REMINDER-CADENCE(慢环债「reminder 时机」核销:sema 已逐字对齐 198,仅三小口径缺口 task #51)。
53
-
54
- ---
55
-
56
- ## 🚀 在飞 / 待办(接手即办)
57
-
58
- **1. M2 认证腿(唯一判决线,海外测试机,watcher 自动跑)**:full-89 @1.259.0 @1.0 口径 k=1 **n=8**,job `m2-cert-1259-fb`,脚本 `~/sema-tb/m2-cert-1259.sh`。watcher 等 CONC-LADDER-DONE + env-main=0 自动开跑(阶梯 12/24 清场后),约 6h。完赛动作(监视 `~/sema-tb/m2-cert-1259.status` 里 `===M2-CERT-DONE===`):判 M2(≥54)→ 翻转表 vs 50 → 单题点名 → scp `bench/tb-matrix/m2-cert-1259.json` → **ledger 轮 10** → 若达 54 做中期汇报 + 给 service 正式滚版单。
59
-
60
- **2. 并发上限标定(L12/L24,在跑)**:job `conc12-1259-fb`/`conc24-1259-fb`,稳定集 8 题×k=2,status `~/sema-tb/conc-ladder-1259.status`(尾标记 `===CONC-LADDER-DONE===`)。判据:≥14/16=该档可判决用。单 key 塌→提多 key 分摊方案。
61
-
62
- **3. 归因双靶(快环,M2 后或并行)**:① **password-recovery**(0/3 稳定死,轮 8「方差回摆」先验被推翻,升头号靶——双轨迹 opus 归因:sema FAIL vs CC PASS)② **mteb-leaderboard vs retrieve 死因分叉**(retrieve 判据修有信号 leaderboard 0/5,两题不同源)。
63
-
64
- **4. 慢环债**:task #51(task-reminder 三小口径:复位面收窄+同轮去重+mode kill-switch,考据已完待落码走宪法两闸);G3 fork prompt-cache(另立 design);nudgeIdx 不变量单测;charsPerToken per-model 校准;R9 trace 帧。
65
-
66
- **5. 外部通道态**:黑板 [541](service consume 已实解,无欠账);团队通道最新=我方 [416] 已发,等 service 回;[413]-3 VIP 抖动分布攒够回帖。
67
-
68
- **6. K8S**:用法(b) adapter 债(低优先,判决不搬家);滚版单等 M2。
69
-
70
- **goal 判据**:达 M2(≥54)做中期汇报;未达=翻转表喂归因。RSI 不停转。
71
-
72
- **详账入口**:`docs/TB-RSI-LEDGER.md`(轮 0-9)、`design/139-tb-engineering-rsi-loop.md`、记忆 `MEMORY.md`(状态行+纪律)、本档同目录各考据档。
@@ -1,114 +0,0 @@
1
- # 压缩链路活体行为验尸(A1 腿,2026-07-09)
2
-
3
- > 性质:**活体轨迹逐机制验尸**(非设计对比 — 那个是 `bench/cc-parity-toolsuite/compaction-cc198-verbatim-capture-2026-07-08.md`)。
4
- > 拿 A1 腿真实发生 6–8 次压缩的活体事件流,对着 src 实现 + CC 198 逐字锚逐项核。
5
- >
6
- > **活体源**(海外机 `ubuntu@91.199.82.197`):`~/sema-tb/jobs/a1-ccdiff-1258-fb/long/*/agent/events.jsonl`
7
- > - `circuit-fibsqrt__E6mDcdG`(115,563 行,**7 次压缩**,34 Read/18 Edit)= 主验尸对象
8
- > - `path-tracing__fEafvLr`(**8 次压缩**)· `path-tracing-reverse__7hCGBZA`(**6 次压缩**)= 交叉核
9
- > - 模型 `deepseek/deepseek-v4-pro`,`contextWindow=64000`,`maxTurns=120`(`config.json` + `sema-tb.ts:115`)
10
- >
11
- > **版本纪律**:A1 腿 pin core=**1.258.2**;本地 main=**1.258.3**(#54 COMPACTABLE 白名单修 + W1 提示词 9 段对齐批已发)。凡 1.258.3 已修的行为一律标「1.258.3 已修」,不计新 BUG。
12
- >
13
- > **活体证据的固有盲区**:events.jsonl / sema.txt **不携带压缩摘要正文**(只有 `compacted` 元数据事件 + reason/tool 渲染;摘要正文在 session store 内,不上 wire、不进 transcript 渲染)。故「摘要 9 段质量」只能**由压缩后行为间接推断**(item 2),无法直读摘要文本。
14
-
15
- ---
16
-
17
- ## 判定摘要
18
-
19
- - **OK 8 项** · **BUG 0 项** · **DIVERGENCE 3 项**(其中 1 项=最大发现) · **观察/QoL 2 项**
20
- - 触发阈值几何、attachment 机制、双断路器、失败面结构、prompt 结构(1.258.3)全部与实现一致、与 CC 同族。
21
- - **最大发现(DIVERGENCE-1,压缩税直接来源)**:活体里 7 次压缩中 **3 次是 `forceUnderThreshold`(trim-pressure)在被 trim 层欺骗的 ~12k–21k 估算下强制触发,压缩后 token 反而变大**(before=18807→after=44609;before=12679→after=35214)。这是 src 注释里逐字预言的「deceived-estimate 锯齿 / 16k-live sawtooth」在活体首次坐实——**压缩不是在省 token,是在被请求层 trim 拖着空转 + 每次贴 summary+attachment 反而涨**。CC 全量 compact 保尾 0 恒缩,不会出现「压完更大」。
22
-
23
- ---
24
-
25
- ## 逐项判定表
26
-
27
- | # | 机制 | 活体证据 | sema 实现坐标 | CC 198 锚 | 判定 |
28
- |---|---|---|---|---|---|
29
- | 1 | 触发阈值几何 | 自然触发 `tokensBefore` 集中在 **45k–65k**(三腿一致:56/72/74/78k;48/51/57/58/52/58k;49/45/51/52/60/65k) | `auto-compaction.ts:60-83` sanitize:64000×0.7=44800=editAt,reserve 16384→阈值 47616 > 44800 → reserve 上浮到 19200,**阈值 clamp 到 44800** | `capture §A3a`:effW=W−min(out,20k),fire at effW−13000。CC 大窗 reserve≈33k(更早触发) | **OK**(阈值≈44800 与活体自然触发下界严丝合缝;数值面 vs CC 见 D-2) |
30
- | 2 | 摘要质量(丢状态) | 无法直读摘要文本(盲区)。**间接**:post-compact 32 次 Read 中 28 次重读 attachment 已恢复的文件 | `compaction.ts:557-604` 9 段 prompt(1.258.2 为 8 段) | `capture §A1a` 9 段 | **OK(间接)** — 见 DIVERGENCE-2:重读主因是 attachment 截断 + 自改文件失效,**非**摘要丢状态;稳定参考文件(sim.c/gates.txt)重读少 |
31
- | 3 | 压缩后重组装 | `compacted` 事件带 `preserved_segment.firstKeptEntryId`(keep-tail 存活),`tokensAfter` 稳定落 keepRecent 附近 | `auto-compaction.ts:570-599` appendCompaction + keep-tail | `capture §A2b/A4`:CC full compact **保尾 0**+attachments 重建;sema keep-tail 20k | **OK(有意偏离)** — keep-tail 是 sema 保真超集(capture C11);注入帽措辞 1.258.3 已向 CC 靠(C7/C8) |
32
- | 4 | attachment / 工作文件 | **全 7 次压缩均带 `attachedFiles`**(gen_gates.py/gates.txt/sim.c),默认 ON | `runtask.ts:2594-2605` attachWorkingFiles≠false 默认开;`recentlyReadFiles` 选读集优先 | `capture §A2c`:CC `D$n` 前 5 文件×5k tok/50k tok 总帽 | **OK** — 记忆「1.98.0 默认关」已被 blackboard 2026-07-03 改判**默认 ON**(runtask 注释坐实);数值面 3×16k chars vs CC 5×5k tok 见 D-3 |
33
- | 5 | microcompact vs full | 活体只见 `compacted`(full)事件;无独立 micro 事件 | `context-edit.ts:19` EDIT_FRACTION=0.7 `clearStaleToolResults`(=CC microCompact.ts 白名单同族);full=`maybeCompact` | `capture §A6/A20`:CC micro=server-driven `context_hint` beta(Anthropic 专有)保最近 5 工具结果 | **OK(有意偏离)** — sema 有本地 micro 同族(clearStale 0.7W),CC micro 触发面=provider 专有 beta 不接。**但 64k 窗下阈值 clamp 到 0.7W=editAt**,故 full compact 恒在 clearStale 前先开火 → 实际 clearStale 几乎不生效(设计如此:summarize-then-never-clear beats clear-then-summarize,`auto-compaction.ts:51-57`) |
34
- | 6 | 压缩调用成本 | `durationMs`:**9.5s–63.6s**(circuit:17/19/37/45/46/37/38s;path-tracing 最高 63.6s) | 单 LLM summary call(`compactionModel`,同 deepseek-v4-pro) | `capture §A3c`:CC `maxTurns:1,skipCacheWrite`;有 precompute 后台预压(C25 不采) | **DIVERGENCE-3(成本)** — 每次压缩 10–60s 纯挂起,7 次≈4–5 分钟纯压缩税;CC 有 precompute 后台预压秒换,sema 无(记档不排期) |
35
- | 7a | rapid-refill 断路器 | 未见 trip(活体压缩间隔 >3 turns) | `auto-compaction.ts:706-719` `recordCompactionAndCheckRapidRefill(3,3)` | `capture §A3b`:<3 turns×3 次 trip | **OK(逐字一致)** |
36
- | 7b | 连续失败断路器 | 未见触发(无 compaction 失败) | `runtask.ts:101` MAX=3 | `capture §A3b`:QNl=3 | **OK(逐字一致)** |
37
- | 7c | 空/超尺寸摘要 throw | 未触发 | `auto-compaction.ts:490-510` empty/oversized(1.5×)throw | `capture §A5`:CC throw hW | **OK** |
38
- | 7d | PTL reactive 重试(C16) | 无 `compaction.input_truncated` 帧(未触发;64k 窗下摘要输入未超压缩模型窗) | `compaction.ts:770-977` `summarizeWithPtlRetry` KNl 组回退+gap-guided+marker | `capture §A5/C16`:CC VNl=3,`[earlier conversation truncated for compaction retry]` | **OK** — port 完整,活体未压到该路径 |
39
- | 7e | image/大 attachment | circuit 无 image;attachment 按 char 截断,`truncated:true` 逐次披露 | `estimateTokens` image pin 2000;attachment perFileCap 16000 chars | `capture §A6/C19`:2000/image | **OK** |
40
- | 7f | todo 状态保留 | `todo` 事件在压缩后仍出现,未见丢失 | keep-tail 保尾 | `capture §A2c M$n`:CC 单独恢复 todo 卡 | **OK(结构性)** — sema keep-tail 天然保住近期 todo;无 CC 型独立 todo 恢复卡(不需要) |
41
-
42
- ---
43
-
44
- ## DIVERGENCE 清单(带证据坐标 + CC 锚)
45
-
46
- ### DIVERGENCE-1 【最大发现 · 压缩税直接来源】trim-pressure 强制压缩在被欺骗估算下「压完更大」
47
-
48
- **活体证据**(`circuit-fibsqrt__E6mDcdG/agent/events.jsonl`,`path-tracing__fEafvLr`):
49
-
50
- | 压缩# | tokensBefore | tokensAfter | 增减 |
51
- |---|---|---|---|
52
- | circuit #2 (L31242) | **18807** | 44609 | **+25802 涨** |
53
- | circuit #5 (L76787) | 31935 | 45594 | +13659 涨 |
54
- | circuit #7 (L99953) | **21831** | 41300 | +19469 涨 |
55
- | path-tracing #6 | **12679** | 35214 | **+22535 涨** |
56
- | path-tracing #8 | 28215 | 41801 | +13586 涨 |
57
-
58
- 前置 `turn_end` 轨迹(circuit L838923–947352)显示 `inputTokens` 在 **~52–58k(全 session)↔ ~17–20k(被 trim 的请求)** 之间**锯齿**震荡 → 请求层在 trim,`estimateContextTokens` 锚在被 trim 后的小 usage 上 → 估算跌到 18807(远低阈值)→ `trimPressureRef.droppedMessages` 触发 `forceUnderThreshold` → 强制压缩。但此时可压的历史很少,贴上 summary(+ 3 文件 attachment ~25k chars)后 **总量反而涨到 44609**。
59
-
60
- **sema 坐标**:`runtask.ts:2556-2567`(trim-pressure 判定)→ `2590 forceUnderThreshold: trimPressure` → `auto-compaction.ts:343 force = forceUnderThreshold && !naturalTrigger`。这是 design/123 D4 逐字预言的两个 regime(`auto-compaction.ts:116-131` 注释:「deceived-estimate 锯齿」+「floor-blocked」)。spiral 保护=`nextTrimForceBackoff`(`2634`):一次 landed 压缩 `postOverThreshold` 就关掉 force。
61
-
62
- **CC 锚**(`capture §A4`):CC full compact **保尾 messagesToKeep:[]=0**,续接=summary+attachments,故**恒缩**;不存在「压完更大」。CC 无 trim-force 概念(CC 请求层不 trim,直接压)。
63
-
64
- **判定**:**DIVERGENCE(机制性,非 BUG)**。这是 sema 特有的「请求层 trim + keep-tail 压缩」两套机制的交互产物。backoff 已在兜底(防无限空转),但**单次「压完更大」的 trim-force 压缩是纯负收益**:花 10–47s 做一次 summary call,结果 token 涨了。这直接就是 circuit 34 次 Read 里压缩后重读的部分成本来源。
65
-
66
- **修复建议**(见 D-1,最高优先级)。
67
-
68
- ### DIVERGENCE-2 attachment 截断导致「自改文件」压缩后必重读
69
-
70
- **活体证据**:全 7 次压缩 `attachedFiles` 里 `gen_gates.py` **每次都 `"truncated":true`(截到 16000 chars)**。而 gen_gates.py 是模型**自己反复改**的文件(18 Edit + Write);Read 结果 char 数在 1k–21.6k 抖动(部分 `truncated:true`=真实 >20k)。28/32 post-compact Read 命中「attachment 已恢复的文件」,但其中大多是 **gen_gates.py 被 attach 的是过期截断快照**(edit 后立刻失效),模型必须重读拿全/新内容。稳定参考文件(sim.c/gates.txt,未被改动)重读次数明显少。
71
-
72
- **sema 坐标**:`auto-compaction.ts:531-555`,`maxCharsPerFile` 默认 16000 chars(≈4k tok),总帽 15% 窗。gen_gates.py 真实 >16k → 每次截断。
73
-
74
- **CC 锚**(`capture §A2c/C12`):CC `D$n` 每文件上限 5000 tok(≈20k chars),**总预算 50000 tok**,前 5 文件。CC 单文件帽比 sema 高(20k vs 16k chars),但同样会截超大文件。
75
-
76
- **判定**:**DIVERGENCE(数值面)**。attachment 对稳定参考文件(sim.c/gates.txt)有效省读;对模型自改的大文件(gen_gates.py)恒截断+恒失效,attach 反成负担(占 16000 chars 预算却仍触发重读)。**非丢状态、非摘要质量问题** — 摘要机制本身健康。
77
-
78
- ### DIVERGENCE-3 无 precompute 后台预压 → 每次压缩 10–60s 纯挂起
79
-
80
- **活体证据**:`durationMs` 9.5s–63.6s;单腿 6–8 次 ⇒ 每题 ~1.5–5 分钟纯压缩挂起。
81
- **CC 锚**(`capture §A3c/C25`):CC 接近 precompute 线时后台先算 summary,PTL 时秒换。
82
- **判定**:**DIVERGENCE(有意偏离,记档不排期)** — capture C25 已判「收益=交互延迟;自治任务面已有 forced-compaction 恢复链」。自治 headless 场景延迟不敏感,但 TB 计时腿这是真实 wall-time 税。
83
-
84
- ---
85
-
86
- ## 修复建议排序(哪些修了能直接减压缩税)
87
-
88
- ### D-1 【P1,直接减税】给 trim-force 压缩加「负收益短路」
89
- **问题**:DIVERGENCE-1,trim-force 在 <阈值估算下强制压缩,`postTriggerTokens > tokensBefore`(压完更大)= 纯负收益,却花 10–47s。
90
- **建议**:`nextTrimForceBackoff` 已在**一次** landed `postOverThreshold` 后关 force,但它看的是「post 是否超阈值」;这里 post=44609 **不超阈值 44800**,所以 backoff **不触发**,下次 trim-force 又开火 → 反复「压完更大」。加一个正交判据:**trim-force 落地后若 `freedTokens ≤ 0`(或 postTriggerTokens ≥ triggerTokens),本次就是负收益,当次即置 backoff**,不必等 postOverThreshold。`maybeCompact` 已返回 `freedTokens/postTriggerTokens`,caller 侧一个 if 即可。**收益:直接砍掉活体里 3/7 的负收益压缩(circuit)+ 2/8(path-tracing),每次省 10–47s + 省一次 summary call 成本。**
91
-
92
- ### D-2 【P2,数值对照】default reserve 触发点 vs CC(capture C13/W3 已挂账)
93
- 64k 窗下 sema sanitize 后阈值=44800(0.7W);CC effW−13000。此腿阈值行为健康(自然触发 45–65k 合理),**但小窗下 0.7W clamp 让 clearStale(micro)几乎失效**(item 5)。建议出 agent-probe 对照:64k 窗下 sema 是否比 CC 系统性早/晚触发。**不盲改常量**(capture W3 纪律)。
94
-
95
- ### D-3 【P2,减重读】attachment 对「自改中的大文件」的策略(DIVERGENCE-2)
96
- 选项(a):`maxCharsPerFile` 16000→20000(对齐 CC 5000 tok≈20k chars),减少稳定大文件的截断重读;选项(b,更准):attach 时若文件在被 summarize 区间内**有 Edit/Write**(details.modifiedFiles 有它),**不 attach 截断快照**(必失效),把预算让给稳定参考文件。**收益:减少 circuit gen_gates.py 类「attach 了截断版仍重读」的双重浪费。** 需过 LONGRUN 复跑(capture C12)。
97
-
98
- ### D-4 【P3,记档不排期】precompute 后台预压(DIVERGENCE-3)= capture C25,自治场景延迟不敏感,TB 计时腿才有感;不入排期。
99
-
100
- ---
101
-
102
- ## 结论
103
-
104
- **压缩链路核心机制在活体里全部正常生效、与 CC 同族**:阈值几何严丝合缝(44800≈自然触发下界)、attachment 默认 ON 且全程带回文件、keep-tail 保尾存活、双断路器与失败面 port 完整、1.258.3 prompt 已 9 段 CC-verbatim。**0 个真 BUG**。
105
-
106
- 三条 DIVERGENCE 全是 sema 特有机制(请求层 trim + keep-tail + provider-neutral)的交互产物,非缺陷:
107
- - **DIVERGENCE-1(最大)**:trim-force 在被欺骗估算下的负收益压缩(压完更大),是压缩税的直接可修来源 → **D-1 一个 if 可砍掉**。
108
- - DIVERGENCE-2:attachment 对自改大文件恒截断失效 → D-3 可优化。
109
- - DIVERGENCE-3:无后台预压,10–60s/次挂起 → 有意偏离,记档。
110
-
111
- **「压完重读重推导」的真相**:不是摘要丢状态(摘要机制健康),而是 (a) attachment 带回的是**截断/过期**的自改文件快照,(b) trim-force 负收益压缩本身在空转。修 D-1+D-3 能直接减 circuit 类题的压缩税。
112
-
113
- ---
114
- *验尸完成 2026-07-09。活体坐标均可回查 events.jsonl 行号;摘要正文盲区已标注(需未来挂 session-store dump 探针才能直读摘要 9 段质量)。*
@@ -1,71 +0,0 @@
1
- # 上下文:生命周期扩展点扩展 + 子代理停止归因(黑板 [475]/[476],[477] 另档)
2
-
3
- > 用途:交接上下文,供后续 AI 验收/实现。**这不是设计文档**——只陈述已核实的现状与飞轮/service 的请求,不含方案。所有代码坐标已对当前工作树核实(2026-07-07,core 1.251.0 发版后)。
4
- > 术语:本文用「生命周期扩展点 / 回调接入点」指代 core 的 `Hooks` 机制;代码标识符(`Hooks`、`hooks.ts` 等)保留原形。
5
-
6
- ## 一、来源(黑板三条,均标注「非紧急/随批排」,非 1.251.0 回归)
7
-
8
- - **[475](飞轮 → core + service)**:core 回调接入点实况审计。飞轮亲核 core 编译产物,给出「4 现成 + 4 待扩展」的判定 + owner 标注要求。
9
- - **[476](飞轮 → service + core)**:子代理停止归因,对标 CC「was stopped by Claude/user」。service 已 ack,判定真前置在 core。
10
- - **[477](飞轮 → core)**:Qwen budget-ignoring 思考吃满 static max_tokens → fail-loud。core 已在 [479] 认领,**属另一主题(reasoning 截断恢复),单独排,不在本文范围**。
11
-
12
- ## 二、core 生命周期扩展点现状(已核实)
13
-
14
- 文件:`src/core/hooks.ts`(接口 `Hooks`)+ `src/core/types.ts:711 / :2171`(`TaskSpec.hooks` / `RunnerDeps.hooks` 挂载点)。
15
-
16
- ### 已存在的 4 个接入点(`src/core/hooks.ts`)
17
- | 接入点 | 行 | 现有能力 |
18
- |---|---|---|
19
- | `preToolUse` | :22 | 工具执行前;可 rewrite args(`allow` + updatedInput)或 allow/deny/ask |
20
- | `postToolUse` | :27 | 工具执行后;可替换 result content / 追加 context |
21
- | `userPromptSubmit` | :33 | objective 成为 user message 前;可 `block` |
22
- | `stop` | :46 | 运行自然结束点;可 `block` 推回继续。CC 198 Stop 对标:`StopHookContext.stopHookActive`(:53,已在续跑标记)+ `consecutiveBlocks`(:55)+ 连续 block 上限默认 8(:41 注释,超限放行并告警)+ additionalContext 注入(:64,CC 2.1.201 :472050-472077 对标) |
23
-
24
- ### 飞轮判定 core 缺的 4 个引擎侧接入点(`hooks.ts` 当前零提及)
25
- - `postToolUseFailure` —— 工具执行失败后
26
- - `postToolBatch` —— 一批工具执行后
27
- - `preCompact` —— 压缩前
28
- - `postCompact` —— 压缩后
29
-
30
- 压缩发生在引擎侧,入口 `src/engine/compaction/compaction.ts`(`maybeCompact` 等);`hooks.ts` 目前不涉及压缩点,故 preCompact/postCompact 需在压缩路径新开回调点。飞轮明确这 4 个是 core 半场。
31
-
32
- ### placement 修正([475],飞轮更正 [474] 自己的划分)
33
- - `stop` / `userPromptSubmit` 归**引擎侧**(core 已实现;run-end 判定只有引擎知道)。
34
- - 壳半场相应减为约 17 个纯 UI/生命周期事件(壳自做,不阻塞 core)。
35
- - 契约要求:registry-core 出 27 事件全集 schema,**每事件标 owner(engine|shell)**;双端可触发的事件(如 UserPromptSubmit 壳也能在发送前拦)定去重规则——飞轮建议 owner 单一制,壳不重复触发 engine-owned 事件。
36
- - 分期口径:wire 字段/schema **首版即全集**,service runner 实现分期(首期工具链 4 + 压缩 2);后续加事件=纯实现不动契约。
37
-
38
- ## 三、子代理停止归因现状([476],已核实)
39
-
40
- ### 请求内容
41
- CC 198 语义:停止原因 → 文案。`reason=parent`→"was stopped by Claude" / `user`→"was stopped by user" / 缺省→"was stopped"。飞轮要让壳能渲染同款文案,前提是 wire 带来源。
42
-
43
- ### core 现状
44
- - settle 入口:`src/core/task-registry.ts:360` `settleBackgroundAgent(id, outcome)`,`outcome.status` 当前枚举 = `"completed" | "failed" | "killed"`,**无发起源字段**。
45
- - 语义:first-writer-wins(:363,codex 1.237 F3/F4);session 释放路径以 `status:"killed"` settle(:402)。
46
- - 结论:当前 settle 只携带终态状态,**不区分「谁停的」**(壳发起 cancel / 引擎内父 agent 停子任务 / 超时 / 自然终)。
47
-
48
- ### service 侧判定(黑板 [476] 回执)
49
- - cancel 动词 wire 面(可选 `source: "user"|"parent"|"system"`,缺省 user)+ 事件回带 = service 半场直做。
50
- - **但「引擎内父 agent 主动停子任务 = parent」的发起源判定在 core**:service 只见 settle,分不出父停/超时/自然终。
51
- - service 建议:core 在 settle 事件带 stop 发起源;`stoppedBy` 枚举与 registry-core 的 hooks 27 事件全集 schema **同一契约窗口**出,省一轮跨仓对齐。
52
-
53
- ## 四、两条的耦合点(客观,非方案)
54
-
55
- - registry-core schema 是 **[475] 的 27 事件全集** 与 **[476] 的 `stoppedBy` 枚举** 的共同落点——两者都要过 registry-core 契约窗口。
56
- - [475] 的 preCompact/postCompact 与 [476] 的 settle 发起源都在引擎侧,是 core 的实现半场。
57
- - service 侧:[475] hook-runner(config→回调翻译+单用户闸)已 ack 排期;[476] cancel wire 面已 ack。两者都等 core 侧契约/字段先落。
58
-
59
- ## 五、待验收/待定项(交接给后续 AI)
60
-
61
- 1. core 4 个新接入点(postToolUseFailure/postToolBatch/preCompact/postCompact)的排期与实现半场边界确认。
62
- 2. settle 发起源字段:`settleBackgroundAgent` 的 outcome 是否扩 `source`,以及引擎内父 agent 停子任务路径如何标 `parent`(核实所有 settle 调用点的发起语境)。
63
- 3. registry-core schema 的契约窗口时机(飞轮/service 都建议 27 事件 + `stoppedBy` 同批出)——需与 registry-core 维护方对齐。
64
- 4. owner 标注与双端去重规则(engine|shell)的 schema 表达。
65
-
66
- ## 引用坐标速查
67
- - `src/core/hooks.ts`:22/27/33/46(4 接入点)、:41/:53/:55/:64(stop 守卫)
68
- - `src/core/types.ts`:711 / :2171(挂载点)
69
- - `src/core/task-registry.ts`:360(settleBackgroundAgent)、:363(first-writer-wins)、:402(release→killed)
70
- - `src/engine/compaction/compaction.ts`(压缩入口,preCompact/postCompact 落点)
71
- - 黑板:NEIGHBOR-REQUESTS.md [475]/[476]/[477](sema-cc-parity 仓)
@@ -1,85 +0,0 @@
1
- # CC-diff 死因初筛:winning-avg-corewars & polyglot-rust-c(2026-07-09)
2
-
3
- 归因初筛腿(证据收集,单轨迹初筛,N=1,置信度已标注)。数据源:海外测试机 `91.199.82.197`。
4
- - sema FAIL:`~/sema-tb/jobs/m1-cert-12586-fb/full89/{题}__*/`(cert 12586-fb,deepseek-v4-pro)
5
- - CC PASS:`~/sema-tb/jobs/cc-pro-r3-full/{题}__*/`(同模型 deepseek-v4-pro,CC 壳)
6
-
7
- **两题共同点**:模型相同(deepseek-v4-pro),差异全在**壳/预算/策略**面 → 排除"模型不同"变量。两题都指向**模型策略/搜索质量**主因,均非引擎机制 bug,但 corewars 掺预算(turn)口径。
8
-
9
- ---
10
-
11
- ## 题1:winning-avg-corewars
12
-
13
- ### ① 验收面(test 判什么)
14
- `test_warrior_performance`:用 `pmars -b -r 100 -f my_warrior.red warriors/<opp>.red` 跑 100 局,取胜局数。
15
- - 硬门:vs stone/vampire/paper ≥ 75 胜;vs snake/g2-clear ≥ 33 胜。
16
- - **5 门全过才 PASS**(单题 all-or-nothing)。这是一道**开放式对抗程序优化**题——没有唯一解,需搜出稳健 warrior 架构。
17
-
18
- ### ② sema 死法(轨迹证据)
19
- - done.stats:`status=completed turns=70 tokens=5.71M cost$1.62 cacheHit=0.969 mech=finalize+nudges:1+capShrinks:1+finalVerify`。**非 timeout 状态但实为墙钟逼停**。
20
- - 终局判分:stone **63**/vampire **73**/paper 81/snake **12**/g2-clear 44 → **3/5**(stone 差 12、vampire 差 2、snake 差 21)。
21
- - 墙钟压力铁证:`timeoutSec=3600`。t=2918s 收到 `source=deadline_nudge`("~12 min 剩,开始收敛");t=3399s 收到 `source=finalize`("墙钟耗尽,FINAL turn,写出最佳当前工作")。t=3427s 被迫写 v14 定稿。**sema 不是自由放弃,是墙钟到点被 finalize 强制交卷**(turn 70/120,turn 预算没用完,墙钟用完了)。
22
- - 关键决策死点(t=2434s):sema **实测了纯 imp** → "16 imp rings 得 0 wins vs stone!Pure imps fail" → 由此**关闭了 imp 主干分支**,转去 vampire+bomber+imp 混合,反复振荡 14 个版本(v1~v14)никогда 落到能过 stone 的架构。轨迹多处自陈"I've been deliberating too long"(t=968s 等)——**搜索发散、决策拖延**。
23
- - 迭代低效:70 turn 里大量长篇 reasoning 手推 pMARS 调度/覆盖概率(t=1091 手算 stone 命中率、t=1710 手推进程调度),烧墙钟在纸上推演而非快速试跑。
24
-
25
- ### ③ CC 对照(同决策点差异)
26
- - CC:`num_turns=122 duration_ms=2402008(40min) cost$8.44` → **PASS 5/5**:stone **78**/vampire 80/paper 79/snake **48**/g2-clear **50**,全部**稳健过线**(非擦边)。
27
- - CC 最终 warrior:**"Pure imp spiral — 10 imps at evenly spaced positions"**(纯 imp 螺旋,10 个均匀分布 imp)。
28
- - **决定性差异**:同一个"纯 imp"方向,sema 实测 0 胜 vs stone 判死、CC 实现却 78 胜 vs stone。说明 CC 的 imp **spiral 步长/间距/spl 展开**实现正确,而 sema 的 imp 实现是错的/mis-tuned,从一次坏实验里推出了错误结论("pure imps fail"),**过早剪掉了唯一能过的分支**。
29
- - 预算:CC 用 122 turn / 40min 就赢;sema 用 70 turn / 60min 墙钟满还没赢。**CC 更快且更好**——不是预算不够,是搜索质量/收敛效率差。CC 单价高(高 turn 数×高单 turn 成本),但那是"愿意多试跑少空想"的表现。
30
- - 注:`corewar.co.uk` 引用是**对手文件头注释**(`;source https://corewar.co.uk/snake.htm`),两边都读到,CC 未额外 web_search(polyglot result.json 的 web_search_requests 字段为壳累计计数器,不可作 CC 用了外部知识的证据)。
31
-
32
- ### ④ 死因假设排序(置信度)
33
- 1. **模型搜索质量/收敛效率(高置信 ~70%)**:同模型下,CC 的 imp-spiral 实现对、sema 实现错并误剪分支。sema 发散振荡 14 版、大量空想手推烧墙钟。这是**策略+实现质量**问题,非引擎。
34
- 2. **turn/迭代节奏——引擎面弱相关(中置信 ~20%)**:sema 每 turn 花大量 output 手推(单版 v4 out=37677 tokens),试跑密度低;CC 用 2x turn 数、更碎更快的试-验循环。若 sema 有更强的"少想多跑"倾向(或 prompt 鼓励快速经验试跑),同墙钟内能多探几个架构。**这条是唯一可能的 prompt/引擎修向**,但根子仍是模型行为。
35
- 3. **墙钟预算口径(低置信 ~10%,已排除为主因)**:sema 60min 满、CC 40min 赢,**给 sema 更多墙钟不一定能救**(它剪错了分支,方向都错了)。轮 7 曾疑"口径税"N=5=0/5 已否;本轮复核确认**非墙钟税**。
36
- 4. **方差(低,~5%)**:pMARS 100 局本身抽样方差小(judge 确定性),warrior 架构差异是结构性的(78 vs 0 不可能是方差)。单轨迹但结论稳。
37
-
38
- ### ⑤ 修向候选
39
- - **主向=模型面,非引擎**。这题坐实为 deepseek-v4-pro 在开放对抗优化上的**搜索质量天花板**(误剪正确分支 + 空想过多)。**明说:主因是模型策略/实现质量,给引擎/prompt 打补丁救不回**。
40
- - **次向(可试,弱)**:prompt 面鼓励"经验试跑优先于理论推演"(减少长 reasoning 空转、提高单位墙钟试跑次数)。CC 锚:CC 的高 turn / 碎试跑风格。但预期收益低(N=1 不能证)。
41
- - **不建议**:加墙钟预算(已证非税);此题不指向任何引擎机制 bug。
42
- - **坐实需**:N≥3 复跑看 sema 是否稳定剪掉 imp 分支(若稳定=模型系统性弱点;若偶尔剪对并 PASS=高方差,那才转方差归因)。与在飞的 siege-a N=3 腿正交,建议 corewars 也排一次 N=3。
43
-
44
- ---
45
-
46
- ## 题2:polyglot-rust-c
47
-
48
- ### ① 验收面(test 判什么)
49
- `test_fibonacci_polyglot` 两道硬门:
50
- 1. **`os.listdir("/app/polyglot") == ["main.rs"]`** —— 目录**只能有 main.rs 一个文件**(编译产物 `cmain`/`main` 必须清掉)。
51
- 2. main.rs 是合法 polyglot:`rustc main.rs` 与 `g++ -x c++ main.rs` 都能编出,且都正确打印第 k 个 Fibonacci(f0=1,f1=1)。
52
-
53
- ### ② sema 死法(轨迹证据)
54
- - done.stats:`status=timeout turns=11 tokens=358282 promptTokens=313388 cost$0.107 mech=finalize+capShrinks:1+callCutoffs:1+toolClamps:4 errorCode=limit.timeout`。**墙钟 cutoff**(t=895s,"walltime cutoff: 越过软墙钟 deadline,截断以保写出窗口")。
55
- - 直接失败断言:`AssertionError: Expected only main.rs, found: ['cmain', 'main.rs']`。
56
- - 但这只是**表层**。轨迹显示 sema 到超时那刻**根本没解出 polyglot**:t=875s 最后一次 rustc 编译 `exit=1`(Rust `fn main()` not found),C++ 侧 OK 但 Rust 侧一直编不过。sema 卡在**难解法**上——用 `/*` 开头 + `// */` 双层嵌套注释,一直在手推为什么 Rust 的 `main` 还在注释里(t=878~891s 大段逐行数注释层级),超时前正准备再试一个变体。
57
- - **两重独立失败**:(a) 到点没解出正确 polyglot(Rust 侧编不过);(b) 即便解出,`cmain` 编译产物没清 → listdir 断言也会挂。sema 连 (a) 都没到,(b) 是顺带的。
58
-
59
- ### ③ CC 对照(同决策点差异)
60
- - CC:`num_turns=24 duration_ms=786665(约13min) cost$2.30` → PASS。
61
- - CC 用了**更简单更稳的 polyglot 解法**:
62
- - Rust 对 C++ 隐藏:用 `//...\`(行尾反斜杠续行)——C++ 在翻译阶段2把物理行拼成一逻辑行(在注释处理之前),整段 Rust 变成 C++ 的一个 `//` 大注释;Rust 里 `\` 在 `//` 行注释内无害。
63
- - C++ 对 Rust 隐藏:`/* /* */` 嵌套块注释(Rust 支持嵌套、C++ 不支持)。
64
- - **决定性收尾差异**:CC 在最后**显式清理产物**——`rm -f /app/polyglot/main /app/polyglot/cmain /tmp/test_* ...`("Clean up compiled binaries and temp files"),这正是让 `listdir==["main.rs"]` 过关的动作。sema 因为超时,连收尾清理都没到。
65
- - 预算:CC 787s(13min)PASS,sema 895s(约15min,更长墙钟)被 cutoff。**又是 sema 墙钟更多却更慢** → 差异在解法选择效率,不在预算。sema 选了双嵌套 `/*`+`//*/` 这条更绕、更易翻车的路,反复调试;CC 选了续行+嵌套注释的经典稳解。
66
-
67
- ### ④ 死因假设排序(置信度)
68
- 1. **模型解法选择/收敛效率(高置信 ~65%)**:同模型,CC 选对了经典稳解并一次成、sema 选了易错解法陷在调试里。这是模型**知识/策略**差(polyglot 是有已知经典配方的技巧题,CC 走到了配方、sema 在造轮子)。
69
- 2. **墙钟 timeout——引擎收尾窗口(中置信 ~25%)**:sema 被墙钟 cutoff 在"还没解出"的点。**若解法效率一样,墙钟不是问题**(CC 更短);但 sema 恰好卡在难解法上,墙钟就成了压死的最后一根。这条把主因(策略)和触发(墙钟)耦合在一起。
70
- 3. **收尾清理契约缺失(低-中,~10%,但是可修的引擎/prompt 面)**:即使 sema 解出了 polyglot,它**没有"清理编译产物再交卷"的习惯**;CC 有。这暴露一个**通用弱点**:sema 在"目录洁净度"类隐性验收上不如 CC。虽然本次不是直接死因(polyglot 没解出),但这是**跨题会复发**的类问题(任何"只留 X 文件"的验收)。
71
- 4. **方差(低,~5%)**:polyglot 是确定性技巧题,解法对就稳过;非采样方差。轮 7 "口径税候选 N=5=0/5"已证非墙钟税——本轮复核确认:**根子是解法效率,墙钟只是耦合触发**。
72
-
73
- ### ⑤ 修向候选
74
- - **主向=模型面**:polyglot 解法选择是模型知识/策略问题,引擎救不了核心。**明说:主因是模型选了低效解法**。
75
- - **次向(可修,引擎/prompt 面,跨题收益)**:**收尾洁净度契约**。sema 缺"交卷前清理临时/编译产物、只留要求的 deliverable"的收尾纪律。这是**类问题**(sweep-the-class):任何"目录只允许含 X"的验收都会踩。
76
- - **CC 锚线索**:CC 轨迹里明确有 `rm -f .../cmain .../main /tmp/test_*` 的收尾清理步。可查 CC 198 是否在 finalize/收尾指令帧里有"clean up build artifacts / leave only the requested deliverable"类措辞,对照 sema 的 finalize 注入文案(sema 现有 finalize 只说"写出最佳工作",没说"清理干净")。若 CC 有此帧而 sema 无 → 可在 sema 收尾指令帧补一句"删除中间产物/临时文件,只保留要求的交付物"。这条**可测、跨题、低风险**,值得进小修批。
77
- - **不建议**:加墙钟预算(CC 更短就赢,非税)。
78
- - **坐实需**:(a) N≥3 复跑看 sema 是否稳定卡在难解法(若偶尔选对稳解→高方差);(b) 独立核 CC 198 收尾帧是否含"清理产物"措辞(定 §⑤次向是否有 CC 锚支撑);(c) 造一道最小 harness 题("生成 X 并保证目录只剩 X")验 sema 收尾清理率。
79
-
80
- ---
81
-
82
- ## 两题横向小结
83
- - **共因**:同模型(deepseek-v4-pro)下,CC 用**更少墙钟**赢、sema 用**更多墙钟**输 → 两题都**排除墙钟预算税**(否定轮 7 口径税假设,复核落定)。差异在**解法/架构选择质量**与**收敛效率**,主因落**模型面**。
84
- - **唯一引擎/prompt 可修点**:polyglot 暴露的**收尾洁净度契约缺失**(留 cmain)——跨题类问题,有潜在 CC 锚(收尾清理帧),建议进小修批 + 核 198 坐实。corewars 无引擎可修点,纯模型天花板。
85
- - **纪律标注**:均 N=1 初筛,结构性差异(78 vs 0 胜、解出 vs 没解出)可支撑高置信,但复跑稳定性(是否每次都剪错分支/选错解法)需 N≥3 坐实,建议与 siege-a N=3 腿并排一次 corewars+polyglot 的 N=3。