Skip to content

Record Codex's trust for Hide's own hooks so Codex does not ask to review them - #670

Merged
yansfil merged 15 commits into
mainfrom
prd/codex-hook-trust
Oct 6, 2026
Merged

yansfil merged 15 commits into
mainfrom
prd/codex-hook-trust

Conversation

@yansfil

@yansfil yansfil commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Related: PRD agents/prd/codex-hook-trust/prd.md

Summary

  • Codex asked "Hooks need review" for Hide's own hooks after every install, update or helper move, though installing Hide is the operator's approval of them.
  • After the kit finds the Codex hook part in place (launch, device connect, Reinstall), Hide has Codex record trust for its own entries through codex app-server (hooks/list, then one config/batchWrite); Hide computes no hash and writes no config.toml.
  • A pass trusts only an entry that is untrusted or modified and exactly Hide's: user hooks.json of this home, same event, same command, same matcher as the install writes; a foreign hook, a look-alike carrying Hide's marker, a project or managed hook is left for the review screen.
  • A trust Codex did not keep, a Codex that answers and then fails, hangs or reports Hide's file unusable shows the Codex hook part as Failed with a one-line reason; a Codex without hook trust, or one that ends before the handshake (no app-server), changes nothing.
  • No UI surface is new, so there are no screenshots.

Review

  • Depends on Clean up Settings: six tabs, seven agents, a Hide AI tab and Reopen for unheard panes #668, already merged into main as eed3f2c.
  • 판단해 주세요: the agent chose these and the operator has not confirmed them: D-02 exact-command match (also requires handlerType == command, canonical sourcePath, key prefix <sourcePath>:, and the same matcher as install, null today); D-03 stacking order with the hook install; D-04..D-10 and D-12 (15 s overall, 5 s per request, 1 MiB per line, 4 MiB total, 16 server requests; cwd is the account home; process-local failure memo); D-14 delegating the merge of config to Codex.
  • 판단해 주세요: the PRD's B1 ("no review screen at all") does not hold where the kit also installs Herdr's integration hook for Codex; that hook is another tool's and stays untrusted, so Codex still shows a review of 1 hook, and Hide's own five are listed Trusted. Docs say so. Should Hide ever vouch for Herdr's hook?
  • 판단해 주세요: a trust failure on a connected device reaches the remote pane chip as "hook is not installed" through the existing Failed mapping in herdr-core/src/agent_hooks.rs; left as is.
  • 조심해서 볼 파일: hide-agent-hooks/src/codex_trust.rs - select_targets decides what Hide may trust (security); the owned child, its bounded shutdown and caps.
  • 조심해서 볼 파일: hide-agent-hooks/src/install.rs - codex_command and hook_matcher are the one source of what install writes and what trust expects.
  • 조심해서 볼 파일: hide-kit/src/lib.rs, hide-kit/src/codex_trust.rs - the apply loop gate and the process-local failure memo that status (read-only, spawns nothing) repeats.
  • 비용 검토: one short codex app-server per pass that finds a Hide entry, only on the kit worker or device helper, never under Mutex<Runtime>; a pass with nothing to record starts one process and writes nothing; status starts none; the child is killed as a tree and reaped within about 2 s of ending.
  • 질문: is the process-local failure memo acceptable, or should the reason survive a restart? It survives status and device connections, not a new process.

