teamsmith 0.4.5 → 0.4.7

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 (81) hide show
  1. package/README.md +6 -6
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +37 -1
  4. package/skills/teamsmith/SKILL.md +32 -23
  5. package/skills/teamsmith/extension/team-bg.ts +12 -11
  6. package/skills/teamsmith/extension/team-inbox-watch.ts +149 -5
  7. package/skills/teamsmith/extension/team-notify.ts +20 -13
  8. package/skills/teamsmith/extension/team-remind.ts +189 -0
  9. package/skills/teamsmith/extension/team-reply.ts +4 -7
  10. package/skills/teamsmith/references/migration.md +101 -0
  11. package/skills/teamsmith/references/openspec.md +43 -27
  12. package/skills/teamsmith/references/protocol.md +28 -18
  13. package/skills/teamsmith/references/reminders.md +133 -98
  14. package/skills/teamsmith/references/troubleshooting.md +12 -7
  15. package/skills/teamsmith/references/workflows.md +85 -34
  16. package/skills/teamsmith/scripts/lib/cmd-agents.sh +28 -5
  17. package/skills/teamsmith/scripts/lib/cmd-project.sh +100 -15
  18. package/skills/teamsmith/scripts/lib/cmd-remind.sh +135 -10
  19. package/skills/teamsmith/scripts/lib/cmd-review.sh +42 -4
  20. package/skills/teamsmith/scripts/lib/cmd-update.sh +90 -88
  21. package/skills/teamsmith/scripts/lib/cmd-watch.sh +322 -159
  22. package/skills/teamsmith/scripts/lib/common.sh +156 -26
  23. package/skills/teamsmith/scripts/panel/panel.js +182 -182
  24. package/skills/teamsmith/scripts/panel/src/data.ts +113 -6
  25. package/skills/teamsmith/scripts/panel/src/layout.ts +26 -4
  26. package/skills/teamsmith/scripts/panel/src/main.tsx +103 -14
  27. package/skills/teamsmith/scripts/remind-capability.mjs +261 -0
  28. package/skills/teamsmith/scripts/remind-store.mjs +404 -17
  29. package/skills/teamsmith/scripts/remind-tick.mjs +105 -0
  30. package/skills/teamsmith/scripts/reminder-delivery.mjs +76 -0
  31. package/skills/teamsmith/scripts/reply-capture.mjs +8 -9
  32. package/skills/teamsmith/scripts/state-authority.mjs +334 -20
  33. package/skills/teamsmith/scripts/strings/commands.tsv +3 -3
  34. package/skills/teamsmith/scripts/strings/help.en.tsv +12 -12
  35. package/skills/teamsmith/scripts/strings/help.zh.tsv +12 -12
  36. package/skills/teamsmith/scripts/team +4 -3
  37. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +13 -11
  38. package/skills/teamsmith/templates/DECISIONS.md.tmpl +2 -2
  39. package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +3 -3
  40. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +19 -14
  41. package/skills/teamsmith/templates/memory-seed.md.tmpl +2 -2
  42. package/skills/teamsmith/templates/pm-prompt.md.tmpl +36 -18
  43. package/skills/teamsmith/templates/report.md.tmpl +33 -0
  44. package/skills/teamsmith/tests/bg-ledger-harness.mjs +217 -33
  45. package/skills/teamsmith/tests/bg-ledger.sh +24 -10
  46. package/skills/teamsmith/tests/checkout-shape-probe.sh +7 -6
  47. package/skills/teamsmith/tests/death-cause.sh +5 -0
  48. package/skills/teamsmith/tests/fixtures/remind-adversarial-delay.ts +27 -0
  49. package/skills/teamsmith/tests/fixtures/remind-tool-provider.ts +65 -0
  50. package/skills/teamsmith/tests/help-surface.sh +14 -151
  51. package/skills/teamsmith/tests/isolation-ledger.sh +89 -0
  52. package/skills/teamsmith/tests/key-replies-ui.sh +53 -0
  53. package/skills/teamsmith/tests/key-replies.sh +307 -106
  54. package/skills/teamsmith/tests/lib/main-team-fingerprint.sh +17 -1
  55. package/skills/teamsmith/tests/lib/routes-pages.sh +243 -0
  56. package/skills/teamsmith/tests/live-capture-probe.sh +12 -2
  57. package/skills/teamsmith/tests/loop-inventory.tsv +1 -0
  58. package/skills/teamsmith/tests/panel-b3-stub.sh +9 -2
  59. package/skills/teamsmith/tests/pulse-nudge-key.sh +5 -0
  60. package/skills/teamsmith/tests/remind-adversarial-faults.mjs +163 -0
  61. package/skills/teamsmith/tests/remind-adversarial-faults.sh +26 -0
  62. package/skills/teamsmith/tests/remind-adversarial-real.sh +27 -0
  63. package/skills/teamsmith/tests/remind-cli.sh +108 -3
  64. package/skills/teamsmith/tests/remind-delivery-node.mjs +189 -0
  65. package/skills/teamsmith/tests/remind-delivery.sh +699 -0
  66. package/skills/teamsmith/tests/remind-lifecycle.sh +197 -0
  67. package/skills/teamsmith/tests/remind-pulse.sh +199 -0
  68. package/skills/teamsmith/tests/remind-recovery-real.sh +5 -0
  69. package/skills/teamsmith/tests/remind-recovery-unit.sh +118 -0
  70. package/skills/teamsmith/tests/remind-tool-node.mjs +159 -0
  71. package/skills/teamsmith/tests/remind-tool-real.mjs +754 -0
  72. package/skills/teamsmith/tests/remind-tool-real.sh +5 -0
  73. package/skills/teamsmith/tests/reply-capture-real.mjs +93 -2
  74. package/skills/teamsmith/tests/routes.sh +213 -293
  75. package/skills/teamsmith/tests/section-paths.tsv +14 -12
  76. package/skills/teamsmith/tests/smoke.sh +876 -130
  77. package/skills/teamsmith/tests/state-authority.sh +392 -28
  78. package/skills/teamsmith/tests/team-inbox-watch-harness.mjs +58 -8
  79. package/skills/teamsmith/tests/tmux-identity-leak.sh +12 -16
  80. package/skills/teamsmith-init/SKILL.md +5 -5
  81. package/skills/teamsmith/tests/fixtures/delivery-truth-real/__pycache__/judge-second.cpython-313.pyc +0 -0
