Repository navigation
fix: keep Hide's letter wake line out of the operator's words in Memory - #1779
Merged
Merged
Conversation
The doorbell's 🦉 line that wakes a pane for a letter carries no envelope, so Project Memory counted it as the operator's own words: it became a human source, counted as an operator event, and the session's link facts took it as the last request. Its shape is now named once in hide-session (BELL_MARK, BELL_INBOX), which bell.rs writes from and is_letter_bell reads; Memory sends any Hide letter (another agent's envelope or the bell) as kind letter, and the link reader drops the bell. Sources already recorded keep their flag; docs/ARCHITECTURE.md says why.
…tions stay the operator's is_bell_line now reads the line the bell writes part by part (mark, sender, a kind word of one interface language, optional summary, the waiting-letter and inbox tails, the bell's limits) from hide-session/src/bell_line.rs, which bell.rs writes from. An instruction that only begins with the owl or only ends with ' · hide inbox' stays the operator's words, a link request and a human source; the owl-less Windows Codex form still needs the inbox tail.
…ts shape stays unambiguous
Codex CLI on Windows drops characters above U+FFFF, which left a double space or an empty summary in the recorded line, and a summary shaped like a tail ('· hide inbox', '· and 2 more') was eaten by the reader's tail stripping; both read as the operator's words. bell.rs now leaves those characters out of the sender and summary before folding spaces, types '·' as '∙', and writes an empty sender as '…', so the recorded line differs only by the missing owl and ' · ' opens only a tail. A Memory test feeds the lines the producer writes for these summaries through a session and checks they are letters: no operator event, no human source, no link request.
yansfil
added a commit
that referenced
this pull request
Oct 28, 2026
…eep Memory tidy (#1816) Related: PRD `agents/prd/memory-self-improve/prd.md` (로컬 계약; 아래 Summary와 Evidence가 검토할 내용입니다) · 선행 #1779, #1780 ## Summary - 운영자가 세션마다 같은 부탁을 다시 하고, 같은 취향이 기억 여러 장으로 흩어지고, 준 기억이 먹혔는지 아무도 몰랐습니다. - 이제 Hide pane의 모든 새 세션이 Hide 전역 지시(`~/.hide/state/global-instruction.md`, 4 KiB)를 운영자가 승인한 지시로 받습니다. - 제안 탭이 되풀이한 요청과 줬는데도 안 먹힌 기억을 찾아, 전역 지시에 넣을 줄을 근거와 함께 보여 줍니다. 누르면 Hide가 넣고, 되돌리기는 그 줄만 뺍니다. - Memory는 같은 뜻의 기억을 합치고(되돌리기 가능), 60일 안 쓴 기억은 보관하고, 운영자 말인지 다시 확인할 수 있습니다. - 에이전트가 전역 지시 파일을 쓰는 도구 호출은 hook이 막습니다(운영자 선택 A: best-effort 가드).  제안 탭: 되풀이한 요청에서 나온 전역 지시 줄과 운영자 말 근거, 넣은 뒤 되돌리기와 다시 말함  Memory 탭: 합치기와 다시 확인이 남긴 변경 기록과 되돌리기, 60일 안 쓴 기억의 보관과 되살리기 ## Review - **판단해 주세요**: 운영자 선택 A로 전역 지시 쓰기 가드는 best-effort입니다. 따옴표로 쪼갠 이름, glob, 계산한 이름, PowerShell 표기는 못 봅니다(아래 수용한 위험). - **판단해 주세요**: 수용한 위험이자 후속 B: 파일 지문을 두고, 바뀌었으면 제안 탭에서 한 번 확인받는 방식입니다. 이슈는 운영자가 직접 엽니다. - **판단해 주세요**: 전역 지시를 흔한 이름의 파일(`AGENTS.md` 등)에 링크하면, 그 이름을 담은 셸 호출은 읽기여도 막힙니다. 셸 호출은 읽기와 쓰기를 구분할 수 없기 때문입니다. - **조심해서 볼 파일**: `hide-memory/src/store.rs`, `store/upkeep.rs` - 운영자 Memory 저장소 스키마 21→22 마이그레이션(21 백업을 남김), failure path. - **조심해서 볼 파일**: `herdr-core/src/global_instruction.rs` - 모든 세션에 들어가는 파일 쓰기. 미리 보인 줄의 token이 맞을 때만 쓰고, 그사이 손으로 고친 저장은 덮지 않으며, 링크는 이미 있는 `.md`/`.txt`로만 따라갑니다. - **조심해서 볼 파일**: `hide-agent-hooks/src/global_guard.rs`, OpenCode·Pi·omp 스크립트 - 모든 pre-tool 호출의 고빈도 경로. 이름이 없는 payload는 바이트 검색과 상태 폴더마다 링크 읽기 한 번으로 끝납니다. - **조심해서 볼 파일**: `herdr-core/src/node_migration/copy.rs` - 코어 이동이 링크된 전역 지시를 코어의 상한 읽기(4 KiB, UTF-8, 링크 재추적 없음)로 옮깁니다. 못 읽으면 남기고 진단만 씁니다. - **조심해서 볼 파일**: `herdr-core/src/runtime/suggestion_evidence.rs` - 근거 발췌 읽기는 lock 밖 worker에서 (workspace, row)별로 한 번에 하나만 돌고, panic은 읽지 못한 발췌로 떨어집니다. - **비용 검토**: 분석, 합치기, 보관, 다시 확인은 기존 Memory 분석 worker 위에서 돕니다. 다시 확인 대기는 프로젝트당 20장, 변경 기록은 상한까지 잘리고, 근거 읽기는 single-flight입니다. ## Evidence - **확인한 것**: `sasu implement verify`가 최종 head에서 PASS: workspace nextest 전체와 clippy `-D warnings`. - **확인한 것**: 같은 변경의 앞선 head에서 hooks·memory 590개, core·hided 4048개, web 2220개, desktop 289개 통과. design contract와 workstation identity 검사 통과. - **확인한 것**: 마지막 수정 뒤 hide-agent-hooks 395개 통과. 링크 대상에 쓰는 Claude Write를 컴파일된 hook으로 보내 거절되고, 로그에 명령이나 경로가 남지 않음을 확인했습니다. - **확인한 것**: policy lane(scripts 테스트 713개와 구조 검사)을 로컬에서 통과. 외부 lane의 `remote_core` Memory 여정을 pinned Herdr로 로컬에서 통과. - **확인한 것**: 제안 탭, Memory 탭 화면(ko, en)과 전역 지시가 너무 큰 상태를 gallery에서 캡처했습니다. - **확인하지 못한 것**: 격리한 후보 앱의 native QA는 돌리지 않았습니다. 화면은 gallery 캡처뿐입니다. - **확인하지 못한 것**: 실제 Claude Code, Codex, OpenCode 세션이 전역 지시를 받는지, 쓰기가 거절되는지 실측하지 않았습니다(B30). Windows와 Linux는 CI lane에만 맡깁니다. - **확인하지 못한 것**: `core_move` lane은 로컬 디스크가 모자라 CI에만 맡깁니다. - **확인하지 못한 것**: Claude Code 컨텍스트 10,000자 상한 안에서 전역 지시와 Memory가 함께 들어가는지 재지 않았습니다. <details><summary>후속 개선 (Follow-up improvements)</summary> - 후속 B: 전역 지시 파일 지문을 두고, 바뀌었으면 제안 탭에서 한 번 확인받습니다(운영자가 이슈를 엽니다). - 가드가 못 보는 표기: 따옴표로 쪼갠 이름, glob, `python -c`로 계산한 이름, `cd ~/.hide && cd state`, 256 KiB 이후에만 이름이 있는 payload, Claude Code PowerShell 도구 matcher. - 가드 비용과 범위: 링크 대상 이름이 흔하면 파싱이 넓어집니다. 거절 로그에 rate limit이 없습니다. 링크는 한 단계만 따라갑니다. `.hide-new` 임시 파일 이름은 예측할 수 있습니다. - 테스트: B15 전달 배지 흐름, B12 에스컬레이션, 근거 읽기 panic, `from_card` 같은 세션 경우, 경로를 넣은 JS route decode, OpenCode 2·Pi 링크 경우. - 동작: B11은 세션 시작 시각으로 "받은 세션"을 근사합니다. B13은 켠 날의 소급 계산이 없습니다. stale `writing` 표시가 남는 crash 구간이 있고, 손으로 넣은 줄을 채택할 때 되돌리기 힌트가 없습니다. - 그 밖: `is_invisible` 목록 확장, 줄의 `>` 거절, `trim_changes` 다시 확인 행, 두 클라이언트의 근거 슬롯 공유, 다시 확인 읽기의 순차 처리, 같은 batch 합치기 undo id, alias 재시도, receipt 상한. </details> <details><summary>Verification record</summary> - PRD: `agents/prd/memory-self-improve/prd.md` (sha256 1ec0f473831342cddec15936561f70fbadf390d53016db2786a103bb212ae9c8) - Base e86a1f4 → head 8bd8a5c, verified 2026-10-28T19:09:34.724Z: PASS - Verification report: `agents/runs/memory-self-improve/verification-report.json` and `agents/runs/memory-self-improve/verification-report.md`; source fingerprint f5e066833570caae5a5621e62f7a1a93336d9ff0a96b58e8fb8fc072392b0bc4 - Suites: - S1: GREEN `bash scripts/verify-cargo.sh test` (exit 0) - S2: GREEN `bash scripts/verify-cargo.sh lint` (exit 0) - Reviews (advisory, native subagents): - Fidelity: 28f6903 Fix now 2개(D-37 새 카드의 정정 억제, AI 꺼짐 다시 확인 core 테스트와 오류 문구) -> 52113f680에서 고침; 52113f6, 6cb74d2 Fix now 없음. Follow-up: `from_card` 해석 테스트, 링크 한 단계, B15/B12 테스트, B11 근사, B13 소급. - Code: 28f6903 Fix now 3개 -> f56aca3, 52113f680에서 고침; 52113f6 Fix now 1개(server.js export, Low) -> 6cb74d2; d99d074 Fix now 1개(링크된 전역 지시면 코어 이동 거절, Medium) -> b730419, c1403906f에서 고침; 3237405 fixture 수정 확인; 마지막 리뷰 c140390, 3237405 Fix now 없음. Follow-up: 흔한 링크 이름의 파싱 비용, `may_name` 중복 검색, JS route decode 테스트, 링크를 평평하게 옮긴 기록(`link_copied`). - Security: 28f6903 Fix now 4개 -> 52113f6(256 KiB 이후 이름은 수용한 한계); 52113f6 Fix now 1개(링크 대상이 hook 사전 검사를 못 지남, Medium) -> 6cb74d2; b730419 Follow-up(이동 복사에 상한 없음, 검사-복사 경합)을 c1403906f에서 상한 읽기로 닫음; c140390 Fix now 없음. Follow-up: 흔한 이름 링크 시 셸 읽기 거절, 거절 로그 rate limit, `.hide-new` 예측 가능 이름, PowerShell matcher. - 8bd8a5c87은 c140390 이후 테스트 두 파일만 바꿨습니다(remote_core fixture 시각, SessionStart receipt 기대). - Evidence: 5 registered (5 screenshot); paths are local to the run directory - agents/runs/memory-self-improve/evidence/global_unusable-ko.png - agents/runs/memory-self-improve/evidence/upkeep-ko.png - agents/runs/memory-self-improve/evidence/upkeep-en.png - agents/runs/memory-self-improve/evidence/global-ko.png - agents/runs/memory-self-improve/evidence/global-en.png - Changed paths: 96 (see Files changed) - Delivery: mode pr, branch `feat/memory-self-improve`, base `main` </details>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hide가 편지를 알리려고 pane에 쳐 넣는
🦉 <보낸 이> <종류>: ...줄을 Project Memory가 운영자 본인의 말로 세고 있었습니다.그래서 다른 에이전트의 보고가 카드의 human 근거가 되고(m375, m378), 운영자 이벤트 수가 부풀고, 세션 링크의 "마지막 요청"이 되기도 했습니다.
이제 이 줄과 다른 에이전트의
Hide letter봉투는 Memory에letter로 넘어가 운영자 이벤트로 세지지 않고 human 근거가 되지 못하며, 링크 리더는 이 줄을 요청으로 받지 않습니다.모든 에이전트(Claude Code, Codex, OpenCode, Pi, omp, Grok)와 모든 OS에 같은 판정이 적용됩니다.
기존 저장 행은 고치지 않습니다: 저장소는 근거의 offset과 hash만 갖고 있어, 고치려면 schema migration 안에서 모든 기기의 세션 파일을 다시 읽어야 합니다. 이미 기록된 16개 정도의 근거는 기존 경로(정정, stale,
hide memory forget)로만 지위를 잃고, 그 이유는docs/ARCHITECTURE.md에 적었습니다.스크린샷 없음: 화면 변경 없음 (Memory 분석 입력과 링크 facts만 바뀜)
Review
EventKind가 아닌 소비자 쪽(ConversationEvent::from_operator)에 둔 것. 이 줄을Injected로 바꾸면 라벨 worker가 Hide가 기록한 bell로 이 턴을 보낸 이의 편지로 세션 기록에 남기는 길(D-19)이 끊기므로, 역할은 Human으로 두고 "운영자의 말인가"를 따로 묻게 했습니다.bell_line은 편지 보존 기간을, 라벨의 in-memory bell은 재시작을 넘기지 못해 과거 transcript를 읽는 Memory에는 쓸 수 없습니다. 문법(부엉이, 언어별 종류 단어와 대기 문구, inbox 꼬리, 길이 제한)은hide-session/src/bell_line.rs에 한 번 두고bell.rs가 그대로 씁니다.🦉 <이름> 보고: ...)으로 치면 편지로 읽힙니다. 부엉이로 시작하기만 하거나· hide inbox로 끝나기만 하는 지시는 운영자 말로 남습니다.Hide letter봉투도 같은 이유로 Memory에서letter가 됩니다(운영자의 Send가 만든 편지는 그대로 운영자). 기존 OpenCode 테스트 두 곳이 봉투를human으로 기대하던 것을letter로 바꿨습니다.bell.rs가 보낸 이와 요약에서 U+FFFF 위 문자(이모지)를 빼고 공백을 접고,·을∙로 바꾸고, 빈 이름은…로 씁니다. 그래서 Windows Codex 기록은 부엉이만 빠진 같은 줄이고·는 꼬리에만 나와, 판정 문법이 추측 없이 한 가지로 읽힙니다. 판정에서 풀면 연속 공백·빈 요약·꼬리 모양 요약마다 후보를 늘려야 해 문법이 넓어집니다. 대가: pane에 보이는 bell 줄 요약에서 이모지가 빠집니다.·로 시작했던 옛 bell은 여전히 운영자 말로 읽힐 수 있습니다(docs/delivery.md).hide-session/src/bell_line.rs-is_bell_line: 부엉이와 공백, 보낸 이(32자+…), 종류 단어, 선택 요약(60자+…), bell이 붙이는 꼬리만. 부엉이 없는 형태(Windows Codex)는 inbox 꼬리가 있어야 합니다.herdr-core/src/runtime/memory_analysis.rs-letter종류와hide-memory/src/engine.rs추출 prompt의 설명 한 줄.Evidence
hide-sessionreader 계층 테스트 - 7개 실제 adapter fixture(Claude 2.1.288, Codex 0.160.0, Grok 1.0.46, Pi 1.0.4, omp 18.7.0, OpenCode 1.18.30/2.0.29)의 편지를🦉줄로 바꿔 읽으면, 입력한 요청은from_operator이고🦉줄은 아니며, 링크 요청에는 입력한 요청만 남음(로컬 nextest 통과).🦉 아이콘은 항상 파란색으로,새 탭은 항상 옆에 열어 · hide inbox는from_operator이고 링크 요청으로 남음(음성 테스트).bell_line.rs단위 테스트 - 4개 언어 bell 줄, 부엉이 없는 Windows 형태, 비슷하지만 아닌 문장(이름 없음,:뒤 공백 없음,@포함, 길이 초과, 여러 줄).bell.rs테스트 - 4개 언어 × 7개 종류 × 보낸 이/본문(공백 든 이름, 잘린 이름과 요약, 빈 본문,@$\\든 본문) × 대기/inbox 조합으로 bell이 쓰는 모든 줄이 인식되고, inbox 줄은 U+FFFF 위 문자를 지워도 인식됨(드리프트 방지).bell.rs가 실제로 쓴 줄(Read 🐈 the letter와🐈를 Windows 형태로,· hide inbox,· and 2 more요약)이 든 Claude 세션: Memory 종류 letter, operator_events는 입력한 지시 1건만, 그 줄만 인용한 카드의 human 출처 0, 링크 요청은 입력한 지시만.-D warnings, hide-session·herdr-core·hide-memory all-targets)와 fmt-check 통과.docs/delivery.md가 기록한 Codex 0.163.0 입력 동작에 기댑니다.Verification record