Evidence

  • 확인한 것: sasu implement verify on the head, S1 verify-cargo.sh test and S2 lint, both PASS; new tests: 17 integration (a python stand-in codex: ok, repeat writes nothing, unknown method, hang, early exit, silent no-op write, refused write, stop, flood, over-long line, unparsable hooks file, a process outside the child's tree holding its pipe) and 7 kit tests (fresh, outdated and shifted-index reinstall, failure survives status, next success clears it, agent off spawns nothing, no Codex).
  • 확인한 것: live on codex-cli 0.160.0, private Herdr 0.9.1 and a private HOME: a first pass wrote five trusted_hash entries and codex --no-daemon opened straight to the prompt with Hide's SessionStart context delivered; a foreign hook and a look-alike over /tmp/impostor were not trusted and Codex still reviewed them; an entry the operator switched off stayed enabled = false and became trusted; three further passes left config.toml byte for byte unchanged; a Codex that never answers ended in Failed with the one-line reason, the cause logged and no process left; the next pass recovered.
  • 확인한 것: real Codex 0.160.0 answers an unknown method as -32600 "unknown variant", an unparsable hooks.json as a warning with an empty list, and a broken config.toml as an errors entry; the check handles all three and the stand-in answers those shapes.
  • 확인하지 못한 것: Windows; a real connected device (the kit runs as a device helper does, against a private HOME); an older Codex without hooks/list; a real hook version bump (a helper path change stood in); a Codex other than 0.160.0 (an update to 0.160.1 was offered and skipped); the operator's own ~/.codex, servers and /Applications/hide.app, which were never touched.
  • 확인하지 못한 것: Codex's own words for a failure go to stderr, which a detached daemon loses; only the cause class reaches the diagnostic log (through apply.completed).
Verification record
  • PRD: agents/prd/codex-hook-trust/prd.md (sha256 8d706fb0c4b1f86ff87075c5ee3b2d5ca9c865a21e99c11e1e082db7d6017d8d)
  • Base acf7edf → head b9b6817, verified 2026-10-06T22:51:06.438Z: PASS
  • Verification report: agents/runs/codex-hook-trust/verification-report.json and agents/runs/codex-hook-trust/verification-report.md; source fingerprint 491fa4991de0ea6d4a23e6e8b0dee31addad61332cf303361652a12bfcf3ddc5
  • Suites:
    • S1: GREEN bash scripts/verify-cargo.sh test (exit 0)
    • S2: GREEN bash scripts/verify-cargo.sh lint (exit 0)
  • Reviews: Fidelity, Code and Security ran at 42f80ee (Security read the D-02 target rule first) and again at 28f8ee0; a closure review ran on aed7b3a with nothing blocking. Fixed: Codex's real unknown-method answer (-32600), an unbounded end of the app-server, the errors guard that never fired on real Codex (now also the unparsable-file warning), key prefix and server-request caps, Herdr's hook named in the docs, one unobserved docs claim dropped (1c846bc). Follow-ups left: a shared stdio JSON-RPC session for hide-ai and this module; narrowing errors to this home or file if a field case needs it; OwnedChild's own Drop can wait after a SIGKILL not seen to land; expectedVersion on the write; a detail field on the part report so Codex's words reach the diagnostic log. From the closure review of the handshake change: log one structured line when a Codex ends before the handshake (it now shows nothing and leaves no trace), assert the child is gone in that test, and a hang_early fixture mode to pin a hang before initialize as TimedOut. Later commits: a docs wording fix (1c846bc) and a neutral account name in unit-test paths (8891579), after CI policy checks refused a home-directory path. CI then showed the package smoke and two e2e specs run a Codex stand-in that exits at once; a Codex that ends before it answers the handshake is now Unsupported (no app-server) and shows nothing, while one that answers and then ends, hangs or refuses stays Failed; pinned by a_codex_that_ends_before_the_handshake_has_no_app_server_and_says_nothing and a kit case, and the fixtures were left as they were.
  • Evidence: 12 registered (2 file, 10 log); paths are local to the run directory
    • agents/runs/codex-hook-trust/evidence/live2/EVIDENCE.md
    • agents/runs/codex-hook-trust/evidence/live2/b1-tokens.txt
    • agents/runs/codex-hook-trust/evidence/live2/b1-pane.txt
    • agents/runs/codex-hook-trust/evidence/live2/b45-table.txt
    • agents/runs/codex-hook-trust/evidence/live2/b45-pane.txt
    • agents/runs/codex-hook-trust/evidence/live2/b6-after.txt
    • agents/runs/codex-hook-trust/evidence/live2/b7.txt
    • agents/runs/codex-hook-trust/evidence/live2/b11.txt
    • agents/runs/codex-hook-trust/evidence/live/b4-review-sessionstart.txt
    • agents/runs/codex-hook-trust/evidence/live/daemon-note-pane.txt
    • agents/runs/codex-hook-trust/evidence/live/daemon-note-control-pane.txt
    • agents/runs/codex-hook-trust/evidence/live/EVIDENCE.md
  • Changed paths: 22 (see Files changed)

yansfil added 15 commits October 7, 2026 05:49
Codex starts no hook whose content hash it does not hold and opens a review
screen for any new or changed entry. Hide's own entries are now recorded as
trusted after the install, through Codex's hooks/list and config/batchWrite,
and only an entry from the account's hooks.json whose command and matcher are
exactly what Hide writes for that event is a target.
… them in place

The Codex hook part runs the trust step after it is installed or found current,
shows a failure as the part's reason, and repeats the last pass's finding on
status reads, which start no process.
… bound the app-server's end, and name Herdr's hook in the docs

An older Codex answers an unknown method as -32600 'unknown variant', not
-32601, so hooks/list absence is read from both. The session now caps the
requests a server may make of it, ends without an unbounded wait, reports a
file Codex could not use, and checks that an entry's key names its own file.
Quitting no longer shows as a failed part.
codex-cli 0.160.0 reports a hooks.json it cannot parse as a warning with an
empty list and only a broken config.toml as an error, so both are read, and a
warning about another tool's hook is not.
@yansfil

yansfil commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Merge check before merge: git merge-tree of origin/main d13419b with head b9b6817 has no conflicts; on that merge result scripts/verify-cargo.sh lint passed and scripts/verify-cargo.sh test passed (73 test binaries green). A first test run hit a load-dependent failure in hided/tests/opener_lifecycle.rs acceptance_timeout_ends_cli_spawned_before_watcher (hided is untouched by this PR; 5/5 reruns of that file passed), left as a follow-up. The Herdr integration hook stays untrusted as the PR states; the operator decides that question separately.

@yansfil
yansfil merged commit 5a8d59b into main Oct 6, 2026
22 checks passed
@yansfil
yansfil deleted the prd/codex-hook-trust branch October 6, 2026 23:18
yansfil added a commit that referenced this pull request Oct 7, 2026
Related: 선행 #668, #670 (둘 다 이미 main에 merge됨)

## Summary

- 에이전트가 `herdr agent start`로 직접 띄운 자식은 부모 기록이 없어 관계도에 선이 없고 watch도 없어,
멈춰도 아무도 깨우지 않습니다.
- Claude Code와 Codex CLI의 hook에 `PreToolUse`(Bash matcher)를 더해, 등록된
checkout의 Herdr pane에서 이런 호출을 실행 전에 거절합니다.
- 거절 이유에 채워진 `hide agent spawn --parent here --name ... --kind ...
--repo ... --branch ...` 명령을 담아, 에이전트가 한 번에 다시 시도합니다.
- 대상은 `herdr agent start`, 그리고 첫 단어가 에이전트 종류인 `herdr pane
run`/`send-text`뿐이고, 그 밖의 호출은 출력도 지연도 없이 그대로 실행됩니다.
- Settings의 Partial 칩 목록에 `종`과 `herdr 직접 실행 차단` 항목이 에이전트별로 더해집니다(해당 없는
에이전트는 -).

```
Not run: this call starts an agent with herdr directly ... Start it through Hide instead:
hide agent spawn --parent here --name set-g --intent <intent> --kind claude --repo /path/repo --branch topic
```

## Review

- **판단해 주세요**: 연쇄 호출(`cd x && herdr agent start ...`)은 호출 전체를 거절하고, 이유에
나머지 명령을 따로 실행하라고 적습니다. 열린 질문의 답입니다.
- **판단해 주세요**: 에이전트가 정한 가정 중 운영자가 확인하지 않은 것: D-09(Gemini `BeforeAgent`)는
이 PR에 없고, D-10 `--branch`는 호출자의 현재 branch, D-12 원칙 intake는 gen-prd 절차의
가정입니다.
- **판단해 주세요**: 범위 축소. Gemini CLI, Grok, Cursor는 이 머신에 없어 검증할 수 없으므로 가드와
`BeforeAgent`를 설치하지 않고 기능 목록에 -로 둡니다. D-06/B7(3개 에이전트), D-09/B8, B11(연결
기기)은 미납품 또는 미검증입니다.
- **판단해 주세요**: Hide가 붙지 않은 Herdr의 pane도 cwd가 등록 checkout이면 같은 거절을 받고, 안내
명령은 그 pane을 부모로 잡지 못합니다. D-03 문자 그대로이며, 가르려면 hided bootstrap 응답에 바인딩을
실어야 합니다.
- **판단해 주세요**: `--session`, `--machine`, 다른
`HERDR_SOCKET_PATH`/`HERDR_SESSION`(inline, `env`, `export`)을 지정한 호출은
거절하지 않습니다. 격리 검증용 Herdr가 그렇게 뜹니다. `source`로 설정하면 읽지 못해 거절됩니다.
- **판단해 주세요**: 새 Mac의 Codex 첫 실행은 "Hooks need review"에 Herdr 통합 hook 하나만
보여 줍니다. Hide의 가드는 이미 Trusted이며, 이번에는 고치지 않습니다.
- **조심해서 볼 파일**: `hide-agent-hooks/src/spawn_guard.rs` - 셸 렉서의 오탐은 평범한
호출을 거절하는 fail-closed이고, 미탐은 허용입니다.
- **조심해서 볼 파일**: `hide-agent-hooks/src/bin/hide-agent-hooks.rs` - 모든
Bash 호출의 고빈도 경로이고, 어떤 실패도 exit 0과 무출력이어야 합니다.
- **조심해서 볼 파일**: `hide-agent-hooks/src/install.rs`, `codex_trust.rs` -
운영자 소유 hook 파일 쓰기와 Codex 신뢰(matcher까지 일치해야 Trusted).
- **조심해서 볼 파일**: `hide-kit/src/agents.rs`,
`contracts/snapshot-wire-enums.json` - snapshot wire enum 순서와 기능 표.
- **조심해서 볼 파일**: `hided/tests/opener_lifecycle.rs` - 이 PR의 범위 밖이지만 S1을
막아 포함한 테스트 완화(원인 증명이 아닌 완화).
- **비용 검토**: 입력(Bash 호출)당 프로세스 시작 1회이고, `herdr`가 payload에 없으면 파싱도 spawn도
하지 않습니다. 상세와 수치는 `docs/PERFORMANCE_TESTING.md`에 있습니다.
- **비용 검토**: `hide workspace bootstrap` 자식은 launch 때만 1개, 2.5초 상한, 출력 16
KiB 상한이며 모든 종료 경로에서 정리됩니다. 로그는 256 KiB와 이전본 1개로 상한이 있고, 락 안 작업과 알림
fan-out은 없습니다.

## Evidence

- **확인한 것**: 전체 `cargo test --workspace` 통과(S1), clippy 포함 lint(S2) 통과,
web typecheck/lint/test 1164개 통과, hide-agent-hooks의 단위 111개와 통합
테스트(stand-in `hide`로 등록/미등록/꺼짐/무응답/느림/타 에이전트 세션)를 확인했습니다.
- **확인한 것**: 격리 Herdr 0.9.1과 실제 Claude Code 2.1.292, Codex CLI 0.160에서
`agent start`, 연쇄 `pane run`, `send-text` 거절, `hide agent spawn`으로 부모 선과
watch가 생기는 것, Codex가 `PreToolUse`(Bash)를 Trusted로 표시하는 것을 봤습니다.
- **확인한 것**: 일반 Bash 호출은 두 TUI 모두 출력과 지연이 없고, 대몬이 꺼진 상태에서 호출은 그대로
실행됩니다(7~39 ms, exit 0).
- **확인한 것**: hook 비용(릴리스, p50/p95, 부하 평균 약 4): 프로세스 시작만 2.8/4.3 ms, 일반
호출 Claude Code 5.7/7.2 ms, Codex 5.6/8.0 ms, 거절된 launch 약 10/12 ms.
- **확인한 것**: 로그인 사본(Claude, Codex)을 격리 HOME에서만 썼고, 토큰이 갱신되지 않았음을 지문 비교로
확인한 뒤 `rm -P`로 지웠습니다.
- **확인하지 못한 것**: Gemini CLI, Grok, Cursor(미설치, D-06/B7, D-09/B8 미납품),
B11 연결 기기, Windows, Codex에서 대몬이 꺼진 상태의 라이브 관찰(통합 테스트만).
- **확인하지 못한 것**: 라이브 검증은 첫 리뷰 때의 head에서 했고, 이후 렉서, 다른 Herdr 허용, 진단 로그
이동은 단위와 통합 테스트로만 확인했습니다. Partial 칩 화면은 직접 보지 않았습니다(두 에이전트는 모든 기능이 ✓라 칩에
나오지 않습니다).
- **확인하지 못한 것**: 새 Codex 자식의 첫 spawn은 `native_identity_unavailable`로 한 번
실패할 수 있고 같은 intent 재시도로 수렴합니다(기존 동작). `opener_lifecycle` 실패는 재현하지 못해
완화로만 고쳤습니다.

<details><summary>추가 증거</summary>

- 거절 화면, 체인/`send-text` 거절, 부모 선과 watch, Codex 신뢰 목록, 지연 측정은 실행 기록에 보관되어
있고(저장소 밖), 이 PR에는 넣지 않았습니다.
- `opener_lifecycle`: 새로 쓴 fake helper 스크립트의 첫 exec가 약 174 ms(두 번째는 8
ms)이고, 이것이 supervisor의 2초 acceptance 창 안에 들어가 부하가 큰 실행에서 pid 파일을 못 쓴 것으로
추정합니다(측정된 것은 비용까지). 스크립트를 창 밖에서 한 번 실행해 두도록 했습니다(macOS만).

</details>

<details><summary>Verification record</summary>

- PRD: `agents/prd/herdr-spawn-guard/prd.md` (sha256
52bd96d6a437c1cf127f32196c8d9244449e5c91fe22a4706e854d541f34afc5)
- Base 5a8d59b → head 8a018e6, verified 2026-10-07T01:20:24.034Z: PASS
- Verification report:
`agents/runs/herdr-spawn-guard/verification-report.json` and
`agents/runs/herdr-spawn-guard/verification-report.md`; source
fingerprint
28ef9b50e63a91ddb8b024a247e4ef06c9d38d74999fcd5b03a26d4b718a25b6
- Suites:
  - S1: GREEN `bash scripts/verify-cargo.sh test` (exit 0)
  - S2: GREEN `bash scripts/verify-cargo.sh lint` (exit 0)
- Reviews:
- Fidelity, Code, Security at da5ea05: Fix now(렉서 fail-closed와 미탐, 다른
Herdr 대상, 미등록 응답의 분류, 진단의 로그 파일 이동, 예약어와 wrapper, owner 핸드셰이크 exit 2,
INSTALL.md 표, 오래된 주석)를 고쳤고, 첫 spawn `ledger_unavailable`은 픽스처 상태 폴더
권한(0755) 때문이라 제품 결함이 아니며, 체크아웃 바인딩 pane 건은 알려진 한계로 문서화했습니다.
- Fidelity+Code and Security follow-up at 8617857: heredoc 본문을 가진
launch가 빠지는 회귀, `export`로 다른 Herdr를 가리키는 호출을 모두 고쳤습니다.
- Final follow-up at 0db57b5 and 77e1de53 (tree identical to the
verified head): `<<\EOF`, here-string 회귀를 고쳤고 새 Fix now는 없습니다.
- Follow-up improvements 미반영: send-text 오탐(문서화), PowerShell 인용과
`<intent>` 자리표시자, `hide_project::git::branch`의 무제한 HEAD 읽기, delivery 진단
저장소 공유, `$` 포함 값의 다른 Herdr 판정, `sudo`/`timeout` wrapper, 한 통합 테스트의
timeout.
- verify한 head는 리뷰한 77e1de53에 main(#684 이후)을 충돌 없이 merge한 것입니다. merge로
들어온 main의 변경은 이 PR의 리뷰 대상이 아니며, 겹친 파일 4개의 자동 merge는 직접 diff로 확인했습니다.
- Evidence: 22 registered (17 file, 5 log); paths are local to the run
directory
  - agents/runs/herdr-spawn-guard/artifacts/step0-probe.md
- agents/runs/herdr-spawn-guard/live/evidence/claude-b1-refusal-pane.txt
-
agents/runs/herdr-spawn-guard/live/evidence/codex-b1-agent-start-pane.txt
-
agents/runs/herdr-spawn-guard/live/evidence/codex-b2-chained-pane-run.txt
  - agents/runs/herdr-spawn-guard/live/evidence/codex-b2-send-text.txt
  - agents/runs/herdr-spawn-guard/live/evidence/claude-b3-spawn-pane.txt
- agents/runs/herdr-spawn-guard/live/evidence/claude-b3-agent-list.json
  - agents/runs/herdr-spawn-guard/live/evidence/codex-b3-spawn-pane.txt
  - agents/runs/herdr-spawn-guard/live/evidence/codex-b3-agent-list.json
-
agents/runs/herdr-spawn-guard/live/evidence/codex-b4-pane-split-allowed.txt
-
agents/runs/herdr-spawn-guard/live/evidence/claude-b4-ordinary-call.txt
- agents/runs/herdr-spawn-guard/live/evidence/codex-b4-ordinary-call.txt
- agents/runs/herdr-spawn-guard/live/evidence/claude-b6-daemon-down.txt
- agents/runs/herdr-spawn-guard/live/evidence/codex-hooks-trust-list.txt
-
agents/runs/herdr-spawn-guard/live/evidence/codex-hooks-review-list.txt
  - agents/runs/herdr-spawn-guard/live/evidence/codex-first-screens.txt
  - agents/runs/herdr-spawn-guard/live/evidence/latency-release.txt
- agents/runs/herdr-spawn-guard/live/evidence/guard-real-hide-timing.txt
  - agents/runs/herdr-spawn-guard/live/opener/first-exec-quiet.txt
  - agents/runs/herdr-spawn-guard/live/opener/chain-latency-quiet.txt
  - agents/runs/herdr-spawn-guard/live/opener/full-run-samples.txt
  - agents/runs/herdr-spawn-guard/live/opener/cause.md
- Changed paths: 48 (see Files changed)

</details>
yansfil added a commit that referenced this pull request Oct 7, 2026
Related: PRD `agents/prd/codex-herdr-hook-trust/prd.md` · 선행: #670
(Codex hook 신뢰), #668 (kit의 Herdr 연동), #688 (spawn guard)

## Summary

- #670 이후 hide 자기 hook은 Codex에 신뢰로 기록되지만, kit이 같이 설치하는 Herdr의 Codex
hook은 남의 것이라 새 기기에서 "Hooks need review"가 뜨고, 승인 전까지 Herdr는 그 pane의 Codex
세션을 모른다.
- kit이 `herdr integration install codex`를 부르기 직전과 직후에
`~/.codex/hooks.json`을 읽어, 그 호출이 추가한 항목(event, matcher, 종류, command)을
kit 기록(`herdr_hooks`)에 남긴다. Herdr의 명령은 hide에 적혀 있지 않다.
- 기록된 항목은 #670의 `select_targets`가 hide 자기 항목과 같은 글자 단위 일치 규칙으로 함께 고른다.
신뢰 확인은 pass당 한 번이고, 에이전트 부품 설치 뒤로 옮겨 첫 설치에서 한 번의 app-server 세션으로 둘 다
신뢰된다.
- 운영자가 먼저 설치한 연동, 같은 스크립트 이름을 흉내 낸 명령, 다른 에이전트는 바뀌지 않는다.
`docs/agent-hooks.md`, `INSTALL.md`, `ARCHITECTURE.md`에 이 규칙과 2026-10-07
조사 결과를 적었다.

## Review

- **판단해 주세요 (보안)**: 학습은 설치 호출 전후 diff다. 그 한 번의 호출 구간에 다른 도구가 항목을 순수하게
추가하면 Herdr 것으로 기록되고 신뢰된다.
상한 4개, 사용자 권한의 쓰기가 필요하고, `config.toml`을 직접 쓰는 것보다 더 얻는 것은 없다. 호출 구간 밖의
쓰기, 다른 항목의 삭제나 수정은 막았다.
더 막으려면 `integration status`의 스크립트 경로를 명령에 요구하는 규칙이 필요한데, 손으로 쓴 Herdr 규칙에
가까워 넣지 않았다. 이 잔여 위험을 받아들이시겠습니까?
- **판단해 주세요 (기존 기기)**: `herdr:codex`만 있고 항목 기록이 없는 기기(#668 빌드가 설치)는 학습하지
못한다. Herdr가 이미 쓴 항목은 재설치해도 그대로라 kit에 추가로 보이지 않는다.
그 기기는 검토 화면을 한 번 보고, 승인하면 그 해시가 신뢰된다. Herdr가 옛 항목을 지우지 않고 새 항목만 더할 때만
회복하며, 제자리 교체는 기록에 없는 항목의 제거라 거절된다. 이전은 넣지 않았다.
- **판단해 주세요 (D-03 해석)**: 신뢰 확인을 #670의 자리(부품 루프 안)에서 `agent_kit::apply`
뒤로 옮겼다. Herdr 연동이 그때서야 설치되므로 B1에 필요하다. 프로세스와 확인 경로는 그대로 하나다.
- **운영자가 확인하지 않은 구현 측 가정**: D-02의 학습 방식(설치 시점 기록), D-04, D-05 조사(Cursor
현재 CLI와 Pi 사용자 extension은 문서 추정), D-06, D-07.
- **조심해서 볼 파일**: `hide-agent-hooks/src/codex_trust.rs` - 신뢰 대상
선택(`select_targets`, `learn_herdr_entries`), 가장 먼저 볼 곳.
`hide-kit/src/agent_kit.rs` - 설치 전후 읽기, `apply`/`reports` 분리.
`hide-kit/src/lib.rs` - 확인 위치와 Codex 부품 실패 전파. `hide-kit/src/record.rs`
- `herdr:codex`가 있을 때만 항목을 읽는 관문.
- **비용 검토**: 새 프로세스와 새 상태 파일은 없다. `codex app-server` 확인은 pass당 1회 그대로이고,
설치 호출마다 hooks.json 읽기 2회, 학습 항목 상한 4개다.

## Evidence

- **확인한 것**: 고정된 Herdr 0.9.1(sha가 `contracts/herdr-bundle.json`과 일치)과
codex-cli 0.160.0, 격리된 Herdr 서버, 비공개 HOME에서 실제 kit
pass(`hide_kit::apply`)를 돌려 봤다.
빈 `~/.codex`에서 한 pass로 7개 항목이 신뢰됐고 Codex가 "Hooks need review" 없이 시작했으며,
첫 턴 뒤 `herdr agent list`에 `agent_session`(source `herdr:codex`)과 hide의
`hide_hooks` 토큰이 있었다(B1, 수정 뒤 코드로 다시 확인).
반복 pass는 `config.toml`을 바이트 단위로 그대로 두었다(B6). 운영자가 먼저 설치한 연동은 신뢰되지 않아
Codex가 그 hook 하나만 검토 화면에 올렸다(B2). 같은 이름의 다른 경로 명령도 검토 화면에 올랐다(B3).
워크스페이스 전체 `cargo test`와 `lint`가 통과했다(kit 140개, `hide-agent-hooks` 통합
22개, 단위 25개 이상 포함). `auth.json` 사본의 지문은 끝까지 같았고 `rm -P`로 지웠다.
- **확인하지 못한 것**: B4(Herdr 명령 변경)와 B5(기록 실패)는 stand-in으로만 확인했고 실제
Herdr/Codex로는 보지 않았다. 패키지된 `hide.app`, 기기(device) 경로, Herdr가 명령을 제자리에서
바꾸는 실제 동작, Herdr 재설치가 `config.toml`의 `hooks.state`를 보존하는지, Cursor와 Pi의
실제 동작은 확인하지 못했다.

<details><summary>Verification record</summary>

- PRD: `agents/prd/codex-herdr-hook-trust/prd.md` (sha256
5efb1726de39a3c658cbe20a3d78b38b17f3e111d72cdce00b2e58ca7ed1a5ae)
- Base 7852aef → head f4ec34a, verified 2026-10-07T02:49:37.198Z: PASS
- Verification report:
`agents/runs/codex-herdr-hook-trust/verification-report.json` and
`agents/runs/codex-herdr-hook-trust/verification-report.md`; source
fingerprint
303af8c81f58d9b78dfe504150308ce977849713bc2efe752613539d398fa624
- Suites:
  - S1: GREEN `bash scripts/verify-cargo.sh test` (exit 0)
  - S2: GREEN `bash scripts/verify-cargo.sh lint` (exit 0)
- Reviews (조언용, 병합 권한 아님):
- 아래 SHA는 origin/main(9e9e6a9)으로 충돌 없이 리베이스하기 전 값이다. 이 PR의 diff는 같고,
리베이스한 head에서 verify가 다시 통과했다.
- Fidelity: a586392a, 4d199851, e27da3be, 0ff0c5f6 검토. Fix now 없음. 사람
결정으로 넘긴 것: 기존 기록 기기 미학습(위 Review 2번), 신뢰 확인 위치 이동. 문서 문구 두 건은 0ff0c5f6에서
반영.
- Code: a586392a에서 Fix now 3건(시험이 주장을 확인하지 못함, 오류 경로 시험 부족, 설치 전후 읽기 간격)
모두 4d199851에서 수정; 4d199851에서 1건(거절된 학습이 기록을 지움)을 e27da3be에서 수정;
e27da3be는 Fix now 없음. 0ff0c5f6(문서와 주석만 바뀜)은 Code와 Security가 다시 보지 않았고
Fidelity가 확인함.
- Security: a586392a에서 Fix now 1건(전후 읽기 창이 넓음)을 4d199851에서 좁힘; 4d199851과
e27da3be는 Fix now 없음.
- 받아들이지 않은 제안: 학습 집합 길이 상한, 기록에서 사라진 항목의 매 pass 정리, `integration status`
경로로 명령 교차 확인, 기록 로드 시 상한 검사(이유는 Review에).
- Follow-up improvements:
`a_refused_learn_keeps_what_was_recorded_before`에 설치 호출 발생 단언 추가,
`handler_type` 검사가 세 곳에 겹침.
- Evidence: 3 registered (2 file, 1 log); paths are local to the run
directory
  - agents/runs/codex-herdr-hook-trust/live/evidence.md
  - agents/runs/codex-herdr-hook-trust/live/b1/screen-after-prompt.txt
  - agents/runs/codex-herdr-hook-trust/live/evidence-rerun.md
- Changed paths: 22 (see Files changed)

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant