Skip to content

Grok과 Cursor의 hook으로 직접 agent 시작을 막고 서브에이전트를 센다 - #811

Merged
yansfil merged 22 commits into
mainfrom
feat/grok-cursor-hooks
Oct 8, 2026
Merged

yansfil merged 22 commits into
mainfrom
feat/grok-cursor-hooks

Conversation

@yansfil

@yansfil yansfil commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Related: #769 (P3), #810, #818

Summary

Grok과 Cursor는 지금까지 hide의 기본 단계라 셸에서 herdr agent start로 hide의 책임 기록을 우회해도 막히지 않았고, 서브에이전트 수도 보이지 않았습니다.
이 PR은 두 에이전트가 공식 문서로 제공하는 hook에 hide 항목을 설치해 실행 차단(spawn guard)과 서브에이전트 수를 Claude Code와 같은 수준으로 줍니다.

  • Grok: hide 소유 파일 ~/.grok/hooks/hide.json을 Herdr, Orca 파일 옆에 둡니다. 이벤트는 SessionStart, PreToolUse(matcher Bash|ask_user_question|exit_plan_mode), SubagentStart, SubagentStop, Stop입니다.
  • Cursor: 함께 쓰는 ~/.cursor/hooks.json에 hide 표지(hide-guidance@2)가 있는 항목만 더하고 지웁니다. 이벤트는 sessionStart, preToolUse(Shell), subagentStart, subagentStop, stop입니다.
  • 거절은 각 에이전트의 모양으로 합니다. Grok은 Claude Code의 envelope을, Cursor는 {"permission":"deny","agent_message":...}을 씁니다. Cursor의 권한 hook은 거절하지 않는 모든 경로에서 {"permission":"allow"}를 냅니다.
  • Grok 안에서는 hide의 Claude Code hook과 Cursor 항목이 조용히 끝나므로, 한 사건은 한 번만 셉니다(GROK_HOOK_EVENT).
  • 코어는 #818의 dialect 기준 설계를 그대로 따라, Grok/Cursor pane의 계측 여부를 OpenCode 플러그인처럼 그 에이전트 행의 hook 조각으로 판정합니다(kit_hook_status).
  • 운영자가 고친 hide 항목은 "edited" 사유와 함께 Outdated로 보이고 Reinstall 전까지 그대로 둡니다. #818의 OpenCode 플러그인과 같은 규칙입니다(B8).
  • 에이전트 폴더가 없으면 아무것도 만들지 않고, 행이 #818의 대기 줄로 그 이유를 보입니다(B8).
  • Factory 질문 가드는 adapter 표가 direct_ask를 선언한 에이전트에만 갑니다. hook, CLI, daemon 소켓이 같은 표(direct_ask_kind)를 읽습니다. Grok은 실측 전이라 Unconfirmed로 두고, 그 질문은 그대로 뜹니다.

화면: Settings 기본 칩 팝오버의 실행 차단과 서브에이전트 수가 Grok/Cursor에서 ✓로 바뀝니다. 폴더가 없을 때는 Grok/Cursor 행에 "Hook: Grok has not created …/.grok yet; the hook is put in once it has" 줄이 Reinstall 없이 보입니다(격리 e2e 스크린샷으로 확인, 이미지는 run 디렉터리에 둠).

