DAP Wiki Skills Enhancement (Sprint 3)

Sprint 3 Deliverable

마스터 플랜 Layer 3 (Skills) 확장 구현

3개 기존 스킬의 고도화: /ingest, /lint, /query


🎯 Sprint 3 목표

현재 상태:
  /ingest: Mode B (URL) 기본 구현 (raw/ + sources/ 생성)
  /lint: 건강 체크만 (이슈 리포팅)
  /query: wiki 검색 + 합성 답변 (파일 저장 안 함)

목표:
  /ingest: Mode A/B/C 모두 지원 + Frontmatter 자동 생성 + raw/sources 연쇄 생성
  /lint: 자동 수정 모드 추가 + Manual review 가이드
  /query: 답변 → insights/ 자동 저장 + Contradiction 감지
  
결과: 수동 작업 70% 감소

Skill 1️⃣: /ingest (Mode 확장)

현재 기능

Mode B: URL 제공
  1. WebFetch로 마크다운 변환
  2. raw/articles/YYYY-MM-DD-name.md 저장
  3. sources/ 페이지 수동 생성 필요

Sprint 3 개선사항

개선 1-1: Frontmatter 자동 생성

목표: raw/ 파일 생성 시 필수 frontmatter 자동 입력

구현 스펙:

def auto_generate_frontmatter(url, file_content):
    """
    Extract metadata from URL + content and generate frontmatter
    
    Input: 
      - url: "https://..."
      - file_content: markdown text
    
    Output:
      - frontmatter dict
    
    Logic:
      1. title: Extract <title> or first # heading
      2. author: Extract from byline or "Unknown"
      3. published: Extract from <meta name="publish_date"> or "unknown"
      4. source_type: Detect (article/report/document/video)
      5. tags: Generate from URL domain + content keywords
      6. harvested: Today's date
      7. url: Input URL
    """

예시:

Input URL: https://example.com/data-architecture-trends.html
Input Title: "Data Architecture Trends 2026"

Output:
---
source_type: article
url: https://example.com/data-architecture-trends.html
title: Data Architecture Trends 2026
author: John Doe
published: 2026-04-01
harvested: 2026-04-27
tags: [source, dap, data-architecture, trends]
---

개선 1-2: raw/ + sources/ 연쇄 생성

목표: raw/articles/… 생성 후 sources/ 페이지 자동 생성

구현 스펙:

def create_sources_page(raw_file_path, frontmatter):
    """
    After raw/ file created, auto-generate sources/ page
    
    Steps:
      1. Extract raw file content
      2. Generate Key Insight (1문장)
      3. Generate Detailed Summary (3-5 섹션)
      4. Add "연결되는 위키 페이지" (empty, user fills in later)
      5. Create sources/YYYY-MM-DD-name.md
      6. Add to log.md
      7. Return: sources/ page path
    """

예시 sources/ 페이지:

# Data Architecture Trends 2026
 
> [!note] Key Insight
> 
> 2026년 데이터 아키텍처 트렌드는 Lakehouse → Zero ETL → AI 자동화
 
## 핵심 Takeaway
 
## 상세 요약
 
### Section 1: ...
### Section 2: ...
 
## 연결되는 위키 페이지
 
(사용자가 나중에 추가)

개선 1-3: Mode C (자연어 검색) 프로토타입

목표: “데이터 거버넌스 글 찾아줘” → 자동 검색 + 후보 제시

구현 스펙:

def ingest_mode_c(query, limit=5):
    """
    Natural language search for sources
    
    Steps:
      1. WebSearch(query)
      2. Return top 5 results
      3. Present with titles + URLs to user
      4. User selects (1 or more)
      5. For each selected: run Mode B
    
    Example:
      User: "공부방 학생관리 시스템 글"
      System:
        [1] "효율적인 학생관리 체계" - URL1
        [2] "온라인 학급 운영 가이드" - URL2
        [3] ...
      User: "1, 3"
      System: Mode B로 처리
    """

제약사항:

  • 사용자 확인 gate 필수 (자동화 X)
  • 관련성 판단은 인간이