@@ -15,7 +15,7 @@
15
15
  # readonly 只读:缺 store 不建、坏源 hash/mtime 不变、无 mkdir/write(2.3)
16
16
  # workflow 指引:fixture Agent 在五种结果后仍发同一正文、回执 body-free、账本不变(4.1)
17
17
  # flip 坏源码→红→还原→绿:九条具名 guard 的独立 scratch 源码 + 哈希(2.4)
18
- # skip-path 缺观测器(/proc/<pid>/io)时可见跳过并点名,而不是判红(V27 M3)
18
+ # skip-path 缺观测器短样本:三条真实诊断、两项未验证、结果消费者与反例(reply-observer-skip-focus)
19
19
  # capture marker parser/source/CAS/crash 及私有真 Pi 注入、终稿和依赖 reload(P396)
20
20
  # guide 指引面:PM 提示词/协议/命令表三处纪律在场 + 示例命令对拍真解析器 + 四变异红侧(change: pm-reply-discipline · P267)
21
21
  #
@@ -648,6 +648,59 @@ kr_group_paging() {
648
648
  eq "paging:bodies 缺失时 list 仍返回元数据(不读正文)" "$(jget "$j4" 'd["total_slots"]')" "123"
649
649
  }
650
650
 
651
+ # ---------------------------------------------------------------- bounded 的观测专属入口
652
+ # 正常 bounded 先完成坏最新、权限与正文检查,最后才调用这里。强制缺席样本也调用同一入口;
653
+ # 能力检查必须先于 mid 的观测专属准备;bounded 缺席时只发自己的具名 SKIP。
654
+ kr_bounded_observe() { # <big proj> <small proj>
655
+ local p="$1" q="$2"
656
+ if ! kr_io_supported; then
657
+ skip "bounded:缺 /proc/<pid>/io($(kr_io_why))—— 读取量断言跳过(点名:内核计数器不可读)"
658
+ return 0
659
+ fi
660
+ local mid; mid="$(kr_new_proj bounded-mid --empty)" || return 1
661
+ kr_make_big_store "$mid" 60 || { bad "bounded:60 槽夹具建不出来"; return 1; }
662
+ # 中档(60 槽)与 10 万槽各取一页:一页的读取量必须与历史规模无关
663
+ kr_observe "$TMP/obs-mid-list" bash -c "cd '$mid' && exec \"\$@\"" _ "${KR_CLEAN[@]}" "$KR_TEAM" --root "$mid" reply list --json
664
+ kr_observe "$TMP/obs-big-list" bash -c "cd '$p' && exec \"\$@\"" _ "${KR_CLEAN[@]}" "$KR_TEAM" --root "$p" reply list --before 90000 --json
665
+ local mid_bytes big_bytes mid_sys big_sys d_bytes d_sys
666
+ mid_bytes="$(kr_obs_rchar "$TMP/obs-mid-list")"; big_bytes="$(kr_obs_rchar "$TMP/obs-big-list")"
667
+ mid_sys="$(kr_obs_syscr "$TMP/obs-mid-list")"; big_sys="$(kr_obs_syscr "$TMP/obs-big-list")"
668
+ d_bytes=$((big_bytes - mid_bytes)); d_sys=$((big_sys - mid_sys))
669
+ # 正控:观测器必须真的看见了这个进程打开过的 store 文件(否则下面的 0 不能当证据)
670
+ local ctl_fd; ctl_fd="$(kr_obs_fd_count "$TMP/obs-big-list" 'index.v1')"
671
+ if [ "$ctl_fd" -ge 1 ]; then ok "bounded:观测器正控(看见了 index.v1 的 fd,$ctl_fd 个)"
672
+ else bad "bounded:观测器看不见 store 的 fd —— 后面的读取量/打开断言不能当证据"; fi
673
+ eq "bounded:一页读的字节数与历史规模无关(10 万槽 − 60 槽 = ${d_bytes} 字节 ≤ 64 KiB)" \
674
+ "$([ "$d_bytes" -le 65536 ] && echo ok || echo over)" "ok"
675
+ eq "bounded:一页的读系统调用数也与历史规模无关(Δsyscr=${d_sys} ≤ 100)" \
676
+ "$([ "$d_sys" -le 100 ] && echo ok || echo over)" "ok"
677
+ eq "bounded:list 不打开任何正文文件(fd 证据)" "$(kr_obs_fd_count "$TMP/obs-big-list" '/bodies/')" "0"
678
+ # bodies/ 目录本身被以 O_PATH 打开(flags 里带 010000000):O_PATH 的 fd 在内核里无法 getdents,
679
+ # 所以「不枚举」是结构性的,不只是行为上的。
680
+ local bflags bdec; bflags="$(kr_obs_fd_flags "$TMP/obs-big-list" '/key-replies/bodies$')"
681
+ bdec=$(( 0$bflags )) # fdinfo 的 flags 是八进制字面(前导 0);O_PATH = 010000000 = 0x200000
682
+ if [ -n "$bflags" ] && [ $(( bdec & 0x200000 )) -ne 0 ]; then
683
+ ok "bounded:bodies 目录以 O_PATH 打开(flags=$bflags)—— 结构上不可能枚举"
684
+ else
685
+ bad "bounded:bodies 目录不是 O_PATH 打开的(flags=${bflags:-<没看见>})"
686
+ fi
687
+ # summary:只读最后一个槽 —— 与历史规模无关(≤ 2 个槽位的余量)
688
+ kr_observe "$TMP/obs-mid-sum" bash -c "cd '$mid' && exec \"\$@\"" _ "${KR_CLEAN[@]}" "$KR_TEAM" --root "$mid" __panel-data --block reply_summary
689
+ kr_observe "$TMP/obs-big-sum" bash -c "cd '$p' && exec \"\$@\"" _ "${KR_CLEAN[@]}" "$KR_TEAM" --root "$p" __panel-data --block reply_summary
690
+ local s_d; s_d=$(( $(kr_obs_rchar "$TMP/obs-big-sum") - $(kr_obs_rchar "$TMP/obs-mid-sum") ))
691
+ eq "bounded:summary 的读取量与历史规模无关(Δ=${s_d} 字节 ≤ 8 KiB,即 ≤ 2 个槽位)" \
692
+ "$([ "$s_d" -le 8192 ] && echo ok || echo over)" "ok"
693
+ # show:恰打开一个正文文件(fd 证据),且它不带 O_PATH
694
+ kr_observe "$TMP/obs-show" bash -c "cd '$q' && exec \"\$@\"" _ "${KR_CLEAN[@]}" "$KR_TEAM" --root "$q" reply show 3
695
+ local sh_d; sh_d=$(( $(kr_obs_rchar "$TMP/obs-show") - $(kr_obs_rchar "$TMP/obs-mid-sum") ))
696
+ eq "bounded:show 的读取量 = summary(都只读一个槽)+ 那份正文(Δ=${sh_d} 字节 ≤ 64 KiB)" \
697
+ "$([ "$sh_d" -le 65536 ] && echo ok || echo over)" "ok"
698
+ local f
699
+ for f in obs-mid-list obs-big-list obs-mid-sum obs-big-sum obs-show; do
700
+ kr_ev_save "$TMP/$f.io" "io-$f.txt"; kr_ev_save "$TMP/$f.fds" "fd-$f.txt"
701
+ done
702
+ }
703
+
651
704
  # ---------------------------------------------------------------- 组:bounded
