Skip to content

refactor(llm-wiki): single-domain + dedup + progressive disclosure#31

Merged
devstefancho merged 3 commits into
mainfrom
refactor/llm-wiki-single-domain
Apr 26, 2026
Merged

refactor(llm-wiki): single-domain + dedup + progressive disclosure#31
devstefancho merged 3 commits into
mainfrom
refactor/llm-wiki-single-domain

Conversation

@devstefancho
Copy link
Copy Markdown
Owner

Summary

llm-wiki 플러그인을 (1) Karpathy 원전 충실 단일 도메인, (2) 공통 규칙 dedup, (3) operation별 progressive disclosure 세 단계로 리팩터.

위키는 단일 지식 그래프 — [[slug]] cross-reference가 한 그래프 안에서만 유효하다는 본질에 맞춰 multi-domain 추상화를 제거. 공통 규칙은 PRINCIPLES.md 단일 정본으로 일원화하고, SKILL.md는 라우터로 슬림화해 operation 호출 시 필요한 파일만 컨텍스트에 들어가게 함.

Why

기존 SKILL.md는 11.4KB에 5개 operation 본문 + 공통 규칙이 모두 들어있어, 어떤 operation을 부르든 전체가 컨텍스트에 로드됐음. 또 page types/frontmatter/governance 같은 규칙이 PRINCIPLES.md와 schema-template에 중복 정의되어 있었음. 사용자의 실제 위키(~/wiki)도 이미 단일 도메인 평탄 구조로 운영 중이라 multi-domain 추상화는 가치 없이 복잡도만 추가하던 상태.

Changes

Single-domain 리팩터

  • SKILL.md Phase 1 "Domain Discovery" 제거, Phase 0에 SCHEMA.md 존재 체크 통합
  • {wiki_root}/{domain}/...{wiki_root}/... (디렉토리 한 단계 평탄화)
  • 11곳의 {domain_path}{wiki_root} 치환
  • {domain}{wiki_title} 변수 통일
  • README의 "도메인" 잔재 제거

Dedup (7개 항목 정본화)

  • Frontmatter YAML 형식 → PRINCIPLES.md
  • Slug 규칙 → PRINCIPLES.md
  • Wikilink 문법 → PRINCIPLES.md
  • Bidirectional Linking Policy → PRINCIPLES.md
  • Page Types (source/entity/concept) → PRINCIPLES.md
  • Immutability Rules → PRINCIPLES.md
  • Log Entry Format → PRINCIPLES.md

templates/schema-template.md의 중복 4개 섹션 제거 후 PRINCIPLES.md 참조로 단순화 (1.0KB → 0.5KB).

Progressive Disclosure

  • SKILL.md 11.4KB → 3.4KB (-70%): 라우터(Phase 0 + Operation Detection + Dispatch)만 남김
  • 5개 operation 본문을 분리:
    • `operations/init.md` (1.9KB)
    • `operations/ingest.md` (3.6KB)
    • `operations/query.md` (1.8KB)
    • `operations/lint.md` (2.5KB)
    • `operations/update.md` (1.9KB)
  • 각 operation 파일이 PRINCIPLES.md를 "필요한 시점에" Read하도록 명시

Operation별 컨텍스트 절감 (기존 14.3KB 대비)

Operation 이후 감소
init 5.3KB -63%
ingest 10.6KB -26%
query (no archive) 5.2KB -64%
lint 9.5KB -34%
update 8.9KB -38%

Eval

정적 검증 + 6 시나리오 functional 워크스루 모두 통과. Blocker 없음.

시나리오 결과
S1 Dedup 효과 (7개 정본화)
S2 Progressive Disclosure (SKILL.md -70%)
S3 라우팅 정확성 (5/5 발화 → 올바른 op 파일)
S4 누락/회귀 (기존 지시 모두 보존)
S5 PRINCIPLES.md 상호 참조 (깨진 링크 0)
S6 schema-template 슬림화 부작용

리팩터 과정에서 발견한 기존 잠복 버그 `{scope_description}` placeholder 미스매치도 함께 수정.

Migration

사용자 기존 위키(~/wiki)는 이미 단일 도메인 평탄 구조(~/wiki/SCHEMA.md)로 운영 중이라 데이터 마이그레이션 불요.