Review

  • 판단해 주세요: Grok 파일은 PRD D-01의 이벤트에 SessionStart를 하나 더 등록합니다. 서브에이전트에서는 불리지 않는 이벤트라 pane 수를 새로 시작하고 계측 token을 쓰는 자리로 씁니다(lead 승인).
  • 판단해 주세요: 사이드바 수 배지는 어느 에이전트에도 그려지지 않습니다(에이전트 행에 서브에이전트 수 배지가 어느 에이전트에도 그려지지 않는다 #810). 이 PR은 Claude Code와 같은 수준, 곧 스냅샷 children.subagents까지만 맞춥니다(lead 결정).
  • 판단해 주세요 (B8): OpenCode 안에서도 편지, 실행 가드, Memory, 하위 에이전트 수가 동작한다 #818 위에서 B8을 맞췄습니다. 폴더가 없을 때의 이유는 Grok/Cursor 행에 대기 줄로 보이고(Reinstall 없음), 고친 항목은 Outdated와 "edited" 사유로 보이며 Reinstall이 되돌립니다. 다음 pass는 고친 항목을 덮어쓰지 않습니다. 둘 다 e2e가 실제 행에서 확인합니다.
  • 판단해 주세요 (D-14, B13): Grok의 질문 도구가 PreToolUse에 오는지 아직 실측하지 못해 direct_ask는 Unconfirmed입니다. 그래서 Factory 작업자 pane의 Grok 질문은 지금 그대로 뜹니다. matcher와 읽기 코드는 남겨 두었으니, 로그인된 Grok으로 실측한 뒤 칸을 Available로 바꿀지 Unavailable로 두고 코드를 지울지 정해 주세요.
  • 조심해서 볼 파일: hided/src/server.rs factory_question_guard - 소켓 허용 목록을 direct_ask_kind로 바꿨습니다. main에서는 claude-code|codex만 받아 OpenCode 플러그인의 질문 가드가 invalid_request로 떨어져 질문이 그대로 떴습니다. 이 PR에서 OpenCode도 받습니다.
  • 조심해서 볼 파일: hide-agent-hooks/src/bin/hide-agent-hooks.rs run_basic_hook - failure path. Cursor가 잘못된 출력을 거절로 읽으므로 allow가 빠지는 경로가 없어야 합니다.
  • 조심해서 볼 파일: hide-agent-hooks/src/guidance.rs - 운영자 소유 파일을 쓰는 유일한 코드입니다. 다른 도구의 바이트 보존과 @1에서 @2로의 교체를 봐 주세요.
  • 조심해서 볼 파일: hide-kit/src/lib.rs, agent_kit.rs - 새 Observed::Edited. Claude Code/Codex hook 부품은 Edited를 만들지 않으므로 그 동작은 그대로입니다.
  • 조심해서 볼 파일: hide-agent-hooks/src/counters.rs - 모든 count 사건이 panes.lock 배타 잠금(1초 대기)을 거치고, 바뀌지 않는 사건은 공유 잠금으로 읽습니다. Claude Code와 Codex도 같은 경로입니다.
  • 조심해서 볼 파일: herdr-core/src/runtime/agents.rs, runtime/kit.rs - Mutex<Runtime> 안의 일입니다. Grok/Cursor는 OpenCode와 같이 kit 행의 hook 조각을 pass당 한 번 읽고, 조각이 바뀔 때만 lineage를 다시 맞춥니다.
  • 비용 검토: hook 사건당 잠금 한 번과 기록 쓰기 한 번이 듭니다(fsync 없음). 기록이 보내는 사이 바뀌었으면 보고를 한 번 더 합니다. 상시 작업과 틱 작업은 없습니다.

Evidence

  • 확인한 것: hide-agent-hooks/tests/it/grok_cursor_hooks.rs는 빌드된 도우미를 각 에이전트의 문서 payload, 가짜 hide, 가짜 Herdr 소켓과 함께 돌립니다. 확인한 항목은 다음과 같습니다:
    • 거절 모양;
    • Cursor allow (pane 밖, 미등록, daemon down/mute/later/slow, 읽을 수 없는 payload, owner handshake 실패);
    • Grok 질문 도구가 가드를 묻지 않고 그대로 뜨는 것;
    • 서브에이전트 수 (Grok 배경 서브에이전트 유지, 서브에이전트 자신의 Stop 무시);
    • Grok 안에서 세 hook이 한 번만 세는 것.
  • 확인한 것: web/e2e/grok-cursor-hooks.spec.ts(5개)는 격리 Herdr와 kit를 돌리는 hided, 개인 HOME 위에서 main 병합 후 통과했습니다. 확인한 항목은 다음과 같습니다:
    • 스위치가 hide 항목만 쓰고 지우며, 다른 도구의 바이트가 그대로인 것;
    • 지운 hook이 "Hook: Removed"로, 고친 hook이 "edited" 사유로 행에 보이고 Reinstall로 돌아오는 것;
    • Grok과 Cursor 폴더가 없으면 아무것도 만들지 않고, 두 행이 "has not created …" 대기 줄을 Reinstall 없이 보이는 것;
    • 설치된 명령 그대로의 거절과 allow;
    • Herdr가 grok/cursor로 분류한 pane의 스냅샷 수;
    • Grok 환경에서 한 번만 세는 것.
  • 확인한 것: Cursor CLI 2026.10.01 번들의 hook 실행 코드를 읽었습니다. 명령은 셸로 돌고, exit 2와 JSON이 아닌 출력만 막습니다. 다른 exit와 빈 출력은 failClosed가 없으면 진행하므로, 도우미가 사라져도 막히지 않습니다.
  • 실측 결과 (scripts/agent-live-check.py --agents grok,cursor, 격리 Herdr 0.9.3, 이 worktree의 hided, 2026-10-09 06:19-06:33 KST): 로그인과 운영자 설정 변경 없이 한 번 돌렸고, exit 3이었습니다. 표는 보고서 그대로입니다.
    • grok 1.0.46, 모델 grok-4.5: 판정 unsafe, 선언된 bell False. grok models가 "You are not authenticated."를 답했고, 화면은 "Connection failed | Retrying"이었습니다. 장면은 startup reached/settings_write, working·model_picker reached/ambiguous이고, 나머지 7개는 timeout/not_tested입니다.
    • cursor 2026.10.01-e373342, 모델 gpt-5.3-codex-low: 판정 unknown, 선언된 bell False, loaded integration not_observed(global_hooks_not_excluded). 모든 장면이 "Do you trust the contents of this directory?" 화면에 머물렀습니다. 장면은 startup·working·model_picker·mcp_approval reached/ambiguous이고, 나머지 6개는 timeout/not_tested입니다.
    • 정리: cleanup.confirmed=true, 공유 설정 변경 0, 자격 사본 제거. Cursor가 자기 상태 폴더 9개를 ~/.cursor/projects/ 아래에 만들었고(일회용 probe 폴더용), 지우지 않았습니다.
    • 두 에이전트 모두 bell은 그대로 꺼 둡니다. 이 도구는 bell 안전성을 재며 hide의 hook을 실제 에이전트에 설치하지 않으므로, 아래 hook 동작은 이 실측으로 확인되지 않았습니다.
  • 확인하지 못한 것: 실제 Grok과 Cursor에서의 hook 동작입니다. 확인할 것은 다음과 같습니다:
    • Grok이 Claude Code 호환 hook과 Cursor 항목에도 GROK_HOOK_EVENT를 주는지;
    • Grok의 deny envelope과 빈 출력 처리;
    • ask_user_question과 exit_plan_mode가 PreToolUse에 오는지 (D-14);
    • Stop 페이로드 모양;
    • 자식 세션의 SubagentStop이 부모 pane에 닿는지;
    • Cursor stop이 서브에이전트 안에서도 불리는지, 도우미가 없을 때 빈 출력으로 진행하는지.
      Grok은 로그인이 필요하고, Cursor는 trust 화면을 넘길 준비가 필요합니다.
  • 확인하지 못한 것: Windows입니다. 이 hook은 Windows에 쓰지 않습니다(셸 명령, 두 문서 모두 Windows 형태 없음).
  • 확인하지 못한 것: OpenCode 질문 가드가 실제 daemon 소켓을 거치는 경로입니다. 테스트는 hide를 대역으로 둡니다.
추가 증거
  • 리뷰: native subagent로 Fidelity, Code/Security, 후속 리뷰 4회를 돌렸습니다. Fix now는 모두 반영했습니다:
  • 마지막 후속 리뷰의 나머지 판단:
    • Grok 셸에서 띄운 Claude Code의 실행 차단은 main 계약(inside_another_agents_session_the_guard_stays_out)대로 꺼진 채 두고, 주석만 바로잡았습니다.
    • Follow-up: 이벤트 하나만 지운 항목은 Outdated로 다음 pass가 되돌림. 항목 바이트를 버전에 묶는 테스트.
  • 이 브랜치와 무관한 flaky 테스트 하나를 함께 고쳤습니다(hide-platform 자손 수 비교).
  • Follow-up:
    • observe_guidance가 pass당 파일을 세 번 읽음;
    • 잠금 실패 문구가 소켓 실패처럼 읽힘.

yansfil added 21 commits October 9, 2026 01:32
…nt subagents

Grok gets its own file in ~/.grok/hooks and Cursor gets entries in its
shared hooks.json, under one guidance marker bumped to v2. The helper
refuses a Herdr agent start from either agent's shell in that agent's
answer shape, answers Cursor's permission hooks with allow on every other
path, and counts subagents under a lock so parallel starts are not lost.
Inside Grok, Hide's Claude Code and Cursor hooks stay silent so each event
counts once.
The sidebar and the device catalog read a Grok or Cursor pane's
instrumentation from that agent's hook piece in the kit, re-sync pane
lineage when that piece changes, and the Factory question guard accepts
the grok runtime.
A report that finds the pane record changed while it was sent sends the
latest record again, a lock that cannot be taken is recorded as the last
report failure, and the lock file and its folders are created private to
the account. Claude Code's hook stays silent only where Grok runs it
(GROK_HOOK_EVENT), an empty Grok subagent type reads as the main session,
and the sidebar reads Grok's and Cursor's hook state once per pass instead
of cloning the kit snapshot.
…erdr

The kit writes Hide's Grok file and Cursor entries beside third-party
ones and takes out only Hide's; the installed commands refuse a direct
Herdr agent start in each agent's shape; subagent events reach the pane's
counts in the snapshot; and under Grok's environment the three hooks
count and refuse once.
…n hided fails to start

The report that re-reads the record after the lock is released could see
a truncated file and send zeros; the record is now replaced atomically.
The e2e reads the pane record by listing rather than rebuilding its name.
On Windows a read can be refused while the record is being replaced; the
re-check now leaves that to the writing event instead of reporting zeros.
The test compared the whole test process's descendant count, which other
modules of the same test binary change while they start and end their
own children, so it failed under load without any leak.
# Conflicts:
#	hide-agent-adapter/tests/fixtures/support.json
#	hide-kit/src/tests/agent_cases.rs
# Conflicts:
#	hide-agent-hooks/tests/it/spawn_guard.rs
…lock

Two syncs per change inside the exclusive lock made eight parallel
subagent starts outwait the one-second lock on a slow CI disk. A count
describes running sessions and need not survive a crash, so the record is
written in place, and the report's re-check reads it under the shared side
of the same lock, which never sees half a write.
A prompt or tool event republishes the pane's count; read without the
lock it could meet a record being rewritten and report zeros for an
instant.
@yansfil
yansfil merged commit c4bcdd5 into main Oct 8, 2026
22 checks passed
@yansfil
yansfil deleted the feat/grok-cursor-hooks branch October 8, 2026 23:35
yansfil added a commit that referenced this pull request Oct 9, 2026
Related: P5 OpenCode plugin #818 (이 PR이 그 위에 쌓은 플러그인 설치기와 helper), P6
session readers #804, Pi reader #826 (머지됨, 이 브랜치에 병합)

## Summary

Pi와 omp 안에서 실행된 에이전트는 지금까지 Hide의 편지, 실행 가드, 하위 에이전트 수 없이 기본 지원(스킬과 Herdr
통합)만 받았습니다.
이 PR은 두 에이전트의 사용자 확장 폴더(`~/.pi/agent/extensions/hide.ts`,
`~/.omp/agent/extensions/hide.ts`)에 Hide 확장 하나를 같은 원본으로 설치합니다.
확장은 pane 자신의 TUI 세션에 첫 프롬프트 안내와 대기 편지를 숨은 메시지(`display: false`)로 붙이고,
호스트가 그 메시지와 답을 기록한 뒤에만 편지를 확인합니다.
셸에서 Herdr로 에이전트를 직접 띄우려는 호출은 Claude Code 훅과 같은 사유로 막고, omp에서는 서브에이전트 수를
Herdr에 보고하고 Factory 작업자의 `ask`를 Factory 질문 가드에 넘깁니다.
OpenCode 플러그인의 파일 처리는 세 파일이 함께 쓰는 소유 스크립트
파일(`hide-agent-hooks/src/plugin.rs`)로 일반화했고, 세션 한도는 세션 파일 경로를 담도록 한
규칙(4096바이트)으로 모았습니다.
그래서 설정의 Pi와 omp 행에서 `기본` 칩이 사라지고(PRD D-10, B1), P6의 Pi 세션 읽기와 합쳐진 Pi 행은
켜져 있으면 `Ready` 또는 `N sessions`를 보입니다.
벨은 두 에이전트 모두 꺼 둔 채이고, Memory는 P6의 omp 세션 읽기까지 머지된 뒤 따로 들어갑니다.

## Review

- **판단해 주세요**: 확장은 Herdr pane 환경 변수만 보고 동작합니다(Hide 데몬이 그 Herdr를 소유하는지는
묻지 않음). PRD D-02/B11은 "Hide가 관리하는 pane"이라 쓰지만 Claude Code, Codex CLI 훅과
OpenCode 플러그인이 이미 같은 방식이라 맞췄습니다. 데몬이 없으면 helper가 `{}`를 답합니다.
- **판단해 주세요**: OpenCode 동작 변화 하나. main의 hided는
`factory_question_guard`에서 `claude-code`와 `codex`만 받아 OpenCode의 질문 가드
요청이 wire에서 거절됐고, 그래서 Factory 작업자의 질문이 그대로 보였습니다. 이제 질문 도구를 선언한 모든 런타임을
받으므로 OpenCode 작업자의 질문도 설계대로 막힙니다.
- **판단해 주세요**: 화면 변화. 어댑터 규칙(`basic()` = 프롬프트 받기나 실행 거절 중 하나라도 없음)에 따라
Pi와 omp는 `기본` 칩을 잃습니다. #818에서 OpenCode가 같은 규칙으로 바뀐 것과 같고 PRD가 정한 결과입니다.
main의 설정 e2e 세 개(`agent-adapter-layer`, `agents-follow-herdr`,
`agents-tab`)가 omp 칩을 기대해 CI가 실패했고, 기대를 새 규칙으로 고쳤습니다(이제 `기본`은 Grok과
Cursor뿐).
- **판단해 주세요**: #811 병합 결과. `HookDialect`에 Pi, omp와 Grok, Cursor가 함께 있고,
기능 표는 두 쪽을 합쳤습니다(Grok, Cursor는 실행 가드와 하위 에이전트 수만, 편지는 없음, 그래서 계속 `기본`).
Factory 질문 가드 wire는 이 PR의 4096바이트 세션 한도와 main의 `direct_ask_kind` 판정을 함께
씁니다(`claude-code`, `codex`, `opencode`, `omp`).
- **판단해 주세요**: #826 병합 결과. Pi 선언은 이 PR의 hook, prompt_hook, spawn_guard와
P6의 session, sleep, fork, resume, conversation, titles를 모두 가집니다. Pi 세션은
`reports_turns`가 아니므로 편지가 턴 대기로 묶이지 않고, 확장이 쓰는 숨은 메시지(`role: custom`)는
Pi 리더에서 사람 입력으로 읽히지 않습니다.
- **조심해서 볼 파일**: `hide-agent-hooks/src/pi_extension/extension.js` - 운영자의
Pi와 omp 프로세스 안에서 돕니다. 모든 콜백이 자기 예외를 잡고(omp는 타이머 콜백 예외로 세션이 끝남), 모든
helper 호출이 예산과 개수 상한을 가집니다.
- **조심해서 볼 파일**: `hide-agent-hooks/src/plugin.rs`,
`src/plugin/helper.rs` - 운영자 소유 폴더에 쓰는 코드이고 OpenCode와 공유합니다. OpenCode
파일의 바이트는 고정 테스트가 그대로임을 보입니다.
- **조심해서 볼 파일**: `herdr-core/src/runtime/factory.rs`,
`hided/src/server.rs`, `herdr-core/src/runtime/delivery.rs` - 세션 한도 256
-> 4096바이트(failure path). 해시 전에 길이를 검사합니다.
- **비용 검토**: 셸 호출마다 `herdr` 문자열 검사 한 번, 그 문자열이 있을 때만 helper 1회(2.5초 예산).
프롬프트마다 helper 1회(1.85초), 확인 1회(2초). 동시 helper 8개, 출력 64KiB, 대기 항목
16개(10분), 하위 에이전트 64개 상한. 세션 종료 때 진행 중인 prompt, tool, start helper를
끊습니다.

## Evidence

- **확인한 것**: sealed `verify-cargo.sh test`와 `lint` PASS(head a8996db).
herdr-core, hided, hide-agent-hooks, hide-kit, hide-agent-adapter 전체
nextest 3585개 통과(#826, #811 병합 뒤).
- **확인한 것**: Node 22+에서 생성된 확장을 실제 Pi 1.0.4, omp 18.7.0에서 잡은 사건 표본으로 재생:
밖에서는 등록 안 함, 숨은 메시지 모양, 답 뒤 한 번만 확인, 실패한 확인의 재시도, omp 재진입에서도 안내 유지, 예산,
omp 수와 `ask`, 어떤 입력에도 예외 없음.
- **확인한 것**: Playwright e2e(고정 Herdr 0.9.3, 격리 서버)에서 kit이 두 파일을 쓰고 Pi와
omp 대역 host가 이를 읽음: 양방향 편지와 기록 후 확인, 두 에이전트의 실행 거절 사유, omp 서브에이전트
수(Herdr 토큰과 snapshot), 서브에이전트 프롬프트에는 편지 없음. 확인 호출을 지운 결함을 심으면 실패함을 확인.
- **확인한 것**: 실제 Pi 1.0.4와 omp 18.7.0 TUI를 pty로 띄워(비공개 HOME, 가짜 provider,
대역 helper) 확장 파일 그대로 실측: start, prompt, confirm 순서, 숨은 메시지가 세션 파일에
`display:false`와 `details.hide`로 남고 화면에는 그려지지 않으며 모델에는 닿음, omp TUI의
`ctx.mode`는 `tui`, Pi RPC 모드에서는 helper 호출 0.
- **확인하지 못한 것**: 로그인된 에이전트로 한 실측. `scripts/agent-live-check.py --agents
pi,omp`를 격리 Herdr에서 돌렸지만 두 에이전트 모두 `not_authenticated`였습니다. Pi는 startup
장면만 닿아 판정 `unsafe`(벨 뒤 비공개 설정 쓰기), rest는 시간 초과, 나머지는 건너뜀. omp는 모든 장면
건너뜀. 로그인은 하지 않았고 벨은 꺼 둡니다.
- **확인하지 못한 것**: 실제 omp의 재진입과 실제 서브에이전트 수(합성 사건으로만), 사이드바 배지 표시(issue
810), 기기에서 도는 Pi와 omp, Windows(확장을 쓰지 않음), Memory(P6 뒤 별도 PR).
- **확인한 것**: 고친 설정 e2e 세 개, `pi-omp-extension`, `opencode-plugin`, P6의
`session-readers`와 `link-graph`를 병합한 트리에서 로컬 통과. `pi-omp-extension`은 20회
중 1회 `native_identity_required`(코어가 pane의 세션을 아직 못 들음)로 실패해, 두 pane에서
`hide inbox`가 답할 때까지 기다리도록 고친 뒤 24회 모두 통과.
- **확인하지 못한 것**: sealed 실행에서
`spawn_guard::a_pane_run_or_send_text_launch_leaves_the_name_and_intent_for_the_agent`가
한 번 빈 stdout으로 실패했고 단독 3회, 전체 binary 2회는 통과했습니다(이 PR이 건드리지 않은 테스트,
`bell_intake`와 같은 부하 기한 부류).
- **확인하지 못한 것**: sealed 실행 한 번에서
`bell_intake::a_prompt_that_only_starts_like_the_bell_is_an_operator_prompt`가
0.5초 payload 읽기 기한을 넘겨 실패했고, 단독과 이후 네 번은 통과했습니다. 같은 binary에서 두 Node 테스트가
동시에 돌던 것을 순서대로 돌게 바꿨습니다.

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

- PRD: `agents/prd/pi-omp-extension/prd.md` (sha256
676a51347370bcc57965ce68ef407ee2585d2fdab6d3c30b64a5ce9ff7113f7d)
- Base ba980fa → head a8996db, verified 2026-10-09T00:08:11.704Z: PASS
- Verification report:
`agents/runs/pi-omp-extension/verification-report.json` and
`agents/runs/pi-omp-extension/verification-report.md`; source
fingerprint
af86a6093a02254b19bcf251c29d027666767d7cd5d857f3bd2d85198399727a
- Suites:
  - S1: GREEN `bash scripts/verify-cargo.sh test` (exit 0)
  - S2: GREEN `bash scripts/verify-cargo.sh lint` (exit 0)
- Reviews (advisory):
- Fidelity, Code, Security on 274e824: Fix now = Factory 질문 가드의 256바이트
세션 한도(세 리뷰 모두), 확인 전 confirmed 기록(세 리뷰 모두), 준비 시점에 안내를 준 것으로
기록(Fidelity, Code), omp RPC를 pane의 루트로 셈(Security), 문서의 범위 과장(Fidelity).
모두 3236fdd, 95e9876, a301065, 4e5808444에서 고침.
- Follow-up on 4e58084: 고친 8건 모두 닫힘, 새 코드 결함 없음; head에서 omp TUI 재실측,
치환 순서 테스트, 문서 한 문장 요청 -> 2ed0090f4에서 처리.
  - Follow-up on 2ed0090: 새 테스트의 rustfmt 위반 -> d5fbf81. 
- Follow-up on 37b60ff: fmt 닫힘, 두 Node 테스트를 순서대로 돈 변경은 결함을 가리지 않는 부분
완화, main 병합(#832)은 상호작용 없음; Fix now 없음. bell_intake는 `cargo test` 레인에서
재발할 때 issue로(그때는 부하에 기대지 않는 payload 기한으로 고침).
- Follow-up on 1337720 (CI 설정 spec 수정): Fix now 없음; UI_BEHAVIOR 세션 수
문장과 AgentsTab 단위 테스트의 omp 모델링 -> da63cfd.
- Follow-up on 27c8409 (#826 병합): Fix now = UI_BEHAVIOR의 Pi `Basic
popover` 문장 -> 고침. 낡은 주석 둘, factory.md 작업자 문단, 단위 테스트 fixture도 함께 고침. 잠든
Pi 부모의 계보(경로 digest vs native id)는 P6 영역의 Follow-up.
- Follow-up on 30d351f: Fix now = factory.md 작업자 문단이 Pi의 sleep과
OpenCode, Pi, omp의 다음 프롬프트 편지를 뭉갬 -> 54af6dc14에서 기능별로 나눠 고침, model.rs
주석도 실제 이유로.
  - Closure on 54af6dc: 두 항목 닫힘, Fix now 없음.
- Follow-up on 428ac77 (#811 Grok, Cursor hooks 병합): Fix now 없음; 안 쓰는
`HookDialect::plugin()` 삭제, kit hook status와 질문 가드 parse 테스트에 Pi, omp
추가, 문서와 테스트 이름 정리 -> 32f9e2c.
- Closure on 32f9e2c (+ main #842, #844 병합 a8996db): 닫힘, Fix now 없음.
- Follow-up improvements: 잠든 Pi 부모 아래 자식의 계보가 깨어날 때까지 끊김(`SleepRecord`에
살아 있던 행의 계보 digest 보관), Herdr pane이면 Hide 데몬 여부와 무관하게 동작(OpenCode 플러그인과
같음), 다음 프롬프트 편지 pull이 pane 자신의 세션인지 코어에서 확인, 256KiB를 넘는 herdr 셸 명령,
symlink로 된 hide.ts, Memory 전 프롬프트 본문 전달, 확장 미동작 에이전트의 편지 대기, CI 부하에서
Node 기동과 제품 예산의 경쟁.
- Evidence: 13 registered (9 log, 4 file); paths are local to the run
directory
  - agents/runs/pi-omp-extension/evidence/host-smoke/README.md
- agents/runs/pi-omp-extension/evidence/host-smoke/pi-helper-calls.jsonl
-
agents/runs/pi-omp-extension/evidence/host-smoke/pi-session-hidden-entry.jsonl
-
agents/runs/pi-omp-extension/evidence/host-smoke/omp-helper-calls.jsonl
-
agents/runs/pi-omp-extension/evidence/host-smoke/omp-session-hidden-entry.jsonl
  - agents/runs/pi-omp-extension/evidence/host-smoke-tui/README.md
-
agents/runs/pi-omp-extension/evidence/host-smoke-tui/pi-helper-calls.jsonl
-
agents/runs/pi-omp-extension/evidence/host-smoke-tui/pi-session-hidden-entry.jsonl
-
agents/runs/pi-omp-extension/evidence/host-smoke-tui/omp-helper-calls.jsonl
-
agents/runs/pi-omp-extension/evidence/host-smoke-tui/omp-session-hidden-entry.jsonl
  - agents/runs/pi-omp-extension/live-check-1/report.md
  - agents/runs/pi-omp-extension/evidence/host-smoke-tui-head/README.md
-
agents/runs/pi-omp-extension/evidence/host-smoke-tui-head/omp-ctx-mode.txt
- Changed paths: 64 (see Files changed)
- Delivery: mode pr, branch `feat/pi-omp-extension`, base `main`

</details>
yansfil added a commit that referenced this pull request Oct 9, 2026
Related: PRD `agents/prd/session-readers-grok/prd.md` · 세션 리더 공통 #804,
Pi #826, omp #865 다음 순서 · Grok 훅 #811, Pi/omp 확장 #838

## Summary

Grok 1.0.46 세션을 hide가 직접 읽습니다.
`~/.grok/sessions/<URL 인코딩한 cwd>/<id>/`의 `summary.json`이 id, cwd, 제목을,
`updates.jsonl`이 대화를 맡습니다.
그래서 Grok 행이 Claude Code, Codex, Pi, omp처럼 자기 제목, 재우기와 깨우기(`--resume
<id>`), fork(`--resume <id> --fork-session`), 폰 대화, 질문과 계획 승인 대기를 갖습니다.
Grok은 편지 hook이 없어 Settings에서 기본(Basic) 칩은 그대로입니다.
화면 구성은 바뀌지 않고, Grok 행에 다른 에이전트와 같은 표시가 생깁니다.

## Review

- **판단해 주세요**: 줄 상한(256 KiB)을 넘는 Grok 기록을 본문 없이 읽습니다. 이미지 붙여넣기와 큰 도구 출력이
흔해서, 예전 규칙(읽기 중단)이면 그 세션의 기능이 계속 꺼집니다. 본문이 빠진 질문은 글과 선택지 없는 질문으로 기다리고, 큰
답변과 도구 출력의 글과 PR 링크는 읽지 않습니다(`body_capacity`로 셈).
- **판단해 주세요**: `/rewind`로 버린 대화를 걸러내지 않고 기록된 역사로 보여 줍니다. 버린 요청에 답이 전혀
없으면 같은 `promptIndex`의 새 요청과 한 메시지로 합쳐질 수 있습니다.
- **조심해서 볼 파일**: `hide-session/src/grok.rs` - 형식 해석과 큰 기록
스캐너(`LargeLine`), checkpoint에 실리는 상태.
- **조심해서 볼 파일**: `hide-session/src/conversation_cursor.rs` - 고빈도 폴링 경로.
Grok은 폴마다 `summary.json`, `plan_mode.json`, `plan.md`를 읽고 그 바이트를 폴 예산에
셉니다.
- **조심해서 볼 파일**: `hide-session/src/native_file.rs`,
`herdr-core/src/live.rs` - 경로 증명. Grok 그룹은 정규화한 cwd의 인코딩이어야 하고, fork와
깨우기는 증명된 파일 경로로만 갑니다.
- **조심해서 볼 파일**: `hided/src/mobile/conversation.rs` - 나뉜 메시지를 페이지 경계 너머로
합치고, 이어지는 기록이 오면 페이지를 다시 엽니다.
- **비용 검토**: 새 프로세스 없음. 폴당 추가 읽기는 세 파일, 각각 상한(요약 256 KiB,
`plan_mode.json` 4 KiB, `plan.md` 8 KiB)과 폴 예산 안. 큰 기록 스캔은 checkpoint에
고정 개수의 작은 필드만 남깁니다.

## Evidence

- **확인한 것**: hide-session 계약 테스트 Grok 10개(공통 사실, 조각 합치기, 질문, 계획 승인, 제목,
소유자 증명, 경로, 목록과 링크, 잘린 줄, 상한 넘는 기록)와 스캐너 단위 테스트 3개(픽스처 모든 줄 대조, 모든 바이트
분할과 checkpoint 왕복, 반복 키).
- **확인한 것**: herdr-core의 fork/resume 인자, 증명된 파일로 Grok fork(성공, 거절, 요약
변경, 실행 변경), 재우기 가능 판정, 보관함 상세 합치기. hided 폰 페이징과 재시작.
- **확인한 것**: Playwright `session-readers.spec.ts` 3/3(pi, omp, grok)을 고정
Herdr 0.9.3과 이 hided에서. Grok은 제목, 계획 승인 사실과 `approval` 표시, 해제, 재우기,
`--resume <id>` 깨우기. 같은 조건에서 `grok-cursor-hooks.spec.ts` 5/5(공유 e2e 대역이
세션 설정 없이도 평범한 대역으로 실행됨).
- **확인한 것**: 실제 grok 1.0.46(별도 HOME)이 픽스처 세션을 `grok sessions list`로 제목과
함께 나열하고 `grok export`로 읽음. `/tmp`로 들어가도 그룹 이름은 `/private/tmp` 기준(정규화한
cwd)임을 확인.
- **확인한 것**: `agent-live-check --agents grok`에서 Herdr가 Grok 세션을 `kind:
id`로 보고함.
- **확인하지 못한 것**: 실제 바이너리의 이어서 시작과 fork. 로그인되지 않아 헤드리스는 "Not signed in"으로
끝났고, 화면 모드는 로그인 화면에서 멈췄습니다(not_authenticated). 인자는 1.0.46 `--help`의
`--resume`, `--fork-session` 설명을 따릅니다.
- **확인하지 못한 것**: 실제 바이너리가 쓴 `agentTimestampMs`, `promptIndex`,
`promptId`, `x.ai/tool` 종류, `hideFromScrollback`, `turn_completed`,
`plan_mode.json`, `plan.md` 모양. 픽스처는 공개된 grok-build 소스에서 만들었습니다. 255바이트
넘는 cwd의 해시 그룹은 거절만 합니다.
- **확인하지 못한 것**: 부모 PRD의 다섯 리더 묶음 e2e와 B16 전체는 마지막 자식 PR에서 닫습니다. 노드
경계(본문 검색, 보관함 재개) Grok 전용 테스트는 없습니다.

<details><summary>후속 개선(이 PR 밖)</summary>

- `/rewind` 기록 걸러내기와 그에 따른 `u:N` 합침
- 폴 경계를 넘는 라벨 이벤트 합치기(폰은 합침), Memory 분석 경로의 조각 이벤트
- 상한 넘는 typed prompt를 빈 Human 이벤트로 남길지
- `links::candidates`가 세션 폴더 안까지 내려가며 다른 에이전트와 방문 상한을 공유하는 문제, 하위 에이전트
세션 후보
- 대화 없는 Grok 폴더가 사용할 수 없는 목록 행으로 보이는 문제, 목록 제목 실패 이유가 사라지는 문제
- `summary.json` 중복 읽기, id 없는 locate의 예산, `plan.md` 없는 계획 승인의 빈 내용, 충돌 뒤
남는 승인 대기 표시
- 노드 경계와 종 보류의 Grok 테스트, `docs/PERFORMANCE_TESTING.md`의 폴당 읽기 목록
- Pi와 omp의 256 KiB 넘는 기록은 여전히 읽기를 멈춤(Grok은 자체 스캔으로 해결, 같은 방식 적용 검토)
- UUID가 아닌 Grok id를 resume/fork에서 거절할지(`--resume`은 UUID 모양이 아니면 제목으로 찾음)
- 큰 기록 대조 테스트에 질문, interjection, hostTurn, 깨우기 줄과 답변 part 비교 추가
- 세션 설정을 빠뜨린 네이티브 e2e가 대역 오류 대신 시간 초과로 실패하는 문제(실패는 그대로, 진단만 약해짐)

</details>

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

- PRD: `agents/prd/session-readers-grok/prd.md` (sha256
745654f89e0f13bd8027bbeb085c43e45b2f2a08e45225d0a756592a7f19947d)
- Base 39efc67 → head 0eeb17a, verified 2026-10-09T08:38:40.330Z: PASS
- Verification report:
`agents/runs/session-readers-grok/verification-report.json` and
`agents/runs/session-readers-grok/verification-report.md`; source
fingerprint
b46295c8b30d8f4069516f9dbc2db0d28540387621d6720c5ac831a0b55a73b5
- Suites:
  - S1: GREEN `bash scripts/verify-cargo.sh test` (exit 0)
  - S2: GREEN `bash scripts/verify-cargo.sh lint` (exit 0)
- Reviews:
- Fidelity (9c2a0aa, 3fe7f6d, bcf77c1): Fix now 1, 실제 CLI resume/fork와
형식 미측정. 실제 grok 1.0.46으로 형식과 그룹 이름을 확인하고 resume/fork는 미측정으로 명시해 닫음. Fix
now 2, 경로 증명 변경 뒤 e2e 재실행 요구. 3fe7f6d와 e51a7c4에서 3/3 통과로 닫음. 마지막 회차 Fix
now 없음.
- Code (9c2a0aa, 3fe7f6d, bcf77c1, e51a7c4, 01e1d26, 0eeb17a): 큰 기록이 읽기를
멈춤, 보관함 상세 미결합, 재우기 테스트가 엉뚱한 이유로 통과, 쓰이지 않는 `id` 경로 분기, 큰 질문이 여전히 멈춤의
5건을 모두 고침(4f8c3c5, 45a0129, bcf77c1). main 병합 정리, checkpoint 박스화, CI e2e
대역 수정(0eeb17a) 재검토에서 Fix now 없음.
  - Follow-up improvements: 위 '후속 개선' 접힌 목록.
- Evidence: 5 registered (5 log); paths are local to the run directory
  - agents/runs/session-readers-grok/evidence/e2e-session-readers.log
  - agents/runs/session-readers-grok/live-grok-1314/report.md
-
agents/runs/session-readers-grok/evidence/e2e-session-readers-3fe7f6dd6.log
-
agents/runs/session-readers-grok/evidence/e2e-session-readers-merged.log
  - agents/runs/session-readers-grok/real-grok-format/findings.md
- Changed paths: 42 (see Files changed)
- Delivery: mode pr, branch `feat/session-readers-grok`, base `main`

</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