652
705
  kr_group_bounded() {
653
706
  section "bounded · 有界读(2.3)"
@@ -668,55 +721,6 @@ kr_group_bounded() {
668
721
  # P348 合并(两条 → 一条):同一次机器出口的两个面(状态 + 没有退回旧标题)。
669
722
  jok "$sj" 'd["state"]=="unavailable" and d.get("entry") is None' \
670
723
  && ok "bounded:坏最新槽 summary=unavailable 且不退回旧标题" || bad "bounded:坏最新槽的处理不对($sj)"
671
- # 读取量的观测器:内核自述的 /proc/<pid>/io(rchar/syscr)+ /proc/<pid>/fd{,info}(进程真正打开过
672
- # 哪些路径、以什么 flags 打开)。无编译器依赖 —— 门禁镜像按 M47 故意 purge 掉 build-essential,
673
- # 所以旧版 LD_PRELOAD shim 在那里永远编不出来(V27 的 M3)。观测器不可用(hidepid 等)时**点名跳过**。
674
- if ! kr_io_supported; then
675
- skip "bounded:缺 /proc/<pid>/io($(kr_io_why))—— 读取量断言跳过(点名:内核计数器不可读)"
676
- skip "bounded:同上 —— flip/full_scan 也会点名跳过"
677
- else
678
- local mid; mid="$(kr_new_proj bounded-mid --empty)" || return 1
679
- kr_make_big_store "$mid" 60 || { bad "bounded:60 槽夹具建不出来"; return 1; }
680
- # 中档(60 槽)与 10 万槽各取一页:一页的读取量必须与历史规模无关
681
- kr_observe "$TMP/obs-mid-list" bash -c "cd '$mid' && exec \"\$@\"" _ "${KR_CLEAN[@]}" "$KR_TEAM" --root "$mid" reply list --json
682
- kr_observe "$TMP/obs-big-list" bash -c "cd '$p' && exec \"\$@\"" _ "${KR_CLEAN[@]}" "$KR_TEAM" --root "$p" reply list --before 90000 --json
683
- local mid_bytes big_bytes mid_sys big_sys d_bytes d_sys
684
- mid_bytes="$(kr_obs_rchar "$TMP/obs-mid-list")"; big_bytes="$(kr_obs_rchar "$TMP/obs-big-list")"
685
- mid_sys="$(kr_obs_syscr "$TMP/obs-mid-list")"; big_sys="$(kr_obs_syscr "$TMP/obs-big-list")"
686
- d_bytes=$((big_bytes - mid_bytes)); d_sys=$((big_sys - mid_sys))
687
- # 正控:观测器必须真的看见了这个进程打开过的 store 文件(否则下面的 0 不能当证据)
688
- local ctl_fd; ctl_fd="$(kr_obs_fd_count "$TMP/obs-big-list" 'index.v1')"
689
- if [ "$ctl_fd" -ge 1 ]; then ok "bounded:观测器正控(看见了 index.v1 的 fd,$ctl_fd 个)"
690
- else bad "bounded:观测器看不见 store 的 fd —— 后面的读取量/打开断言不能当证据"; fi
691
- eq "bounded:一页读的字节数与历史规模无关(10 万槽 − 60 槽 = ${d_bytes} 字节 ≤ 64 KiB)" \
692
- "$([ "$d_bytes" -le 65536 ] && echo ok || echo over)" "ok"
693
- eq "bounded:一页的读系统调用数也与历史规模无关(Δsyscr=${d_sys} ≤ 100)" \
694
- "$([ "$d_sys" -le 100 ] && echo ok || echo over)" "ok"
695
- eq "bounded:list 不打开任何正文文件(fd 证据)" "$(kr_obs_fd_count "$TMP/obs-big-list" '/bodies/')" "0"
696
- # bodies/ 目录本身被以 O_PATH 打开(flags 里带 010000000):O_PATH 的 fd 在内核里无法 getdents,
697
- # 所以「不枚举」是结构性的,不只是行为上的。
698
- local bflags bdec; bflags="$(kr_obs_fd_flags "$TMP/obs-big-list" '/key-replies/bodies$')"
699
- bdec=$(( 0$bflags )) # fdinfo 的 flags 是八进制字面(前导 0);O_PATH = 010000000 = 0x200000
700
- if [ -n "$bflags" ] && [ $(( bdec & 0x200000 )) -ne 0 ]; then
701
- ok "bounded:bodies 目录以 O_PATH 打开(flags=$bflags)—— 结构上不可能枚举"
702
- else
703
- bad "bounded:bodies 目录不是 O_PATH 打开的(flags=${bflags:-<没看见>})"
704
- fi
705
- # summary:只读最后一个槽 —— 与历史规模无关(≤ 2 个槽位的余量)
706
- kr_observe "$TMP/obs-mid-sum" bash -c "cd '$mid' && exec \"\$@\"" _ "${KR_CLEAN[@]}" "$KR_TEAM" --root "$mid" __panel-data --block reply_summary
707
- kr_observe "$TMP/obs-big-sum" bash -c "cd '$p' && exec \"\$@\"" _ "${KR_CLEAN[@]}" "$KR_TEAM" --root "$p" __panel-data --block reply_summary
708
- local s_d; s_d=$(( $(kr_obs_rchar "$TMP/obs-big-sum") - $(kr_obs_rchar "$TMP/obs-mid-sum") ))
709
- eq "bounded:summary 的读取量与历史规模无关(Δ=${s_d} 字节 ≤ 8 KiB,即 ≤ 2 个槽位)" \
710
- "$([ "$s_d" -le 8192 ] && echo ok || echo over)" "ok"
711
- # show:恰打开一个正文文件(fd 证据),且它不带 O_PATH
712
- kr_observe "$TMP/obs-show" bash -c "cd '$q' && exec \"\$@\"" _ "${KR_CLEAN[@]}" "$KR_TEAM" --root "$q" reply show 3
713
- local sh_d; sh_d=$(( $(kr_obs_rchar "$TMP/obs-show") - $(kr_obs_rchar "$TMP/obs-mid-sum") ))
714
- eq "bounded:show 的读取量 = summary(都只读一个槽)+ 那份正文(Δ=${sh_d} 字节 ≤ 64 KiB)" \
715
- "$([ "$sh_d" -le 65536 ] && echo ok || echo over)" "ok"
716
- for f in obs-mid-list obs-big-list obs-mid-sum obs-big-sum obs-show; do
717
- kr_ev_save "$TMP/$f.io" "io-$f.txt"; kr_ev_save "$TMP/$f.fds" "fd-$f.txt"
718
- done
719
- fi
720
724
  # 不枚举的独立证据(受控文件接口):bodies/ 去掉读权限(0111)——枚举必然 EACCES,
721
725
  # 按名直开仍可用。先证明这个金丝雀真的看得见枚举,再断言读命令在同样权限下照常。
722
726
  local KR_B="$KR/bodies" KR_QB="$q/.pi/team/state/key-replies/bodies"
@@ -750,6 +754,8 @@ kr_group_bounded() {
750
754
  eq "bounded:同一 store 的 list 照常(不读正文)" "$rc_noread_list" "0"
751
755
  eq "bounded:同一 store 的 summary 照常(不读正文)" "$rc_noread_sum" "0"
752
756
  kr_ev_save "$TMP/obs-noread-show.out" "obs-body-unreadable-show.txt"
757
+ # 读取量观测最后执行:上面的坏最新、不可枚举、正文不可读与权限恢复不依赖观测器。
758
+ kr_bounded_observe "$p" "$q" || return 1
753
759
  }
754
760
 
755
761
  # ---------------------------------------------------------------- 组:readonly
@@ -863,6 +869,31 @@ kr_flip_copy() { # → 独立 scratch 源码树
863
869
  }
864
870
  kr_hash_file() { sha256sum "$1" 2>/dev/null | cut -d' ' -f1; }
865
871
 
872
+ # full_scan probe 与缺席样本共用。能力判定必须先于 60/100000 槽准备。
873
+ flip_probe_full_scan() { # <proj> <body>
874
+ local p="$1" b="$2"
875
+ kr_io_supported || return 9 # 9 = 观测器缺席 → 具名跳过,不判红
876
+ local mid; mid="$(kr_new_proj "flip-scan-mid" --empty)" || return 1
877
+ kr_make_big_store "$mid" 60 || return 1
878
+ kr_make_big_store "$p" 100000 || return 1
879
+ # 观测前缀不能与夹具项目同名($TMP/flip-scan-mid 是项目目录,.io 会写到目录上)
880
+ kr_observe "$TMP/obs-flip-mid" bash -c "cd '$mid' && exec \"\$@\"" _ "${KR_CLEAN[@]}" "$KR_TEAM" --root "$mid" reply list --json
881
+ kr_observe "$TMP/obs-flip-big" bash -c "cd '$p' && exec \"\$@\"" _ "${KR_CLEAN[@]}" "$KR_TEAM" --root "$p" reply list --json
882
+ local big mid d brc
883
+ big="$(kr_obs_rchar "$TMP/obs-flip-big")"; mid="$(kr_obs_rchar "$TMP/obs-flip-mid")"
884
+ brc="$(kr_obs_rc "$TMP/obs-flip-big")"
885
+ d=$(( big - mid ))
886
+ printf 'flip/full_scan:big=%s mid=%s rc=%s Δrchar=%s\n' "$big" "$mid" "$brc" "$d" >>"$TMP/flip-scan.log"
887
+ [ "$d" -le 65536 ]
888
+ }
889
+
890
+ # flip_run 与短缺席样本共用的正常结果消费者。返回 0 表示已经按缺席收口;其它结果交回调用者。
891
+ kr_flip_absence_result() { # <arm> <probe rc>
892
+ local a="$1" r1="$2"
893
+ [ "$r1" = "9" ] || return 1
894
+ skip "flip/$a:观测器缺席($(kr_io_why))—— 该臂跳过,未得结论"
895
+ }
896
+
866
897
  kr_group_flip() {
867
898
  section "flip · 坏源码→红→还原→绿(2.4)"
868
899
  local B="$TMP/flip-body.md"; printf 'flip body\n' >"$B"
@@ -879,9 +910,7 @@ kr_group_flip() {
879
910
  if [ "$after_mut" = "$before_hash" ]; then bad "flip/$a:matched=0(源码没被改)"; return 1; fi
880
911
  KR_TEAM="$mutant/scripts/team" KR_SKILL="$mutant" "$probe" "$proj" "$B" >/dev/null 2>&1
881
912
  local r1=$?
882
- if [ "$r1" = "9" ]; then
883
- # 9 = 该臂依赖的观测器缺席:**可见跳过并点名**(不判红、也不算绿)
884
- skip "flip/$a:观测器缺席($(kr_io_why))—— 该臂跳过,未得结论"
913
+ if kr_flip_absence_result "$a" "$r1"; then
885
914
  rm -rf "$mutant"
886
915
  return 0
887
916
  fi
@@ -938,24 +967,7 @@ kr_group_flip() {
938
967
  }
939
968
  kr_flip_mutate_no_cursor() { perl -0pi -e 's/const nextBefore = oldest > 1 \? oldest : null/const nextBefore = null/' "$1"; }
940
969
  flip_run no_cursor flip_probe_no_cursor
941
- # 探针 ⑤:全历史读 → 一页读量越界。用内核计数器:10 万槽 store 的一页读取量必须与 60 槽 store
942
- # 的一页几乎相同;全扫会读 400 MB,任何一次采样都抓得住。观测器不可用 → 该臂**可见跳过**。
943
- flip_probe_full_scan() {
944
- local p="$1" b="$2"
945
- kr_io_supported || return 9 # 9 = 观测器缺席 → 具名跳过,不判红
946
- local mid; mid="$(kr_new_proj "flip-scan-mid" --empty)" || return 1
947
- kr_make_big_store "$mid" 60 || return 1
948
- kr_make_big_store "$p" 100000 || return 1
949
- # 观测前缀不能与夹具项目同名($TMP/flip-scan-mid 是项目目录,.io 会写到目录上)
950
- kr_observe "$TMP/obs-flip-mid" bash -c "cd '$mid' && exec \"\$@\"" _ "${KR_CLEAN[@]}" "$KR_TEAM" --root "$mid" reply list --json
951
- kr_observe "$TMP/obs-flip-big" bash -c "cd '$p' && exec \"\$@\"" _ "${KR_CLEAN[@]}" "$KR_TEAM" --root "$p" reply list --json
952
- local big mid d brc
953
- big="$(kr_obs_rchar "$TMP/obs-flip-big")"; mid="$(kr_obs_rchar "$TMP/obs-flip-mid")"
954
- brc="$(kr_obs_rc "$TMP/obs-flip-big")"
955
- d=$(( big - mid ))
956
- printf 'flip/full_scan:big=%s mid=%s rc=%s Δrchar=%s\n' "$big" "$mid" "$brc" "$d" >>"$TMP/flip-scan.log"
957
- [ "$d" -le 65536 ]
958
- }
970
+ # 探针 ⑤:全历史读 → 一页读量越界。probe 在组外,与短缺席样本共用。
959
971
  kr_flip_mutate_full_scan() { perl -0pi -e 's/entries\.length < LIST_PAGE/entries.length < slots/' "$1"; }
960
972
  flip_run full_scan flip_probe_full_scan
961
973
  # 探针 ⑥:跟随软链 → 外根文件被当索引读
@@ -1009,45 +1021,230 @@ kr_group_flip() {
1009
1021
  flip_run no_enumerate flip_probe_no_enumerate
1010
1022
  }
1011
1023
 
1012
- # ---------------------------------------------------------------- 组:skip-path(M3)
1024
+ # ---------------------------------------------------------------- skip-path 的短缺席样本
1025
+ kr_skip_sample_index_facts() { # <owned root> <before|after>;只报事实,不记产品通过/失败
1026
+ local root="$1" when="$2"
1027
+ local bp="$root/bounded-project/.pi/team/state/key-replies/index.v1"
1028
+ local fp="$root/full-scan-project/.pi/team/state/key-replies/index.v1"
1029
+ local indexes count bi=absent fi=absent
1030
+ [ ! -e "$bp" ] || bi=present
1031
+ [ ! -e "$fp" ] || fi=present
1032
+ indexes="$(find "$root" -type f -name index.v1 -print)"
1033
+ if [ -n "$indexes" ]; then count="$(printf '%s\n' "$indexes" | wc -l | tr -d ' ')"; else count=0; fi
1034
+ printf 'reply-observer-sample-%s: bounded-index=%s full-scan-index=%s prepared-indexes=%s\n' \
1035
+ "$when" "$bi" "$fi" "$count"
1036
+ if [ "$count" -gt 0 ]; then printf 'reply-observer-sample-index: %s\n' "$indexes"; fi
1037
+ }
1038
+
1039
+ kr_skip_sample_collect() {
1040
+ # 命令替换会捕获 fd 1;fd 3 也必须改向,否则 kr_paths_check 等报告行会泄进父日志。
1041
+ local PASS=0 FAIL=0 SKIP=0 GROUP_PASS=0 GROUP_FAIL=0 KR_REPORT_FD=1
1042
+ exec 3>&1
1043
+ local root="$TMP/reply-observer-absence-sample"
1044
+ rm -rf "$root"
1045
+ local bp="$root/bounded-project" fp="$root/full-scan-project"
1046
+ mkdir -p "$bp/.pi/team" "$fp/.pi/team"
1047
+ local body="$root/body.md"; printf 'absence sample\n' >"$body"
1048
+ kr_skip_sample_index_facts "$root" before
1049
+
1050
+ kr_driver_observer_notice
1051
+ kr_bounded_observe "$bp" "$bp"
1052
+ local bounded_rc=$?
1053
+ if [ "$bounded_rc" -ne 0 ]; then bad "reply-observer sample:bounded 观测入口异常返回 rc=$bounded_rc"; fi
1054
+
1055
+ flip_probe_full_scan "$fp" "$body"
1056
+ local full_rc=$?
1057
+ if kr_flip_absence_result full_scan "$full_rc"; then
1058
+ :
1059
+ elif [ "$full_rc" -eq 0 ]; then
1060
+ ok "reply-observer sample:flip/full_scan 被误算为观测通过"
1061
+ else
1062
+ bad "reply-observer sample:flip/full_scan 被误判为产品失败(rc=$full_rc)"
1063
+ fi
1064
+
1065
+ # 清理前留下文件事实;判定同时要求 before/after 都没有任何观测专属索引。
1066
+ kr_skip_sample_index_facts "$root" after
1067
+ printf '\n== reply-observer absence sample 结果 == ✓%s ✗%s SKIP%s\n' "$PASS" "$FAIL" "$SKIP"
1068
+ [ "$FAIL" -eq 0 ]
1069
+ }
1070
+
1071
+ kr_skip_sample_clean() {
1072
+ printf '%s\n' "$1" | sed 's/\x1b\[[0-9;]*m//g'
1073
+ }
1074
+
1075
+ kr_skip_sample_diagnose() { # <sample output> → 失败时只返回缺项文本,不打父级断言
1076
+ local clean reason id want count misses=""
1077
+ clean="$(kr_skip_sample_clean "$1")"
1078
+ reason="$(TEAM_REPLY_NO_PROC_IO=1 kr_io_why)"
1079
+ for id in driver bounded full_scan; do
1080
+ case "$id" in
1081
+ driver) want="key-replies: 可见跳过 —— /proc/<pid>/io 不可读(${reason}):bounded 的读取量断言与 flip/full_scan 会点名跳过" ;;
1082
+ bounded) want=" SKIP bounded:缺 /proc/<pid>/io(${reason})—— 读取量断言跳过(点名:内核计数器不可读)" ;;
1083
+ full_scan) want=" SKIP flip/full_scan:观测器缺席(${reason})—— 该臂跳过,未得结论" ;;
1084
+ esac
1085
+ count="$(printf '%s\n' "$clean" | grep -Fxc -- "$want")"
1086
+ if [ "$count" -ne 1 ]; then misses+="${id}诊断=${count}次;"; fi
1087
+ done
1088
+ [ -z "$misses" ] || printf '%s' "$misses"
1089
+ [ -z "$misses" ]
1090
+ }
1091
+
1092
+ kr_skip_sample_judge() { # <real rc> <sample output> → 0 证据完整;1 输出具体差异
1093
+ local rc="$1" out="$2" clean misses="" detail
1094
+ clean="$(kr_skip_sample_clean "$out")"
1095
+ if detail="$(kr_skip_sample_diagnose "$out")"; then :; else misses+="诊断[$detail];"; fi
1096
+ if [ "$rc" -ne 0 ]; then misses+="真实退出=${rc};"; fi
1097
+
1098
+ local result='== reply-observer absence sample 结果 == ✓0 ✗0 SKIP2'
1099
+ local result_count
1100
+ result_count="$(printf '%s\n' "$clean" | grep -Fxc -- "$result")"
1101
+ if [ "$result_count" -ne 1 ]; then misses+="完整结果行=${result_count}份;"; fi
1102
+ if [ "$(printf '%s\n' "$clean" | tail -1)" != "$result" ]; then misses+="结果行不是末行;"; fi
1103
+ if printf '%s\n' "$clean" | grep -Fq '== P234 key-replies 结果 =='; then misses+="子样本混入父级结果前缀;"; fi
1104
+
1105
+ local skip_count pass_lines fail_lines
1106
+ skip_count="$(printf '%s\n' "$clean" | awk 'index($0,"SKIP") && index($0,"== reply-observer absence sample 结果 ==") != 1 {n++} END {print n+0}')"
1107
+ if [ "$skip_count" -ne 2 ]; then misses+="观测跳过数=${skip_count}(应为2);"; fi
1108
+ pass_lines="$(printf '%s\n' "$clean" | awk 'index($0,"✓") && index($0,"== reply-observer absence sample 结果 ==") != 1 {print}')"
1109
+ fail_lines="$(printf '%s\n' "$clean" | awk 'index($0,"✗") && index($0,"== reply-observer absence sample 结果 ==") != 1 {print}')"
1110
+ if [ -n "$pass_lines" ]; then misses+="意外通过[$(printf '%s' "$pass_lines" | head -1)];"; fi
1111
+ if [ -n "$fail_lines" ]; then misses+="意外失败[$(printf '%s' "$fail_lines" | head -1)];"; fi
1112
+
1113
+ local before after
1114
+ before='reply-observer-sample-before: bounded-index=absent full-scan-index=absent prepared-indexes=0'
1115
+ after='reply-observer-sample-after: bounded-index=absent full-scan-index=absent prepared-indexes=0'
1116
+ if ! printf '%s\n' "$clean" | grep -Fqx -- "$before"; then misses+="准备顺序[调用前索引事实缺失];"; fi
1117
+ if ! printf '%s\n' "$clean" | grep -Fqx -- "$after"; then
1118
+ detail="$(printf '%s\n' "$clean" | grep -E '^reply-observer-sample-(after|index):' | tr '\n' ' ')"
1119
+ misses+="准备顺序[${detail:-调用后索引事实缺失}];"
1120
+ fi
1121
+ [ -z "$misses" ] || printf '%s' "$misses"
1122
+ [ -z "$misses" ]
1123
+ }
1124
+
1125
+ kr_skip_control_red() { # <label> <judge 必须点名的文本>;在当前 subshell 的函数覆盖下收集
1126
+ local label="$1" expect="$2" out rc jout jrc
1127
+ if out="$(TEAM_REPLY_NO_PROC_IO=1 kr_skip_sample_collect 2>&1)"; then rc=0; else rc=$?; fi
1128
+ if jout="$(kr_skip_sample_judge "$rc" "$out")"; then jrc=0; else jrc=$?; fi
1129
+ {
1130
+ printf '\n=== %s · sample rc=%s judge rc=%s ===\n%s\n--- judgement ---\n%s\n' \
1131
+ "$label" "$rc" "$jrc" "$out" "$jout"
1132
+ } >>"$TMP/skip-path-controls.log"
1133
+ [ "$jrc" -ne 0 ] && case "$jout" in *"$expect"*) return 0 ;; esac
1134
+ return 1
1135
+ }
1136
+
1137
+ kr_skip_control_green() { # <label>;离开覆盖 subshell 后用真实函数收集并判定
1138
+ local label="$1" out rc jout jrc
1139
+ if out="$(TEAM_REPLY_NO_PROC_IO=1 kr_skip_sample_collect 2>&1)"; then rc=0; else rc=$?; fi
1140
+ if jout="$(kr_skip_sample_judge "$rc" "$out")"; then jrc=0; else jrc=$?; fi
1141
+ {
1142
+ printf '\n=== %s · sample rc=%s judge rc=%s ===\n%s\n--- judgement ---\n%s\n' \
1143
+ "$label" "$rc" "$jrc" "$out" "$jout"
1144
+ } >>"$TMP/skip-path-controls.log"
1145
+ [ "$rc" -eq 0 ] && [ "$jrc" -eq 0 ]
1146
+ }
1147
+
1148
+ kr_skip_preparation_control() {
1149
+ local failed=0
1150
+ (
1151
+ # 保存原函数后在当前 subshell 覆盖:先真实建一槽,再委托原缺席处理,绝不递归进入 skip-path。
1152
+ eval "$(declare -f kr_bounded_observe | sed '1s/^kr_bounded_observe /kr_bounded_observe_delegated /')"
1153
+ kr_bounded_observe() {
1154
+ kr_make_big_store "$1" 1 || return 1
1155
+ kr_bounded_observe_delegated "$@"
1156
+ }
1157
+ kr_skip_control_red preparation-order 准备顺序
1158
+ ) || failed=1
1159
+ kr_skip_control_green preparation-restore || failed=1
1160
+ return "$failed"
1161
+ }
1162
+
1163
+ kr_skip_negative_diagnostics() {
1164
+ local failed=0
1165
+ ( kr_driver_observer_notice() { return 0; }
1166
+ kr_skip_control_red missing-driver driver ) || failed=1
1167
+ kr_skip_control_green missing-driver-restore || failed=1
1168
+ (
1169
+ kr_bounded_observe() {
1170
+ skip "unrelated:任意跳过①"; skip "unrelated:任意跳过②"; skip "unrelated:任意跳过③"
1171
+ }
1172
+ kr_skip_control_red missing-bounded-with-unrelated-skips bounded
1173
+ ) || failed=1
1174
+ kr_skip_control_green missing-bounded-restore || failed=1
1175
+ ( kr_flip_absence_result() { return 0; }
1176
+ kr_skip_control_red missing-full-scan full_scan ) || failed=1
1177
+ kr_skip_control_green missing-full-scan-restore || failed=1
1178
+ if [ "$failed" -eq 0 ]; then
1179
+ ok "skip-path:反例·三处诊断各自不可缺,无关 SKIP 不能顶数且逐项还原"
1180
+ else
1181
+ bad "skip-path:反例·缺诊断判定或还原不成立(详见 skip-path-controls.log)"
1182
+ fi
1183
+ }
1184
+
1185
+ kr_skip_negative_success() {
1186
+ local failed=0
1187
+ ( kr_bounded_observe() { ok "bounded:读取量被误算通过"; }
1188
+ kr_skip_control_red bounded-false-success 意外通过 ) || failed=1
1189
+ kr_skip_control_green bounded-false-success-restore || failed=1
1190
+ ( flip_probe_full_scan() { return 0; }
1191
+ kr_skip_control_red full-scan-false-success 意外通过 ) || failed=1
1192
+ kr_skip_control_green full-scan-false-success-restore || failed=1
1193
+ if [ "$failed" -eq 0 ]; then
1194
+ ok "skip-path:反例·bounded/full_scan 缺席都不能误算观测通过且逐项还原"
1195
+ else
1196
+ bad "skip-path:反例·误算成功的判定或还原不成立(详见 skip-path-controls.log)"
1197
+ fi
1198
+ }
1199
+
1200
+ kr_skip_negative_failure() {
1201
+ local failed=0
1202
+ ( kr_bounded_observe() { bad "bounded:被误判为产品失败"; return 1; }
1203
+ kr_skip_control_red bounded-false-failure 意外失败 ) || failed=1
1204
+ kr_skip_control_green bounded-false-failure-restore || failed=1
1205
+ ( flip_probe_full_scan() { return 1; }
1206
+ kr_skip_control_red full-scan-false-failure 意外失败 ) || failed=1
1207
+ kr_skip_control_green full-scan-false-failure-restore || failed=1
1208
+ if [ "$failed" -eq 0 ]; then
1209
+ ok "skip-path:反例·bounded/full_scan 缺席都不能误判产品失败且逐项还原"
1210
+ else
1211
+ bad "skip-path:反例·误判产品失败的判定或还原不成立(详见 skip-path-controls.log)"
1212
+ fi
1213
+ }
1214
+
1215
+ # ---------------------------------------------------------------- 组:skip-path(七条旧判断 → 六条聚焦判断)
1013
1216
  kr_group_skip_path() {
1014
- section "skip-path · 缺观测器时可见跳过并点名(M3)"
1015
- # 旋钮本身生效(否则下面的子进程证明是空对空)
1217
+ section "skip-path · 缺观测器短样本与结果分类"
1016
1218
  if TEAM_REPLY_NO_PROC_IO=1 bash -c '. "$1"; kr_io_supported' _ "$SELF_DIR/lib/proc-io.sh"; then
1017
1219
  bad "skip-path:TEAM_REPLY_NO_PROC_IO=1 没有让观测器判为不可用(旋钮失效)"
1018
1220
  else
1019
1221
  ok "skip-path:旋钮让观测器判为不可用"
1020
1222
  fi
1021
- # 子进程里跑 bounded + flip:必须点名跳过、没有 ✗、退出 0(可见跳过 ≠ 静默通过,也 ≠ 红)
1022
- local out="$TMP/skip-path.out" rc
1023
- # P357/P324:嵌套子进程跑的是**用完就扔**的隔离基,门禁的 `--keep` 说的是它自己那个根。继承了保留
1024
- # 开关时子进程末行会变成「保留临时根:…」而不是结果行 —— 那条断言测的「跑完整轮」就永远不成立。
1025
- TEAM_REPLY_NO_PROC_IO=1 env -u TEAM_TMP_KEEP timeout 900 bash "$SELF_DIR/key-replies.sh" --select bounded,flip >"$out" 2>&1; rc=$?
1026
- # 实质判据有两条:子进程跑完了整轮(末行是结果行且 ✗0)且没有红行。失败时**重跑一次带 trace**
1027
- # 只为取证(不是掩盖红:红照旧判红,只是把成因写进断言与证据包)。
1028
- local last
1029
- last="$(tail -1 "$out" 2>/dev/null | sed 's/\x1b\[[0-9;]*m//g')"
1030
- case "$last" in
1031
- *"✗0"*) ok "skip-path:缺观测器时子进程跑完整轮且 ✗0(末行:${last})" ;;
1032
- *)
1033
- local trace="$TMP/skip-path-trace.out"
1034
- TEAM_REPLY_NO_PROC_IO=1 env -u TEAM_TMP_KEEP timeout 600 bash -x "$SELF_DIR/key-replies.sh" --select bounded,flip >"$trace" 2>&1
1035
- kr_ev_save "$trace" "skip-path-failure-trace.txt"
1036
- bad "skip-path:子进程没跑完整轮(末行=[${last:-<空>}],rc=$rc,子进程日志长度=$(stat -c %s "$out" 2>/dev/null || echo 0))—— 带 trace 的重跑见证据包 skip-path-failure-trace.txt;trace 尾部=[$(tail -3 "$trace" 2>/dev/null | tr '\n' ' ' | cut -c1-200)]"
1037
- ;;
1038
- esac
1039
- has "skip-path:点名缺 /proc/<pid>/io" "$(cat "$out")" "缺 /proc/<pid>/io"
1040
- has "skip-path:bounded 的读取量断言点名跳过" "$(cat "$out")" "读取量断言跳过"
1041
- has "skip-path:flip/full_scan 也点名跳过" "$(cat "$out")" "flip/full_scan:观测器缺席"
1042
- local reds; reds="$(grep '✗' "$out" 2>/dev/null | grep -v '结果 ==' || true)"
1043
- if [ -n "$reds" ]; then
1044
- bad "skip-path:跳过路径里出现了红($(printf '%s' "$reds" | head -1 | cut -c1-120))"
1223
+
1224
+ : >"$TMP/skip-path-controls.log"
1225
+ local out rc diag judge
1226
+ if out="$(TEAM_REPLY_NO_PROC_IO=1 kr_skip_sample_collect 2>&1)"; then rc=0; else rc=$?; fi
1227
+ printf '%s\n' "$out" >"$TMP/skip-path.out"
1228
+ if diag="$(kr_skip_sample_diagnose "$out")"; then
1229
+ ok "skip-path:驱动/bounded/full_scan 三条缺席诊断及理由完整"
1045
1230
  else