Skill 2️⃣: /lint (자동 수정 모드)

현재 기능

/lint: 이슈 리포팅 (Major/Medium/Info)
       수동 검토 필요

Sprint 3 개선사항

개선 2-1: Major 이슈 자동 수정

목표: 자동으로 수정 가능한 이슈는 자동 처리

자동 수정 대상:

✅ 자동화 가능:
  - Frontmatter 필드 누락 → 템플릿 추가
  - date field 자동 갱신 → updated = today
  - source_count 불일치 → 배열 길이로 자동 보정
  - Broken sections (예: "관련 개념" 없음) → 템플릿 추가

⚠️ 자동화 불가 (Manual review):
  - 내용이 부실한 경우 → 사용자 검토 필요
  - Orphan 페이지 → keep/link/delete 판단
  - Contradiction → 해결 방법 불명확

구현 스펙:

def lint_auto_fix(file_path, dry_run=True):
    """
    Auto-fix Major issues that are mechanical
    
    Parameters:
      file_path: target file
      dry_run: True → preview changes, False → apply
    
    Logic:
      1. For each Major issue:
         if is_auto_fixable(issue):
           apply_fix(file_path, issue)
         else:
           flag_for_manual_review(issue)
      
      2. Report:
         - Fixed issues: [count]
         - Manual review needed: [count + details]
    """

예시 실행:

/lint --auto-fix wiki/concepts/...md

Results:
  ✓ Auto-fixed (3):
    - updated field: 2026-04-26 → 2026-04-27
    - source_count: 2 → 3 (배열 길이 기준)
    - Added "관련 개념" section (template)
    
  ⚠️ Manual review (2):
    - Orphan page (no backlinks) → keep/link/delete?
    - Stale data (valid_as_of > 180 days) → update needed?

개선 2-2: Manual Review 가이드

목표: Orphan 페이지, Contradiction 등의 판단 기준 제시

구현 스펙:

/lint --review-guide

Output:
  1. Orphan Pages (역링크 0개)
     - Definition: 아무도 링크하지 않는 페이지
     - Decision Tree:
       Q1: 새로 만든 페이지인가? → Keep (임시)
       Q2: 한 달 이상 미링크인가? → Review
           - 불필요한가? → Delete
           - 필요한가? → Link (어디서?)
  
  2. Contradictions (⚠️ 섹션 있음)
     - Definition: 2개 이상 sources가 충돌
     - Decision:
       - 둘 다 맞는 맥락이 있는가? → 조정 설명
       - 하나가 구식인가? → Deprecate
       - 진짜 모순인가? → Research 필요 표시
  
  3. Stale Data (valid_as_of > 180 days)
     - Definition: 6개월 이상 미갱신
     - Decision:
       - 업데이트 가능한가? → 갱신
       - 역사 자료인가? → valid_as_of 유지 (주석 추가)
       - 폐기할 데이터인가? → 제거

Skill 3️⃣: /query (insights 파이프라인)

현재 기능

/query: wiki 검색 + 합성 답변 (텍스트만)
        파일 저장 X

Sprint 3 개선사항

개선 3-1: query → insights/ 자동 저장

목표: 좋은 질문/답변은 자동으로 insights/ 페이지 생성

구현 스펙:

def query_to_insight(question, answer, sources_used):
    """
    After /query generates answer, optionally save as insight
    
    Logic:
      1. Check: sources_used >= 3?
         if < 3: skip (insights는 3+ sources)
      
      2. Evaluate: 이 답변이 wiki에 값어치 있는가?
         - Synthesizes multiple perspectives? → Yes
         - Answers recurring question? → Yes
         - Reveals contradiction? → Yes
         - New connection discovered? → Yes
      
      3. If valuable:
         - Create insights/YYYY-MM-DD-query-slug.md
         - Frontmatter:
           * sources: [sources_used]
           * source_count: len(sources)
           * created/updated: today
           * tags: [insight, synthesis, domain-tags]
         - Body: answer text
         - "## 연결된 개념" section
         - "## 출처" section (sources 명시)
      
      4. Update log.md
      5. Prompt user: "이 답변을 insights/에 저장할까요?"
    """

