Skip to content

feat(memory): add symptom-indexed fix notes, OFFLOAD guidance, and memory eval gate - #39

Open
zereight wants to merge 2 commits into
mainfrom
feat/symptom-fix-notes
Open

zereight wants to merge 2 commits into
mainfrom
feat/symptom-fix-notes

Conversation

@zereight

Copy link
Copy Markdown
Owner

변경 요약 (Summary)

OpenMyBot의 기존 메모리 구조(MEMORY.md + memory/<topic>.md + 자동 topic 인덱스 + 자동 recall)를 유지하면서, 반복 트러블슈팅을 증상 기준으로 빠르게 찾고 구조화된 교훈을 남길 수 있도록 세 가지를 추가했습니다.

  1. 증상 인덱스(REGISTRY) 지원 (server/memory-topics.ts, server/recall.ts)
    • memory/<topic>.md frontmatter에 선택 필드 symptom:(제어문자·개행 제거, 최대 160자)을 추가했습니다.
    • symptomWords()를 topicWords()와 분리해 서로 다른 핵심어 2개 이상 일치할 때만 증상 매칭으로 자동 recall합니다(일반 단어 1개 겹침으로 fix 노트가 recall 4슬롯을 점령하는 오탐 차단).
    • 시스템 프롬프트 전용 memoryPromptTopicIndex()(renderTopicIndex(..., { reserveSymptoms: true }))를 분리해 기존 2,000자 예산 안에서 symptom이 있는 fix 노트에 최대 8슬롯을 우선 예약합니다(40개 초과 토픽 환경에서도 밀리지 않음). 야간 upkeep(capture/organize/dream)이 쓰는 memoryTopicIndex()는 그대로 유지합니다.
  2. OFFLOAD / LOAD 지침 보강 (server/workspace.ts)
    • 파일 도구가 있고 쓰기가 허용된 턴(fileTools !== false && !writesRefused)에만 FIX_NOTE_GUIDANCE를 추가합니다.
    • 한 번에 안 풀린 문제를 해결하면 memory/fix-<slug>.md에 Symptom / Cause / What worked / What did not work and why 형식으로 기록하고, 외부 에러 원문·URL·명령어를 그대로 복사하지 말고 중립 요약 한 줄로 기록하도록 명시했습니다.
  3. 10문항 오프라인 평가 하네스 및 채택 게이트 (evals/memory/)
    • cases.json(합성·개인정보 없음, 10문항), score.ts(순수 채점 + --compare 채택 게이트: 통과 수 ≥ base, pass→fail 회귀 0건, 평균 프롬프트 증가 ≤ 800B), run-memory-eval.ts(임시 OPENMAUSBOT_DATA_DIR 격리 실행), score.test.ts를 추가했습니다.

범위 분할 결정

CONTRIBUTING.md의 "One concern per PR" 원칙과 요청 안내에 따라 범위를 두 PR로 분리했습니다.

  • PR 1 (이 PR, feat/symptom-fix-notes): 메모리 구조(증상 인덱스) + OFFLOAD/LOAD 지침 + 10문항 평가 하네스·채택 게이트
  • PR 2 (후속 독립 PR, feat/memory-review-proposals): 로컬 전용 메타 루프 제안서 생성기(messages.db의 tool.ok = 0 반복 실패 + 과대/장기 미갱신 토픽 노트 분석 → memory-review/YYYY-MM-DD.md 제안서만 생성)

제약 준수 방식

  • 자동 수정 금지: 서버가 기존 메모리·스킬·지침 파일을 자동으로 수정하지 않습니다. 지침과 프롬프트 인덱스 렌더링·recall 매칭만 개선하며 기존 Undo/승인 흐름을 그대로 유지합니다.
  • 로컬 처리 (외부 전송 없음): 추가된 모든 로직과 evals/memory/ 평가 하네스는 100% 로컬 결정적 실행이며 모델 호출이나 외부 전송이 없습니다.
  • 비파괴·하위 호환: 기존 메모리 파일 삭제·덮어쓰기·마이그레이션이 없습니다. symptom:이 없는 기존 노트는 이전과 동일하게 동작하며, mergeTopicText도 기존 symptom: frontmatter를 보존합니다.