1046
- ok "skip-path:跳过路径里没有红(结果行的 ✗0 不算)"
1231
+ bad "skip-path:缺席诊断集合不完整($diag)"
1047
1232
  fi
1048
- local skips; skips="$(grep -c 'SKIP' "$out" 2>/dev/null || echo 0)"
1049
- if [ "$skips" -ge 3 ]; then ok "skip-path:子进程打印了 $skips 条可见跳过"; else bad "skip-path:可见跳过只有 $skips 条"; fi
1050
- kr_ev_save "$out" "skip-path-bounded-flip.txt"
1233
+ if judge="$(kr_skip_sample_judge "$rc" "$out")"; then
1234
+ if kr_skip_preparation_control; then
1235
+ ok "skip-path:样本 rc=0、✓0 ✗0 SKIP2、无索引;一槽准备反例及还原创立"
1236
+ else
1237
+ bad "skip-path:准备顺序反例或还原不成立(详见 skip-path-controls.log)"
1238
+ fi
1239
+ else
1240
+ # 父级唯一定位标签:外部损坏/吞错对照靠它证明普通样本失败确实被消费。
1241
+ bad "skip-path:缺席诊断/分类不完整($judge;样本rc=$rc)"
1242
+ fi
1243
+ kr_skip_negative_diagnostics
1244
+ kr_skip_negative_success
1245
+ kr_skip_negative_failure
1246
+ kr_ev_save "$TMP/skip-path.out" "skip-path-focused-sample.txt"
1247
+ kr_ev_save "$TMP/skip-path-controls.log" "skip-path-focused-controls.txt"
1051
1248
  }
