v3.3.0 — NEXT-37: 회수 메모리 활용률 측정 + Zep/Chain-of-Note hook contract
NEXT-37 — 회수 메모리 본질 결함 해결
[[recalled-memory-weight]] 결함: 회수된 메모리가 메인 Claude deliberation 에 통합 안 되는 v3 본질 약점. v4 (멀티에이전트 통합) 비전 진입 전 v3 장기기억 신뢰성 회복이 선결.
3-agent 자료조사 수렴 결론
회수 메모리를 LLM 답변에 강제 통합하는 유일한 검증된 메커니즘 = 답변에 활용 흔적을 explicit 출력하라는 contract (Self-RAG reflection token / Chain-of-Note 명시 노트 / Cursor positive instruction / Anthropic structured output 모두 같은 아이디어 수렴).
변경
Phase 1 — 측정 framework
- 1A (
hooks/memory-recall.py):_metricdict 에recalled_ids컬럼 추가 — 회수된 메모리 id (name 우선, path fallback) 박힘 - 1B (
src/self_eval.py):recall_utilization메소드 신규 — 4-bucket 분류 (cited / marker_only / unused / no_response). CLI:python3 src/self_eval.py --recall-utilization --hours 168 - 1B retroactive:
--source transcriptsflag — metrics.jsonl 없이 transcript jsonl 의 hook attachment.stdout 직접 파싱. Phase 1A 이전 데이터도 활용도 분석 가능
Phase 2 (Step 2) — Hook contract 변경
_format_output 변경:
옛:
<system-reminder>
# 메모리 회수 (Layer 4 hybrid)
- **name** (score 0.95, vec+fts) — desc
</system-reminder>
신규:
<system-reminder>
MEMORY CONTEXT (다음 fact 를 본 답변 reasoning 에 반드시 통합):
- [name] (score 0.95, vec+fts) — desc
발췌: ...
답변 시작 전 한 줄로 "회수 노트: <위 메모리가 본 질문과 어떻게 관련되는가, 무관하면 '무관'>" 명시 출력 의무. 회수 fact 와 답변이 모순되면 즉시 표기.
</system-reminder>
3 메커니즘 결합:
- Zep "MEMORY CONTEXT:" 라벨 — production 검증 포맷
- Cursor positive instruction ("반드시 통합") — arxiv 2512.18925 수렴
- Chain-of-Note self-report ("회수 노트:") — EM +7.9 효과
Codex 5-round sweep (systematic-debugging "2 연속 0건 close")
- Round 1 (9건): M1 (marker), M2 (substring length floor), M3 (TZ 명시), L1 (source sanitize), L2 (빈 results 가드), L3 (name
]escape), L4 (splitext multi-dot), L5 (header prefix) - Round 2 (5건 root-cause): A2/B4/B5 →
_get_naive_tzlazy resolution + env-keyed cache, A7 (system-reminder wrapper 필수), B1 (events_source ValueError) - Round 3 (B3 scope 외): 3 test file env var leak —
patch.dict(os.environ, {}, clear=False)패턴 - Round 4 (vacuous pass): integration test 의
if r.stdout.strip(): assert→self.skipTest(...)명시 - Round 5: 자체 + codex 둘 다 0건 → close
현재 상태
- pytest 470 passed + 25 subtests (회귀 0)
- Production retroactive baseline (30일, N=213): cited 17 (7.62%), marker_only 2 (0.95%), unused 194 (91.43%)
- Hook contract deploy timestamp: 2026-05-27T09:56 KST
- 1주 dogfood 진행 중 — 정량 효과 측정은 누적 후 가능
호환성
- Apple Silicon Mac 전용 (Intel/Linux/Windows 미지원, 로컬 LLM 은 Gemma 4 E4B 만)
- Phase 1B retroactive 분석은 옛 (Layer 4 hybrid) + 신규 (MEMORY CONTEXT) 두 hook format 모두 backward compat
MV3_NAIVE_TZenv var 로 timezone override 가능 (default Asia/Seoul)
회수 결함 직접 측정
python3 src/self_eval.py --recall-utilization --source transcripts --hours 168
설치 후 1주 사용 → 위 명령으로 본인 환경 활용률 측정 가능.