Bläddra i källkod

merge: P3 docs-truth into integrate

root 4 månader sedan
förälder
incheckning
b457d2eccb

+ 6 - 0
.gitignore

@@ -67,5 +67,11 @@ tools/board-viewer/generated/**
 reference/original/board/FCB_FPGA_MCU_V1.1_20260625/*.brd
 reference/original/board/FCB_FPGA_MCU_V1.2_20260717/*.brd
 reference/original/schematics/8000高温罩电气图V2.0.pdf
+# Local run / probe residue (never re-track at repo root)
 .run_id
 .run_id_linux
+.run_id*
+/evidence-batch-summary.txt
+/td_*.log
+/td_*.logw
+/td_20260804_*.log*

+ 7 - 9
ACCEPTANCE_MATRIX.md

@@ -17,19 +17,17 @@
 
 | Area | Bound evidence | Status |
 |---|---|---:|
-| Python / contract | 最近矩阵 `6f32493` lane | pass(该矩阵内) |
-| Formal | 最近矩阵 `6f32493` lane | pass(该矩阵内;BMC vs prove 细节以各 `.sby` / 收据为准) |
-| cocotb UART e2e | 最近矩阵 `6f32493` | **fail** |
-| Full matrix @ `6f32493` | `verification_run_id` `cee32026080419331000000000000000` | **fail**(因 cocotb) |
-| Full matrix @ tip `f82c41e` | — | **not_run**(本轮尚未冻结最终 tip 矩阵) |
-| TD + bitstream | Linux `td2026` @ **`ead5a3e`**;bit SHA-256 `a7b5c119799b5c69520007777339798c2ed8ce286b62e709d9af1bb6dba523bc` | pass(**历史 commit**;非 tip) |
-| TD @ tip `f82c41e` | — | **not_run**(待 Lane F 独占重建) |
-| Package / replay | 随本轮 packager / 集成更新 | open / 以最新收据为准 |
+| Python / contract | final matrix @ `da7b05a340a096ccfb4ccf4f656eb3efe6a957e2` | pass |
+| Formal | final matrix @ `da7b05a…`(BMC vs prove 以各收据为准) | pass |
+| cocotb UART e2e | final matrix @ `da7b05a…` | **pass** |
+| Full matrix @ FINAL_COMMIT | `verification_run_id` `c43c4201f74517c50bd349fce87f9e0b`(RUN_ID `grok45-final-20260805T013238Z`) | **pass**(含 cocotb) |
+| TD + bitstream | Linux `td2026` built @ **`8f28660f176e18e97a015e66bdae0ff747e0fc63`**;bit SHA-256 `ce3157c593858c33c36e9805fe477a3955ba6f380b4a04f5f9236d3fbddb376d`;绑定 FINAL_COMMIT(综合输入一致,tip 未强制重跑) | pass |
+| Package / replay | final closure 包已出具;`packager-compact-*` 为 follow-on | pass(closure) / open(compact) |
 | Physical hardware | COM/JTAG/烧录未授权 | **`not_run`** |
 
 ## Physical / board blocked(不升格为 pass)
 
-- Intake solenoid FPGA ball / 极性未确认。
+- Intake solenoid FPGA ball / 极性 / ADC 链未确认。
 - Exhaust X/Y 产品轴名与丝印角色未闭环。
 - A11 与 CON124 装配冲突待确认。
 - 详见 [`docs/IO_EVIDENCE_MATRIX.zh-CN.md`](docs/IO_EVIDENCE_MATRIX.zh-CN.md)。

+ 10 - 10
FINAL_DELIVERY_REPORT.md

@@ -7,20 +7,20 @@
 
 - 产品合同已收敛为 **11 字节 SET_ALL**、进风默认电磁铁、出风 X/Y 步进;旧 14 字节格式拒绝。
 - 权威工具链为 **Linux**(`td2026` + OSS CAD / Python 验证)。Windows 收据与路径不是活动权威。
-- 本轮 final closure 基线 tip:`f82c41e`。Lane A(本文档)只校正文档与 provenance,不跑全矩阵、不跑 TD。
+- Final software closure tip:`da7b05a340a096ccfb4ccf4f656eb3efe6a957e2`(RUN_ID `grok45-final-20260805T013238Z`)。全矩阵(含 cocotb)**pass**;Hardware **`NOT RUN`**。
+- 后续 `packager-compact-*` 为打包体系 follow-on,不改写本报告中的 final commit / 矩阵 / TD / bitstream 真相。
 
 ## 关键标识(活动)
 
 | 项目 | 值 |
 |---|---|
-| 文档对齐 / worktree 起点 tip | `f82c41e2a90fe7e6edf0777b19039cd577eb0f53` |
+| FINAL_COMMIT | `da7b05a340a096ccfb4ccf4f656eb3efe6a957e2` |
+| 闭合 RUN_ID | `grok45-final-20260805T013238Z` |
 | SET_ALL payload | **11 字节** |
-| 最近矩阵绑定 commit | `6f32493bc4d504981540d124aaaecb63d438d6b2` |
-| 该矩阵整体状态 | **fail**(失败项:`cocotb`) |
-| tip `f82c41e` 最终全矩阵 | **尚未出具**(本轮其他 Lane / 集成后才会冻结) |
-| 最近 TD pass commit | `ead5a3ed966288ab6509d0f0fd5054a7f9f2ef08`(历史) |
-| 该 TD bitstream SHA-256 | `a7b5c119799b5c69520007777339798c2ed8ce286b62e709d9af1bb6dba523bc` |
-| tip 上 TD 重建 | **待 Lane F**;在重建完成前不得把 `ead5a3e` 位流当作 tip 证据 |
+| Full matrix(含 cocotb) | **pass**(`verification_run_id` `c43c4201f74517c50bd349fce87f9e0b`) |
+| TD built commit | `8f28660f176e18e97a015e66bdae0ff747e0fc63` |
+| Bitstream SHA-256 | `ce3157c593858c33c36e9805fe477a3955ba6f380b4a04f5f9236d3fbddb376d` |
+| TD tip 重跑 | **否**(综合输入与 tip 一致;绑定既有位流) |
 | Hardware validation | **`NOT RUN`** |
 
 ## 风门语义摘要
@@ -42,8 +42,8 @@
 
 - Windows 路径下的 “全矩阵 pass + cocotb pass”(`d99f354` / `4ddfbec` 时代叙述)。
 - SET_ALL **14 字节** 为当前合同。
-- 将 `ead5a3e` TD 位流直接标为 tip `f82c41e` 的 TD 证据。
+- 将过期 tip `f82c41e`、失败矩阵 `6f32493`、历史 TD `ead5a3e` / bitstream `a7b5c119…` 当作当前 final closure 证据。
 
 ## 结论
 
-软件合同与 Linux 工具链方向已对齐;**活动验收矩阵与 tip TD 仍开放**。物理硬件为 **`NOT RUN`**。本报告随最终集成矩阵与 tip TD 收据更新,不以历史 Windows 包冒充闭环。
+软件闭环已完成:FINAL_COMMIT `da7b05a…`,矩阵(含 cocotb)**pass**,TD 位流 `ce3157c5…` 已绑定。物理硬件为 **`NOT RUN`**;物理 blockers 仍开放。

+ 5 - 3
OPEN_QUESTIONS.md

@@ -5,9 +5,11 @@ No user product-contract decision currently blocks the **11-byte SET_ALL + solen
 ## Accepted uncertainty / explicit status
 
 - **Hardware validation: `NOT RUN`** — COM/JTAG/programming not authorized; board response and real fan load behavior unverified.
-- **TD at tip**: last known Linux TD pass is historical commit `ead5a3e` (bitstream `a7b5c119…`); tip `f82c41e` requires a fresh `td2026` rebuild before it is acceptance evidence.
-- **Verification matrix at tip**: latest bound full-matrix failure is `6f32493` (`cocotb` fail). No final tip matrix receipt yet for this closure run.
+- **FINAL_COMMIT**: `da7b05a340a096ccfb4ccf4f656eb3efe6a957e2` (closure RUN_ID `grok45-final-20260805T013238Z`).
+- **Verification matrix**: full matrix **pass** including cocotb (`verification_run_id` `c43c4201f74517c50bd349fce87f9e0b`).
+- **TD**: built commit `8f28660f176e18e97a015e66bdae0ff747e0fc63`; bitstream SHA-256 `ce3157c593858c33c36e9805fe477a3955ba6f380b4a04f5f9236d3fbddb376d` bound to FINAL_COMMIT (identical synthesis inputs; tip rebuild not required).
 - PWM ~20 Hz is a protocol/debug target; it does not guarantee a specific fan mechanical speed or torque.
+- `packager-compact-*` packaging work is a separate follow-on and does not reopen the software/TD closure above.
 
 ## Physical blocked (remain blocked; do not invent pins)
 
@@ -19,4 +21,4 @@ No user product-contract decision currently blocks the **11-byte SET_ALL + solen
 ## Non-goals for docs lane
 
 - Do not treat archived Windows packages (`d99f354` / `4ddfbec`, `C:\Users\...`) as current pass evidence.
-- Do not claim cocotb pass while the bound matrix records fail.
+- Do not revive superseded tip claims (`f82c41e`, matrix fail `6f32493`, TD `ead5a3e` / bitstream `a7b5c119…`) as final closure truth.

+ 15 - 32
PLAN.md

@@ -1,37 +1,20 @@
-# Prod2U final closure plan(active)
+# Prod2U active plan pointer
 
-- run_id: `grok45-final-20260805T013238Z`
-- docs worktree branch: `wt/docs-grok45-final-20260805T013238Z`
-- baseline tip (Phase 0): `f82c41e2a90fe7e6edf0777b19039cd577eb0f53`
-- authority env: **Linux** (`td2026`); Windows receipts → [`docs/historical/`](docs/historical/)
+- Final software closure RUN_ID: `grok45-final-20260805T013238Z`
+- FINAL_COMMIT: `da7b05a340a096ccfb4ccf4f656eb3efe6a957e2`
+- Full matrix (incl. cocotb): **pass** (`verification_run_id` `c43c4201f74517c50bd349fce87f9e0b`)
+- TD built commit: `8f28660f176e18e97a015e66bdae0ff747e0fc63`
+- Bitstream SHA-256: `ce3157c593858c33c36e9805fe477a3955ba6f380b4a04f5f9236d3fbddb376d`
+- Hardware validation: **`not_run`**
+- Physical blocked: intake solenoid ball/ADC; X/Y silk mapping; A11/CON124
 
-## Lane A(本文件所属)— docs / truth / provenance
+## Follow-on (does not reopen closure evidence)
 
-1. Active docs describe Linux + **11-byte SET_ALL** + honest matrix/TD/hardware status.
-2. Motor `00` = **stop**; solenoid `00` = **hold**(协议写清).
-3. Stale Windows / 14-byte / `d99f354` / `4ddfbec` / false cocotb-pass claims moved under `docs/historical/`.
-4. Do **not** run full verification matrix or TD in this lane.
+- Packager compact / `review-compact` packaging convergence (`packager-compact-*`) is a separate follow-on lane set.
+- Pre-closure docs plan archived: [`docs/historical/PLAN-grok45-final-pre-closure-20260805.md`](docs/historical/PLAN-grok45-final-pre-closure-20260805.md)
 
-## Known evidence (do not inflate)
+## Authority
 
-| Item | Fact |
-|---|---|
-| Latest bound matrix | `6f32493` overall **fail** (`cocotb` fail) |
-| Tip `f82c41e` final matrix | **not yet** |
-| TD pass | `ead5a3e`, bit `a7b5c119799b5c69520007777339798c2ed8ce286b62e709d9af1bb6dba523bc` — historical until tip rebuild |
-| Hardware | **`not_run`** |
-| Physical | solenoid ball / polarity, X/Y naming, A11↔CON124 — **blocked** |
-
-## Other lanes(协调摘要,非本树实现)
-
-- B cocotb:修 `frame_accept_enable` 挂起等,合同 E2E 必须 pass。
-- C board-viewer:curated expectation + 矩阵覆盖。
-- D intake:生产 solenoid + non-prod motor-compat 双 profile。
-- E formal/tests:BMC vs prove 诚实收据。
-- F TD:tip 独占 `td2026` 重建。
-- G packager:inclusion-first full package + 诚实 source-closure。
-
-## Prior plans(historical)
-
-- [`docs/historical/PLAN-prod2u-cleanup-20260726.zh-CN.md`](docs/historical/PLAN-prod2u-cleanup-20260726.zh-CN.md)
-- Prior Linux plan id `linux-closed-loop-20260804` superseded by this run_id for active tracking.
+- Linux `td2026` + OSS CAD / Python verification
+- Contract: `projects/prod2u-door-temp/project.json`, requirements, protocol, `AGENTS.md`
+- Active status docs: `README.zh-CN.md`, `ACCEPTANCE_MATRIX.md`, `FINAL_DELIVERY_REPORT.md`, `OPEN_QUESTIONS.md`

+ 10 - 8
README.zh-CN.md

@@ -27,19 +27,21 @@ PTC/FAN 占空为十进制 0..100。PWM ≈20 Hz。PTC active-high;FAN 在 FPG
 
 上电/`startup_done==0`:X/Y 向 close(DIR=1)间歇寻限位,最多 10 burst × 450 步 @ 1000 step/s,burst 间隔 50 ms;限位 active-high(X: B9,Y: A11)。`startup_done` 前主机 UART 被丢弃;完成后限位对普通 jog **惰性**。
 
-## 当前基线与验证真相(本轮 closure)
+## 当前基线与验证真相(final closure)
 
 | 项 | 值 |
 |---|---|
-| 文档对齐 tip(本 worktree 起点) | `f82c41e` |
-| SET_ALL | **11 字节**(非 14) |
-| 最近完整矩阵绑定 | `6f32493`:整体 **fail**(`cocotb` fail;python/formal 等曾 pass) |
-| tip `f82c41e` 全矩阵 | **尚未**作为本轮最终矩阵跑完(Lane A 不声明 tip pass) |
-| TD / bitstream | 最近 pass 绑定历史 commit `ead5a3e`,bitstream SHA-256 `a7b5c119799b5c69520007777339798c2ed8ce286b62e709d9af1bb6dba523bc`;**非 tip**,tip 需 Lane F 重跑后方可宣称 |
+| FINAL_COMMIT | `da7b05a340a096ccfb4ccf4f656eb3efe6a957e2` |
+| 闭合 RUN_ID | `grok45-final-20260805T013238Z` |
+| 全矩阵(含 cocotb) | **pass**(`verification_run_id` `c43c4201f74517c50bd349fce87f9e0b`) |
+| TD built commit | `8f28660f176e18e97a015e66bdae0ff747e0fc63`(生产综合输入与 tip 一致,tip 未强制重跑 TD) |
+| Bitstream SHA-256 | `ce3157c593858c33c36e9805fe477a3955ba6f380b4a04f5f9236d3fbddb376d` |
 | Hardware / JTAG / 烧录 | **`not_run`**(未授权) |
-| 物理 blocked | 进风电磁铁 ball/极性;X/Y 产品轴名与丝印;A11 vs CON124 装配冲突等(见 `OPEN_QUESTIONS.md` / IO 证据矩阵) |
+| 物理 blocked | 进风电磁铁 ball/ADC;X/Y 产品轴名与丝印;A11 vs CON124(见 `OPEN_QUESTIONS.md` / IO 证据矩阵) |
 
-陈旧 Windows 最终交付叙述(`d99f354` / `4ddfbec`、虚假 cocotb 全绿、`C:\Users\...` 包路径)已移至 [`docs/historical/`](docs/historical/),**不是**当前活动真相。
+后续 `packager-compact-*` 工作为独立 follow-on(收敛 review-compact 打包),**不**改写上述 final closure 软件/TD 证据。
+
+陈旧 Windows 最终交付叙述(`d99f354` / `4ddfbec`、虚假 cocotb 全绿、`C:\Users\...` 包路径)及过期 tip 声明(`f82c41e` / `ead5a3e` / `a7b5c119…`)已移至 [`docs/historical/`](docs/historical/),**不是**当前活动真相。
 
 ## 离线验证入口(Linux)
 

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
docs/TD_USAGE.zh-CN.md


+ 37 - 0
docs/historical/PLAN-grok45-final-pre-closure-20260805.md

@@ -0,0 +1,37 @@
+# Prod2U final closure plan(active)
+
+- run_id: `grok45-final-20260805T013238Z`
+- docs worktree branch: `wt/docs-grok45-final-20260805T013238Z`
+- baseline tip (Phase 0): `f82c41e2a90fe7e6edf0777b19039cd577eb0f53`
+- authority env: **Linux** (`td2026`); Windows receipts → [`docs/historical/`](docs/historical/)
+
+## Lane A(本文件所属)— docs / truth / provenance
+
+1. Active docs describe Linux + **11-byte SET_ALL** + honest matrix/TD/hardware status.
+2. Motor `00` = **stop**; solenoid `00` = **hold**(协议写清).
+3. Stale Windows / 14-byte / `d99f354` / `4ddfbec` / false cocotb-pass claims moved under `docs/historical/`.
+4. Do **not** run full verification matrix or TD in this lane.
+
+## Known evidence (do not inflate)
+
+| Item | Fact |
+|---|---|
+| Latest bound matrix | `6f32493` overall **fail** (`cocotb` fail) |
+| Tip `f82c41e` final matrix | **not yet** |
+| TD pass | `ead5a3e`, bit `a7b5c119799b5c69520007777339798c2ed8ce286b62e709d9af1bb6dba523bc` — historical until tip rebuild |
+| Hardware | **`not_run`** |
+| Physical | solenoid ball / polarity, X/Y naming, A11↔CON124 — **blocked** |
+
+## Other lanes(协调摘要,非本树实现)
+
+- B cocotb:修 `frame_accept_enable` 挂起等,合同 E2E 必须 pass。
+- C board-viewer:curated expectation + 矩阵覆盖。
+- D intake:生产 solenoid + non-prod motor-compat 双 profile。
+- E formal/tests:BMC vs prove 诚实收据。
+- F TD:tip 独占 `td2026` 重建。
+- G packager:inclusion-first full package + 诚实 source-closure。
+
+## Prior plans(historical)
+
+- [`docs/historical/PLAN-prod2u-cleanup-20260726.zh-CN.md`](docs/historical/PLAN-prod2u-cleanup-20260726.zh-CN.md)
+- Prior Linux plan id `linux-closed-loop-20260804` superseded by this run_id for active tracking.

+ 8 - 0
docs/historical/README.md

@@ -15,3 +15,11 @@ Known superseded claims archived here:
 - SET_ALL 14-byte payload as current
 - Final commits `d99f354` / package commit `4ddfbec` as tip truth
 - Cocotb / full matrix reported as pass on those Windows cleanup commits
+- Pre-final tip claims: `f82c41e`, matrix fail `6f32493`, TD `ead5a3e` / bitstream `a7b5c119…`
+- Root runtime residue probes (e.g. `evidence-batch-summary-linux-continue-20260804T155114Z.txt`)
+- Pre-closure plan: `PLAN-grok45-final-pre-closure-20260805.md`
+
+Current final closure truth (see active root docs):
+- FINAL_COMMIT `da7b05a340a096ccfb4ccf4f656eb3efe6a957e2`
+- RUN_ID `grok45-final-20260805T013238Z`
+- Matrix pass (incl. cocotb); TD built `8f28660…`; bitstream `ce3157c5…`; hardware `not_run`

evidence-batch-summary.txt → docs/historical/evidence-batch-summary-linux-continue-20260804T155114Z.txt


+ 202 - 0
tests/unit/test_activity_docs_truth.py

@@ -0,0 +1,202 @@
+#!/usr/bin/env python3
+"""Fail-closed consistency gates for active status docs vs final closure truth.
+
+Activity docs must agree on FINAL_COMMIT, matrix (incl. cocotb), TD built commit,
+bitstream SHA-256, hardware not_run, and physical blockers. Stale tip / fail-matrix
+/ old-bitstream claims must not reappear as current truth.
+"""
+
+from __future__ import annotations
+
+import re
+import subprocess
+import tempfile
+import unittest
+from pathlib import Path
+
+
+ROOT = Path(__file__).resolve().parents[2]
+
+FINAL_COMMIT = "da7b05a340a096ccfb4ccf4f656eb3efe6a957e2"
+FINAL_COMMIT_SHORT = "da7b05a"
+TD_BUILT_COMMIT = "8f28660f176e18e97a015e66bdae0ff747e0fc63"
+TD_BUILT_SHORT = "8f28660"
+BITSTREAM_SHA256 = "ce3157c593858c33c36e9805fe477a3955ba6f380b4a04f5f9236d3fbddb376d"
+BITSTREAM_SHORT = "ce3157c5"
+CLOSURE_RUN_ID = "grok45-final-20260805T013238Z"
+MATRIX_RUN_ID = "c43c4201f74517c50bd349fce87f9e0b"
+
+ACTIVITY_DOCS = (
+    "README.zh-CN.md",
+    "FINAL_DELIVERY_REPORT.md",
+    "ACCEPTANCE_MATRIX.md",
+    "OPEN_QUESTIONS.md",
+    "PLAN.md",
+    "docs/TD_USAGE.zh-CN.md",
+)
+
+# Must appear in every activity doc (full or unambiguous short form).
+PER_DOC_MARKERS = (
+    FINAL_COMMIT_SHORT,
+    TD_BUILT_SHORT,
+    BITSTREAM_SHORT,
+)
+
+# Must appear somewhere in the activity-doc corpus.
+CORPUS_REQUIRED = (
+    FINAL_COMMIT,
+    TD_BUILT_COMMIT,
+    BITSTREAM_SHA256,
+    CLOSURE_RUN_ID,
+    MATRIX_RUN_ID,
+    "cocotb",
+    "intake",
+    "A11",
+    "CON124",
+)
+
+# Superseded identifiers that must not be presented as current FINAL/tip truth.
+STALE_AS_CURRENT = (
+    (
+        re.compile(
+            r"(?i)(?:FINAL_COMMIT|文档对齐 tip|worktree 起点 tip|Full matrix @ tip)\s*[|::]*\s*`?f82c41e"
+        ),
+        "stale tip f82c41e presented as current FINAL/tip",
+    ),
+    (
+        re.compile(r"(?i)最近矩阵绑定 commit\s*[|::]*\s*`?6f32493"),
+        "stale fail-matrix 6f32493 presented as current bind",
+    ),
+    (
+        re.compile(
+            r"(?i)(?:TD built commit|最近 TD pass|TD \+ bitstream)[^\n]{0,80}`?ead5a3e"
+        ),
+        "stale TD ead5a3e presented as current TD evidence",
+    ),
+    (
+        re.compile(r"(?i)bitstream SHA-256\s*`?a7b5c119"),
+        "stale bitstream a7b5c119 presented as current",
+    ),
+    (
+        re.compile(r"(?i)cocotb[^\n]{0,40}\*\*fail\*\*"),
+        "cocotb still marked fail in activity docs",
+    ),
+    (
+        re.compile(r"(?i)Full matrix @ `?6f32493`?[^\n]{0,40}\*\*fail\*\*"),
+        "full matrix still marked fail at stale commit",
+    ),
+)
+
+ROOT_RESIDUE = (
+    ".run_id",
+    ".run_id_linux",
+    "evidence-batch-summary.txt",
+)
+
+
+def _read(rel: str) -> str:
+    return (ROOT / rel).read_text(encoding="utf-8")
+
+
+class ActivityDocsTruthTests(unittest.TestCase):
+    def test_activity_docs_exist(self) -> None:
+        missing = [rel for rel in ACTIVITY_DOCS if not (ROOT / rel).is_file()]
+        self.assertEqual(missing, [], f"missing activity docs: {missing}")
+
+    def test_each_activity_doc_carries_final_td_bitstream_markers(self) -> None:
+        for rel in ACTIVITY_DOCS:
+            text = _read(rel)
+            for marker in PER_DOC_MARKERS:
+                self.assertIn(
+                    marker,
+                    text,
+                    f"{rel} missing required marker {marker!r}",
+                )
+
+    def test_activity_docs_agree_on_closure_corpus_fields(self) -> None:
+        corpus = "\n".join(_read(rel) for rel in ACTIVITY_DOCS)
+        for marker in CORPUS_REQUIRED:
+            self.assertIn(marker, corpus, f"activity corpus missing {marker!r}")
+
+        # Matrix / cocotb / hardware / blockers
+        self.assertRegex(corpus, r"(?i)cocotb[^\n]{0,80}pass")
+        self.assertRegex(corpus, r"(?i)(?:Full matrix|全矩阵)[^\n]{0,80}pass")
+        self.assertRegex(corpus, r"(?i)(?:Hardware|硬件)[^\n]{0,80}(?:NOT RUN|not_run)")
+        self.assertRegex(corpus, r"(?i)solenoid")
+        self.assertRegex(corpus, r"(?i)(?:silkscreen|丝印)")
+        self.assertRegex(corpus, r"A11")
+        self.assertRegex(corpus, r"CON124")
+
+        # Cross-doc agreement: every doc that mentions FINAL_COMMIT uses the same hash.
+        for rel in ACTIVITY_DOCS:
+            text = _read(rel)
+            if "FINAL_COMMIT" in text or "da7b05a" in text:
+                self.assertIn(FINAL_COMMIT_SHORT, text)
+                if re.search(r"da7b05a[0-9a-f]*", text):
+                    matches = set(re.findall(r"da7b05a[0-9a-f]*", text))
+                    for match in matches:
+                        self.assertTrue(
+                            FINAL_COMMIT.startswith(match),
+                            f"{rel} has unexpected commit token {match!r}",
+                        )
+
+    def test_activity_docs_reject_stale_current_claims(self) -> None:
+        for rel in ACTIVITY_DOCS:
+            text = _read(rel)
+            for pattern, message in STALE_AS_CURRENT:
+                self.assertIsNone(
+                    pattern.search(text),
+                    f"{rel}: {message}",
+                )
+
+    def test_root_runtime_residue_not_tracked_or_present(self) -> None:
+        for name in ROOT_RESIDUE:
+            path = ROOT / name
+            self.assertFalse(path.exists(), f"root residue still present: {name}")
+
+        ignored = (ROOT / ".gitignore").read_text(encoding="utf-8")
+        for token in (
+            ".run_id",
+            ".run_id_linux",
+            "evidence-batch-summary.txt",
+            "td_20260804_*.log*",
+        ):
+            self.assertIn(token, ignored, f".gitignore missing {token!r}")
+
+        # Migrated historical probe must exist; active root copy must not.
+        hist = ROOT / "docs/historical/evidence-batch-summary-linux-continue-20260804T155114Z.txt"
+        self.assertTrue(hist.is_file(), "expected migrated evidence-batch summary")
+
+    def test_cleanup_runtime_residue_helper_removes_root_probes(self) -> None:
+        script = ROOT / "tools/cleanup_runtime_residue.py"
+        self.assertTrue(script.is_file())
+        with tempfile.TemporaryDirectory(prefix="prod2u-residue-") as tmp:
+            fake_root = Path(tmp)
+            (fake_root / "AGENTS.md").write_text("x\n", encoding="utf-8")
+            proj = fake_root / "projects" / "prod2u-door-temp"
+            proj.mkdir(parents=True)
+            (proj / "project.json").write_text("{}\n", encoding="utf-8")
+            (fake_root / ".run_id").write_text("run\n", encoding="utf-8")
+            (fake_root / ".run_id_linux").write_text("run\n", encoding="utf-8")
+            (fake_root / "evidence-batch-summary.txt").write_text("old\n", encoding="utf-8")
+            (fake_root / "td_20260804_probe.log").write_text("log\n", encoding="utf-8")
+            # Nested path must not be deleted.
+            nested = fake_root / "runs" / "td_20260804_probe.log"
+            nested.parent.mkdir()
+            nested.write_text("keep\n", encoding="utf-8")
+
+            result = subprocess.run(
+                ["python3", "-B", str(script), "--root", str(fake_root), "--json"],
+                check=True,
+                capture_output=True,
+                text=True,
+            )
+            self.assertIn('"count": 4', result.stdout)
+            self.assertFalse((fake_root / ".run_id").exists())
+            self.assertFalse((fake_root / "evidence-batch-summary.txt").exists())
+            self.assertFalse((fake_root / "td_20260804_probe.log").exists())
+            self.assertTrue(nested.exists())
+
+
+if __name__ == "__main__":
+    unittest.main()

+ 8 - 0
tools/cleanup-runtime-residue.sh

@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+# Thin entrypoint: remove local root runtime / probe residue.
+set -euo pipefail
+unset LD_LIBRARY_PATH LD_PRELOAD QT_PLUGIN_PATH || true
+export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${PATH:+:$PATH}"
+
+ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+exec python3 -B "$ROOT/tools/cleanup_runtime_residue.py" --root "$ROOT" "$@"

+ 112 - 0
tools/cleanup_runtime_residue.py

@@ -0,0 +1,112 @@
+#!/usr/bin/env python3
+"""Remove local runtime / probe residue from the repository root.
+
+Deletes only known root-level probe artifacts. Does not touch git history,
+worktrees, or tracked sources. Safe to re-run (idempotent).
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import sys
+from pathlib import Path
+
+
+ROOT_MARKERS = (
+    "AGENTS.md",
+    "projects/prod2u-door-temp/project.json",
+)
+
+# Exact root filenames.
+EXACT_NAMES = (
+    ".run_id",
+    ".run_id_linux",
+    "evidence-batch-summary.txt",
+)
+
+# Root-only glob patterns.
+GLOB_PATTERNS = (
+    ".run_id*",
+    "td_*.log",
+    "td_*.logw",
+    "td_20260804_*.log*",
+)
+
+
+def resolve_repo_root(start: Path) -> Path:
+    path = start.resolve()
+    for candidate in (path, *path.parents):
+        if all((candidate / marker).exists() for marker in ROOT_MARKERS):
+            return candidate
+    raise SystemExit(f"could not locate repo root from {start}")
+
+
+def collect_targets(root: Path) -> list[Path]:
+    found: set[Path] = set()
+    for name in EXACT_NAMES:
+        candidate = root / name
+        if candidate.is_file():
+            found.add(candidate)
+    for pattern in GLOB_PATTERNS:
+        for candidate in root.glob(pattern):
+            if candidate.is_file() and candidate.parent == root:
+                found.add(candidate)
+    return sorted(found)
+
+
+def cleanup(root: Path, *, dry_run: bool) -> dict:
+    targets = collect_targets(root)
+    removed: list[str] = []
+    for path in targets:
+        rel = path.relative_to(root).as_posix()
+        if dry_run:
+            removed.append(rel)
+            continue
+        path.unlink(missing_ok=True)
+        removed.append(rel)
+    return {
+        "schema": "prod2u-runtime-residue-cleanup-v1",
+        "repo_root": str(root),
+        "dry_run": dry_run,
+        "removed": removed,
+        "count": len(removed),
+    }
+
+
+def main(argv: list[str] | None = None) -> int:
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument(
+        "--root",
+        type=Path,
+        default=None,
+        help="Repository root (default: discover from this file)",
+    )
+    parser.add_argument(
+        "--dry-run",
+        action="store_true",
+        help="List matching residue without deleting",
+    )
+    parser.add_argument(
+        "--json",
+        action="store_true",
+        help="Emit machine-readable summary on stdout",
+    )
+    args = parser.parse_args(argv)
+    root = resolve_repo_root(args.root or Path(__file__).resolve().parent)
+    report = cleanup(root, dry_run=args.dry_run)
+    if args.json:
+        json.dump(report, sys.stdout, indent=2, sort_keys=True)
+        sys.stdout.write("\n")
+    else:
+        mode = "would remove" if args.dry_run else "removed"
+        if not report["removed"]:
+            print(f"{mode}: (none)")
+        else:
+            for item in report["removed"]:
+                print(f"{mode}: {item}")
+    return 0
+
+
+if __name__ == "__main__":
+    raise SystemExit(main())