LLM-Wiki 시스템 구조

Summary

Claude와의 모든 대화를 Obsidian vault에 날짜별로 저장하고, 지식으로 정제하는 자동화 시스템.
raw/ 에 원본 대화를 보존하고, wiki/ 에 주제별 지식 문서를 생성·병합하는 Core Loop 구조.


Details

폴더 구조

D:\project\Home-obsidian-vault\Home-obsidian\LLM-Wiki\
├── raw/                      ← 대화 원본 (불변)
│   └── YYYY-MM-DD/
│       └── NNN-title.md      ← 표준 형식
├── wiki/                     ← 정제된 지식
│   ├── _wiki-index.md
│   └── {topic}.md
├── schema/
│   └── wiki-template.md
├── AGENTS.md
├── state.json
├── _index.md                 ← 자동 생성
└── _log.md

D:\project\llm-wiki\          ← 운영 스크립트
├── config.json
├── save-session.ps1
├── update-status.ps1
├── build-index.ps1
├── wiki.ps1 / wiki.bat
└── skills/
    ├── ingest/
    ├── query/
    ├── lint/
    ├── index/
    ├── refactor/
    ├── gc/
    ├── feedback/
    └── contradiction/

Core Loop

대화 종료 (Stop 훅 or 수동 "저장해")
    ↓
raw/YYYY-MM-DD/ 저장
    ↓
[수동] "인제스트"
    ↓
wiki/ 생성·병합
    ↓
[주기적] lint / refactor / gc
    ↓
[질문] "wiki에서 찾아봐" → query
    ↓
[오류] "틀렸어" → feedback

raw 파일 frontmatter 표준 형식

---
date: YYYY-MM-DD
title: "제목"
status: reviewing        # reviewing | success | failed | stopped
source: telegram         # telegram | cli | manual | claude-code
session_id: "..."
tags: []
saved_at: "YYYY-MM-DDThh:mm:ss+09:00"
---

Status 의미

Status 의미
reviewing 기본값, 검토 필요
success 목표 달성, 완전 해결
failed 해결 실패 또는 잘못된 정보
stopped 중간 중단, 방향 변경

PowerShell 스크립트

save-session.ps1

Stop 훅에서 호출되어 JSONL → raw/.md 저장.

구현 시 발견된 버그:

버그 원인 수정
한글 파일명 깨짐 Console.InputEncoding 기본값 문제 [Console]::InputEncoding = [System.Text.UTF8Encoding]::new($false) 추가, 파일명에서 한글 제거 (title은 frontmatter에 보존)
-replace 3인자 오류 PowerShell -replace는 2인자만 지원 [System.Text.RegularExpressions.Regex]::Replace() 방식으로 변경

update-status.ps1

pwsh -File D:/project/llm-wiki/update-status.ps1 `
  -Date "2026-04-10" -Number "001" -Status "success"

build-index.ps1

raw/ 전체 스캔 → _index.md 날짜별 테이블 + status 통계 자동 생성.

wiki.ps1 / wiki.bat 명령어

명령어 설명
wiki status 전체 상태 요약
wiki index 인덱스 재생성
wiki lint 품질 점검
wiki gc 오래된 항목 탐지
wiki ingest raw → wiki 변환
wiki query <키워드> wiki 검색
wiki update <date> <num> <status> status 변경

Stop 훅 등록 위치

C:\Users\FT\.claude\settings.local.json   ← 전역 (현재 사용)
D:\project\claudeclaw-setup-telegram\.claude\settings.json  ← 프로젝트

⚠️ 두 곳 동시 등록 시 충돌 주의. 전역 settings.local.json 쪽이 우선.
전역에 pm2 restart Stop 훅이 있으면 save-session.ps1 stdin이 비어버림 → 제거 필요.

Stop 훅 미등록 진단 & 수정 (2026-04-10)

"hooks": {
  "Stop": [
    {
      "matcher": "",
      "hooks": [
        {
          "type": "command",
          "command": "pwsh -ExecutionPolicy Bypass -File D:/project/llm-wiki/save-session.ps1"
        }
      ]
    }
  ]
}

Conflicts

시놀로지 Time Machine 정보 오류 (2026-04-10)


Source