docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거

Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
Antigravity Agent
2026-07-05 00:33:48 +09:00
parent 1cfd3bbb56
commit 9148c358d0
6455 changed files with 1 additions and 86875 deletions
@@ -0,0 +1,158 @@
---
id: wiki-2026-0508-p-reinforce
title: P-Reinforce
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Auto-Reinforce, Wiki-Reinforcement, Reinforcement-Marker]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [wiki, automation, knowledge-management, claude-code]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: markdown
framework: obsidian
---
# P-Reinforce
## 매 한 줄
> **"매 wiki entry 의 자동 강화 marker"**. P-Reinforce 는 Claude Code agent 가 wiki node 를 재방문할 때마다 frontmatter 의 `last_reinforced` 를 갱신하고 missing graph link 을 보충하는 light-weight reinforcement loop. 매 hand-curated knowledge graph 의 staleness 방지.
## 매 핵심
### 매 trigger 조건
- agent 가 file 을 Read 하고 substantive change (>= 3 lines) 을 적용한 경우.
- backlink resolver 가 dangling `[[X]]` 을 발견 후 stub 을 만든 경우.
- weekly cron (`/loop 7d /reinforce`) 의 sweep.
### 매 frontmatter 의 강화 field
- `last_reinforced` — ISO date.
- `confidence_score` — 0..1, decay 0.02/month, +0.05 per reinforcement.
- `verification_status``applied` | `pending` | `redirected`.
- `source_trust_level` — A/B/C.
### 매 응용
1. Wiki staleness audit — `last_reinforced < 90d` 의 file 을 batch 로 재방문.
2. Confidence-weighted retrieval — RAG 가 high-confidence node 을 prefer.
3. Graph hygiene — orphan / dangling link 을 reinforcement pass 에서 fix.
## 💻 패턴
### Frontmatter reinforcement (Python)
```python
import re, yaml, datetime, pathlib
def reinforce(path: pathlib.Path, bump: float = 0.05):
text = path.read_text()
m = re.match(r"^---\n(.*?)\n---\n(.*)$", text, re.DOTALL)
if not m:
return False
fm = yaml.safe_load(m.group(1)) or {}
fm["last_reinforced"] = datetime.date.today().isoformat()
fm["confidence_score"] = min(0.99, fm.get("confidence_score", 0.5) + bump)
fm["verification_status"] = "applied"
new = "---\n" + yaml.safe_dump(fm, sort_keys=False, allow_unicode=True) + "---\n" + m.group(2)
path.write_text(new)
return True
```
### Decay sweep (cron)
```python
from datetime import date, timedelta
def decayed(fm: dict, days: int = 90) -> bool:
last = date.fromisoformat(fm.get("last_reinforced", "1970-01-01"))
return (date.today() - last) > timedelta(days=days)
stale = [p for p in pathlib.Path("10_Wiki").rglob("*.md")
if decayed(load_fm(p))]
```
### Dangling link harvest
```python
import re
LINK = re.compile(r"\[\[([^\]|#]+)")
def dangling(root):
existing = {p.stem for p in root.rglob("*.md")}
for md in root.rglob("*.md"):
for tgt in LINK.findall(md.read_text()):
if tgt not in existing:
yield md, tgt
```
### Reinforcement-aware retrieval (BM25 + confidence)
```python
def score(doc, query):
bm = bm25(doc.text, query)
conf = doc.frontmatter.get("confidence_score", 0.5)
age = days_since(doc.frontmatter["last_reinforced"])
decay = max(0.5, 1 - age / 365)
return bm * conf * decay
```
### Claude Code hook (settings.json)
```json
{
"hooks": {
"Stop": [{
"command": "python ~/scripts/reinforce_touched.py"
}]
}
}
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| 매 active editing | inline reinforcement on Write |
| 매 background hygiene | weekly cron sweep |
| 매 large refactor | manual `verification_status: applied` bump |
| 매 redirect/duplicate | `verification_status: redirected`, no decay |
**기본값**: Stop hook + weekly sweep 의 조합.
## 🔗 Graph
- 부모: [[Knowledge Graph|Knowledge-Graph]]
- 응용: [[RAG]] · [[Agent-Memory]]
## 🤖 LLM 활용
**언제**: 매 long-lived wiki / second-brain 의 staleness 가 문제일 때.
**언제 X**: 매 ephemeral note / scratchpad — overhead > benefit.
## ❌ 안티패턴
- **Reinforce without read**: blind date bump — confidence 의 의미를 잃음.
- **Unbounded confidence growth**: cap 없이 +0.05 누적 — 매 1.0 saturation. cap 0.99.
- **Decay-only no-bump**: stale 만 잡고 fresh 강화는 없음 — graph 가 균질하게 늙음.
## 🧪 검증 / 중복
- Verified (in-house spec, CLEANUP_SPEC.md).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — full content for P-Reinforce framework |
## 🛠️ 적용 사례 (Applied in summary)
<!-- CODE-GROUNDING:START -->
### 🔎 코드베이스 근거 (자동 추출 — E:\Wiki 레포)
**실제 구현/사용 위치:**
- `Datacollect/src/components/EmailPanel.tsx:17` — * Gmail 읽기전용 연결 → 최근 스레드 수집 → 스레드별 P-Reinforce wiki 합성 →
- `Datacollect/scripts/web_extract.mjs:5` — * P-Reinforce v3.0 위키 문서로 LLM 합성한다.
- `connectai/src/retrieval/terminologyBlock.ts:5` — * `P-Reinforce` vs `p-reinforce`, `Chronicle` vs `크로니클`.
- `connectai/src/features/datacollect/handlers.ts:424` — [Omitted long matching line]
**관련 커밋:**
- `connectai eeb527c feat(datacollect): /youtube 개편·/wikify 신규·출력 위생 (v2.2.48)`
- `connectai a714017 feat(engine): complete stability overhaul - added state resume, deduplication, and P-Reinforce formatting`
- `Datacollect 4e00342 feat(wiki): RAG 포맷 강화 + 링크 해소 도구`
_자동 생성: code_grounding.mjs · 재실행 시 갱신됨_
<!-- CODE-GROUNDING:END -->