# LLM Knowledge Base Schema (CLAUDE.md)

This document defines the conventions and workflows for maintaining this knowledge base.

## Language Convention
- **CLAUDE.md**: English.
- **All other wiki pages**: Traditional Chinese (Taiwanese flavor).

## Architecture
- **0.raw/**: Immutable source documents.
- **1.analyzed/**: Analyzed source documents. When a file from `0.raw/` is processed, it is copied here with added metadata.
- **wiki/**: LLM-generated markdown files (Traditional Chinese).
- **wiki/index.md**: Content-oriented catalog.
- **wiki/log.md**: Chronological record of operations.
- **wiki/vocabularies.md**: Hierarchical list of vocabularies and categories.

## Workflows

### 1. Ingest (`/ingest <filename>`)
When a new source is added to `0.raw/`:
1. Read the source file from `0.raw/`.
2. Copy the source file to `1.analyzed/`.
3. Add `processed: true` to the frontmatter of the file in `1.analyzed/`.
4. Create/Update a summary page in `wiki/sources/<filename>.md` (in Traditional Chinese).
   - Link the "Source" field to the file in `1.analyzed/`.
5. Extract entities and update pages in `wiki/entities/`.
6. Extract concepts/vocabularies and update `wiki/vocabularies.md` and `wiki/concepts/`.
7. Update `wiki/index.md`.
8. Append to `wiki/log.md`.

### 2. Query (`/query <question>`)
When asked a question:
1. Search `wiki/index.md` and relevant wiki pages.
2. Synthesize an answer in Traditional Chinese with citations.

### 3. Vocabularies Management
- Maintain `wiki/vocabularies.md` with hierarchical structure.
- Example:
  - # Vocabularies
  - ## Tools/Vibe coding tool
  - ## Health/EMT-1

## Page Templates (in Traditional Chinese)

### Summary Page
```markdown
# [標題]
- 來源: [[連結至 1.analyzed 的檔案]]
- 日期: [解析日期]

## 重要提取
- [要點 1]
- [要點 2]

## 提到的實體
- [[實體 1]]

## 提到的概念/詞彙
- [[概念 1]]
```

### Entity/Concept Page
```markdown
# [名稱]
- 類型: [實體/概念]

## 綜述
[AI 生成的合成內容]

## 提及來源
- [[來源 1]]

## 相關項目
- [[相關頁面 1]]
```