1052
1249
 
1053
1250
  # ---------------------------------------------------------------- 组:guide(change: pi-marker-key-replies · P396;判据面沿用 P267/P301)
@@ -1395,11 +1592,15 @@ kr_group_guide() {
1395
1592
  }
1396
1593
 
1397
1594
  # ---------------------------------------------------------------- 驱动
1595
+ kr_driver_observer_notice() {
1596
+ if ! kr_io_supported; then
1597
+ printf 'key-replies: 可见跳过 —— /proc/<pid>/io 不可读(%s):bounded 的读取量断言与 flip/full_scan 会点名跳过\n' \
1598
+ "$(kr_io_why)" >&2
1599
+ fi
1600
+ }
1601
+
1398
1602
  if [ -n "$KR_EV" ]; then mkdir -p "$KR_EV" 2>/dev/null || true; kr_ev_note "run start $(date -u +%Y-%m-%dT%H:%M:%SZ)"; fi
1399
- if ! kr_io_supported; then
1400
- printf 'key-replies: 可见跳过 —— /proc/<pid>/io 不可读(%s):bounded 的读取量断言与 flip/full_scan 会点名跳过\n' \
1401
- "$(kr_io_why)" >&2
1402
- fi
1603
+ kr_driver_observer_notice
1403
1604
 