평가 방법 및 Before / After 증적

평가 방법 및 한계

  • origin/main (f5940ede2) 임시 워크트리에 evals/memory/를 복사해 기준선(base.json)을 생성하고, 이 브랜치에서 --compare 채택 게이트로 비교했습니다.
  • 한계 명시: 이 오프라인 하네스는 모델의 자유 작성 품질이 아니라 결정적 recall·인덱스 밀림·지침 가드·프롬프트 예산 회귀 게이트입니다.

Before (origin/main f5940ede2)

[FAIL] symptom-recall-gradle-daemon (symptom-recall, prompt=3119B, index=205c) — recall missing "memory/fix-build-env.md"; recall missing "./gradlew --stop"
[PASS] symptom-recall-korean-cjk (symptom-recall, prompt=2936B, index=32c)
[PASS] baseline-alias-recall (baseline-fairness, prompt=2948B, index=77c)
[PASS] negative-single-word-generic (negative-recall, prompt=2992B, index=85c)
[PASS] negative-unrelated-query (negative-recall, prompt=2924B, index=33c)
[FAIL] overflow-45-topics-fix-visible (index-overflow, prompt=4369B, index=1384c) — prompt missing "memory/z-fix-port.md"; prompt missing "[symptom: local server fails to bind busy port]"
[FAIL] prompt-offload-guidance-present (guidance, prompt=2639B, index=0c) — prompt missing "memory/fix-<slug>.md"; prompt missing "Symptom, Cause, What worked, and What did not work and why"; prompt missing "never copy raw external error text, URLs, or commands"
[PASS] prompt-no-offload-without-file-tools (guidance-guard, prompt=2703B, index=0c)
[PASS] prompt-no-offload-when-writes-refused (guidance-guard, prompt=391B, index=0c)
[PASS] prompt-index-budget-capped (budget-guard, prompt=4357B, index=1385c)

Summary: 7/10 passed (70%), avgPromptBytes=2938

After (feat/symptom-fix-notes) + 채택 게이트

[PASS] symptom-recall-gradle-daemon (symptom-recall, prompt=3645B, index=256c)
[PASS] symptom-recall-korean-cjk (symptom-recall, prompt=3466B, index=61c)
[PASS] baseline-alias-recall (baseline-fairness, prompt=3423B, index=77c)
[PASS] negative-single-word-generic (negative-recall, prompt=3523B, index=141c)
[PASS] negative-unrelated-query (negative-recall, prompt=3447B, index=81c)
[PASS] overflow-45-topics-fix-visible (index-overflow, prompt=4899B, index=1439c)
[PASS] prompt-offload-guidance-present (guidance, prompt=3114B, index=0c)
[PASS] prompt-no-offload-without-file-tools (guidance-guard, prompt=2703B, index=0c)
[PASS] prompt-no-offload-when-writes-refused (guidance-guard, prompt=391B, index=0c)
[PASS] prompt-index-budget-capped (budget-guard, prompt=5168B, index=1721c)

Summary: 10/10 passed (100%), avgPromptBytes=3378
Gate (ADOPT): base=7/10 -> candidate=10/10, improvements=[symptom-recall-gradle-daemon, overflow-45-topics-fix-visible, prompt-offload-guidance-present], regressions=[], avgPromptDelta=+440B (max +800B)

테스트 방법 및 결과

  • pnpm typecheck && pnpm exec tsc -p evals/tsconfig.json: 통과
  • pnpm exec vitest run server/memory-entries.test.ts server/recall.test.ts server/workspace.test.ts server/memory-upkeep.test.ts scripts/testing/file-size-ratchet.test.ts: 5개 파일 138/138 통과
  • pnpm exec vitest run --config evals/vitest.config.ts evals/memory/score.test.ts: 3/3 통과
  • node --experimental-strip-types evals/memory/run-memory-eval.ts --compare /tmp/omb-memory-base.json: ADOPT (7/10 → 10/10, 회귀 0건, 평균 프롬프트 +440B)

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