예시 workflow:

User: /query "데이터 품질과 거버넌스는 어떤 관계인가?"

System:
  [Searching wiki...]
  - Found 4 sources:
    * [[99-Archive/sources/data-quality-framework]]
    * [[wiki/concepts/data-quality-and-governance]]
    * [[concepts/data-quality-and-governance]]
    * [[wiki/concepts/etl-design-framework]]
  
  [Synthesis...]
  Data quality는 "얼마나 좋은 데이터인가"를 측정하고,
  governance는 "좋은 데이터를 어떻게 유지할 것인가"를 정의합니다...
  
  [Evaluation]
  ✓ 3+ sources used
  ✓ Synthesizes multiple perspectives
  ✓ Reveals relationship
  
  Save as insight? [Y/n]
  → Yes
  
  Created: 

개선 3-2: Contradiction 감지

목표: query 답변이 기존 claims과 모순 시 감지

구현 스펙:

def detect_contradiction(answer, wiki_context):
    """
    Check if query answer contradicts existing concepts
    
    Logic:
      1. Extract key claims from answer
         e.g., "AWS Glue는 ELT를 지원한다"
      
      2. Search wiki for same claims
         - If found in concept/source: check consistency
         - If found conflicting: flag
      
      3. If contradiction detected:
         - Add to target concept: ⚠️ Contradiction section
         - Log: "conflict detected between [old] and [new]"
         - Mark for monthly review
    
    Example:
      Old claim: "AWS Glue는 ETL만 지원"
      New claim: "AWS Glue는 ELT도 지원"
      
      System:
        ⚠️ Contradiction detected
        [[concepts/etl-design-framework]]: 
        "AWS Glue는 전통 ETL를 지원했으나, 2024년부터 ELT 패턴도 가능"
    """

Sprint 3 구현 일정 (3주)

Week 1: /ingest 확장 (5일)

Day 1-2: Spec + 프로토타입
  - Frontmatter 자동 생성 로직
  - sources/ 페이지 템플릿
  
Day 3-4: Mode C 프로토타입
  - WebSearch 통합
  - 후보 제시 UI
  
Day 5: 테스트 + 통합
  - Mode A/B/C 모두 테스트
  - raw/ + sources/ 연쇄 생성 검증

Week 2: /lint 확장 (5일)

Day 1-2: Auto-fix 로직
  - 자동 수정 가능한 이슈 식별
  - dry-run 모드 구현
  
Day 3-4: Manual review 가이드
  - Decision tree 구현
  - 사용자 안내 문구
  
Day 5: 테스트 + /lint --auto-fix 통합

Week 3: /query 확장 (5일)

Day 1-2: query → insights 파이프라인
  - insights/ 페이지 자동 생성
  - sources 링킹
  
Day 3-4: Contradiction 감지
  - 기존 claims과 비교
  - ⚠️ Contradiction 섹션 추가
  
Day 5: 통합 테스트 + 성능 최적화

Sprint 3 성공 기준

항목목표
/ingestMode A/B 100% 동작, Mode C 프로토타입 완성
Frontmatter자동 생성 정확도 > 95%
sources/raw/ 생성 후 1분 내 sources/ 자동 생성
/lintMajor 자동 수정 >= 80%
Manual guideOrphan/Contradiction/Stale 판단 기준 명시
/query3+ sources 답변 → insights/ 저장 가능
Contradiction모순 감지율 > 90%
PerformanceSkills 실행 시간 < 10초

Sprint 4 통합 & 최적화 (1주)

Day 1-2: 통합 시나리오 테스트
  - Scenario: 새 source → raw/ → sources/ → synthesis → insights
  - 성능 프로파일링
  
Day 3-4: 문서화 + 사용자 가이드
  - /ingest Mode C 사용법
  - /lint --auto-fix 사용법
  - /query insights 저장 워크플로우
  
Day 5: 최종 검증 + 성능 튜닝

관련 개념