1404
1605
  kr_group_capture() {
1405
1606
  section 'capture:真 parser/source/writer 与隔离 Pi 生命周期'
@@ -16,6 +16,10 @@
16
16
  # main_team_volatile <./relpath> → 0 = the shape is allowed to move
17
17
  # main_team_violations <before> <after> → one path per non-whitelisted change
18
18
  # main_team_volatile_changes <b> <a> → count of whitelisted changes (proves the check sees motion)
19
+ # main_team_touched <b> <a> <./prefix> → one path per file under the prefix that appeared, vanished
20
+ # or changed (the accident-shape probe: "this run must not
21
+ # have written it", which stays true when the path is a
22
+ # legitimate runtime file the real team owns)
19
23
  #
20
24
  # MAIN_TEAM_BREAK=skip-state is the fixtures' own red side: it restores the old "skip state/" shape so
21
25
  # a stray file there stops being reported. Product code never reads it.
@@ -59,7 +63,7 @@ main_team_volatile() { # <relative path, starting with ./ >
59
63
  inbox-*|pm-*|pm.*|dispatch-*|draft-*|held) return 0 ;;
60
64
  notify*|nudge*|watchdog*|capacity*|digest-*|deaths.*|bg.log|panel*) return 0 ;;
61
65
  changes.json|refs|pane|_watch.*|reload-requested|interrupt.*|update-check.*|config.*) return 0 ;;
