skills/llm-wiki/templates/CLAUDE.md.template

172 lines
4.8 KiB
Plaintext

# LLM Wiki — Schema for {{TOPIC}}
This file tells Claude Code exactly how to maintain the **{{TOPIC}} wiki**.
It is the single most important file in this vault. Read it at the start of every session.
Vault location: `{{VAULT_PATH}}`
Created: {{DATE}}
---
## What this wiki is for
{{TOPIC_DESCRIPTION}}
---
## Directory Structure
```
raw/ ← immutable source documents (YOU add, Claude reads only)
assets/ ← downloaded images (use Obsidian hotkey Ctrl+Shift+D)
wiki/ ← Claude-maintained markdown (Claude writes, you read)
index.md ← master catalog of ALL wiki pages — always update this
log.md ← append-only chronological log — always append here
overview.md ← high-level synthesis of the entire wiki
sources/ ← one summary page per ingested source
concepts/ ← concept pages (ideas, techniques, theories, frameworks)
entities/ ← entity pages (people, organizations, products, places)
queries/ ← saved query answers worth keeping
tools/
search.sh ← grep-based search helper
```
**Golden rule:** Never modify files in `raw/`. They are the source of truth.
---
## Page Types
| Type | Location | When to create |
|------|----------|----------------|
| `source` | `wiki/sources/` | One per ingested raw document |
| `concept` | `wiki/concepts/` | For ideas, techniques, frameworks mentioned in 2+ sources |
| `entity` | `wiki/entities/` | For people, orgs, products, places mentioned in 2+ sources |
| `query` | `wiki/queries/` | For important answers worth preserving |
| `overview` | root of `wiki/` | Only `overview.md` (singular synthesis) |
---
## Required Frontmatter
Every wiki page must have this YAML frontmatter:
```yaml
---
title: "Page Title"
date: YYYY-MM-DD
type: source | concept | entity | query
tags: [tag1, tag2]
source-count: N # how many sources discuss this topic
last-updated: YYYY-MM-DD
---
```
Source pages also need:
```yaml
source-url: https://...
source-type: article | paper | video | transcript | book | podcast
ingested: YYYY-MM-DD
```
---
## Naming Conventions
- File names: `lowercase-hyphenated.md` (no spaces, no special chars)
- WikiLinks: `[[Exact Page Title]]` or `[[filename|Display Text]]`
- Always use Obsidian-compatible `[[WikiLink]]` format for internal links
- Never use relative markdown links `[text](../path)` inside wiki pages
---
## Ingest Workflow
When asked to ingest a source:
1. **Check index first** — read `wiki/index.md` to find related pages
2. **Read the source** — `raw/<filename>` or scrape URL with firecrawl
3. **Write summary page** — `wiki/sources/<slug>.md` with full template
4. **Update related pages** — touch at most 15 existing pages per ingest
5. **Create new pages** — for new entities/concepts that need pages
6. **Update index** — add row in `wiki/index.md`
7. **Append log** — `## [YYYY-MM-DD] ingest | Title`
See: `~/.agents/skills/llm-wiki/phases/ingest.md` for full protocol.
---
## Query Workflow
When asked a question about wiki content:
1. Read `wiki/index.md` first — find relevant pages
2. Read 3-7 most relevant pages
3. Answer with `[[WikiLink]]` citations
4. Offer to file good answers as `wiki/queries/<slug>.md`
See: `~/.agents/skills/llm-wiki/phases/query.md` for full protocol.
---
## Lint Workflow
When asked for a health check:
1. Find orphan pages (no inbound links)
2. Find broken WikiLinks (no target file)
3. Flag potential contradictions
4. Write `wiki/lint-<date>.md` report
See: `~/.agents/skills/llm-wiki/phases/lint.md` for full protocol.
---
## Log Format (mandatory)
Log entries MUST start with this prefix pattern:
```
## [YYYY-MM-DD] operation | description
```
Where `operation` is one of: `ingest`, `query`, `lint`, `edit`, `create`
This makes the log grep-able:
```bash
grep "^## \[" wiki/log.md | tail -10 # last 10 entries
grep "ingest" wiki/log.md | wc -l # total sources ingested
```
---
## Index Format
`wiki/index.md` is organized by page type. Each row:
```markdown
| [[path/to/page\|Page Title]] | YYYY-MM-DD | type | One-line summary |
```
---
## What Claude Should NEVER Do
- Modify any file in `raw/` — these are immutable
- Create duplicate pages (check index first)
- Use relative markdown links inside wiki pages (use `[[WikiLinks]]` only)
- Leave `wiki/log.md` without a new entry after any operation
- Add more than 15 pages per single ingest session
- Use `##` log headers without the `## [YYYY-MM-DD]` prefix
---
## Session Start Protocol
At the start of every Claude Code session in this vault:
1. Read this `CLAUDE.md` file
2. Read `wiki/index.md` to understand current state
3. Check `wiki/log.md` last 5 entries (`grep "^## \[" wiki/log.md | tail -5`) to see recent activity
4. Confirm you're ready: "Wiki loaded. N pages indexed. Last activity: [date] [operation]."