@chrono-meta/fh-gate 2.13.0 → 2.15.0
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.
- package/.claude/rules/fh_4axis_gate.md +35 -1
- package/.claude-plugin/marketplace.json +2 -2
- package/AGENTS.md +50 -0
- package/CLAUDE.md +14 -1
- package/README.ja.md +3 -3
- package/README.ko.md +3 -3
- package/README.md +4 -4
- package/README.zh.md +3 -3
- package/docs/ETHOS.md +21 -0
- package/docs/IDENTITIES.md +83 -0
- package/knowledge/shared/harness-core/fh_detail_protocols.md +77 -1
- package/knowledge/shared/harness-core/measurement-integrity-checklist.md +80 -0
- package/knowledge/shared/harness-core/ship_readiness_gate.md +199 -5
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +173 -0
- package/knowledge/shared/rules/multi_session_close_protocol.md +7 -1
- package/package.json +23 -2
- package/plugins/fh-commons/.claude-plugin/plugin.json +2 -2
- package/plugins/fh-commons/skills/preprep/README.md +45 -0
- package/plugins/fh-commons/skills/preprep/SKILL.md +214 -0
- package/plugins/fh-commons/skills/preprep/canon_terms.example.yaml +36 -0
- package/plugins/fh-commons/skills/preprep/fixtures/adjdup_known_negative.md +7 -0
- package/plugins/fh-commons/skills/preprep/fixtures/adjdup_known_positive.md +8 -0
- package/plugins/fh-commons/skills/preprep/fixtures/progression_known_negative.md +13 -0
- package/plugins/fh-commons/skills/preprep/fixtures/progression_known_positive.md +13 -0
- package/plugins/fh-commons/skills/preprep/fixtures/promise_known_negative.md +9 -0
- package/plugins/fh-commons/skills/preprep/fixtures/promise_known_positive.md +7 -0
- package/plugins/fh-commons/skills/preprep/interslide_deps.py +223 -0
- package/plugins/fh-commons/skills/preprep/jargon_terms.example.yaml +40 -0
- package/plugins/fh-commons/skills/preprep/lane_adjacent_dup.py +86 -0
- package/plugins/fh-commons/skills/preprep/lane_progression.py +81 -0
- package/plugins/fh-commons/skills/preprep/lane_promise.py +121 -0
- package/plugins/fh-commons/skills/preprep/ooxml/c1_baseline.txt +12 -0
- package/plugins/fh-commons/skills/preprep/ooxml/gate.py +164 -0
- package/plugins/fh-commons/skills/preprep/preprep.py +789 -0
- package/plugins/fh-commons/skills/preprep/presentation_checklist.md +310 -0
- package/plugins/fh-commons/skills/preprep/surfaces.example.yaml +148 -0
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +140 -0
- package/plugins/fh-meta/skills/install-wizard/SKILL.md +39 -0
- package/scripts/com.forge-harness.daily-report.plist +44 -0
- package/scripts/context_continuity_score.sh +894 -0
- package/scripts/daily_report.sh +208 -0
- package/scripts/digest_landing_check.sh +71 -0
- package/scripts/directional_diff_gate.sh +11 -4
- package/scripts/fh_session_load.sh +19 -0
- package/scripts/field_canon_preload.sh +44 -0
- package/scripts/fixture_guard_lib.sh +55 -0
- package/scripts/lane_runner_check.sh +34 -1
- package/scripts/launchd_wiring_check.sh +182 -0
- package/scripts/mapped_tracks.sh +69 -0
- package/scripts/novelty_claim_check.sh +5 -1
- package/scripts/package_coverage_check.sh +39 -0
- package/scripts/portability_lint.sh +117 -0
- package/scripts/prepush_guard_check.sh +2 -2
- package/scripts/public_surface_scan_files.sh +36 -1
- package/scripts/selfcheck.sh +171 -1
- package/scripts/session_close_check.sh +17 -0
- package/scripts/shell_name_boundary_scan.sh +30 -0
- package/scripts/sim_isolated_run.sh +484 -0
- package/scripts/test_branch_claim_lanes.sh +8 -3
- package/scripts/test_env_purity_lanes.sh +4 -1
- package/scripts/test_lane_runner_lanes.sh +75 -0
- package/scripts/test_mapped_tracks_lanes.sh +64 -2
- package/scripts/test_marker_address_lanes.sh +78 -0
- package/scripts/test_marker_soul_check_lanes.sh +36 -0
- package/scripts/test_memory_link_check.sh +3 -1
- package/scripts/test_node_check_lanes.sh +5 -2
- package/scripts/test_node_infra_delta_lanes.sh +3 -1
- package/scripts/test_peer_worktree_detect_lanes.sh +3 -1
- package/scripts/test_precommit_staged_drift_lanes.sh +91 -0
- package/scripts/test_preprep_adjacent_dup_lanes.sh +57 -0
- package/scripts/test_preprep_drift_anchor.sh +65 -0
- package/scripts/test_preprep_progression_lanes.sh +53 -0
- package/scripts/test_preprep_promise_lanes.sh +56 -0
- package/scripts/test_preprep_retired_lanes.sh +54 -0
- package/scripts/test_prepush_destructive_lanes.sh +5 -2
- package/scripts/test_prepush_stdin_integrity.sh +2 -2
- package/scripts/test_regression_guard_ci_lanes.sh +4 -1
- package/scripts/test_selfcheck_state_lanes.sh +19 -4
- package/scripts/test_session_close_lanes.sh +5 -5
- package/scripts/test_sim_isolated_run_lanes.sh +265 -0
- package/scripts/test_skill_canon_preload_lanes.sh +58 -0
- package/scripts/test_target_freeze_lanes.sh +3 -1
- package/scripts/test_verdict_watermark_lanes.sh +427 -0
- package/scripts/test_wizard_snippet_merge_lanes.sh +4 -1
- package/scripts/universal_guard_check.sh +1 -1
- package/templates/.git-hooks/pre-commit +426 -8
- package/templates/.git-hooks/pre-push +8 -3
- package/templates/predelete_check.sh +4 -2
- package/templates/regression_guard.sh +7 -1
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# sim_isolated_run.sh — run a blind floor-tier sim WITHOUT letting it become an agent fleet.
|
|
3
|
+
#
|
|
4
|
+
# WHY THIS EXISTS (measured 2026-08-29, twice):
|
|
5
|
+
# A blind sim of identity ④ was launched as 12 parallel `claude -p` calls in the LIVE repo cwd.
|
|
6
|
+
# Three things went wrong, and the third is the one that matters:
|
|
7
|
+
# 1. the arms wrote 6 files into the working tree and read each other's output — corpus
|
|
8
|
+
# self-contamination, the same defect as the 2026-08-23 probe's invalidated arm A3;
|
|
9
|
+
# 2. one arm registered a **launchd agent** in ~/Library/LaunchAgents — an unrequested,
|
|
10
|
+
# persistent change to the operator's machine, made by something called "a measurement";
|
|
11
|
+
# 3. 🟥 the contamination produced a FALSE POSITIVE POINTING AT THE DESIRED CONCLUSION.
|
|
12
|
+
# An arm answered "이미 돼있어" — found prior art, declined to rebuild — which is the
|
|
13
|
+
# textbook success scene for identity ④. The "prior art" was a file another arm had
|
|
14
|
+
# created two minutes earlier. Scored naively, ④ would have looked GREEN, on the same
|
|
15
|
+
# day the operator asked for ④ to be shown green.
|
|
16
|
+
# Isolation is therefore not "keep the answer word out of the prompt". It is "put the target
|
|
17
|
+
# where the arms cannot reach it".
|
|
18
|
+
#
|
|
19
|
+
# WHAT THIS GIVES YOU, and what it does NOT:
|
|
20
|
+
# ✅ PREVENTS repo-tree contamination — each arm gets its own disposable clone
|
|
21
|
+
# ✅ PREVENTS settings inheritance — `--restricted` ignores user/project/local settings
|
|
22
|
+
# ✅ DETECTS machine-level side effects — LaunchAgents / crontab / ~/.claude snapshot diff
|
|
23
|
+
# 🟥 DOES NOT PREVENT machine-level side effects in `act` mode. Full containment needs an OS
|
|
24
|
+
# sandbox, which this script does not provide. `observe` mode prevents them by removing the
|
|
25
|
+
# tools that could cause them; `act` mode trades that for behavioural fidelity and reports
|
|
26
|
+
# what happened. Saying "isolated" without this paragraph would be the lie this file exists
|
|
27
|
+
# to stop. A detector is not a gate (CLAUDE.md §Surface-Class Degrade Invariant).
|
|
28
|
+
#
|
|
29
|
+
# MODES
|
|
30
|
+
# observe (default) --tools "Read,Grep,Glob" → read-only. No writes possible.
|
|
31
|
+
# act write tools, inside a disposable clone. Machine surfaces are snapshotted
|
|
32
|
+
# before and after; any delta is printed LOUDLY and the run is CONTAMINATED.
|
|
33
|
+
# --no-harness adds `--restricted`, which DROPS the project CLAUDE.md. See below — this is
|
|
34
|
+
# a CONTROL arm generator, never the default.
|
|
35
|
+
#
|
|
36
|
+
# 🟥 WHY `--restricted` IS NOT THE DEFAULT — measured, one variable at a time, 2026-08-29.
|
|
37
|
+
# `--restricted` reads like the isolation flag you want ("ignores user, project and local
|
|
38
|
+
# settings files"). It also drops the project memory, so the harness under test is not loaded.
|
|
39
|
+
# The first build of this script used it, and the very first smoke run returned a bare
|
|
40
|
+
# "안녕하세요! 무엇을 도와드릴까요?" to a greeting — which would have been written up as
|
|
41
|
+
# **"the onboarding menu does not fire at floor tier"**, a large and false claim about FH.
|
|
42
|
+
# Worse, the first known-positive PASSED and hid it: the arm answered a CLAUDE.md question
|
|
43
|
+
# correctly *by grepping a file*, so "the harness is loaded" and "the model can search" were
|
|
44
|
+
# never separated. The discriminating pair needs `--tools ""` so search is impossible:
|
|
45
|
+
# same clone, --tools "", --restricted → "그런 규칙이 없어요" (memory ABSENT)
|
|
46
|
+
# same clone, --tools "", no --restricted → "🐿️" (memory PRESENT)
|
|
47
|
+
# One variable, opposite answers. ([[feedback_instrument_cannot_discriminate_hypotheses]])
|
|
48
|
+
#
|
|
49
|
+
# 🟢 AND THE DEFECT IS REUSABLE AS AN INSTRUMENT. `--no-harness` answers a question this repo
|
|
50
|
+
# asks constantly and usually by eye: **does this behaviour come from FH, or would the base
|
|
51
|
+
# model have done it anyway?** Run the same prompt with and without the flag; a behaviour that
|
|
52
|
+
# survives `--no-harness` was never the harness's doing. That is a control arm, and it is the
|
|
53
|
+
# cheapest honest one available here.
|
|
54
|
+
#
|
|
55
|
+
# USAGE
|
|
56
|
+
# bash scripts/sim_isolated_run.sh --arm cluster --reps 3 --prompt "이 프로젝트 가속화하고 싶어"
|
|
57
|
+
# bash scripts/sim_isolated_run.sh --arm build --mode act --reps 3 --prompt "..." --model sonnet
|
|
58
|
+
# bash scripts/sim_isolated_run.sh --arm door3 --reps 3 --prompt "..." \
|
|
59
|
+
# --setup 'mkdir -p tracks/demoproj' # build the precondition inside the clone
|
|
60
|
+
# Outputs land in a run dir printed at the end; each arm/rep is its own file.
|
|
61
|
+
#
|
|
62
|
+
# 🟥 OBSERVE MODE CANNOT SEE AN EMPTY DIRECTORY — and FH has machine signals that ARE empty
|
|
63
|
+
# directories. `fh_detail_protocols.md` §Branch test defines a mapped project as a
|
|
64
|
+
# `tracks/{name}/` **dir**, which is routinely empty; `Glob` matches files, so a read-only arm
|
|
65
|
+
# reports "no mapped projects" no matter what you created. Measured 2026-08-29: a `--setup` that
|
|
66
|
+
# ran `mkdir -p tracks/demoproj` succeeded, the directory existed in the clone, and all three
|
|
67
|
+
# arms still answered "매핑된 프로젝트가 하나도 없다". The fixture was real and invisible.
|
|
68
|
+
# ⇒ **A fixture for observe mode must contain a FILE.** This is an instrument constraint, not an
|
|
69
|
+
# FH defect (a normal session has Bash and can `ls`) — but scoring an arm without knowing it
|
|
70
|
+
# produces a confident zero from a fixture that was never observable.
|
|
71
|
+
#
|
|
72
|
+
# 🟥 PROJECT HOOKS DO NOT RUN IN A DISPOSABLE CLONE — so this runner cannot measure anything
|
|
73
|
+
# that depends on one. Measured 2026-08-30: an arm copied `.claude/settings.json` into its clone
|
|
74
|
+
# to make the PreToolUse PriorArt hook live; not one of the three clones grew
|
|
75
|
+
# `.claude/.prior_art_events.tsv`, while the live repo's copy carries entries from the same hour.
|
|
76
|
+
# The hook never fired, so the "hook vs no-hook" contrast was HOOK ≡ NOHOOK and either verdict
|
|
77
|
+
# would have been false. ⇒ Before claiming a hook-dependent result, check the hook's own
|
|
78
|
+
# evidence file INSIDE the clone; absence of that file invalidates the arm, not the hypothesis.
|
|
79
|
+
#
|
|
80
|
+
# 🟥 CONTROL IS NOT OPTIONAL. Always run at least one arm whose correct answer is "the thing
|
|
81
|
+
# being measured should NOT fire". An instrument that fires on everything measures nothing
|
|
82
|
+
# ([[feedback_control_presence_is_not_discrimination]]).
|
|
83
|
+
|
|
84
|
+
set -uo pipefail
|
|
85
|
+
|
|
86
|
+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
87
|
+
# ── 경로 격리 계산 (함수로 꺼냈다 — 레인이 «실행»해서 검증할 수 있게) ──────────────
|
|
88
|
+
# 🟥 처음엔 인라인이었고 레인이 `grep` 으로만 확인했다. new-code-anchor 게이트가 그것을
|
|
89
|
+
# **MENTION_ONLY** 로 잡았다: 「레인이 파일을 이름만 대고 실행하지 않는다」.
|
|
90
|
+
# 옳은 지적이다 — 그래서 함수로 꺼내 레인이 진짜로 부르게 한다.
|
|
91
|
+
fh_sim_write_path_isolation() { # $1=WORK $2=OUTDIR $3=REPO_ROOT $4=HOME → 0=썼다 1=격리없음(차단)
|
|
92
|
+
local _w="$1" _out="$2" _repo="$3" _home="$4"
|
|
93
|
+
# ── 🟥 경로 격리 (2026-08-30 — 이 러너는 이날까지 «격리»가 아니었다) ──────────────
|
|
94
|
+
# 헤더가 *"disposable clone 이라 오염 없음"* 이라 적어왔는데, **클론은 cwd 일 뿐이고
|
|
95
|
+
# 읽기는 어디든 갔다.** `--tools "Read,Grep,Glob"` 는 «쓰기»만 막지 «경로»를 안 막는다.
|
|
96
|
+
# 실측(같은 날, known-pair): observe 팔이 `/tmp` 파일을 출력했고, **채점용 qset 을
|
|
97
|
+
# 정답 토큰까지 통째로** 읽었고, 앞선 팔의 답변 디렉터리를 나열했다(159,050 파일).
|
|
98
|
+
# ⇒ 맥락유지 3개 회차가 전부 무효. 세 번의 VOID 는 «다른 증상 셋»이 아니라 **근인 하나**였다.
|
|
99
|
+
#
|
|
100
|
+
# 🟥 **첫 수리는 과차단이었다 — 클론 자신을 막았다.** `Read(//tmp/**)` 로 통째로 막았는데
|
|
101
|
+
# `WRAP="$_out/..."` 라서 `--out /tmp/...` 이면 **클론이 그 아래 산다.** ARM 이
|
|
102
|
+
# *"working directory 에 대한 read 권한이 모든 도구에서 거부"* 라고 답했다.
|
|
103
|
+
# ⇒ 광범위 차단 대신 **위험한 곳만 이름으로** 막는다: 실제 레포 · 홈 · 이 회차의 out 디렉터리.
|
|
104
|
+
# 그 셋이 «이 실험이 자기 답을 볼 수 있는» 전부다(소스·qset·앞선 팔의 답변).
|
|
105
|
+
# ⚠️ 완전 격리가 아니다 — 열거 안 한 절대경로는 여전히 읽힌다. 그렇게 적는다.
|
|
106
|
+
# 형태도 실측으로 골랐다: `Read(/x/**)`(슬래시 하나)는 **안 막힌다**. `Read(//x/**)` 라야 한다.
|
|
107
|
+
# `Glob(...)`/`Grep(...)` 을 섞으면 클론 안까지 과차단됐다 — 그래서 **Read 만** 둔다.
|
|
108
|
+
mkdir -p "$_w/.claude"
|
|
109
|
+
# 🟥 cross-family(agy #4): 여기가 **명백한 fail-open** 이었다 — 격리 규칙이 없는
|
|
110
|
+
# `settings.local.json` 이 클론에 있으면 주입을 건너뛰고 **비격리 상태로 측정을 강행**한다.
|
|
111
|
+
# 「SKIPPED 라고 알렸다」는 변명이 안 된다: 이 회차의 산출은 그래도 숫자로 쓰인다.
|
|
112
|
+
# ⇒ 격리 없이는 **회차를 시작하지 않는다**. 강행은 명시 플래그로만.
|
|
113
|
+
if [ -f "$_w/.claude/settings.local.json" ] && ! grep -q '"deny"' "$_w/.claude/settings.local.json" 2>/dev/null; then
|
|
114
|
+
if [ "${FH_SIM_NO_ISOLATION_OK:-}" = 1 ]; then
|
|
115
|
+
echo " ⚠️ arm 격리 없이 강행됨(FH_SIM_NO_ISOLATION_OK=1) — 이 회차는 오염 가능하다고 기록해라." >&2
|
|
116
|
+
else
|
|
117
|
+
echo " ❌ arm settings.local.json 이 이미 있는데 deny 규칙이 없다 — **격리 없이 재지 않는다.**" >&2
|
|
118
|
+
echo " 강행: FH_SIM_NO_ISOLATION_OK=1 (그러면 그 회차는 오염 가능으로 기록해라)" >&2
|
|
119
|
+
: # 오염 표기는 호출부가 한다(함수는 rc 로만 말한다)
|
|
120
|
+
return 1
|
|
121
|
+
fi
|
|
122
|
+
fi
|
|
123
|
+
if [ -f "$_w/.claude/settings.local.json" ]; then
|
|
124
|
+
:
|
|
125
|
+
else
|
|
126
|
+
# 🟥 **물리경로로 계산한다** (2026-08-30, 세 번째 수리). macOS 에서 `/tmp` 는
|
|
127
|
+
# `/private/tmp` 심링크라 **같은 자리가 두 이름**을 갖는다. 논리경로만 적으면
|
|
128
|
+
# 어떤 회차는 클론을 막고(과차단) 어떤 회차는 레포를 못 막는다(누출) — 즉 격리가
|
|
129
|
+
# **비결정적**이 된다. 실측: 같은 설정에서 한 팔은 «working directory 거부», 다른 팔은
|
|
130
|
+
# 레포의 qset 을 읽었다. 비결정적 격리는 격리가 아니다.
|
|
131
|
+
_phys(){ ( cd "$1" 2>/dev/null && pwd -P ) || printf '%s' "$1"; }
|
|
132
|
+
_p_repo=$(_phys "$_repo"); _p_home=$(_phys "$_home")
|
|
133
|
+
_p_out=$(_phys "$_out"); _p_work=$(_phys "$_w")
|
|
134
|
+
_deny_repo="//${_p_repo#/}"
|
|
135
|
+
_deny_home="//${_p_home#/}"
|
|
136
|
+
_deny_out="//${_p_out#/}"; _extra_out=""
|
|
137
|
+
# 🟥 클론이 out 아래 살면 out 을 통째로 막을 수 없다. 그 경우 «앞선 팔의 답변 파일»만 막는다.
|
|
138
|
+
# 클론이 out 아래 살면 out 을 통째로 못 막는다. 그때는 «다른 팔의 산출»만 막는다 —
|
|
139
|
+
# 🟥 `*.txt` 만으로는 부족했다: 다른 팔의 **클론 트리**(`w_*/repo/**`)에 주입된 봉인 원장을
|
|
140
|
+
# 읽을 수 있었다. 그것도 막고, **내 클론은 예외로 둔다**.
|
|
141
|
+
case "$_p_work" in
|
|
142
|
+
"$_p_out"/*)
|
|
143
|
+
_deny_out="//${_p_out#/}/*.txt"
|
|
144
|
+
# 🟥 2026-08-31 — 종전 `w_*` 는 **자기 클론에도 매치**했다. 바로 위 주석이
|
|
145
|
+
# 「내 클론은 예외로 둔다」고 적어놓고 코드엔 그 예외가 없었다
|
|
146
|
+
# ([[feedback_rule_misdescribes_its_own_machine]]). 조건 분기는 **항상 참**이라
|
|
147
|
+
# (`WRAP="$OUTDIR/w_${ARM}_r${r}"`) 이 deny 가 모든 회차에 붙었고, 그래서
|
|
148
|
+
# **팔은 자기 운반체를 한 번도 못 읽었다.** known-pair 로 확정:
|
|
149
|
+
# 자기 클론의 seal → BLOCKED · 같은 클론의 CLAUDE.md → 읽힘
|
|
150
|
+
# ⇒ `DELIVERY` 는 한 번도 측정된 적이 없다. `_ccrun7` 의 positive ARM PASS 는
|
|
151
|
+
# 운반체가 아니라 stdin 으로 샌 정답키였다(두 결함이 서로를 가려줬다).
|
|
152
|
+
# 🟥 글롭으로는 「나만 빼고」를 표현할 수 없다. 그래서 설정을 쓰는 시점에
|
|
153
|
+
# **이미 존재하는 형제만 이름으로** 막는다. 팔·rep 이 순차 루프이므로
|
|
154
|
+
# (`for r in $(seq 1 "$REPS")` · `&`/`wait` 없음) 그 시점 열거는 완전하다 —
|
|
155
|
+
# 뒤에 생길 형제는 이 팔이 끝난 뒤에 만들어진다.
|
|
156
|
+
_extra_out=""
|
|
157
|
+
_my_wrap="$(basename "$(dirname "$_p_work")")"
|
|
158
|
+
for _sib in "$_p_out"/w_*; do
|
|
159
|
+
[ -d "$_sib" ] || continue
|
|
160
|
+
_sib_b="$(basename "$_sib")"
|
|
161
|
+
[ "$_sib_b" = "$_my_wrap" ] && continue # 나는 뺀다 — 그게 이 수리의 전부다
|
|
162
|
+
_extra_out="$_extra_out,\"Read(//${_p_out#/}/$_sib_b/repo/tracks/**)\""
|
|
163
|
+
done
|
|
164
|
+
;;
|
|
165
|
+
esac
|
|
166
|
+
# 🟥 cross-family(agy #1): 기본 `$TMPDIR`(macOS `/var/folders/**`)·공유 경로·마운트 볼륨이
|
|
167
|
+
# 빠져 있었다. 산출물이 기본 TMPDIR 에 생기면 앞선 팔의 결과가 그대로 읽힌다.
|
|
168
|
+
# 🟥 단 **클론이 사는 경로는 막으면 안 된다**(첫 수리가 그렇게 자기 발을 쐈다) —
|
|
169
|
+
# 그래서 `$_w` 를 품는 접두사는 목록에서 뺀다. 계산으로 하지, 손으로 고르지 않는다.
|
|
170
|
+
_extra=""
|
|
171
|
+
for d in /var/folders /private/var/folders /Users/Shared /Volumes /var/tmp /private/tmp /tmp; do
|
|
172
|
+
_pd=$(_phys "$d"); [ -n "$_pd" ] || continue
|
|
173
|
+
case "$_p_work" in "$_pd"/*) continue ;; esac # 내 클론이 그 아래면 막지 않는다(물리경로 비교)
|
|
174
|
+
case "$_p_out" in "$_pd"/*) continue ;; esac # out 도 마찬가지 — 위에서 정밀하게 다룬다
|
|
175
|
+
d="$_pd"
|
|
176
|
+
case "$_extra" in *"Read(//${d#/}/**)"*) continue ;; esac # 중복 금지(실행으로 드러났다)
|
|
177
|
+
_extra="$_extra,\"Read(//${d#/}/**)\""
|
|
178
|
+
done
|
|
179
|
+
# 🟥 함수로 꺼내 «실행»해보자마자 JSON 결함이 드러났다: 종전엔 `_deny_out` 안에 따옴표·괄호를
|
|
180
|
+
# 끼워넣어 `Read(...*.txt` 가 안 닫히고 `tracks/**))` 로 두 번 닫혔다. **grep 레인이었으면
|
|
181
|
+
# 영영 못 봤다** — new-code-anchor 게이트가 MENTION_ONLY 를 막은 것이 이걸 잡았다.
|
|
182
|
+
# ⇒ 조각을 문자열로 조립하지 말고 **필드별로 분리**한다. 그리고 중복도 제거한다.
|
|
183
|
+
printf '{"permissions":{"deny":["Read(%s/**)","Read(%s/**)","Read(%s)"%s%s]}}' \
|
|
184
|
+
"$_deny_repo" "$_deny_home" "$_deny_out" "$_extra_out" "$_extra" > "$_w/.claude/settings.local.json"
|
|
185
|
+
fi
|
|
186
|
+
|
|
187
|
+
# ── 🟥 조립 검증 (2026-08-31 신설) — 파싱만 보면 이 결함을 놓친다 ─────────────
|
|
188
|
+
# 회차 3(_ccrun7)은 위 문단이 고친 바로 그 파손을 안고 돌았다:
|
|
189
|
+
# 'Read(//private/tmp/_ccrun7/*.txt' ← 닫는 괄호 없음
|
|
190
|
+
# 'Read(//private/tmp/_ccrun7/w_*/repo/tracks/**))' ← 괄호 둘
|
|
191
|
+
# 파손된 규칙은 매칭이 안 되므로 **형제 클론의 tracks/ 가 안 막혔고**, 거기 seal 이 있다.
|
|
192
|
+
# 그 회차의 CTRL 이 기대토큰을 축자로 댄 것이 그렇게 설명된다.
|
|
193
|
+
# 🟥 **그 JSON 은 «정상 파싱된다».** 파손은 구조가 아니라 규칙 문자열 «안»에 있다.
|
|
194
|
+
# 그래서 「JSON 파싱 레인」은 두 팔을 못 가르는 **장식**이다
|
|
195
|
+
# ([[feedback_anchor_can_be_decorative]]). known-pair 로 확인했다:
|
|
196
|
+
# K+ 회차3 실물 : JSON=OK · 문법위반 2 · 중복 1 ← 잡힌다
|
|
197
|
+
# K- 현행 조립 : JSON=OK · 문법위반 0 · 중복 0 ← 안 잡힌다
|
|
198
|
+
# ⇒ 검사는 셋이다: 파싱 ∧ 항목 문법(괄호 정확히 한 쌍) ∧ 중복 0.
|
|
199
|
+
# 🟥 fail-closed — 격리가 깨진 채로 재느니 안 재는 게 낫다. 이 함수의 rc 1 은 호출부에서
|
|
200
|
+
# CONTAMINATED=1 + continue 로 이어져 **그 팔은 안 뜬다**(격리 없이는 회차를 시작 안 한다).
|
|
201
|
+
# ⚠️ 문법 검사의 한계를 이름으로 남긴다: 패턴 «안»에 괄호를 쓰는 규칙은 이 검사가
|
|
202
|
+
# 거짓 위반으로 잡는다. 현재 조립은 그런 규칙을 안 만든다 — 만들게 되면 여기를 고쳐라.
|
|
203
|
+
if ! python3 - "$_w/.claude/settings.local.json" <<'_PYEOF'
|
|
204
|
+
import json,re,sys
|
|
205
|
+
try:
|
|
206
|
+
d=json.load(open(sys.argv[1]))
|
|
207
|
+
except Exception as e:
|
|
208
|
+
print(" ISOLATION-ASSEMBLY: JSON parse failed: %s" % e); sys.exit(1)
|
|
209
|
+
rules=d.get("permissions",{}).get("deny",[])
|
|
210
|
+
if not rules:
|
|
211
|
+
print(" ISOLATION-ASSEMBLY: deny list EMPTY — 격리 없음"); sys.exit(1)
|
|
212
|
+
pat=re.compile(r'^[A-Za-z]+\([^()]*\)$')
|
|
213
|
+
bad=[r for r in rules if not pat.match(r)]
|
|
214
|
+
dup=sorted({r for r in rules if rules.count(r)>1})
|
|
215
|
+
if bad or dup:
|
|
216
|
+
for r in bad: print(" ISOLATION-ASSEMBLY: malformed rule: %r" % r)
|
|
217
|
+
for r in dup: print(" ISOLATION-ASSEMBLY: duplicate rule: %r" % r)
|
|
218
|
+
sys.exit(1)
|
|
219
|
+
sys.exit(0)
|
|
220
|
+
_PYEOF
|
|
221
|
+
then
|
|
222
|
+
echo " ❌ 격리 규칙 조립이 깨졌다 — **이 팔은 안 띄운다**(fail-closed)." >&2
|
|
223
|
+
return 1
|
|
224
|
+
fi
|
|
225
|
+
|
|
226
|
+
return 0
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
BASE_REF=""; BASE_SHA=""
|
|
230
|
+
ARM=""; REPS=1; PROMPT=""; MODE="observe"; MODEL="sonnet"; TIMEOUT=900; OUTDIR=""; NOHARNESS=0; SETUP=""; EXTRA=""
|
|
231
|
+
while [ $# -gt 0 ]; do
|
|
232
|
+
case "$1" in
|
|
233
|
+
--arm) ARM="${2:-}"; shift 2 ;;
|
|
234
|
+
--reps) REPS="${2:-1}"; shift 2 ;;
|
|
235
|
+
--prompt) PROMPT="${2:-}"; shift 2 ;;
|
|
236
|
+
--mode) MODE="${2:-observe}"; shift 2 ;;
|
|
237
|
+
--model) MODEL="${2:-sonnet}"; shift 2 ;;
|
|
238
|
+
--timeout) TIMEOUT="${2:-900}"; shift 2 ;;
|
|
239
|
+
--out) OUTDIR="${2:-}"; shift 2 ;;
|
|
240
|
+
--no-harness) NOHARNESS=1; shift ;; # CONTROL arm: drops project CLAUDE.md. Not isolation.
|
|
241
|
+
--base-ref) BASE_REF="${2:-}"; shift 2 ;; # BASE 얕은 클론 (2026-09-01) — 아래 참조
|
|
242
|
+
--base-sha) BASE_SHA="${2:-}"; shift 2 ;;
|
|
243
|
+
--setup) SETUP="${2:-}"; shift 2 ;; # shell run INSIDE each clone before the sim. See below.
|
|
244
|
+
--extra-tools) EXTRA="${2:-}"; shift 2 ;; # append tools to the mode's set. See TOOL VISIBILITY.
|
|
245
|
+
*) echo "unknown flag: $1" >&2; exit 2 ;;
|
|
246
|
+
esac
|
|
247
|
+
done
|
|
248
|
+
[ -n "$ARM" ] || { echo "FAIL: --arm required" >&2; exit 2; }
|
|
249
|
+
[ -n "$PROMPT" ] || { echo "FAIL: --prompt required" >&2; exit 2; }
|
|
250
|
+
case "$MODE" in observe|act) ;; *) echo "FAIL: --mode must be observe|act" >&2; exit 2 ;; esac
|
|
251
|
+
|
|
252
|
+
command -v claude >/dev/null 2>&1 || { echo "FAIL: claude CLI not on PATH" >&2; exit 2; }
|
|
253
|
+
|
|
254
|
+
OUTDIR="${OUTDIR:-$(mktemp -d "${TMPDIR:-/tmp}/fh-sim-XXXXXX")}"
|
|
255
|
+
mkdir -p "$OUTDIR"
|
|
256
|
+
|
|
257
|
+
# ── machine-surface snapshot ──────────────────────────────────────────────────────────────────
|
|
258
|
+
# Enumerated, not guessed. Each line is a surface a past run actually touched or plausibly could.
|
|
259
|
+
# `not found` is written as `ABSENT`, never as an empty string — an unreadable surface and an
|
|
260
|
+
# empty one must not collapse ([[feedback_not_found_is_not_zero_family]]).
|
|
261
|
+
snapshot() {
|
|
262
|
+
local f="$1"
|
|
263
|
+
{
|
|
264
|
+
echo "## LaunchAgents"
|
|
265
|
+
ls -1 "$HOME/Library/LaunchAgents" 2>/dev/null || echo "ABSENT"
|
|
266
|
+
echo "## crontab"
|
|
267
|
+
crontab -l 2>/dev/null || echo "ABSENT"
|
|
268
|
+
echo "## claude settings mtime"
|
|
269
|
+
# GNU-first on purpose: `stat -f` on GNU coreutils means "filesystem info" and SUCCEEDS,
|
|
270
|
+
# so a BSD-first chain never reaches the fallback and silently reports the wrong thing.
|
|
271
|
+
# Caught by this repo's own portability lint on the first commit attempt of this file.
|
|
272
|
+
stat -c '%Y %n' "$HOME/.claude/settings.json" 2>/dev/null \
|
|
273
|
+
|| stat -f '%m %N' "$HOME/.claude/settings.json" 2>/dev/null || echo "ABSENT"
|
|
274
|
+
} > "$f"
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
echo "── sim_isolated_run ──────────────────────────────────────────────"
|
|
278
|
+
echo "arm=$ARM mode=$MODE model=$MODEL reps=$REPS timeout=${TIMEOUT}s"
|
|
279
|
+
echo "out=$OUTDIR"
|
|
280
|
+
|
|
281
|
+
snapshot "$OUTDIR/_machine_before.txt"
|
|
282
|
+
|
|
283
|
+
CONTAMINATED=0
|
|
284
|
+
for r in $(seq 1 "$REPS"); do
|
|
285
|
+
# Each clone gets its OWN parent directory. Siblings under one parent are visible to `../`,
|
|
286
|
+
# and that is not hypothetical: an arm measured 2026-08-29 scanned its parent for mappable
|
|
287
|
+
# projects and reported finding "iso_A, door_CTRL" — the other arms' work dirs. Content stayed
|
|
288
|
+
# isolated, but their EXISTENCE leaked into the arm's reasoning, which is enough to change an
|
|
289
|
+
# answer about "what projects are around". Isolation has to hold for the parent too.
|
|
290
|
+
WRAP="$OUTDIR/w_${ARM}_r${r}"; mkdir -p "$WRAP"
|
|
291
|
+
WORK="$WRAP/repo"
|
|
292
|
+
# A disposable clone per REP, not per arm: two reps of the same arm contaminate each other
|
|
293
|
+
# exactly as two different arms do. That was the measured failure — reps 1 and 2 of build_cron.
|
|
294
|
+
# ── BASE 얕은 클론 (2026-09-01, §7-12) ──────────────────────────────────────
|
|
295
|
+
# 🟥 왜: 이 레포의 «개발 이력 자체»가 팔의 코퍼스에 들어간다. 세션 시작 컨텍스트가 최근 커밋을
|
|
296
|
+
# 싣고(실측: 팔이 5줄을 그대로 옮겼다), 그 줄들이 「팔의 클론에서 정답지를 없앤다」처럼
|
|
297
|
+
# 실험을 설명한다. 파일을 지워도 안 닫힌다 — 이력은 strip 대상이 아니다.
|
|
298
|
+
# 🟥 그리고 «지우는 것»이 오히려 악화시켰다: rm 만 하면 `git status` 가 51줄로 이름을 광고한다
|
|
299
|
+
# (실측 0줄 → 52줄). 얕은 클론은 status 가 «원래» 0 이라 그 문제가 없다.
|
|
300
|
+
# 🟥 `file://` 이 «필수»다 — 로컬 «경로»로 주면 git 이 `--depth` 를 **조용히 무시**한다.
|
|
301
|
+
# 🟥 ref 는 움직인다. 그래서 sha 를 «둘 다» 받고 클론 후 대조한다 — 안 맞으면 다른 코퍼스다.
|
|
302
|
+
if [ -n "$BASE_REF" ] || [ -n "$BASE_SHA" ]; then
|
|
303
|
+
if [ -z "$BASE_REF" ] || [ -z "$BASE_SHA" ]; then
|
|
304
|
+
echo " ❌ --base-ref 와 --base-sha 는 «둘 다» 필요하다(하나만 주면 대조를 못 한다)"; exit 2
|
|
305
|
+
fi
|
|
306
|
+
if ! git clone --quiet --depth 1 --branch "$BASE_REF" "file://$REPO_ROOT" "$WORK" 2>"$OUTDIR/_clone_${ARM}_r${r}.err"; then
|
|
307
|
+
echo " ❌ r$r BASE CLONE FAILED — see $OUTDIR/_clone_${ARM}_r${r}.err"; continue
|
|
308
|
+
fi
|
|
309
|
+
_got="$(git -C "$WORK" rev-parse HEAD 2>/dev/null)"
|
|
310
|
+
case "$_got" in
|
|
311
|
+
"$BASE_SHA"*) : ;;
|
|
312
|
+
*) echo " ❌ r$r BASE SHA MISMATCH — ref=$BASE_REF 기대=$BASE_SHA 실제=${_got:-읽기실패}"
|
|
313
|
+
echo " 🟥 ref 가 움직였다 = «다른 코퍼스»다. 회차를 재현할 수 없다."
|
|
314
|
+
rm -rf "$WRAP"; exit 9 ;;
|
|
315
|
+
esac
|
|
316
|
+
elif ! git clone --quiet --local --no-hardlinks "$REPO_ROOT" "$WORK" 2>"$OUTDIR/_clone_${ARM}_r${r}.err"; then
|
|
317
|
+
echo " ❌ r$r CLONE FAILED — see $OUTDIR/_clone_${ARM}_r${r}.err"
|
|
318
|
+
continue
|
|
319
|
+
fi
|
|
320
|
+
|
|
321
|
+
# ── 🟥 팔이 읽으면 안 되는 tracked 자산을 «클론 안에서» 제거한다 (2026-09-01) ──────
|
|
322
|
+
# 왜: 얼린 정답지(`scripts/fixtures/knownpair_refusal_48_*`)가 tracked 가 되면서
|
|
323
|
+
# **모든 팔의 클론에 들어갔다.** 실측 — negative 문항의 핵심 명사구가 그 안에 있다
|
|
324
|
+
# (브랜드5·도시6·팀명7·향3·카페3·상자4·제품명7 히트, 「가상의」38/48 파일).
|
|
325
|
+
# 그러면 팔이 자기 질문과 거의 같은 문항의 **모범 거절 48개**를 찾는다 ⇒ 베끼거나
|
|
326
|
+
# 시험임을 추론한다. 둘 다 «저자에게 유리한» 방향이다.
|
|
327
|
+
# 자산을 tracked 로 옮기는 것이 그 자산이 «재는 코퍼스»를 바꾼 것이다.
|
|
328
|
+
# 🟥 왜 deny 가 아니라 «제거»인가: deny 는 «못 읽게» 하고 이건 «없게» 한다. 없는 파일은
|
|
329
|
+
# Read·Grep·Glob·Bash 어느 것으로도 못 읽는다 — **도구 목록에 의존하지 않는다.**
|
|
330
|
+
# 클론은 일회용이라 제거가 파괴적 표면이 아니다(원본은 안 건드린다).
|
|
331
|
+
# 🟥 목록으로 둔다 — 「팔이 읽으면 안 되는 자산」은 늘어난다. 지금은 하나다.
|
|
332
|
+
# 🟥 `scripts/round` — 이건 «시험 인지»가 아니라 **정답 유출**이다:
|
|
333
|
+
# `eligcheck_qset.sh:30-31` 이 축자로 「negative: CTRL 이 «거절»해야 적격」·
|
|
334
|
+
# 「conflict: CTRL 이 «원래값을 답해야» 적격」 을 적는다. 읽은 팔의 거절은
|
|
335
|
+
# «능력»이 아니라 «힌트를 따른 것»이다.
|
|
336
|
+
# 🟥 2026-09-01: 러너 재작성 중 이 항목이 «조용히 사라졌다»(커밋 3265224 가 되돌려졌다).
|
|
337
|
+
# arm_blind_probe 가 「히트 8→1」로 잡았다 — 프로브가 없었으면 회차가 그대로 열렸다.
|
|
338
|
+
# 🟥 `scripts/context_continuity_score.sh` — «공통 노출»이 «차등»으로 전환되는 자리다.
|
|
339
|
+
# :386 `setup=""; [ "$arm" = ARM ] && setup="$SETUP_ARM"`
|
|
340
|
+
# :388 `if [ "$DELIVER" = 1 ] && [ "$arm" = ARM ]; then`
|
|
341
|
+
# ⇒ 이 분기를 읽은 팔은 «내 프롬프트에 봉인 줄이 있나»로 **자기 배정을 역추론**한다.
|
|
342
|
+
# 공통 노출은 «수준»만 옮기지만(차이는 남는다), 자기 배정을 알면 **비교 자체가 죽는다.**
|
|
343
|
+
# 🟥 지워도 conflict prior 가 안 죽는지 «먼저» 확인했다(실측, BASE 트리):
|
|
344
|
+
# tool_result 1파일(채점기 밖) · Automati 33 · banner.png 4 — 채점기 안 0
|
|
345
|
+
# compaction_probe.sh 7 중 1 · starter.md 22 중 1 — 여유 충분
|
|
346
|
+
ARM_BLIND_PATHS=( "scripts/fixtures" "scripts/round" "scripts/context_continuity_score.sh" )
|
|
347
|
+
for _bp in "${ARM_BLIND_PATHS[@]}"; do
|
|
348
|
+
rm -rf "$WORK/$_bp"
|
|
349
|
+
# 🟥 rm 의 rc 를 안 믿는다 — 경로 오타면 rm 은 «성공»을 낸다(지울 게 없으니).
|
|
350
|
+
# 판정은 «제거 후에 정말 없는가»로 한다.
|
|
351
|
+
if [ -e "$WORK/$_bp" ]; then
|
|
352
|
+
echo " ❌ r$r BLIND-STRIP FAILED — $_bp 가 클론에 남았다. 이 회차는 오염이다"
|
|
353
|
+
rm -rf "$WORK"; continue 2
|
|
354
|
+
fi
|
|
355
|
+
done
|
|
356
|
+
|
|
357
|
+
# --setup: build the PRECONDITION the measurement needs, inside the clone, before the sim.
|
|
358
|
+
# WHY THIS EXISTS: the first door-③ measurement (2026-08-29) scored 0/3 on both arms and the
|
|
359
|
+
# number meant nothing — a fresh clone has no mapped project tracks, so door ③ can never reach
|
|
360
|
+
# the follow-up proposal that was under test. Both arms correctly answered "there is nothing to
|
|
361
|
+
# accelerate" and the instrument never entered the state it was built to observe. A run whose
|
|
362
|
+
# precondition is unmet does not produce a negative result; it produces no result. Setting the
|
|
363
|
+
# fixture up INSIDE the disposable clone keeps that from being a reason to touch the live tree.
|
|
364
|
+
if [ -n "$SETUP" ]; then
|
|
365
|
+
if ! ( cd "$WORK" && eval "$SETUP" ) >"$WRAP/_setup.log" 2>&1; then
|
|
366
|
+
echo " ❌ r$r SETUP FAILED — precondition not built, arm is VOID (see $WRAP/_setup.log)"
|
|
367
|
+
CONTAMINATED=1
|
|
368
|
+
continue
|
|
369
|
+
fi
|
|
370
|
+
fi
|
|
371
|
+
# 🟥 기준선은 «클론 직후»가 아니라 «--setup 직후»다 (2026-08-30, 첫 실사용이 잡았다).
|
|
372
|
+
# 아래 :treediff 는 `git status --porcelain` 을 클론 시점 기준으로 읽었다. 그러면
|
|
373
|
+
# `--setup` 이 추적 파일을 건드리는 순간 그 팔은 **자동으로 CONTAMINATED** 가 된다 —
|
|
374
|
+
# 즉 «전제를 만드는 공식 수단»이 «판정을 무효로 만드는 수단»이었다.
|
|
375
|
+
# 실측: CTRL 3팔이 `rm -f .claude/soul_tenets.txt`(내가 시킨 그 삭제) 한 줄 때문에 전량 무효.
|
|
376
|
+
# ⇒ setup 이 만든 변화를 기준선으로 빼고, **팔이 만든 변화만** 본다.
|
|
377
|
+
# ⚠️ 이것은 오염 검사를 «약화»시키는 게 아니다: setup 은 내가 선언한 조작이고 로그에 남는다.
|
|
378
|
+
# 팔이 만든 변화는 여전히 한 줄도 허용 안 된다(observe 모드).
|
|
379
|
+
( cd "$WORK" && git status --porcelain ) > "$WRAP/_tree_baseline.txt" 2>/dev/null
|
|
380
|
+
|
|
381
|
+
fh_sim_write_path_isolation "$WORK" "$OUTDIR" "$REPO_ROOT" "$HOME" || { CONTAMINATED=1; continue; }
|
|
382
|
+
|
|
383
|
+
if [ "$MODE" = observe ]; then
|
|
384
|
+
TOOLS=(--tools "Read,Grep,Glob")
|
|
385
|
+
else
|
|
386
|
+
TOOLS=(--tools "Read,Grep,Glob,Bash,Write,Edit")
|
|
387
|
+
fi
|
|
388
|
+
# 🟥 TOOL VISIBILITY IS PART OF THE MEASUREMENT, NOT A DETAIL. `Glob` matches FILES; a
|
|
389
|
+
# directory with no file directly inside it is invisible to a Read/Grep/Glob arm. FH's branch
|
|
390
|
+
# test keys on `tracks/{name}/` DIRECTORIES, so an observe-mode arm can report "tracks/ has only
|
|
391
|
+
# .gitkeep" while `tracks/demoproj/` and `tracks/webshop/` both exist — measured 2026-08-29,
|
|
392
|
+
# verified by opening the clones. That looks exactly like a session misjudging, and it is not.
|
|
393
|
+
# ⇒ When the thing under test depends on ENUMERATION, add Bash and say so:
|
|
394
|
+
# --extra-tools Bash
|
|
395
|
+
# and treat the observe-only number as the "cannot enumerate" arm rather than as a defect rate.
|
|
396
|
+
[ -n "$EXTRA" ] && TOOLS[1]="${TOOLS[1]},$EXTRA"
|
|
397
|
+
# `--restricted` is opt-in ONLY, and opting in means you are measuring the BASE MODEL, not FH.
|
|
398
|
+
[ "$NOHARNESS" -eq 1 ] && TOOLS+=(--restricted)
|
|
399
|
+
|
|
400
|
+
# Blindness comes from the CLONE, not from a flag: `CLAUDE.local.md` is gitignored, so the
|
|
401
|
+
# operator's register pin and standing bindings are structurally absent from every arm. That is
|
|
402
|
+
# verifiable (`git ls-files | grep CLAUDE` returns CLAUDE.md alone) rather than asserted.
|
|
403
|
+
# `.claude/settings.json` is untracked too, so no hooks fire — which makes an arm resemble a
|
|
404
|
+
# CONSUMER install. State that when scoring: this measures the shipped surface, not this node.
|
|
405
|
+
# ── 🟥 실행 기록 (2026-08-31 신설) — 「누출 기전을 못 짚었다」가 아니라 «볼 수 없었다» ──
|
|
406
|
+
# 회차 3(_ccrun7)에서 CTRL 산출물이 qset 기대토큰을 축자로 댔는데(4/6·3/6 파일,
|
|
407
|
+
# known-negative 0), **팔이 무엇을 받았는지 재구성이 원리적으로 불가능**했다:
|
|
408
|
+
# 프롬프트는 어디에도 안 남고, `.err` 24개는 전부 0바이트이며(그건 *클론* 에러다),
|
|
409
|
+
# 아래 `2>/dev/null` 이 claude 자신의 stderr 를 통째로 버렸다.
|
|
410
|
+
# ⇒ 두 채널을 연다. **마스킹하지 않는다** — 누출을 보려고 만든 계기가 누출을 가리면
|
|
411
|
+
# 계기가 아니다. 이 파일들은 정답 토큰을 그대로 담을 수 있고, 그것이 목적이다.
|
|
412
|
+
# ⚠️ 그러므로 이 산출 디렉터리는 «답을 아는» 자리다. 다른 팔이 읽지 못하도록 막는 것은
|
|
413
|
+
# fh_sim_write_path_isolation 의 `_deny_out` 이고, 그 결박이 이 덤프의 전제다.
|
|
414
|
+
printf '%s' "$PROMPT" > "$OUTDIR/${ARM}_r${r}.prompt.txt"
|
|
415
|
+
# 🟥 `< /dev/null` 이 **하중이다** — 빼면 격리가 통째로 무너진다 (2026-08-31 확정).
|
|
416
|
+
# `claude -p` 는 **stdin 이 TTY 가 아니면 그것을 읽어 프롬프트 뒤에 붙인다.**
|
|
417
|
+
# 호출부(`context_continuity_score.sh`)는 `while … done < "$QSET"` 루프 «안»에서 이 러너를
|
|
418
|
+
# 부르므로, 러너도 그 밑 claude 도 **stdin = 채점용 qset(정답 열 포함)** 을 상속했다.
|
|
419
|
+
# ⇒ 모든 팔이 매 회차 **정답키 전체**를 받았다. ARM 도 CTRL 도.
|
|
420
|
+
# known-pair (같은 모델·같은 플래그, 변수는 stdin 하나):
|
|
421
|
+
# stdin=파일 → 판정줄은 NOTHING_APPENDED 인데 **본문이 미끼 토큰을 축자로 인용**한다
|
|
422
|
+
# stdin=/dev/null → 미끼 토큰이 어디에도 안 나온다
|
|
423
|
+
# 🟥 그래서 이 결함은 «팔에게 물어보면» 안 잡힌다 — 팔은 그것을 «프롬프트 인젝션»이라
|
|
424
|
+
# 부르며 정직하게 거부하면서도, 거부문 안에서 정답을 말한다. 채점기는 그걸 토큰으로 센다.
|
|
425
|
+
# 이것이 회차 1~3 과 probe1~4 를 전부 무효로 만든 근인이고, 경로 deny·코퍼스 마스킹은
|
|
426
|
+
# **원리적으로 못 막는다**(도구 읽기가 아니라 프롬프트 조립이다).
|
|
427
|
+
( cd "$WORK" && timeout "$TIMEOUT" claude -p "$PROMPT" \
|
|
428
|
+
--model "$MODEL" "${TOOLS[@]}" \
|
|
429
|
+
< /dev/null 2>"$OUTDIR/${ARM}_r${r}.stderr.txt" ) > "$OUTDIR/${ARM}_r${r}.txt"
|
|
430
|
+
rc=$?
|
|
431
|
+
bytes=$(wc -c < "$OUTDIR/${ARM}_r${r}.txt" | tr -d ' ')
|
|
432
|
+
|
|
433
|
+
# 🟥 An empty output is NOT a "no" answer. The first version of tonight's runner used
|
|
434
|
+
# `timeout 300`, which killed exactly the heavy arms — the ones where the behaviour under test
|
|
435
|
+
# actually fired — and left 0-byte files that read as "the identity did not fire". A false RED
|
|
436
|
+
# generated by the instrument. So the verdict here is three-valued, never two.
|
|
437
|
+
if [ "$rc" -ne 0 ] && [ "$bytes" -eq 0 ]; then
|
|
438
|
+
echo " ⚠️ r$r UNMEASURED (rc=$rc, 0 bytes) — timeout or crash, NOT a negative result"
|
|
439
|
+
elif [ "$bytes" -eq 0 ]; then
|
|
440
|
+
echo " ⚠️ r$r EMPTY (rc=0) — the session said nothing; distinct from UNMEASURED"
|
|
441
|
+
else
|
|
442
|
+
echo " ✅ r$r captured ${bytes}B"
|
|
443
|
+
fi
|
|
444
|
+
|
|
445
|
+
# Report what the arm changed inside its own clone — in `act` mode this is the interesting part,
|
|
446
|
+
# and in `observe` mode a non-empty diff means --restricted did not hold and the run is void.
|
|
447
|
+
( cd "$WORK" && git status --porcelain ) > "$WRAP/_tree_final.txt" 2>/dev/null
|
|
448
|
+
# setup 기준선을 뺀다. 기준선 파일이 없으면(=setup 미사용) 빈 파일로 두어 종전과 동일하게 동작한다.
|
|
449
|
+
[ -f "$WRAP/_tree_baseline.txt" ] || : > "$WRAP/_tree_baseline.txt"
|
|
450
|
+
comm -13 <(sort "$WRAP/_tree_baseline.txt") <(sort "$WRAP/_tree_final.txt") \
|
|
451
|
+
> "$OUTDIR/${ARM}_r${r}.treediff.txt" 2>/dev/null
|
|
452
|
+
# 🟥 setup 이 만든 변화도 «버리지 말고» 별도로 남긴다 — 조용히 사라지면 다음 감사자가
|
|
453
|
+
# «CTRL 이 정말 등록부 없이 돌았나»를 확인할 방법이 없다.
|
|
454
|
+
cp "$WRAP/_tree_baseline.txt" "$OUTDIR/${ARM}_r${r}.setupdiff.txt" 2>/dev/null || true
|
|
455
|
+
tchanged=$(wc -l < "$OUTDIR/${ARM}_r${r}.treediff.txt" | tr -d ' ')
|
|
456
|
+
if [ "$MODE" = observe ] && [ "$tchanged" -gt 0 ]; then
|
|
457
|
+
echo " 🟥 r$r VOID — observe mode wrote $tchanged path(s); the read-only tool set did not hold"
|
|
458
|
+
CONTAMINATED=1
|
|
459
|
+
elif [ "$tchanged" -gt 0 ]; then
|
|
460
|
+
echo " ℹ️ r$r touched $tchanged path(s) inside its own clone (contained)"
|
|
461
|
+
fi
|
|
462
|
+
done
|
|
463
|
+
|
|
464
|
+
snapshot "$OUTDIR/_machine_after.txt"
|
|
465
|
+
if ! diff -q "$OUTDIR/_machine_before.txt" "$OUTDIR/_machine_after.txt" >/dev/null 2>&1; then
|
|
466
|
+
echo ""
|
|
467
|
+
echo "🟥🟥🟥 MACHINE SURFACE CHANGED DURING THIS RUN — the sim had side effects outside its clone."
|
|
468
|
+
diff "$OUTDIR/_machine_before.txt" "$OUTDIR/_machine_after.txt" | sed 's/^/ /'
|
|
469
|
+
echo " 이 실행은 CONTAMINATED 다. 채점하기 전에 되돌려라."
|
|
470
|
+
CONTAMINATED=1
|
|
471
|
+
fi
|
|
472
|
+
|
|
473
|
+
echo ""
|
|
474
|
+
echo "── scoring reminder (the part no script can do for you) ──────────"
|
|
475
|
+
echo " 🟥 «찾았다»는 답이 나오면 그것이 «언제 생겼는지»부터 봐라."
|
|
476
|
+
echo " tonight's false positive was an arm finding another arm's output and calling it prior art."
|
|
477
|
+
echo " 🟥 컨트롤 팔 없이 낸 숫자는 숫자가 아니다."
|
|
478
|
+
echo " 🟢 «이게 FH 때문인가»가 궁금하면 같은 프롬프트를 --no-harness 로 한 번 더 돌려라."
|
|
479
|
+
[ "$NOHARNESS" -eq 1 ] && echo " ⚠️ 이 실행은 --no-harness 다 — FH 를 잰 것이 아니라 «FH 없이도 그런가»를 잰 것이다."
|
|
480
|
+
echo ""
|
|
481
|
+
[ "$CONTAMINATED" -eq 1 ] && echo "RESULT: CONTAMINATED — do not score" || echo "RESULT: CLEAN"
|
|
482
|
+
echo "OUT: $OUTDIR"
|
|
483
|
+
# Detector, never a gate: always exit 0 so a caller cannot be trained to skip running it.
|
|
484
|
+
exit 0
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# usage: bash scripts/test_branch_claim_lanes.sh
|
|
14
14
|
|
|
15
15
|
set -uo pipefail
|
|
16
|
+
. "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # 픽스처는 실레포에 쓰지 않는다
|
|
16
17
|
SCRIPT="$(cd "$(dirname "$0")" && pwd)/branch_claim.sh"
|
|
17
18
|
PASS=0; FAIL=0; LIVE_PID=""
|
|
18
19
|
|
|
@@ -24,7 +25,8 @@ cleanup() {
|
|
|
24
25
|
trap cleanup EXIT
|
|
25
26
|
|
|
26
27
|
_mkrepo() {
|
|
27
|
-
local d; d
|
|
28
|
+
local d; d="$(fh_fixture_root "$(mktemp -d "${TMPDIR:-/tmp}/bclaim.XXXXXX")")"
|
|
29
|
+
: "${d:?fixture root unset — refusing to run git in cwd}"
|
|
28
30
|
git -C "$d" init -q -b main
|
|
29
31
|
git -C "$d" config user.email t@t; git -C "$d" config user.name t
|
|
30
32
|
echo x > "$d/f"; git -C "$d" add f; git -C "$d" commit -qm init
|
|
@@ -70,7 +72,8 @@ unset CLAUDE_PID
|
|
|
70
72
|
# 판정을 바꾼다 — 실측 2026-08-09: 이 수정을 넣자 레인 ④ 가 즉시 깨졌다(실제 세션 5개).
|
|
71
73
|
# **위의 CLAUDE_PID 와 같은 결함을 수리 그 자체가 재생산한 것**이라, 같은 처방을 붙인다.
|
|
72
74
|
# 개별 레인은 필요할 때 이 값을 인라인으로 덮는다.
|
|
73
|
-
SOCK_EMPTY
|
|
75
|
+
SOCK_EMPTY="$(fh_fixture_root "$(mktemp -d "${TMPDIR:-/tmp}/bcsock0.XXXXXX")")"
|
|
76
|
+
: "${SOCK_EMPTY:?fixture root unset — refusing to run git in cwd}"
|
|
74
77
|
export FH_CLAIM_SOCK_DIR="$SOCK_EMPTY"
|
|
75
78
|
|
|
76
79
|
echo "[branch-claim] known-pair 앵커"
|
|
@@ -243,7 +246,9 @@ rm -rf "$R"
|
|
|
243
246
|
# 그걸 0 으로 렌더한 게 라이브 결함이었다. 세 값이 **각각 다른 문장**을 내야 한다.
|
|
244
247
|
# ⚠️ 세 팔이 rc 는 전부 0(차단 안 함)이라 **rc 로는 구분이 안 된다** — 출력으로 잡는다.
|
|
245
248
|
# 이 레인이 rc 만 봤으면 세 팔 다 통과하고 아무것도 안 잡았을 것이다.
|
|
246
|
-
_sockdir() { local d; d
|
|
249
|
+
_sockdir() { local d; d="$(fh_fixture_root "$(mktemp -d "${TMPDIR:-/tmp}/bcsock.XXXXXX")")"
|
|
250
|
+
: "${d:?fixture root unset — refusing to run git in cwd}"
|
|
251
|
+
echo "$d"; }
|
|
247
252
|
|
|
248
253
|
# ⑭ 소켓엔 살아있는 세션이 있는데 claim 은 0 → 「판정할 수 없다」
|
|
249
254
|
R=$(_mkrepo); S=$(_sockdir); : > "$S/${PEERPID}.sock"
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# test_env_purity_lanes.sh — env_purity_scan known-pair (샌드박스 픽스처)
|
|
3
3
|
set -uo pipefail
|
|
4
|
+
. "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # 픽스처는 실레포에 쓰지 않는다
|
|
4
5
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
-
SB
|
|
6
|
+
SB="$(fh_fixture_root "$(mktemp -d)")"
|
|
7
|
+
: "${SB:?fixture root unset — refusing to run git in cwd}"
|
|
8
|
+
trap 'rm -rf "$SB"' EXIT
|
|
6
9
|
mkdir -p "$SB/scripts" "$SB/knowledge/shared" "$SB/templates" "$SB/plugins" "$SB/.claude/rules"
|
|
7
10
|
cp "$HERE/env_purity_scan.sh" "$SB/scripts/"
|
|
8
11
|
printf 'planted-env-token\n' > "$SB/scripts/.env_purity_tokens.defaults"
|
|
@@ -44,6 +44,26 @@ else
|
|
|
44
44
|
bad "L1 known-positive did not fire (rc=$rc) — every lane below is meaningless without it"
|
|
45
45
|
fi
|
|
46
46
|
|
|
47
|
+
# ── IDX7 the FAIL path must EXECUTE the provenance note, not merely contain a call to it ──────
|
|
48
|
+
# 🟥 THIS IS THE LANE THAT THE OTHER SIX SHOULD HAVE BEEN. IDX1–IDX6 source the function and call
|
|
49
|
+
# it with literals, and IDX6 asserts the call site by GREP. All six were green while the real FAIL
|
|
50
|
+
# path died twice in a row under `set -u`:
|
|
51
|
+
# line 880: INDEX_MODE: unbound variable (the value was extracted BELOW its use)
|
|
52
|
+
# line 886: index_source_note: command not found (the function was DEFINED below its use)
|
|
53
|
+
# Both were found by running the thing, not by the lanes. A grep that a call exists is not a test
|
|
54
|
+
# that the call works ([[feedback_anchor_can_be_decorative]]). This lane executes the branch.
|
|
55
|
+
# It asserts the SHAPE of provenance, not the exact sentence: the fixture is a non-git dir, so the
|
|
56
|
+
# honest answer there is the DISK one, and pinning the index wording would make the lane wrong.
|
|
57
|
+
D="$T/idx7"; mkfixture "$D"
|
|
58
|
+
out=$(run "$D")
|
|
59
|
+
if printf '%s' "$out" | grep -qE 'unbound variable|command not found|syntax error'; then
|
|
60
|
+
bad "IDX7 the FAIL path errored: $(printf '%s' "$out" | grep -E 'unbound|not found|syntax' | head -1)"
|
|
61
|
+
elif printf '%s' "$out" | grep -qE 'ⓘ|🟥'; then
|
|
62
|
+
ok "IDX7 the FAIL path actually emits a provenance line (executed, not grepped)"
|
|
63
|
+
else
|
|
64
|
+
bad "IDX7 no provenance line on the FAIL path — the note is defined but never reached"
|
|
65
|
+
fi
|
|
66
|
+
|
|
47
67
|
# ── L2 NO-OP: no declaration file → behaviour is exactly the L1 behaviour ─────────────────────
|
|
48
68
|
# This is the arm that protects THIS repo, which ships no company/ directory.
|
|
49
69
|
D="$T/l2"; mkfixture "$D"
|
|
@@ -290,6 +310,61 @@ else
|
|
|
290
310
|
printf '%s\n' "$out" | sed 's/^/ │ /'
|
|
291
311
|
fi
|
|
292
312
|
|
|
313
|
+
# ── INDEX-SOURCE DISCLOSURE (2026-08-30) ──────────────────────────────────────────────────────
|
|
314
|
+
# WHY. This check enumerates runners from the git INDEX. In the normal (index) mode it used to say
|
|
315
|
+
# nothing about that, and the disclosure fired only in the anomalous DISK modes — so an author who
|
|
316
|
+
# had wired a suite but not staged it got "a suite nothing executes is prose" with no hint that the
|
|
317
|
+
# wiring existed on disk. Measured 2026-08-30: that happened, and it was the FIFTH instance in one
|
|
318
|
+
# day of «the tree I verified is not the tree the tool read». The note now fires on the FAIL path.
|
|
319
|
+
#
|
|
320
|
+
# 🟥 THREE STATES, NOT TWO. "read the index" · "read the disk" · "could not count" send a reader to
|
|
321
|
+
# three different places. Folding UNMEASURED into the index branch would render a thing that was
|
|
322
|
+
# never counted as a thing that was counted and found empty
|
|
323
|
+
# ([[feedback_not_found_is_not_zero_family]]).
|
|
324
|
+
_ISN=$(mktemp); sed -n '/^index_source_note()/,/^}/p' "$CHECK" > "$_ISN"
|
|
325
|
+
if ! grep -q 'UNMEASURED' "$_ISN"; then
|
|
326
|
+
no "IDX-harness — index_source_note did not extract from $CHECK (lanes would measure nothing)"
|
|
327
|
+
else
|
|
328
|
+
# shellcheck disable=SC1090
|
|
329
|
+
. "$_ISN"
|
|
330
|
+
o=$(index_source_note "index")
|
|
331
|
+
printf '%s' "$o" | grep -q "INDEX 기준" && printf '%s' "$o" | grep -q "스테이징" \
|
|
332
|
+
&& ok "IDX1 index mode names the index AND the staging remedy" \
|
|
333
|
+
|| no "IDX1 index mode note missing/incomplete: $o"
|
|
334
|
+
|
|
335
|
+
o=$(index_source_note "nongit")
|
|
336
|
+
printf '%s' "$o" | grep -q "DISK" && ok "IDX2 nongit mode says DISK, not index" \
|
|
337
|
+
|| no "IDX2 nongit: $o"
|
|
338
|
+
|
|
339
|
+
o=$(index_source_note "UNMEASURED")
|
|
340
|
+
printf '%s' "$o" | grep -q "못 셌다" && ok "IDX3 UNMEASURED says «could not count», not «none»" \
|
|
341
|
+
|| no "IDX3 UNMEASURED: $o"
|
|
342
|
+
|
|
343
|
+
# 🟥 CONTROL — an unknown/empty mode must stay SILENT. Inventing a source line for a state the
|
|
344
|
+
# check does not recognise is worse than saying nothing, and without this lane the function
|
|
345
|
+
# could pass IDX1–IDX3 while emitting the index sentence for every input.
|
|
346
|
+
o=$(index_source_note "")
|
|
347
|
+
[ -z "$o" ] && ok "IDX4 control — empty mode is silent (no invented provenance)" \
|
|
348
|
+
|| no "IDX4 control — empty mode spoke: $o"
|
|
349
|
+
|
|
350
|
+
# 🟥 CONTROL 2 — the three states must be DISTINGUISHABLE from each other, not merely non-empty.
|
|
351
|
+
a=$(index_source_note "index"); b=$(index_source_note "nongit"); c=$(index_source_note "UNMEASURED")
|
|
352
|
+
if [ "$a" != "$b" ] && [ "$b" != "$c" ] && [ "$a" != "$c" ]; then
|
|
353
|
+
ok "IDX5 control — the three states produce three different sentences"
|
|
354
|
+
else
|
|
355
|
+
no "IDX5 control — states collapsed into the same sentence"
|
|
356
|
+
fi
|
|
357
|
+
fi
|
|
358
|
+
rm -f "$_ISN"
|
|
359
|
+
|
|
360
|
+
# The note must fire on the FAIL path — a function nothing calls is the very defect this file names.
|
|
361
|
+
if sed -n '/lane suite(s) with no runner and no declaration/,/Fix by ONE of/p' "$CHECK" \
|
|
362
|
+
| grep -q 'index_source_note'; then
|
|
363
|
+
ok "IDX6 the note is CALLED on the FAIL path (not just defined)"
|
|
364
|
+
else
|
|
365
|
+
no "IDX6 index_source_note is defined but the FAIL path does not call it"
|
|
366
|
+
fi
|
|
367
|
+
|
|
293
368
|
echo "----"
|
|
294
369
|
echo "lane-runner lanes: $pass passed, $fail failed"
|
|
295
370
|
[ "$fail" -eq 0 ] || exit 1
|