62
- summary-*|prompt-*|pm-loaded.*|pm-launch*) return 0 ;;
66
+ summary-*|prompt-*|pm-launch*) return 0 ;;
63
67
  esac
64
68
  return 1 ;;
65
69
  esac
@@ -94,6 +98,18 @@ main_team_volatile_changes() { # <before> <after> → number of whitelisted path
94
98
  printf '%s\n' "$n"
95
99
  }
96
100
 
101
+ # The accident-shape probe. "This path must not exist" is the wrong judgement for a live project: the
102
+ # team legitimately owns e.g. state/standby until it migrates. The judgement that stays true is "this
103
+ # run did not create, change or remove it", which covers a file that was never there and one that was.
104
+ main_team_touched() { # <before> <after> <./prefix> → one path per file under the prefix that moved
105
+ local before="$1" after="$2" prefix="$3" path b a
106
+ join -t "$(printf '\t')" -a1 -a2 -e MISSING -o '0,1.2,2.2' "$before" "$after" |
107
+ while IFS="$(printf '\t')" read -r path b a; do
108
+ [ "$b" = "$a" ] && continue
109
+ case "$path" in "$prefix"|"$prefix"/*) printf '%s\n' "$path" ;; esac
110
+ done
111
+ }
112
+
97
113
  # The proof target is this project's **main checkout**, never this worktree: the fixture runs from a
98
114
  # worktree while the authority must never land in the main checkout.
99
115
  main_team_project_root() { # <skill-dir> → the main checkout (empty when this checkout has none)