Test Plan

  • 플러그인 재설치 후 `wiki ingest ` 호출 시 라우터가 operations/ingest.md 만 Read하는지 확인
  • `wiki query` 호출 시 archival "No" 분기에서 PRINCIPLES.md를 불필요하게 Read하지 않는지 확인
  • `wiki lint` 결과가 기존 SKILL.md 시점과 동일한 검사 항목을 적용하는지 확인
  • init 한 번 더 시도 시 중복 init 가드가 동작하는지 확인

🤖 Generated with Claude Code

Karpathy 원전을 충실히 따라 위키를 단일 그래프로 운영하도록 리팩터.
[[slug]] cross-reference가 한 그래프 안에서만 유효하다는 위키 본질에
맞춰 multi-domain 추상화를 제거하고, 공통 규칙을 PRINCIPLES.md로
정본화한 뒤, SKILL.md를 라우터로 슬림화해 progressive disclosure 적용.

주요 변경:
- SKILL.md를 라우터로 재작성 (11.4KB → 3.4KB, 70% 감소)
  - Phase 1 "Domain Discovery" 제거, Phase 0에 SCHEMA.md 존재 체크 통합
  - 5개 operation 본문을 operations/{init,ingest,query,lint,update}.md 로 분리
- PRINCIPLES.md 를 공통 규칙 정본화
  - frontmatter, slug rules, wikilink, bidirectional, page types,
    immutability, log format 모두 단일 출처로 일원화
- templates/schema-template.md 슬림화 (1.0KB → 0.5KB)
  - frontmatter/cross-ref/governance 4개 중복 섹션 제거하고
    PRINCIPLES.md 참조로 단순화
- {domain} → {wiki_title} 변수 통일, README의 도메인 잔재 제거

Operation별 컨텍스트 절감 (기존 14.3KB 대비):
- init     5.3KB (-63%)
- ingest  10.6KB (-26%)
- query    5.2KB (-64%, no archive)
- lint     9.5KB (-34%)
- update   8.9KB (-38%)

Eval (정적 검증 + 6 시나리오 워크스루): blocker 없음.
사용자 기존 wiki(~/wiki)는 이미 평탄 구조라 마이그레이션 불요.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
claude-plugins Ready Ready Preview, Comment Apr 26, 2026 2:21am

… to reasoning

Iteration on PR #31 driven by 4 review passes (SKILL+PRINCIPLES, operations
cross-check, scripts↔markdown contracts, deterministic-vs-reasoning) and
two functional eval rounds (5-op + real-prompt).

scripts
- drop slugify.py (CJK input → "untitled" fallback; LLM transliterates better)
- drop init_wiki.py (str.replace template render mishandles user input
  containing '{date}' etc.; mkdir + Write are LLM-friendly anyway)
- keep lint_wiki.py (deterministic large-vault audit) + append_log.py
  (format consistency); both gain encoding="utf-8", wikilink #anchor support,
  index/overview as inbound source for orphan check, EOF-without-newline
  frontmatter parsing, description-newline refusal

dedup
- single-graph statement collapsed to PRINCIPLES.md architecture only
- lazy-load policy stated once (PRINCIPLES.md head)
- prereq line removed from each operation; SKILL.md dispatch handles it
- backlink procedure described once in PRINCIPLES.md bidirectional;
  operations reference it instead of restating

XML kept only where it carries semantics
- <phase>, <routes>, <dispatch>, <refs>, <onaccept>, <onreject>, <forbid>
- removed <step>, <layer>, <type>, <prereq> (headings/lists are clearer)

clarity
- Phase 0 step "op=init / op≠init" moved into dispatch (was paradox: op
  not yet known at Phase 0)
- routes table flags "wiki_root 안의 기존 파일 경로면 update 우선"
- "section" extraction defined as one ## heading block
- init.md drops dead "사용자 페이지를 만들 때만 PRINCIPLES.md 참조" line
- overview-template.md type: index → overview (matches PRINCIPLES.md)
리팩터(single-domain + dedup + progressive disclosure)와 후속 정리
(deterministic 작업을 scripts/로 분리)에 맞춰 버전 업.

캐시 무효화를 위해 플러그인 수정 시 버전 업이 필요.

부수: skill-creator workspace 디렉토리를 .gitignore에 추가.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@devstefancho devstefancho merged commit 831648e into main Apr 26, 2026
3 checks passed
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