{"owner":"SamurAIGPT","repo":"llm-wiki-agent","hasSkills":true,"totalSkillsCount":7,"totalTokensCount":6766,"categories":["gemini-rule","command-prompt","claude-rule","root-instruction"],"hasMcp":false,"mcpConfig":null,"found":["GEMINI.md",".claude/commands/wiki-ingest.md",".claude/commands/wiki-lint.md",".claude/commands/wiki-graph.md","CLAUDE.md","AGENTS.md",".claude/commands/wiki-query.md"],"skills":{"GEMINI.md":"# LLM Wiki Agent — Schema & Workflow Instructions\n\nThis wiki is maintained entirely by Gemini CLI. No API key or Python scripts needed — just open this repo with `gemini` and talk to it.\n\n## How to Use\n\nDescribe what you want in plain English:\n- *\"Ingest this file: raw/papers/my-paper.md\"*\n- *\"What does the wiki say about transformer models?\"*\n- *\"Check the wiki for orphan pages and contradictions\"*\n- *\"Build the knowledge graph\"*\n\nOr use shorthand triggers:\n- `ingest <file>` → runs the Ingest Workflow\n- `query: <question>` → runs the Query Workflow\n- `health` → runs the Health Workflow (fast, every session)\n- `lint` → runs the Lint Workflow (expensive, periodic)\n- `build graph` → runs the Graph Workflow\n\n---\n\n## Directory Layout\n\n```\nraw/          # Immutable source documents — never modify these\nwiki/         # Agent owns this layer entirely\n  index.md    # Catalog of all pages — update on every ingest\n  log.md      # Append-only chronological record\n  overview.md # Living synthesis across all sources\n  sources/    # One summary page per source document\n  entities/   # People, companies, projects, products\n  concepts/   # Ideas, frameworks, methods, theories\n  syntheses/  # Saved query answers\ngraph/        # Auto-generated graph data\ntools/        # Standalone Python scripts\n  health.py   # Structural checks (deterministic, no LLM calls)\n  lint.py     # Content quality checks (uses LLM for semantic analysis)\n  build_graph.py  # Knowledge graph generation\n```\n\n---\n\n## Page Format\n\nEvery wiki page uses this frontmatter:\n\n```yaml\n---\ntitle: \"Page Title\"\ntype: source | entity | concept | synthesis\ntags: []\nsources: []\nlast_updated: YYYY-MM-DD\n---\n```\n\nUse `[[PageName]]` wikilinks to link to other wiki pages.\n\n---\n\n## Ingest Workflow\n\nTriggered by: *\"ingest <file>\"*\n\n**Supported formats:** `.md` ingested directly. Non-markdown files (`.pdf`, `.docx`, `.pptx`, `.xlsx`, `.html`, `.txt`, `.csv`, `.json`, `.xml`, `.rst`, `.rtf`, `.epub`, `.ipynb`, `.yaml`, `.yml`, `.tsv`, `.wav`, `.mp3`) auto-converted via markitdown. Use `--no-convert` to skip.\n\n1. Read the source document fully (auto-convert if non-markdown)\n2. Read `wiki/index.md` and `wiki/overview.md` for current wiki context\n3. Write `wiki/sources/<slug>.md` (source page format below)\n4. Update `wiki/index.md` — add entry under Sources\n5. Update `wiki/overview.md` — revise synthesis if warranted\n6. Update/create entity and concept pages\n7. Flag contradictions with existing wiki content\n8. Append to `wiki/log.md`: `## [YYYY-MM-DD] ingest | <Title>`\n9. **Post-ingest validation** — check for broken `[[wikilinks]]`, verify all new pages are in `index.md`, print a change summary\n\n### Source Page Format\n\n```markdown\n---\ntitle: \"Source Title\"\ntype: source\ntags: []\ndate: YYYY-MM-DD\nsource_file: raw/...\n---\n\n## Summary\n2–4 sentence summary.\n\n## Key Claims\n- Claim 1\n\n## Key Quotes\n> \"Quote here\"\n\n## Connections\n- [[EntityName]] — how they relate\n\n## Contradictions\n- Contradicts [[OtherPage]] on: ...\n```\n\n### Domain-Specific Templates\n\nIf the source falls into a specific domain (e.g., personal diary, meeting notes), the agent should use a specialized template instead of the default generic one above:\n\n#### Diary / Journal Template\n```markdown\n---\ntitle: \"YYYY-MM-DD Diary\"\ntype: source\ntags: [diary]\ndate: YYYY-MM-DD\n---\n## Event Summary\n...\n## Key Decisions\n...\n## Energy & Mood\n...\n## Connections\n...\n## Shifts & Contradictions\n...\n```\n\n#### Meeting Notes Template\n```markdown\n---\ntitle: \"Meeting Title\"\ntype: source\ntags: [meeting]\ndate: YYYY-MM-DD\n---\n## Goal\n...\n## Key Discussions\n...\n## Decisions Made\n...\n## Action Items\n...\n```\n\n---\n\n## Query Workflow\n\nTriggered by: *\"query: <question>\"*\n\n1. Read `wiki/index.md` — identify relevant pages\n2. Read those pages\n3. Synthesize answer with `[[PageName]]` citations\n4. Offer to save as `wiki/syntheses/<slug>.md`\n\n---\n\n## Lint Workflow\n\nTriggered by: *\"lint\"*\n\nCheck for: orphan pages, broken links, contradictions, stale content, missing entity pages, sparse pages (< 2 outbound links), data gaps.\n\nGraph-aware checks (require `graph.json`): hub stubs, fragile bridges, isolated communities.\n\n---\n\n## Health Workflow\n\nTriggered by: *\"health\"*\n\nRun: `python tools/health.py` (or `python tools/health.py --json` for machine-readable output)\n\nFast structural integrity checks — **zero LLM calls**, safe to run every session:\n- **Empty / stub files** — pages with no content beyond frontmatter (rate-limit damage)\n- **Index sync** — `wiki/index.md` entries vs actual files on disk\n- **Log coverage** — source pages missing a corresponding `ingest` entry in `wiki/log.md`\n\nOutput a health report. Use `--save` to write to `wiki/health-report.md`.\n\n### Health vs Lint Boundary\n\n| Dimension | `health` | `lint` |\n|---|---|---|\n| **Scope** | Structural integrity | Content quality |\n| **LLM calls** | Zero | Yes (semantic analysis) |\n| **Cost** | Free | Tokens |\n| **Frequency** | Every session, before other work | Every 10-15 ingests |\n| **Checks** | Empty files, index sync, log sync | Orphans, broken links, contradictions, gaps |\n| **Tool** | `tools/health.py` | `tools/lint.py` |\n| **Run order** | First (pre-flight) | After health passes |\n\n> Run `health` first — linting an empty file wastes tokens.\n\n---\n\n## Graph Workflow\n\nTriggered by: *\"build graph\"*\n\nTry `python tools/build_graph.py --open` first. If unavailable, build graph.json and graph.html manually from wikilinks.\n\n---\n\n## Naming Conventions\n\n- Source slugs: `kebab-case`\n- Entity/Concept pages: `TitleCase.md`\n\n## Log Format\n\n`## [YYYY-MM-DD] <operation> | <title>`\n\nOperations: `ingest`, `query`, `lint`, `graph`, `report`\n\n---\n\n## Graph Health Report\n\nTriggered by: *\"graph report\"* or `python tools/build_graph.py --report`\n\nCovers: health summary, orphan nodes, god nodes, fragile bridges, phantom hubs. Use `--save` to persist.\n\n---\n\n## Phase 3 Design Constraints (Auto-Linking — Open)\n\n- Auto-linked edges start as `DRAFT`, require promotion gate validation\n- Link density budget: ≥2 outbound wikilinks before promotion\n- HG-WA-01: Graph layer MUST NOT auto-create pages from broken links\n- HG-WA-02: New commands MUST NOT duplicate existing command coverage\n",".claude/commands/wiki-ingest.md":"Ingest a source document into the LLM Wiki.\n\nUsage: /wiki-ingest $ARGUMENTS\n\n$ARGUMENTS should be the path to a file in raw/, e.g. `raw/articles/my-article.md`\n\nFollow the Ingest Workflow defined in CLAUDE.md exactly:\n1. Read the source file at the given path\n2. Read wiki/index.md and wiki/overview.md for current context\n3. Write wiki/sources/<slug>.md (source page format per CLAUDE.md)\n4. Update wiki/index.md — add the new entry under Sources\n5. Update wiki/overview.md — revise synthesis if warranted\n6. Create/update entity pages (wiki/entities/) for key people, companies, projects\n7. Create/update concept pages (wiki/concepts/) for key ideas and frameworks\n8. Flag any contradictions with existing wiki content\n9. Append to wiki/log.md: ## [today's date] ingest | <Title>\n\nAfter completing all writes, summarize: what was added, which pages were created or updated, and any contradictions found.\n",".claude/commands/wiki-lint.md":"Health-check the LLM Wiki for issues.\n\nUsage: /wiki-lint\n\nFollow the Lint Workflow defined in CLAUDE.md:\n\nStructural checks (use Grep and Glob tools):\n1. Orphan pages — wiki pages with no inbound [[wikilinks]] from other pages\n2. Broken links — [[WikiLinks]] pointing to pages that don't exist\n3. Missing entity pages — names referenced in 3+ pages but lacking their own page\n\nSemantic checks (read and reason over page content):\n4. Contradictions — claims that conflict between pages\n5. Stale summaries — pages not updated after newer sources changed the picture\n6. Data gaps — important questions the wiki can't answer; suggest specific sources to find\n\nOutput a structured markdown lint report. At the end, ask if the user wants it saved to wiki/lint-report.md.\n\nAppend to wiki/log.md: ## [today's date] lint | Wiki health check\n",".claude/commands/wiki-graph.md":"Build the LLM Wiki knowledge graph.\n\nUsage: /wiki-graph\n\nFirst try running: python tools/build_graph.py --open\n\nIf that fails (missing dependencies), build the graph manually:\n\n1. Use Grep to find all [[wikilinks]] across every file in wiki/\n2. Build a nodes list: one node per wiki page, with id=relative-path, label=title, type from frontmatter\n3. Build an edges list: one edge per [[wikilink]], tagged EXTRACTED\n4. Infer additional implicit relationships between pages not captured by wikilinks — tag these INFERRED with a confidence score (0.0–1.0); tag low-confidence ones AMBIGUOUS\n5. Write graph/graph.json with {nodes, edges, built: today}\n6. Write graph/graph.html as a self-contained vis.js page (nodes colored by type, edges colored by type, interactive, searchable)\n\nAfter building, summarize: node count, edge count, breakdown by type, and the most connected nodes (hubs).\n\nAppend to wiki/log.md: ## [today's date] graph | Knowledge graph rebuilt\n","CLAUDE.md":"# LLM Wiki Agent — Schema & Workflow Instructions\n\nThis wiki is maintained entirely by Claude Code. No API key or Python scripts needed — just open this repo in Claude Code and talk to it.\n\n## Slash Commands (Claude Code)\n\n| Command | What to say |\n|---|---|\n| `/wiki-ingest` | `ingest raw/my-article.md` |\n| `/wiki-query` | `query: what are the main themes?` |\n| `/wiki-health` | `health` (fast, every session) |\n| `/wiki-lint` | `lint the wiki` (expensive, periodic) |\n| `/wiki-graph` | `build the knowledge graph` |\n\nOr just describe what you want in plain English:\n- *\"Ingest this file: raw/papers/attention-is-all-you-need.md\"*\n- *\"What does the wiki say about transformer models?\"*\n- *\"Check the wiki for orphan pages and contradictions\"*\n- *\"Build the graph and show me what's connected to RAG\"*\n\nClaude Code reads this file automatically and follows the workflows below.\n\n---\n\n## Directory Layout\n\n```\nraw/          # Immutable source documents — never modify these\nwiki/         # Claude owns this layer entirely\n  index.md    # Catalog of all pages — update on every ingest\n  log.md      # Append-only chronological record\n  overview.md # Living synthesis across all sources\n  sources/    # One summary page per source document\n  entities/   # People, companies, projects, products\n  concepts/   # Ideas, frameworks, methods, theories\n  syntheses/  # Saved query answers\ngraph/        # Auto-generated graph data\ntools/        # Standalone Python scripts\n  health.py   # Structural checks (deterministic, no LLM calls)\n  lint.py     # Content quality checks (uses LLM for semantic analysis)\n  build_graph.py  # Knowledge graph generation\n```\n\n---\n\n## Page Format\n\nEvery wiki page uses this frontmatter:\n\n```yaml\n---\ntitle: \"Page Title\"\ntype: source | entity | concept | synthesis\ntags: []\nsources: []       # list of source slugs that inform this page\nlast_updated: YYYY-MM-DD\n---\n```\n\nUse `[[PageName]]` wikilinks to link to other wiki pages.\n\n---\n\n## Ingest Workflow\n\nTriggered by: *\"ingest <file>\"* or `/wiki-ingest`\n\n**Supported formats:** Markdown (`.md`) ingested directly. Non-markdown files (`.pdf`, `.docx`, `.pptx`, `.xlsx`, `.html`, `.txt`, `.csv`, `.json`, `.xml`, `.rst`, `.rtf`, `.epub`, `.ipynb`, `.yaml`, `.yml`, `.tsv`, `.wav`, `.mp3`) auto-converted to markdown via [markitdown](https://github.com/microsoft/markitdown) before ingestion. Use `--no-convert` to skip auto-conversion.\n\nSteps (in order):\n1. Read the source document fully using the Read tool (auto-convert if non-markdown)\n2. Read `wiki/index.md` and `wiki/overview.md` for current wiki context\n3. Write `wiki/sources/<slug>.md` — use the source page format below\n4. Update `wiki/index.md` — add entry under Sources section\n5. Update `wiki/overview.md` — revise synthesis if warranted\n6. Update/create entity pages for key people, companies, projects mentioned\n7. Update/create concept pages for key ideas and frameworks discussed\n8. Flag any contradictions with existing wiki content\n9. Append to `wiki/log.md`: `## [YYYY-MM-DD] ingest | <Title>`\n10. **Post-ingest validation** — check for broken `[[wikilinks]]`, verify all new pages are in `index.md`, print a change summary\n\n### Source Page Format\n\n```markdown\n---\ntitle: \"Source Title\"\ntype: source\ntags: []\ndate: YYYY-MM-DD\nsource_file: raw/...\n---\n\n## Summary\n2–4 sentence summary.\n\n## Key Claims\n- Claim 1\n- Claim 2\n\n## Key Quotes\n> \"Quote here\" — context\n\n## Connections\n- [[EntityName]] — how they relate\n- [[ConceptName]] — how it connects\n\n## Contradictions\n- Contradicts [[OtherPage]] on: ...\n```\n\n### Domain-Specific Templates\n\nIf the source falls into a specific domain (e.g., personal diary, meeting notes), the agent should use a specialized template instead of the default generic one above:\n\n#### Diary / Journal Template\n```markdown\n---\ntitle: \"YYYY-MM-DD Diary\"\ntype: source\ntags: [diary]\ndate: YYYY-MM-DD\n---\n## Event Summary\n...\n## Key Decisions\n...\n## Energy & Mood\n...\n## Connections\n...\n## Shifts & Contradictions\n...\n```\n\n#### Meeting Notes Template\n```markdown\n---\ntitle: \"Meeting Title\"\ntype: source\ntags: [meeting]\ndate: YYYY-MM-DD\n---\n## Goal\n...\n## Key Discussions\n...\n## Decisions Made\n...\n## Action Items\n...\n```\n\n---\n\n## Query Workflow\n\nTriggered by: *\"query: <question>\"* or `/wiki-query`\n\nSteps:\n1. Read `wiki/index.md` to identify relevant pages\n2. Read those pages with the Read tool\n3. Synthesize an answer with inline citations as `[[PageName]]` wikilinks\n4. Ask the user if they want the answer filed as `wiki/syntheses/<slug>.md`\n\n---\n\n## Lint Workflow\n\nTriggered by: *\"lint the wiki\"* or `/wiki-lint`\n\nUse Grep and Read tools to check for:\n- **Orphan pages** — wiki pages with no inbound `[[links]]` from other pages\n- **Broken links** — `[[WikiLinks]]` pointing to pages that don't exist\n- **Contradictions** — claims that conflict across pages\n- **Stale summaries** — pages not updated after newer sources\n- **Missing entity pages** — entities mentioned in 3+ pages but lacking their own page\n- **Data gaps** — questions the wiki can't answer; suggest new sources\n\nOutput a lint report and ask if the user wants it saved to `wiki/lint-report.md`.\n\n---\n\n## Health Workflow\n\nTriggered by: *\"health\"* or `/wiki-health`\n\nRun: `python tools/health.py` (or `python tools/health.py --json` for machine-readable output)\n\nFast structural integrity checks — **zero LLM calls**, safe to run every session:\n- **Empty / stub files** — pages with no content beyond frontmatter (rate-limit damage)\n- **Index sync** — `wiki/index.md` entries vs actual files on disk\n- **Log coverage** — source pages missing a corresponding `ingest` entry in `wiki/log.md`\n\nOutput a health report. Use `--save` to write to `wiki/health-report.md`.\n\n### Health vs Lint Boundary\n\n| Dimension | `health` | `lint` |\n|---|---|---|\n| **Scope** | Structural integrity | Content quality |\n| **LLM calls** | Zero | Yes (semantic analysis) |\n| **Cost** | Free | Tokens |\n| **Frequency** | Every session, before other work | Every 10-15 ingests |\n| **Checks** | Empty files, index sync, log sync | Orphans, broken links, contradictions, gaps |\n| **Tool** | `tools/health.py` | `tools/lint.py` |\n| **Run order** | First (pre-flight) | After health passes |\n\n> Run `health` first — linting an empty file wastes tokens.\n\n---\n\n## Graph Workflow\n\nTriggered by: *\"build the knowledge graph\"* or `/wiki-graph`\n\nWhen the user asks to build the graph, run `tools/build_graph.py` which:\n- Pass 1: Parses all `[[wikilinks]]` → deterministic `EXTRACTED` edges\n- Pass 2: Infers implicit relationships → `INFERRED` edges with confidence scores\n- Runs Louvain community detection\n- Outputs `graph/graph.json` + `graph/graph.html`\n\nIf the user doesn't have Python/dependencies set up, instead generate the graph data manually:\n1. Use Grep to find all `[[wikilinks]]` across wiki pages\n2. Build a node/edge list\n3. Write `graph/graph.json` directly\n4. Write `graph/graph.html` using the vis.js template\n\n---\n\n## Naming Conventions\n\n- Source slugs: `kebab-case` matching source filename\n- Entity pages: `TitleCase.md` (e.g. `OpenAI.md`, `SamAltman.md`)\n- Concept pages: `TitleCase.md` (e.g. `ReinforcementLearning.md`, `RAG.md`)\n- Source pages: `kebab-case.md`\n\n## Index Format\n\n```markdown\n# Wiki Index\n\n## Overview\n- [Overview](overview.md) — living synthesis\n\n## Sources\n- [Source Title](sources/slug.md) — one-line summary\n\n## Entities\n- [Entity Name](entities/EntityName.md) — one-line description\n\n## Concepts\n- [Concept Name](concepts/ConceptName.md) — one-line description\n\n## Syntheses\n- [Analysis Title](syntheses/slug.md) — what question it answers\n```\n\n## Log Format\n\nEach entry starts with `## [YYYY-MM-DD] <operation> | <title>` so it's grep-parseable:\n\n```\ngrep \"^## \\[\" wiki/log.md | tail -10\n```\n\nOperations: `ingest`, `query`, `health`, `lint`, `graph`\n","AGENTS.md":"# LLM Wiki Agent — Schema & Workflow Instructions\n\nThis wiki is maintained entirely by your coding agent. No API key or Python scripts needed — just open this repo in Codex, OpenCode, or any agent that reads this file, and talk to it.\n\n## How to Use\n\nDescribe what you want in plain English:\n- *\"Ingest this file: raw/papers/my-paper.md\"*\n- *\"What does the wiki say about transformer models?\"*\n- *\"Check the wiki for orphan pages and contradictions\"*\n- *\"Build the knowledge graph\"*\n\nOr use shorthand triggers:\n- `ingest <file>` → runs the Ingest Workflow\n- `query: <question>` → runs the Query Workflow\n- `health` → runs the Health Workflow (fast, every session)\n- `lint` → runs the Lint Workflow (expensive, periodic)\n- `build graph` → runs the Graph Workflow\n\n---\n\n## Directory Layout\n\n```\nraw/          # Immutable source documents — never modify these\nwiki/         # Agent owns this layer entirely\n  index.md    # Catalog of all pages — update on every ingest\n  log.md      # Append-only chronological record\n  overview.md # Living synthesis across all sources\n  sources/    # One summary page per source document\n  entities/   # People, companies, projects, products\n  concepts/   # Ideas, frameworks, methods, theories\n  syntheses/  # Saved query answers\ngraph/        # Auto-generated graph data\ntools/        # Standalone Python scripts\n  health.py   # Structural checks (deterministic, no LLM calls)\n  lint.py     # Content quality checks (uses LLM for semantic analysis)\n  build_graph.py  # Knowledge graph generation\n```\n\n---\n\n## Page Format\n\nEvery wiki page uses this frontmatter:\n\n```yaml\n---\ntitle: \"Page Title\"\ntype: source | entity | concept | synthesis\ntags: []\nsources: []       # list of source slugs that inform this page\nlast_updated: YYYY-MM-DD\n---\n```\n\nUse `[[PageName]]` wikilinks to link to other wiki pages.\n\n---\n\n## Ingest Workflow\n\nTriggered by: *\"ingest <file>\"*\n\n**Supported formats:** Markdown (`.md`) is ingested directly. Non-markdown files (`.pdf`, `.docx`, `.pptx`, `.xlsx`, `.html`, `.txt`, `.csv`, `.json`, `.xml`, `.rst`, `.rtf`, `.epub`, `.ipynb`, `.yaml`, `.yml`, `.tsv`, `.wav`, `.mp3`) are auto-converted to markdown via [markitdown](https://github.com/microsoft/markitdown) before ingestion. Use `--no-convert` to skip auto-conversion.\n\nSteps (in order):\n1. Read the source document fully (auto-convert if non-markdown)\n2. Read `wiki/index.md` and `wiki/overview.md` for current wiki context\n3. Write `wiki/sources/<slug>.md` — use the source page format below\n4. Update `wiki/index.md` — add entry under Sources section\n5. Update `wiki/overview.md` — revise synthesis if warranted\n6. Update/create entity pages for key people, companies, projects mentioned\n7. Update/create concept pages for key ideas and frameworks discussed\n8. Flag any contradictions with existing wiki content\n9. Append to `wiki/log.md`: `## [YYYY-MM-DD] ingest | <Title>`\n10. **Post-ingest validation** — check for broken `[[wikilinks]]`, verify all new pages are in `index.md`, print a change summary\n\n### Source Page Format\n\n```markdown\n---\ntitle: \"Source Title\"\ntype: source\ntags: []\ndate: YYYY-MM-DD\nsource_file: raw/...\n---\n\n## Summary\n2–4 sentence summary.\n\n## Key Claims\n- Claim 1\n- Claim 2\n\n## Key Quotes\n> \"Quote here\" — context\n\n## Connections\n- [[EntityName]] — how they relate\n- [[ConceptName]] — how it connects\n\n## Contradictions\n- Contradicts [[OtherPage]] on: ...\n```\n\n### Domain-Specific Templates\n\nIf the source falls into a specific domain (e.g., personal diary, meeting notes), the agent should use a specialized template instead of the default generic one above:\n\n#### Diary / Journal Template\n```markdown\n---\ntitle: \"YYYY-MM-DD Diary\"\ntype: source\ntags: [diary]\ndate: YYYY-MM-DD\n---\n## Event Summary\n...\n## Key Decisions\n...\n## Energy & Mood\n...\n## Connections\n...\n## Shifts & Contradictions\n...\n```\n\n#### Meeting Notes Template\n```markdown\n---\ntitle: \"Meeting Title\"\ntype: source\ntags: [meeting]\ndate: YYYY-MM-DD\n---\n## Goal\n...\n## Key Discussions\n...\n## Decisions Made\n...\n## Action Items\n...\n```\n\n---\n\n## Query Workflow\n\nTriggered by: *\"query: <question>\"*\n\nSteps:\n1. Read `wiki/index.md` to identify relevant pages\n2. Read those pages\n3. Synthesize an answer with inline citations as `[[PageName]]` wikilinks\n4. Ask the user if they want the answer filed as `wiki/syntheses/<slug>.md`\n\n---\n\n## Lint Workflow\n\nTriggered by: *\"lint\"*\n\nCheck for:\n- **Orphan pages** — wiki pages with no inbound `[[links]]` from other pages\n- **Broken links** — `[[WikiLinks]]` pointing to pages that don't exist\n- **Contradictions** — claims that conflict across pages\n- **Stale summaries** — pages not updated after newer sources\n- **Missing entity pages** — entities mentioned in 3+ pages but lacking their own page\n- **Sparse pages** — pages with fewer than 2 outbound `[[wikilinks]]` (link density budget)\n- **Data gaps** — questions the wiki can't answer; suggest new sources\n\nGraph-aware checks (require `graph.json` from `build graph`):\n- **Hub stubs** — god nodes (degree > μ+2σ) with thin content (< 500 chars)\n- **Fragile bridges** — community pairs connected by only 1 edge\n- **Isolated communities** — clusters with zero external connections\n\nOutput a lint report and ask if the user wants it saved to `wiki/lint-report.md`.\n\n---\n\n## Health Workflow\n\nTriggered by: *\"health\"*\n\nRun: `python tools/health.py` (or `python tools/health.py --json` for machine-readable output)\n\nFast structural integrity checks — **zero LLM calls**, safe to run every session:\n- **Empty / stub files** — pages with no content beyond frontmatter (rate-limit damage)\n- **Index sync** — `wiki/index.md` entries vs actual files on disk\n- **Log coverage** — source pages missing a corresponding `ingest` entry in `wiki/log.md`\n\nOutput a health report. Use `--save` to write to `wiki/health-report.md`.\n\n### Health vs Lint Boundary\n\n| Dimension | `health` | `lint` |\n|---|---|---|\n| **Scope** | Structural integrity | Content quality |\n| **LLM calls** | Zero | Yes (semantic analysis) |\n| **Cost** | Free | Tokens |\n| **Frequency** | Every session, before other work | Every 10-15 ingests |\n| **Checks** | Empty files, index sync, log sync | Orphans, broken links, contradictions, gaps |\n| **Tool** | `tools/health.py` | `tools/lint.py` |\n| **Run order** | First (pre-flight) | After health passes |\n\n> Run `health` first — linting an empty file wastes tokens.\n\n---\n\n## Graph Workflow\n\nTriggered by: *\"build graph\"*\n\nFirst try: `python tools/build_graph.py --open`\n\nIf Python/deps unavailable, build manually:\n1. Search for all `[[wikilinks]]` across wiki pages\n2. Build nodes (one per page) and edges (one per link)\n3. Infer implicit relationships not captured by wikilinks — tag `INFERRED` with confidence score; low confidence → `AMBIGUOUS`\n4. Write `graph/graph.json` with `{nodes, edges, built: date}`\n5. Write `graph/graph.html` as a self-contained vis.js visualization\n\n---\n\n## Naming Conventions\n\n- Source slugs: `kebab-case` matching source filename\n- Entity pages: `TitleCase.md` (e.g. `OpenAI.md`, `SamAltman.md`)\n- Concept pages: `TitleCase.md` (e.g. `ReinforcementLearning.md`, `RAG.md`)\n\n## Index Format\n\n```markdown\n# Wiki Index\n\n## Overview\n- [Overview](overview.md) — living synthesis\n\n## Sources\n- [Source Title](sources/slug.md) — one-line summary\n\n## Entities\n- [Entity Name](entities/EntityName.md) — one-line description\n\n## Concepts\n- [Concept Name](concepts/ConceptName.md) — one-line description\n\n## Syntheses\n- [Analysis Title](syntheses/slug.md) — what question it answers\n```\n\n## Log Format\n\n`## [YYYY-MM-DD] <operation> | <title>`\n\nOperations: `ingest`, `query`, `health`, `lint`, `graph`, `report`\n\n---\n\n## Graph Health Report\n\nTriggered by: *\"graph report\"* or `python tools/build_graph.py --report`\n\nThe `--report` flag generates a structured graph health report covering:\n- **Health summary** — edges/node ratio, orphan %, community count, link density\n- **Orphan nodes** — pages with zero graph connections\n- **God nodes** — hub pages with degree > μ+2σ (disproportionate connectivity)\n- **Fragile bridges** — community pairs connected by only 1 edge\n- **Phantom hubs** — `[[wikilinks]]` referenced by 2+ existing pages but pointing to non-existent pages (page creation signals)\n\nUse `--save` to write the report to `graph/graph-report.md`.\n\n---\n\n## Phase 3 Design Constraints (Auto-Linking — Open)\n\nPhase 3 proposes automatic `[[wikilink]]` insertion based on graph analysis. The following hard rules apply:\n\n### Promotion Gate: `draft → stable`\n- Auto-linked edges start as `DRAFT` (visible in graph, not written to page body)\n- A dedicated `promote` pass validates source grounding + consistency\n- Only edges that pass get materialized as `[[wikilinks]]` in the page\n- **Link density budget**: a page must have ≥2 outbound wikilinks before promotion\n\n### Hard Rules\n| ID | Rule | Rationale |\n|---|---|---|\n| HG-WA-01 | Graph layer MUST NOT auto-create pages from broken links — report only | LLM ingest produces hallucinated wikilinks; auto-creating amplifies noise |\n| HG-WA-02 | New slash commands MUST NOT duplicate existing command coverage | Prevents user confusion; merge into existing commands instead |\n",".claude/commands/wiki-query.md":"Query the LLM Wiki and synthesize an answer.\n\nUsage: /wiki-query $ARGUMENTS\n\n$ARGUMENTS is the question to answer, e.g. `What are the main themes across all sources?`\n\nFollow the Query Workflow defined in CLAUDE.md:\n1. Read wiki/index.md to identify the most relevant pages\n2. Read those pages (up to ~10 most relevant)\n3. Synthesize a thorough markdown answer with [[PageName]] wikilink citations\n4. Include a ## Sources section at the end listing pages you drew from\n5. Ask the user if they want the answer saved as wiki/syntheses/<slug>.md\n\nIf the wiki is empty, say so and suggest running /wiki-ingest first.\n"},"files":{"GEMINI.md":"# LLM Wiki Agent — Schema & Workflow Instructions\n\nThis wiki is maintained entirely by Gemini CLI. No API key or Python scripts needed — just open this repo with `gemini` and talk to it.\n\n## How to Use\n\nDescribe what you want in plain English:\n- *\"Ingest this file: raw/papers/my-paper.md\"*\n- *\"What does the wiki say about transformer models?\"*\n- *\"Check the wiki for orphan pages and contradictions\"*\n- *\"Build the knowledge graph\"*\n\nOr use shorthand triggers:\n- `ingest <file>` → runs the Ingest Workflow\n- `query: <question>` → runs the Query Workflow\n- `health` → runs the Health Workflow (fast, every session)\n- `lint` → runs the Lint Workflow (expensive, periodic)\n- `build graph` → runs the Graph Workflow\n\n---\n\n## Directory Layout\n\n```\nraw/          # Immutable source documents — never modify these\nwiki/         # Agent owns this layer entirely\n  index.md    # Catalog of all pages — update on every ingest\n  log.md      # Append-only chronological record\n  overview.md # Living synthesis across all sources\n  sources/    # One summary page per source document\n  entities/   # People, companies, projects, products\n  concepts/   # Ideas, frameworks, methods, theories\n  syntheses/  # Saved query answers\ngraph/        # Auto-generated graph data\ntools/        # Standalone Python scripts\n  health.py   # Structural checks (deterministic, no LLM calls)\n  lint.py     # Content quality checks (uses LLM for semantic analysis)\n  build_graph.py  # Knowledge graph generation\n```\n\n---\n\n## Page Format\n\nEvery wiki page uses this frontmatter:\n\n```yaml\n---\ntitle: \"Page Title\"\ntype: source | entity | concept | synthesis\ntags: []\nsources: []\nlast_updated: YYYY-MM-DD\n---\n```\n\nUse `[[PageName]]` wikilinks to link to other wiki pages.\n\n---\n\n## Ingest Workflow\n\nTriggered by: *\"ingest <file>\"*\n\n**Supported formats:** `.md` ingested directly. Non-markdown files (`.pdf`, `.docx`, `.pptx`, `.xlsx`, `.html`, `.txt`, `.csv`, `.json`, `.xml`, `.rst`, `.rtf`, `.epub`, `.ipynb`, `.yaml`, `.yml`, `.tsv`, `.wav`, `.mp3`) auto-converted via markitdown. Use `--no-convert` to skip.\n\n1. Read the source document fully (auto-convert if non-markdown)\n2. Read `wiki/index.md` and `wiki/overview.md` for current wiki context\n3. Write `wiki/sources/<slug>.md` (source page format below)\n4. Update `wiki/index.md` — add entry under Sources\n5. Update `wiki/overview.md` — revise synthesis if warranted\n6. Update/create entity and concept pages\n7. Flag contradictions with existing wiki content\n8. Append to `wiki/log.md`: `## [YYYY-MM-DD] ingest | <Title>`\n9. **Post-ingest validation** — check for broken `[[wikilinks]]`, verify all new pages are in `index.md`, print a change summary\n\n### Source Page Format\n\n```markdown\n---\ntitle: \"Source Title\"\ntype: source\ntags: []\ndate: YYYY-MM-DD\nsource_file: raw/...\n---\n\n## Summary\n2–4 sentence summary.\n\n## Key Claims\n- Claim 1\n\n## Key Quotes\n> \"Quote here\"\n\n## Connections\n- [[EntityName]] — how they relate\n\n## Contradictions\n- Contradicts [[OtherPage]] on: ...\n```\n\n### Domain-Specific Templates\n\nIf the source falls into a specific domain (e.g., personal diary, meeting notes), the agent should use a specialized template instead of the default generic one above:\n\n#### Diary / Journal Template\n```markdown\n---\ntitle: \"YYYY-MM-DD Diary\"\ntype: source\ntags: [diary]\ndate: YYYY-MM-DD\n---\n## Event Summary\n...\n## Key Decisions\n...\n## Energy & Mood\n...\n## Connections\n...\n## Shifts & Contradictions\n...\n```\n\n#### Meeting Notes Template\n```markdown\n---\ntitle: \"Meeting Title\"\ntype: source\ntags: [meeting]\ndate: YYYY-MM-DD\n---\n## Goal\n...\n## Key Discussions\n...\n## Decisions Made\n...\n## Action Items\n...\n```\n\n---\n\n## Query Workflow\n\nTriggered by: *\"query: <question>\"*\n\n1. Read `wiki/index.md` — identify relevant pages\n2. Read those pages\n3. Synthesize answer with `[[PageName]]` citations\n4. Offer to save as `wiki/syntheses/<slug>.md`\n\n---\n\n## Lint Workflow\n\nTriggered by: *\"lint\"*\n\nCheck for: orphan pages, broken links, contradictions, stale content, missing entity pages, sparse pages (< 2 outbound links), data gaps.\n\nGraph-aware checks (require `graph.json`): hub stubs, fragile bridges, isolated communities.\n\n---\n\n## Health Workflow\n\nTriggered by: *\"health\"*\n\nRun: `python tools/health.py` (or `python tools/health.py --json` for machine-readable output)\n\nFast structural integrity checks — **zero LLM calls**, safe to run every session:\n- **Empty / stub files** — pages with no content beyond frontmatter (rate-limit damage)\n- **Index sync** — `wiki/index.md` entries vs actual files on disk\n- **Log coverage** — source pages missing a corresponding `ingest` entry in `wiki/log.md`\n\nOutput a health report. Use `--save` to write to `wiki/health-report.md`.\n\n### Health vs Lint Boundary\n\n| Dimension | `health` | `lint` |\n|---|---|---|\n| **Scope** | Structural integrity | Content quality |\n| **LLM calls** | Zero | Yes (semantic analysis) |\n| **Cost** | Free | Tokens |\n| **Frequency** | Every session, before other work | Every 10-15 ingests |\n| **Checks** | Empty files, index sync, log sync | Orphans, broken links, contradictions, gaps |\n| **Tool** | `tools/health.py` | `tools/lint.py` |\n| **Run order** | First (pre-flight) | After health passes |\n\n> Run `health` first — linting an empty file wastes tokens.\n\n---\n\n## Graph Workflow\n\nTriggered by: *\"build graph\"*\n\nTry `python tools/build_graph.py --open` first. If unavailable, build graph.json and graph.html manually from wikilinks.\n\n---\n\n## Naming Conventions\n\n- Source slugs: `kebab-case`\n- Entity/Concept pages: `TitleCase.md`\n\n## Log Format\n\n`## [YYYY-MM-DD] <operation> | <title>`\n\nOperations: `ingest`, `query`, `lint`, `graph`, `report`\n\n---\n\n## Graph Health Report\n\nTriggered by: *\"graph report\"* or `python tools/build_graph.py --report`\n\nCovers: health summary, orphan nodes, god nodes, fragile bridges, phantom hubs. Use `--save` to persist.\n\n---\n\n## Phase 3 Design Constraints (Auto-Linking — Open)\n\n- Auto-linked edges start as `DRAFT`, require promotion gate validation\n- Link density budget: ≥2 outbound wikilinks before promotion\n- HG-WA-01: Graph layer MUST NOT auto-create pages from broken links\n- HG-WA-02: New commands MUST NOT duplicate existing command coverage\n",".claude/commands/wiki-ingest.md":"Ingest a source document into the LLM Wiki.\n\nUsage: /wiki-ingest $ARGUMENTS\n\n$ARGUMENTS should be the path to a file in raw/, e.g. `raw/articles/my-article.md`\n\nFollow the Ingest Workflow defined in CLAUDE.md exactly:\n1. Read the source file at the given path\n2. Read wiki/index.md and wiki/overview.md for current context\n3. Write wiki/sources/<slug>.md (source page format per CLAUDE.md)\n4. Update wiki/index.md — add the new entry under Sources\n5. Update wiki/overview.md — revise synthesis if warranted\n6. Create/update entity pages (wiki/entities/) for key people, companies, projects\n7. Create/update concept pages (wiki/concepts/) for key ideas and frameworks\n8. Flag any contradictions with existing wiki content\n9. Append to wiki/log.md: ## [today's date] ingest | <Title>\n\nAfter completing all writes, summarize: what was added, which pages were created or updated, and any contradictions found.\n",".claude/commands/wiki-lint.md":"Health-check the LLM Wiki for issues.\n\nUsage: /wiki-lint\n\nFollow the Lint Workflow defined in CLAUDE.md:\n\nStructural checks (use Grep and Glob tools):\n1. Orphan pages — wiki pages with no inbound [[wikilinks]] from other pages\n2. Broken links — [[WikiLinks]] pointing to pages that don't exist\n3. Missing entity pages — names referenced in 3+ pages but lacking their own page\n\nSemantic checks (read and reason over page content):\n4. Contradictions — claims that conflict between pages\n5. Stale summaries — pages not updated after newer sources changed the picture\n6. Data gaps — important questions the wiki can't answer; suggest specific sources to find\n\nOutput a structured markdown lint report. At the end, ask if the user wants it saved to wiki/lint-report.md.\n\nAppend to wiki/log.md: ## [today's date] lint | Wiki health check\n",".claude/commands/wiki-graph.md":"Build the LLM Wiki knowledge graph.\n\nUsage: /wiki-graph\n\nFirst try running: python tools/build_graph.py --open\n\nIf that fails (missing dependencies), build the graph manually:\n\n1. Use Grep to find all [[wikilinks]] across every file in wiki/\n2. Build a nodes list: one node per wiki page, with id=relative-path, label=title, type from frontmatter\n3. Build an edges list: one edge per [[wikilink]], tagged EXTRACTED\n4. Infer additional implicit relationships between pages not captured by wikilinks — tag these INFERRED with a confidence score (0.0–1.0); tag low-confidence ones AMBIGUOUS\n5. Write graph/graph.json with {nodes, edges, built: today}\n6. Write graph/graph.html as a self-contained vis.js page (nodes colored by type, edges colored by type, interactive, searchable)\n\nAfter building, summarize: node count, edge count, breakdown by type, and the most connected nodes (hubs).\n\nAppend to wiki/log.md: ## [today's date] graph | Knowledge graph rebuilt\n","CLAUDE.md":"# LLM Wiki Agent — Schema & Workflow Instructions\n\nThis wiki is maintained entirely by Claude Code. No API key or Python scripts needed — just open this repo in Claude Code and talk to it.\n\n## Slash Commands (Claude Code)\n\n| Command | What to say |\n|---|---|\n| `/wiki-ingest` | `ingest raw/my-article.md` |\n| `/wiki-query` | `query: what are the main themes?` |\n| `/wiki-health` | `health` (fast, every session) |\n| `/wiki-lint` | `lint the wiki` (expensive, periodic) |\n| `/wiki-graph` | `build the knowledge graph` |\n\nOr just describe what you want in plain English:\n- *\"Ingest this file: raw/papers/attention-is-all-you-need.md\"*\n- *\"What does the wiki say about transformer models?\"*\n- *\"Check the wiki for orphan pages and contradictions\"*\n- *\"Build the graph and show me what's connected to RAG\"*\n\nClaude Code reads this file automatically and follows the workflows below.\n\n---\n\n## Directory Layout\n\n```\nraw/          # Immutable source documents — never modify these\nwiki/         # Claude owns this layer entirely\n  index.md    # Catalog of all pages — update on every ingest\n  log.md      # Append-only chronological record\n  overview.md # Living synthesis across all sources\n  sources/    # One summary page per source document\n  entities/   # People, companies, projects, products\n  concepts/   # Ideas, frameworks, methods, theories\n  syntheses/  # Saved query answers\ngraph/        # Auto-generated graph data\ntools/        # Standalone Python scripts\n  health.py   # Structural checks (deterministic, no LLM calls)\n  lint.py     # Content quality checks (uses LLM for semantic analysis)\n  build_graph.py  # Knowledge graph generation\n```\n\n---\n\n## Page Format\n\nEvery wiki page uses this frontmatter:\n\n```yaml\n---\ntitle: \"Page Title\"\ntype: source | entity | concept | synthesis\ntags: []\nsources: []       # list of source slugs that inform this page\nlast_updated: YYYY-MM-DD\n---\n```\n\nUse `[[PageName]]` wikilinks to link to other wiki pages.\n\n---\n\n## Ingest Workflow\n\nTriggered by: *\"ingest <file>\"* or `/wiki-ingest`\n\n**Supported formats:** Markdown (`.md`) ingested directly. Non-markdown files (`.pdf`, `.docx`, `.pptx`, `.xlsx`, `.html`, `.txt`, `.csv`, `.json`, `.xml`, `.rst`, `.rtf`, `.epub`, `.ipynb`, `.yaml`, `.yml`, `.tsv`, `.wav`, `.mp3`) auto-converted to markdown via [markitdown](https://github.com/microsoft/markitdown) before ingestion. Use `--no-convert` to skip auto-conversion.\n\nSteps (in order):\n1. Read the source document fully using the Read tool (auto-convert if non-markdown)\n2. Read `wiki/index.md` and `wiki/overview.md` for current wiki context\n3. Write `wiki/sources/<slug>.md` — use the source page format below\n4. Update `wiki/index.md` — add entry under Sources section\n5. Update `wiki/overview.md` — revise synthesis if warranted\n6. Update/create entity pages for key people, companies, projects mentioned\n7. Update/create concept pages for key ideas and frameworks discussed\n8. Flag any contradictions with existing wiki content\n9. Append to `wiki/log.md`: `## [YYYY-MM-DD] ingest | <Title>`\n10. **Post-ingest validation** — check for broken `[[wikilinks]]`, verify all new pages are in `index.md`, print a change summary\n\n### Source Page Format\n\n```markdown\n---\ntitle: \"Source Title\"\ntype: source\ntags: []\ndate: YYYY-MM-DD\nsource_file: raw/...\n---\n\n## Summary\n2–4 sentence summary.\n\n## Key Claims\n- Claim 1\n- Claim 2\n\n## Key Quotes\n> \"Quote here\" — context\n\n## Connections\n- [[EntityName]] — how they relate\n- [[ConceptName]] — how it connects\n\n## Contradictions\n- Contradicts [[OtherPage]] on: ...\n```\n\n### Domain-Specific Templates\n\nIf the source falls into a specific domain (e.g., personal diary, meeting notes), the agent should use a specialized template instead of the default generic one above:\n\n#### Diary / Journal Template\n```markdown\n---\ntitle: \"YYYY-MM-DD Diary\"\ntype: source\ntags: [diary]\ndate: YYYY-MM-DD\n---\n## Event Summary\n...\n## Key Decisions\n...\n## Energy & Mood\n...\n## Connections\n...\n## Shifts & Contradictions\n...\n```\n\n#### Meeting Notes Template\n```markdown\n---\ntitle: \"Meeting Title\"\ntype: source\ntags: [meeting]\ndate: YYYY-MM-DD\n---\n## Goal\n...\n## Key Discussions\n...\n## Decisions Made\n...\n## Action Items\n...\n```\n\n---\n\n## Query Workflow\n\nTriggered by: *\"query: <question>\"* or `/wiki-query`\n\nSteps:\n1. Read `wiki/index.md` to identify relevant pages\n2. Read those pages with the Read tool\n3. Synthesize an answer with inline citations as `[[PageName]]` wikilinks\n4. Ask the user if they want the answer filed as `wiki/syntheses/<slug>.md`\n\n---\n\n## Lint Workflow\n\nTriggered by: *\"lint the wiki\"* or `/wiki-lint`\n\nUse Grep and Read tools to check for:\n- **Orphan pages** — wiki pages with no inbound `[[links]]` from other pages\n- **Broken links** — `[[WikiLinks]]` pointing to pages that don't exist\n- **Contradictions** — claims that conflict across pages\n- **Stale summaries** — pages not updated after newer sources\n- **Missing entity pages** — entities mentioned in 3+ pages but lacking their own page\n- **Data gaps** — questions the wiki can't answer; suggest new sources\n\nOutput a lint report and ask if the user wants it saved to `wiki/lint-report.md`.\n\n---\n\n## Health Workflow\n\nTriggered by: *\"health\"* or `/wiki-health`\n\nRun: `python tools/health.py` (or `python tools/health.py --json` for machine-readable output)\n\nFast structural integrity checks — **zero LLM calls**, safe to run every session:\n- **Empty / stub files** — pages with no content beyond frontmatter (rate-limit damage)\n- **Index sync** — `wiki/index.md` entries vs actual files on disk\n- **Log coverage** — source pages missing a corresponding `ingest` entry in `wiki/log.md`\n\nOutput a health report. Use `--save` to write to `wiki/health-report.md`.\n\n### Health vs Lint Boundary\n\n| Dimension | `health` | `lint` |\n|---|---|---|\n| **Scope** | Structural integrity | Content quality |\n| **LLM calls** | Zero | Yes (semantic analysis) |\n| **Cost** | Free | Tokens |\n| **Frequency** | Every session, before other work | Every 10-15 ingests |\n| **Checks** | Empty files, index sync, log sync | Orphans, broken links, contradictions, gaps |\n| **Tool** | `tools/health.py` | `tools/lint.py` |\n| **Run order** | First (pre-flight) | After health passes |\n\n> Run `health` first — linting an empty file wastes tokens.\n\n---\n\n## Graph Workflow\n\nTriggered by: *\"build the knowledge graph\"* or `/wiki-graph`\n\nWhen the user asks to build the graph, run `tools/build_graph.py` which:\n- Pass 1: Parses all `[[wikilinks]]` → deterministic `EXTRACTED` edges\n- Pass 2: Infers implicit relationships → `INFERRED` edges with confidence scores\n- Runs Louvain community detection\n- Outputs `graph/graph.json` + `graph/graph.html`\n\nIf the user doesn't have Python/dependencies set up, instead generate the graph data manually:\n1. Use Grep to find all `[[wikilinks]]` across wiki pages\n2. Build a node/edge list\n3. Write `graph/graph.json` directly\n4. Write `graph/graph.html` using the vis.js template\n\n---\n\n## Naming Conventions\n\n- Source slugs: `kebab-case` matching source filename\n- Entity pages: `TitleCase.md` (e.g. `OpenAI.md`, `SamAltman.md`)\n- Concept pages: `TitleCase.md` (e.g. `ReinforcementLearning.md`, `RAG.md`)\n- Source pages: `kebab-case.md`\n\n## Index Format\n\n```markdown\n# Wiki Index\n\n## Overview\n- [Overview](overview.md) — living synthesis\n\n## Sources\n- [Source Title](sources/slug.md) — one-line summary\n\n## Entities\n- [Entity Name](entities/EntityName.md) — one-line description\n\n## Concepts\n- [Concept Name](concepts/ConceptName.md) — one-line description\n\n## Syntheses\n- [Analysis Title](syntheses/slug.md) — what question it answers\n```\n\n## Log Format\n\nEach entry starts with `## [YYYY-MM-DD] <operation> | <title>` so it's grep-parseable:\n\n```\ngrep \"^## \\[\" wiki/log.md | tail -10\n```\n\nOperations: `ingest`, `query`, `health`, `lint`, `graph`\n","AGENTS.md":"# LLM Wiki Agent — Schema & Workflow Instructions\n\nThis wiki is maintained entirely by your coding agent. No API key or Python scripts needed — just open this repo in Codex, OpenCode, or any agent that reads this file, and talk to it.\n\n## How to Use\n\nDescribe what you want in plain English:\n- *\"Ingest this file: raw/papers/my-paper.md\"*\n- *\"What does the wiki say about transformer models?\"*\n- *\"Check the wiki for orphan pages and contradictions\"*\n- *\"Build the knowledge graph\"*\n\nOr use shorthand triggers:\n- `ingest <file>` → runs the Ingest Workflow\n- `query: <question>` → runs the Query Workflow\n- `health` → runs the Health Workflow (fast, every session)\n- `lint` → runs the Lint Workflow (expensive, periodic)\n- `build graph` → runs the Graph Workflow\n\n---\n\n## Directory Layout\n\n```\nraw/          # Immutable source documents — never modify these\nwiki/         # Agent owns this layer entirely\n  index.md    # Catalog of all pages — update on every ingest\n  log.md      # Append-only chronological record\n  overview.md # Living synthesis across all sources\n  sources/    # One summary page per source document\n  entities/   # People, companies, projects, products\n  concepts/   # Ideas, frameworks, methods, theories\n  syntheses/  # Saved query answers\ngraph/        # Auto-generated graph data\ntools/        # Standalone Python scripts\n  health.py   # Structural checks (deterministic, no LLM calls)\n  lint.py     # Content quality checks (uses LLM for semantic analysis)\n  build_graph.py  # Knowledge graph generation\n```\n\n---\n\n## Page Format\n\nEvery wiki page uses this frontmatter:\n\n```yaml\n---\ntitle: \"Page Title\"\ntype: source | entity | concept | synthesis\ntags: []\nsources: []       # list of source slugs that inform this page\nlast_updated: YYYY-MM-DD\n---\n```\n\nUse `[[PageName]]` wikilinks to link to other wiki pages.\n\n---\n\n## Ingest Workflow\n\nTriggered by: *\"ingest <file>\"*\n\n**Supported formats:** Markdown (`.md`) is ingested directly. Non-markdown files (`.pdf`, `.docx`, `.pptx`, `.xlsx`, `.html`, `.txt`, `.csv`, `.json`, `.xml`, `.rst`, `.rtf`, `.epub`, `.ipynb`, `.yaml`, `.yml`, `.tsv`, `.wav`, `.mp3`) are auto-converted to markdown via [markitdown](https://github.com/microsoft/markitdown) before ingestion. Use `--no-convert` to skip auto-conversion.\n\nSteps (in order):\n1. Read the source document fully (auto-convert if non-markdown)\n2. Read `wiki/index.md` and `wiki/overview.md` for current wiki context\n3. Write `wiki/sources/<slug>.md` — use the source page format below\n4. Update `wiki/index.md` — add entry under Sources section\n5. Update `wiki/overview.md` — revise synthesis if warranted\n6. Update/create entity pages for key people, companies, projects mentioned\n7. Update/create concept pages for key ideas and frameworks discussed\n8. Flag any contradictions with existing wiki content\n9. Append to `wiki/log.md`: `## [YYYY-MM-DD] ingest | <Title>`\n10. **Post-ingest validation** — check for broken `[[wikilinks]]`, verify all new pages are in `index.md`, print a change summary\n\n### Source Page Format\n\n```markdown\n---\ntitle: \"Source Title\"\ntype: source\ntags: []\ndate: YYYY-MM-DD\nsource_file: raw/...\n---\n\n## Summary\n2–4 sentence summary.\n\n## Key Claims\n- Claim 1\n- Claim 2\n\n## Key Quotes\n> \"Quote here\" — context\n\n## Connections\n- [[EntityName]] — how they relate\n- [[ConceptName]] — how it connects\n\n## Contradictions\n- Contradicts [[OtherPage]] on: ...\n```\n\n### Domain-Specific Templates\n\nIf the source falls into a specific domain (e.g., personal diary, meeting notes), the agent should use a specialized template instead of the default generic one above:\n\n#### Diary / Journal Template\n```markdown\n---\ntitle: \"YYYY-MM-DD Diary\"\ntype: source\ntags: [diary]\ndate: YYYY-MM-DD\n---\n## Event Summary\n...\n## Key Decisions\n...\n## Energy & Mood\n...\n## Connections\n...\n## Shifts & Contradictions\n...\n```\n\n#### Meeting Notes Template\n```markdown\n---\ntitle: \"Meeting Title\"\ntype: source\ntags: [meeting]\ndate: YYYY-MM-DD\n---\n## Goal\n...\n## Key Discussions\n...\n## Decisions Made\n...\n## Action Items\n...\n```\n\n---\n\n## Query Workflow\n\nTriggered by: *\"query: <question>\"*\n\nSteps:\n1. Read `wiki/index.md` to identify relevant pages\n2. Read those pages\n3. Synthesize an answer with inline citations as `[[PageName]]` wikilinks\n4. Ask the user if they want the answer filed as `wiki/syntheses/<slug>.md`\n\n---\n\n## Lint Workflow\n\nTriggered by: *\"lint\"*\n\nCheck for:\n- **Orphan pages** — wiki pages with no inbound `[[links]]` from other pages\n- **Broken links** — `[[WikiLinks]]` pointing to pages that don't exist\n- **Contradictions** — claims that conflict across pages\n- **Stale summaries** — pages not updated after newer sources\n- **Missing entity pages** — entities mentioned in 3+ pages but lacking their own page\n- **Sparse pages** — pages with fewer than 2 outbound `[[wikilinks]]` (link density budget)\n- **Data gaps** — questions the wiki can't answer; suggest new sources\n\nGraph-aware checks (require `graph.json` from `build graph`):\n- **Hub stubs** — god nodes (degree > μ+2σ) with thin content (< 500 chars)\n- **Fragile bridges** — community pairs connected by only 1 edge\n- **Isolated communities** — clusters with zero external connections\n\nOutput a lint report and ask if the user wants it saved to `wiki/lint-report.md`.\n\n---\n\n## Health Workflow\n\nTriggered by: *\"health\"*\n\nRun: `python tools/health.py` (or `python tools/health.py --json` for machine-readable output)\n\nFast structural integrity checks — **zero LLM calls**, safe to run every session:\n- **Empty / stub files** — pages with no content beyond frontmatter (rate-limit damage)\n- **Index sync** — `wiki/index.md` entries vs actual files on disk\n- **Log coverage** — source pages missing a corresponding `ingest` entry in `wiki/log.md`\n\nOutput a health report. Use `--save` to write to `wiki/health-report.md`.\n\n### Health vs Lint Boundary\n\n| Dimension | `health` | `lint` |\n|---|---|---|\n| **Scope** | Structural integrity | Content quality |\n| **LLM calls** | Zero | Yes (semantic analysis) |\n| **Cost** | Free | Tokens |\n| **Frequency** | Every session, before other work | Every 10-15 ingests |\n| **Checks** | Empty files, index sync, log sync | Orphans, broken links, contradictions, gaps |\n| **Tool** | `tools/health.py` | `tools/lint.py` |\n| **Run order** | First (pre-flight) | After health passes |\n\n> Run `health` first — linting an empty file wastes tokens.\n\n---\n\n## Graph Workflow\n\nTriggered by: *\"build graph\"*\n\nFirst try: `python tools/build_graph.py --open`\n\nIf Python/deps unavailable, build manually:\n1. Search for all `[[wikilinks]]` across wiki pages\n2. Build nodes (one per page) and edges (one per link)\n3. Infer implicit relationships not captured by wikilinks — tag `INFERRED` with confidence score; low confidence → `AMBIGUOUS`\n4. Write `graph/graph.json` with `{nodes, edges, built: date}`\n5. Write `graph/graph.html` as a self-contained vis.js visualization\n\n---\n\n## Naming Conventions\n\n- Source slugs: `kebab-case` matching source filename\n- Entity pages: `TitleCase.md` (e.g. `OpenAI.md`, `SamAltman.md`)\n- Concept pages: `TitleCase.md` (e.g. `ReinforcementLearning.md`, `RAG.md`)\n\n## Index Format\n\n```markdown\n# Wiki Index\n\n## Overview\n- [Overview](overview.md) — living synthesis\n\n## Sources\n- [Source Title](sources/slug.md) — one-line summary\n\n## Entities\n- [Entity Name](entities/EntityName.md) — one-line description\n\n## Concepts\n- [Concept Name](concepts/ConceptName.md) — one-line description\n\n## Syntheses\n- [Analysis Title](syntheses/slug.md) — what question it answers\n```\n\n## Log Format\n\n`## [YYYY-MM-DD] <operation> | <title>`\n\nOperations: `ingest`, `query`, `health`, `lint`, `graph`, `report`\n\n---\n\n## Graph Health Report\n\nTriggered by: *\"graph report\"* or `python tools/build_graph.py --report`\n\nThe `--report` flag generates a structured graph health report covering:\n- **Health summary** — edges/node ratio, orphan %, community count, link density\n- **Orphan nodes** — pages with zero graph connections\n- **God nodes** — hub pages with degree > μ+2σ (disproportionate connectivity)\n- **Fragile bridges** — community pairs connected by only 1 edge\n- **Phantom hubs** — `[[wikilinks]]` referenced by 2+ existing pages but pointing to non-existent pages (page creation signals)\n\nUse `--save` to write the report to `graph/graph-report.md`.\n\n---\n\n## Phase 3 Design Constraints (Auto-Linking — Open)\n\nPhase 3 proposes automatic `[[wikilink]]` insertion based on graph analysis. The following hard rules apply:\n\n### Promotion Gate: `draft → stable`\n- Auto-linked edges start as `DRAFT` (visible in graph, not written to page body)\n- A dedicated `promote` pass validates source grounding + consistency\n- Only edges that pass get materialized as `[[wikilinks]]` in the page\n- **Link density budget**: a page must have ≥2 outbound wikilinks before promotion\n\n### Hard Rules\n| ID | Rule | Rationale |\n|---|---|---|\n| HG-WA-01 | Graph layer MUST NOT auto-create pages from broken links — report only | LLM ingest produces hallucinated wikilinks; auto-creating amplifies noise |\n| HG-WA-02 | New slash commands MUST NOT duplicate existing command coverage | Prevents user confusion; merge into existing commands instead |\n",".claude/commands/wiki-query.md":"Query the LLM Wiki and synthesize an answer.\n\nUsage: /wiki-query $ARGUMENTS\n\n$ARGUMENTS is the question to answer, e.g. `What are the main themes across all sources?`\n\nFollow the Query Workflow defined in CLAUDE.md:\n1. Read wiki/index.md to identify the most relevant pages\n2. Read those pages (up to ~10 most relevant)\n3. Synthesize a thorough markdown answer with [[PageName]] wikilink citations\n4. Include a ## Sources section at the end listing pages you drew from\n5. Ask the user if they want the answer saved as wiki/syntheses/<slug>.md\n\nIf the wiki is empty, say so and suggest running /wiki-ingest first.\n"},"items":[{"name":"AGENTS.md","path":"AGENTS.md","rawUrl":"https://raw.githubusercontent.com/SamurAIGPT/llm-wiki-agent/HEAD/AGENTS.md","title":"AI Agent Protocol & Instructions","category":"root-instruction","format":"markdown","content":"# LLM Wiki Agent — Schema & Workflow Instructions\n\nThis wiki is maintained entirely by your coding agent. No API key or Python scripts needed — just open this repo in Codex, OpenCode, or any agent that reads this file, and talk to it.\n\n## How to Use\n\nDescribe what you want in plain English:\n- *\"Ingest this file: raw/papers/my-paper.md\"*\n- *\"What does the wiki say about transformer models?\"*\n- *\"Check the wiki for orphan pages and contradictions\"*\n- *\"Build the knowledge graph\"*\n\nOr use shorthand triggers:\n- `ingest <file>` → runs the Ingest Workflow\n- `query: <question>` → runs the Query Workflow\n- `health` → runs the Health Workflow (fast, every session)\n- `lint` → runs the Lint Workflow (expensive, periodic)\n- `build graph` → runs the Graph Workflow\n\n---\n\n## Directory Layout\n\n```\nraw/          # Immutable source documents — never modify these\nwiki/         # Agent owns this layer entirely\n  index.md    # Catalog of all pages — update on every ingest\n  log.md      # Append-only chronological record\n  overview.md # Living synthesis across all sources\n  sources/    # One summary page per source document\n  entities/   # People, companies, projects, products\n  concepts/   # Ideas, frameworks, methods, theories\n  syntheses/  # Saved query answers\ngraph/        # Auto-generated graph data\ntools/        # Standalone Python scripts\n  health.py   # Structural checks (deterministic, no LLM calls)\n  lint.py     # Content quality checks (uses LLM for semantic analysis)\n  build_graph.py  # Knowledge graph generation\n```\n\n---\n\n## Page Format\n\nEvery wiki page uses this frontmatter:\n\n```yaml\n---\ntitle: \"Page Title\"\ntype: source | entity | concept | synthesis\ntags: []\nsources: []       # list of source slugs that inform this page\nlast_updated: YYYY-MM-DD\n---\n```\n\nUse `[[PageName]]` wikilinks to link to other wiki pages.\n\n---\n\n## Ingest Workflow\n\nTriggered by: *\"ingest <file>\"*\n\n**Supported formats:** Markdown (`.md`) is ingested directly. Non-markdown files (`.pdf`, `.docx`, `.pptx`, `.xlsx`, `.html`, `.txt`, `.csv`, `.json`, `.xml`, `.rst`, `.rtf`, `.epub`, `.ipynb`, `.yaml`, `.yml`, `.tsv`, `.wav`, `.mp3`) are auto-converted to markdown via [markitdown](https://github.com/microsoft/markitdown) before ingestion. Use `--no-convert` to skip auto-conversion.\n\nSteps (in order):\n1. Read the source document fully (auto-convert if non-markdown)\n2. Read `wiki/index.md` and `wiki/overview.md` for current wiki context\n3. Write `wiki/sources/<slug>.md` — use the source page format below\n4. Update `wiki/index.md` — add entry under Sources section\n5. Update `wiki/overview.md` — revise synthesis if warranted\n6. Update/create entity pages for key people, companies, projects mentioned\n7. Update/create concept pages for key ideas and frameworks discussed\n8. Flag any contradictions with existing wiki content\n9. Append to `wiki/log.md`: `## [YYYY-MM-DD] ingest | <Title>`\n10. **Post-ingest validation** — check for broken `[[wikilinks]]`, verify all new pages are in `index.md`, print a change summary\n\n### Source Page Format\n\n```markdown\n---\ntitle: \"Source Title\"\ntype: source\ntags: []\ndate: YYYY-MM-DD\nsource_file: raw/...\n---\n\n## Summary\n2–4 sentence summary.\n\n## Key Claims\n- Claim 1\n- Claim 2\n\n## Key Quotes\n> \"Quote here\" — context\n\n## Connections\n- [[EntityName]] — how they relate\n- [[ConceptName]] — how it connects\n\n## Contradictions\n- Contradicts [[OtherPage]] on: ...\n```\n\n### Domain-Specific Templates\n\nIf the source falls into a specific domain (e.g., personal diary, meeting notes), the agent should use a specialized template instead of the default generic one above:\n\n#### Diary / Journal Template\n```markdown\n---\ntitle: \"YYYY-MM-DD Diary\"\ntype: source\ntags: [diary]\ndate: YYYY-MM-DD\n---\n## Event Summary\n...\n## Key Decisions\n...\n## Energy & Mood\n...\n## Connections\n...\n## Shifts & Contradictions\n...\n```\n\n#### Meeting Notes Template\n```markdown\n---\ntitle: \"Meeting Title\"\ntype: source\ntags: [meeting]\ndate: YYYY-MM-DD\n---\n## Goal\n...\n## Key Discussions\n...\n## Decisions Made\n...\n## Action Items\n...\n```\n\n---\n\n## Query Workflow\n\nTriggered by: *\"query: <question>\"*\n\nSteps:\n1. Read `wiki/index.md` to identify relevant pages\n2. Read those pages\n3. Synthesize an answer with inline citations as `[[PageName]]` wikilinks\n4. Ask the user if they want the answer filed as `wiki/syntheses/<slug>.md`\n\n---\n\n## Lint Workflow\n\nTriggered by: *\"lint\"*\n\nCheck for:\n- **Orphan pages** — wiki pages with no inbound `[[links]]` from other pages\n- **Broken links** — `[[WikiLinks]]` pointing to pages that don't exist\n- **Contradictions** — claims that conflict across pages\n- **Stale summaries** — pages not updated after newer sources\n- **Missing entity pages** — entities mentioned in 3+ pages but lacking their own page\n- **Sparse pages** — pages with fewer than 2 outbound `[[wikilinks]]` (link density budget)\n- **Data gaps** — questions the wiki can't answer; suggest new sources\n\nGraph-aware checks (require `graph.json` from `build graph`):\n- **Hub stubs** — god nodes (degree > μ+2σ) with thin content (< 500 chars)\n- **Fragile bridges** — community pairs connected by only 1 edge\n- **Isolated communities** — clusters with zero external connections\n\nOutput a lint report and ask if the user wants it saved to `wiki/lint-report.md`.\n\n---\n\n## Health Workflow\n\nTriggered by: *\"health\"*\n\nRun: `python tools/health.py` (or `python tools/health.py --json` for machine-readable output)\n\nFast structural integrity checks — **zero LLM calls**, safe to run every session:\n- **Empty / stub files** — pages with no content beyond frontmatter (rate-limit damage)\n- **Index sync** — `wiki/index.md` entries vs actual files on disk\n- **Log coverage** — source pages missing a corresponding `ingest` entry in `wiki/log.md`\n\nOutput a health report. Use `--save` to write to `wiki/health-report.md`.\n\n### Health vs Lint Boundary\n\n| Dimension | `health` | `lint` |\n|---|---|---|\n| **Scope** | Structural integrity | Content quality |\n| **LLM calls** | Zero | Yes (semantic analysis) |\n| **Cost** | Free | Tokens |\n| **Frequency** | Every session, before other work | Every 10-15 ingests |\n| **Checks** | Empty files, index sync, log sync | Orphans, broken links, contradictions, gaps |\n| **Tool** | `tools/health.py` | `tools/lint.py` |\n| **Run order** | First (pre-flight) | After health passes |\n\n> Run `health` first — linting an empty file wastes tokens.\n\n---\n\n## Graph Workflow\n\nTriggered by: *\"build graph\"*\n\nFirst try: `python tools/build_graph.py --open`\n\nIf Python/deps unavailable, build manually:\n1. Search for all `[[wikilinks]]` across wiki pages\n2. Build nodes (one per page) and edges (one per link)\n3. Infer implicit relationships not captured by wikilinks — tag `INFERRED` with confidence score; low confidence → `AMBIGUOUS`\n4. Write `graph/graph.json` with `{nodes, edges, built: date}`\n5. Write `graph/graph.html` as a self-contained vis.js visualization\n\n---\n\n## Naming Conventions\n\n- Source slugs: `kebab-case` matching source filename\n- Entity pages: `TitleCase.md` (e.g. `OpenAI.md`, `SamAltman.md`)\n- Concept pages: `TitleCase.md` (e.g. `ReinforcementLearning.md`, `RAG.md`)\n\n## Index Format\n\n```markdown\n# Wiki Index\n\n## Overview\n- [Overview](overview.md) — living synthesis\n\n## Sources\n- [Source Title](sources/slug.md) — one-line summary\n\n## Entities\n- [Entity Name](entities/EntityName.md) — one-line description\n\n## Concepts\n- [Concept Name](concepts/ConceptName.md) — one-line description\n\n## Syntheses\n- [Analysis Title](syntheses/slug.md) — what question it answers\n```\n\n## Log Format\n\n`## [YYYY-MM-DD] <operation> | <title>`\n\nOperations: `ingest`, `query`, `health`, `lint`, `graph`, `report`\n\n---\n\n## Graph Health Report\n\nTriggered by: *\"graph report\"* or `python tools/build_graph.py --report`\n\nThe `--report` flag generates a structured graph health report covering:\n- **Health summary** — edges/node ratio, orphan %, community count, link density\n- **Orphan nodes** — pages with zero graph connections\n- **God nodes** — hub pages with degree > μ+2σ (disproportionate connectivity)\n- **Fragile bridges** — community pairs connected by only 1 edge\n- **Phantom hubs** — `[[wikilinks]]` referenced by 2+ existing pages but pointing to non-existent pages (page creation signals)\n\nUse `--save` to write the report to `graph/graph-report.md`.\n\n---\n\n## Phase 3 Design Constraints (Auto-Linking — Open)\n\nPhase 3 proposes automatic `[[wikilink]]` insertion based on graph analysis. The following hard rules apply:\n\n### Promotion Gate: `draft → stable`\n- Auto-linked edges start as `DRAFT` (visible in graph, not written to page body)\n- A dedicated `promote` pass validates source grounding + consistency\n- Only edges that pass get materialized as `[[wikilinks]]` in the page\n- **Link density budget**: a page must have ≥2 outbound wikilinks before promotion\n\n### Hard Rules\n| ID | Rule | Rationale |\n|---|---|---|\n| HG-WA-01 | Graph layer MUST NOT auto-create pages from broken links — report only | LLM ingest produces hallucinated wikilinks; auto-creating amplifies noise |\n| HG-WA-02 | New slash commands MUST NOT duplicate existing command coverage | Prevents user confusion; merge into existing commands instead |\n","isInternal":false,"tokens":2346,"sizeBytes":9257},{"name":"CLAUDE.md","path":"CLAUDE.md","rawUrl":"https://raw.githubusercontent.com/SamurAIGPT/llm-wiki-agent/HEAD/CLAUDE.md","title":"Claude Agent Guidelines & System Prompt","category":"claude-rule","format":"markdown","content":"# LLM Wiki Agent — Schema & Workflow Instructions\n\nThis wiki is maintained entirely by Claude Code. No API key or Python scripts needed — just open this repo in Claude Code and talk to it.\n\n## Slash Commands (Claude Code)\n\n| Command | What to say |\n|---|---|\n| `/wiki-ingest` | `ingest raw/my-article.md` |\n| `/wiki-query` | `query: what are the main themes?` |\n| `/wiki-health` | `health` (fast, every session) |\n| `/wiki-lint` | `lint the wiki` (expensive, periodic) |\n| `/wiki-graph` | `build the knowledge graph` |\n\nOr just describe what you want in plain English:\n- *\"Ingest this file: raw/papers/attention-is-all-you-need.md\"*\n- *\"What does the wiki say about transformer models?\"*\n- *\"Check the wiki for orphan pages and contradictions\"*\n- *\"Build the graph and show me what's connected to RAG\"*\n\nClaude Code reads this file automatically and follows the workflows below.\n\n---\n\n## Directory Layout\n\n```\nraw/          # Immutable source documents — never modify these\nwiki/         # Claude owns this layer entirely\n  index.md    # Catalog of all pages — update on every ingest\n  log.md      # Append-only chronological record\n  overview.md # Living synthesis across all sources\n  sources/    # One summary page per source document\n  entities/   # People, companies, projects, products\n  concepts/   # Ideas, frameworks, methods, theories\n  syntheses/  # Saved query answers\ngraph/        # Auto-generated graph data\ntools/        # Standalone Python scripts\n  health.py   # Structural checks (deterministic, no LLM calls)\n  lint.py     # Content quality checks (uses LLM for semantic analysis)\n  build_graph.py  # Knowledge graph generation\n```\n\n---\n\n## Page Format\n\nEvery wiki page uses this frontmatter:\n\n```yaml\n---\ntitle: \"Page Title\"\ntype: source | entity | concept | synthesis\ntags: []\nsources: []       # list of source slugs that inform this page\nlast_updated: YYYY-MM-DD\n---\n```\n\nUse `[[PageName]]` wikilinks to link to other wiki pages.\n\n---\n\n## Ingest Workflow\n\nTriggered by: *\"ingest <file>\"* or `/wiki-ingest`\n\n**Supported formats:** Markdown (`.md`) ingested directly. Non-markdown files (`.pdf`, `.docx`, `.pptx`, `.xlsx`, `.html`, `.txt`, `.csv`, `.json`, `.xml`, `.rst`, `.rtf`, `.epub`, `.ipynb`, `.yaml`, `.yml`, `.tsv`, `.wav`, `.mp3`) auto-converted to markdown via [markitdown](https://github.com/microsoft/markitdown) before ingestion. Use `--no-convert` to skip auto-conversion.\n\nSteps (in order):\n1. Read the source document fully using the Read tool (auto-convert if non-markdown)\n2. Read `wiki/index.md` and `wiki/overview.md` for current wiki context\n3. Write `wiki/sources/<slug>.md` — use the source page format below\n4. Update `wiki/index.md` — add entry under Sources section\n5. Update `wiki/overview.md` — revise synthesis if warranted\n6. Update/create entity pages for key people, companies, projects mentioned\n7. Update/create concept pages for key ideas and frameworks discussed\n8. Flag any contradictions with existing wiki content\n9. Append to `wiki/log.md`: `## [YYYY-MM-DD] ingest | <Title>`\n10. **Post-ingest validation** — check for broken `[[wikilinks]]`, verify all new pages are in `index.md`, print a change summary\n\n### Source Page Format\n\n```markdown\n---\ntitle: \"Source Title\"\ntype: source\ntags: []\ndate: YYYY-MM-DD\nsource_file: raw/...\n---\n\n## Summary\n2–4 sentence summary.\n\n## Key Claims\n- Claim 1\n- Claim 2\n\n## Key Quotes\n> \"Quote here\" — context\n\n## Connections\n- [[EntityName]] — how they relate\n- [[ConceptName]] — how it connects\n\n## Contradictions\n- Contradicts [[OtherPage]] on: ...\n```\n\n### Domain-Specific Templates\n\nIf the source falls into a specific domain (e.g., personal diary, meeting notes), the agent should use a specialized template instead of the default generic one above:\n\n#### Diary / Journal Template\n```markdown\n---\ntitle: \"YYYY-MM-DD Diary\"\ntype: source\ntags: [diary]\ndate: YYYY-MM-DD\n---\n## Event Summary\n...\n## Key Decisions\n...\n## Energy & Mood\n...\n## Connections\n...\n## Shifts & Contradictions\n...\n```\n\n#### Meeting Notes Template\n```markdown\n---\ntitle: \"Meeting Title\"\ntype: source\ntags: [meeting]\ndate: YYYY-MM-DD\n---\n## Goal\n...\n## Key Discussions\n...\n## Decisions Made\n...\n## Action Items\n...\n```\n\n---\n\n## Query Workflow\n\nTriggered by: *\"query: <question>\"* or `/wiki-query`\n\nSteps:\n1. Read `wiki/index.md` to identify relevant pages\n2. Read those pages with the Read tool\n3. Synthesize an answer with inline citations as `[[PageName]]` wikilinks\n4. Ask the user if they want the answer filed as `wiki/syntheses/<slug>.md`\n\n---\n\n## Lint Workflow\n\nTriggered by: *\"lint the wiki\"* or `/wiki-lint`\n\nUse Grep and Read tools to check for:\n- **Orphan pages** — wiki pages with no inbound `[[links]]` from other pages\n- **Broken links** — `[[WikiLinks]]` pointing to pages that don't exist\n- **Contradictions** — claims that conflict across pages\n- **Stale summaries** — pages not updated after newer sources\n- **Missing entity pages** — entities mentioned in 3+ pages but lacking their own page\n- **Data gaps** — questions the wiki can't answer; suggest new sources\n\nOutput a lint report and ask if the user wants it saved to `wiki/lint-report.md`.\n\n---\n\n## Health Workflow\n\nTriggered by: *\"health\"* or `/wiki-health`\n\nRun: `python tools/health.py` (or `python tools/health.py --json` for machine-readable output)\n\nFast structural integrity checks — **zero LLM calls**, safe to run every session:\n- **Empty / stub files** — pages with no content beyond frontmatter (rate-limit damage)\n- **Index sync** — `wiki/index.md` entries vs actual files on disk\n- **Log coverage** — source pages missing a corresponding `ingest` entry in `wiki/log.md`\n\nOutput a health report. Use `--save` to write to `wiki/health-report.md`.\n\n### Health vs Lint Boundary\n\n| Dimension | `health` | `lint` |\n|---|---|---|\n| **Scope** | Structural integrity | Content quality |\n| **LLM calls** | Zero | Yes (semantic analysis) |\n| **Cost** | Free | Tokens |\n| **Frequency** | Every session, before other work | Every 10-15 ingests |\n| **Checks** | Empty files, index sync, log sync | Orphans, broken links, contradictions, gaps |\n| **Tool** | `tools/health.py` | `tools/lint.py` |\n| **Run order** | First (pre-flight) | After health passes |\n\n> Run `health` first — linting an empty file wastes tokens.\n\n---\n\n## Graph Workflow\n\nTriggered by: *\"build the knowledge graph\"* or `/wiki-graph`\n\nWhen the user asks to build the graph, run `tools/build_graph.py` which:\n- Pass 1: Parses all `[[wikilinks]]` → deterministic `EXTRACTED` edges\n- Pass 2: Infers implicit relationships → `INFERRED` edges with confidence scores\n- Runs Louvain community detection\n- Outputs `graph/graph.json` + `graph/graph.html`\n\nIf the user doesn't have Python/dependencies set up, instead generate the graph data manually:\n1. Use Grep to find all `[[wikilinks]]` across wiki pages\n2. Build a node/edge list\n3. Write `graph/graph.json` directly\n4. Write `graph/graph.html` using the vis.js template\n\n---\n\n## Naming Conventions\n\n- Source slugs: `kebab-case` matching source filename\n- Entity pages: `TitleCase.md` (e.g. `OpenAI.md`, `SamAltman.md`)\n- Concept pages: `TitleCase.md` (e.g. `ReinforcementLearning.md`, `RAG.md`)\n- Source pages: `kebab-case.md`\n\n## Index Format\n\n```markdown\n# Wiki Index\n\n## Overview\n- [Overview](overview.md) — living synthesis\n\n## Sources\n- [Source Title](sources/slug.md) — one-line summary\n\n## Entities\n- [Entity Name](entities/EntityName.md) — one-line description\n\n## Concepts\n- [Concept Name](concepts/ConceptName.md) — one-line description\n\n## Syntheses\n- [Analysis Title](syntheses/slug.md) — what question it answers\n```\n\n## Log Format\n\nEach entry starts with `## [YYYY-MM-DD] <operation> | <title>` so it's grep-parseable:\n\n```\ngrep \"^## \\[\" wiki/log.md | tail -10\n```\n\nOperations: `ingest`, `query`, `health`, `lint`, `graph`\n","isInternal":false,"tokens":2033,"sizeBytes":7856},{"name":"GEMINI.md","path":"GEMINI.md","rawUrl":"https://raw.githubusercontent.com/SamurAIGPT/llm-wiki-agent/HEAD/GEMINI.md","title":"Gemini Agent & Antigravity Instructions","category":"gemini-rule","format":"markdown","content":"# LLM Wiki Agent — Schema & Workflow Instructions\n\nThis wiki is maintained entirely by Gemini CLI. No API key or Python scripts needed — just open this repo with `gemini` and talk to it.\n\n## How to Use\n\nDescribe what you want in plain English:\n- *\"Ingest this file: raw/papers/my-paper.md\"*\n- *\"What does the wiki say about transformer models?\"*\n- *\"Check the wiki for orphan pages and contradictions\"*\n- *\"Build the knowledge graph\"*\n\nOr use shorthand triggers:\n- `ingest <file>` → runs the Ingest Workflow\n- `query: <question>` → runs the Query Workflow\n- `health` → runs the Health Workflow (fast, every session)\n- `lint` → runs the Lint Workflow (expensive, periodic)\n- `build graph` → runs the Graph Workflow\n\n---\n\n## Directory Layout\n\n```\nraw/          # Immutable source documents — never modify these\nwiki/         # Agent owns this layer entirely\n  index.md    # Catalog of all pages — update on every ingest\n  log.md      # Append-only chronological record\n  overview.md # Living synthesis across all sources\n  sources/    # One summary page per source document\n  entities/   # People, companies, projects, products\n  concepts/   # Ideas, frameworks, methods, theories\n  syntheses/  # Saved query answers\ngraph/        # Auto-generated graph data\ntools/        # Standalone Python scripts\n  health.py   # Structural checks (deterministic, no LLM calls)\n  lint.py     # Content quality checks (uses LLM for semantic analysis)\n  build_graph.py  # Knowledge graph generation\n```\n\n---\n\n## Page Format\n\nEvery wiki page uses this frontmatter:\n\n```yaml\n---\ntitle: \"Page Title\"\ntype: source | entity | concept | synthesis\ntags: []\nsources: []\nlast_updated: YYYY-MM-DD\n---\n```\n\nUse `[[PageName]]` wikilinks to link to other wiki pages.\n\n---\n\n## Ingest Workflow\n\nTriggered by: *\"ingest <file>\"*\n\n**Supported formats:** `.md` ingested directly. Non-markdown files (`.pdf`, `.docx`, `.pptx`, `.xlsx`, `.html`, `.txt`, `.csv`, `.json`, `.xml`, `.rst`, `.rtf`, `.epub`, `.ipynb`, `.yaml`, `.yml`, `.tsv`, `.wav`, `.mp3`) auto-converted via markitdown. Use `--no-convert` to skip.\n\n1. Read the source document fully (auto-convert if non-markdown)\n2. Read `wiki/index.md` and `wiki/overview.md` for current wiki context\n3. Write `wiki/sources/<slug>.md` (source page format below)\n4. Update `wiki/index.md` — add entry under Sources\n5. Update `wiki/overview.md` — revise synthesis if warranted\n6. Update/create entity and concept pages\n7. Flag contradictions with existing wiki content\n8. Append to `wiki/log.md`: `## [YYYY-MM-DD] ingest | <Title>`\n9. **Post-ingest validation** — check for broken `[[wikilinks]]`, verify all new pages are in `index.md`, print a change summary\n\n### Source Page Format\n\n```markdown\n---\ntitle: \"Source Title\"\ntype: source\ntags: []\ndate: YYYY-MM-DD\nsource_file: raw/...\n---\n\n## Summary\n2–4 sentence summary.\n\n## Key Claims\n- Claim 1\n\n## Key Quotes\n> \"Quote here\"\n\n## Connections\n- [[EntityName]] — how they relate\n\n## Contradictions\n- Contradicts [[OtherPage]] on: ...\n```\n\n### Domain-Specific Templates\n\nIf the source falls into a specific domain (e.g., personal diary, meeting notes), the agent should use a specialized template instead of the default generic one above:\n\n#### Diary / Journal Template\n```markdown\n---\ntitle: \"YYYY-MM-DD Diary\"\ntype: source\ntags: [diary]\ndate: YYYY-MM-DD\n---\n## Event Summary\n...\n## Key Decisions\n...\n## Energy & Mood\n...\n## Connections\n...\n## Shifts & Contradictions\n...\n```\n\n#### Meeting Notes Template\n```markdown\n---\ntitle: \"Meeting Title\"\ntype: source\ntags: [meeting]\ndate: YYYY-MM-DD\n---\n## Goal\n...\n## Key Discussions\n...\n## Decisions Made\n...\n## Action Items\n...\n```\n\n---\n\n## Query Workflow\n\nTriggered by: *\"query: <question>\"*\n\n1. Read `wiki/index.md` — identify relevant pages\n2. Read those pages\n3. Synthesize answer with `[[PageName]]` citations\n4. Offer to save as `wiki/syntheses/<slug>.md`\n\n---\n\n## Lint Workflow\n\nTriggered by: *\"lint\"*\n\nCheck for: orphan pages, broken links, contradictions, stale content, missing entity pages, sparse pages (< 2 outbound links), data gaps.\n\nGraph-aware checks (require `graph.json`): hub stubs, fragile bridges, isolated communities.\n\n---\n\n## Health Workflow\n\nTriggered by: *\"health\"*\n\nRun: `python tools/health.py` (or `python tools/health.py --json` for machine-readable output)\n\nFast structural integrity checks — **zero LLM calls**, safe to run every session:\n- **Empty / stub files** — pages with no content beyond frontmatter (rate-limit damage)\n- **Index sync** — `wiki/index.md` entries vs actual files on disk\n- **Log coverage** — source pages missing a corresponding `ingest` entry in `wiki/log.md`\n\nOutput a health report. Use `--save` to write to `wiki/health-report.md`.\n\n### Health vs Lint Boundary\n\n| Dimension | `health` | `lint` |\n|---|---|---|\n| **Scope** | Structural integrity | Content quality |\n| **LLM calls** | Zero | Yes (semantic analysis) |\n| **Cost** | Free | Tokens |\n| **Frequency** | Every session, before other work | Every 10-15 ingests |\n| **Checks** | Empty files, index sync, log sync | Orphans, broken links, contradictions, gaps |\n| **Tool** | `tools/health.py` | `tools/lint.py` |\n| **Run order** | First (pre-flight) | After health passes |\n\n> Run `health` first — linting an empty file wastes tokens.\n\n---\n\n## Graph Workflow\n\nTriggered by: *\"build graph\"*\n\nTry `python tools/build_graph.py --open` first. If unavailable, build graph.json and graph.html manually from wikilinks.\n\n---\n\n## Naming Conventions\n\n- Source slugs: `kebab-case`\n- Entity/Concept pages: `TitleCase.md`\n\n## Log Format\n\n`## [YYYY-MM-DD] <operation> | <title>`\n\nOperations: `ingest`, `query`, `lint`, `graph`, `report`\n\n---\n\n## Graph Health Report\n\nTriggered by: *\"graph report\"* or `python tools/build_graph.py --report`\n\nCovers: health summary, orphan nodes, god nodes, fragile bridges, phantom hubs. Use `--save` to persist.\n\n---\n\n## Phase 3 Design Constraints (Auto-Linking — Open)\n\n- Auto-linked edges start as `DRAFT`, require promotion gate validation\n- Link density budget: ≥2 outbound wikilinks before promotion\n- HG-WA-01: Graph layer MUST NOT auto-create pages from broken links\n- HG-WA-02: New commands MUST NOT duplicate existing command coverage\n","isInternal":false,"tokens":1588,"sizeBytes":6226},{"name":"wiki-graph.md","path":".claude/commands/wiki-graph.md","rawUrl":"https://raw.githubusercontent.com/SamurAIGPT/llm-wiki-agent/HEAD/.claude/commands/wiki-graph.md","title":"Command: /wiki-graph","category":"command-prompt","format":"markdown","content":"Build the LLM Wiki knowledge graph.\n\nUsage: /wiki-graph\n\nFirst try running: python tools/build_graph.py --open\n\nIf that fails (missing dependencies), build the graph manually:\n\n1. Use Grep to find all [[wikilinks]] across every file in wiki/\n2. Build a nodes list: one node per wiki page, with id=relative-path, label=title, type from frontmatter\n3. Build an edges list: one edge per [[wikilink]], tagged EXTRACTED\n4. Infer additional implicit relationships between pages not captured by wikilinks — tag these INFERRED with a confidence score (0.0–1.0); tag low-confidence ones AMBIGUOUS\n5. Write graph/graph.json with {nodes, edges, built: today}\n6. Write graph/graph.html as a self-contained vis.js page (nodes colored by type, edges colored by type, interactive, searchable)\n\nAfter building, summarize: node count, edge count, breakdown by type, and the most connected nodes (hubs).\n\nAppend to wiki/log.md: ## [today's date] graph | Knowledge graph rebuilt\n","isInternal":false,"tokens":232,"sizeBytes":964},{"name":"wiki-ingest.md","path":".claude/commands/wiki-ingest.md","rawUrl":"https://raw.githubusercontent.com/SamurAIGPT/llm-wiki-agent/HEAD/.claude/commands/wiki-ingest.md","title":"Command: /wiki-ingest","category":"command-prompt","format":"markdown","content":"Ingest a source document into the LLM Wiki.\n\nUsage: /wiki-ingest $ARGUMENTS\n\n$ARGUMENTS should be the path to a file in raw/, e.g. `raw/articles/my-article.md`\n\nFollow the Ingest Workflow defined in CLAUDE.md exactly:\n1. Read the source file at the given path\n2. Read wiki/index.md and wiki/overview.md for current context\n3. Write wiki/sources/<slug>.md (source page format per CLAUDE.md)\n4. Update wiki/index.md — add the new entry under Sources\n5. Update wiki/overview.md — revise synthesis if warranted\n6. Create/update entity pages (wiki/entities/) for key people, companies, projects\n7. Create/update concept pages (wiki/concepts/) for key ideas and frameworks\n8. Flag any contradictions with existing wiki content\n9. Append to wiki/log.md: ## [today's date] ingest | <Title>\n\nAfter completing all writes, summarize: what was added, which pages were created or updated, and any contradictions found.\n","isInternal":false,"tokens":218,"sizeBytes":910},{"name":"wiki-lint.md","path":".claude/commands/wiki-lint.md","rawUrl":"https://raw.githubusercontent.com/SamurAIGPT/llm-wiki-agent/HEAD/.claude/commands/wiki-lint.md","title":"Command: /wiki-lint","category":"command-prompt","format":"markdown","content":"Health-check the LLM Wiki for issues.\n\nUsage: /wiki-lint\n\nFollow the Lint Workflow defined in CLAUDE.md:\n\nStructural checks (use Grep and Glob tools):\n1. Orphan pages — wiki pages with no inbound [[wikilinks]] from other pages\n2. Broken links — [[WikiLinks]] pointing to pages that don't exist\n3. Missing entity pages — names referenced in 3+ pages but lacking their own page\n\nSemantic checks (read and reason over page content):\n4. Contradictions — claims that conflict between pages\n5. Stale summaries — pages not updated after newer sources changed the picture\n6. Data gaps — important questions the wiki can't answer; suggest specific sources to find\n\nOutput a structured markdown lint report. At the end, ask if the user wants it saved to wiki/lint-report.md.\n\nAppend to wiki/log.md: ## [today's date] lint | Wiki health check\n","isInternal":false,"tokens":195,"sizeBytes":844},{"name":"wiki-query.md","path":".claude/commands/wiki-query.md","rawUrl":"https://raw.githubusercontent.com/SamurAIGPT/llm-wiki-agent/HEAD/.claude/commands/wiki-query.md","title":"Command: /wiki-query","category":"command-prompt","format":"markdown","content":"Query the LLM Wiki and synthesize an answer.\n\nUsage: /wiki-query $ARGUMENTS\n\n$ARGUMENTS is the question to answer, e.g. `What are the main themes across all sources?`\n\nFollow the Query Workflow defined in CLAUDE.md:\n1. Read wiki/index.md to identify the most relevant pages\n2. Read those pages (up to ~10 most relevant)\n3. Synthesize a thorough markdown answer with [[PageName]] wikilink citations\n4. Include a ## Sources section at the end listing pages you drew from\n5. Ask the user if they want the answer saved as wiki/syntheses/<slug>.md\n\nIf the wiki is empty, say so and suggest running /wiki-ingest first.\n","isInternal":false,"tokens":154,"sizeBytes":613}],"systemPromptSnippet":"<yakaai_skills repo=\"SamurAIGPT/llm-wiki-agent\">\n<!-- File: AGENTS.md (Tokens: ~2346 | Category: root-instruction) -->\n# LLM Wiki Agent — Schema & Workflow Instructions\n\nThis wiki is maintained entirely by your coding agent. No API key or Python scripts needed — just open this repo in Codex, OpenCode, or any agent that reads this file, and talk to it.\n\n## How to Use\n\nDescribe what you want in plain English:\n- *\"Ingest this file: raw/papers/my-paper.md\"*\n- *\"What does the wiki say about transformer models?\"*\n- *\"Check the wiki for orphan pages and contradictions\"*\n- *\"Build the knowledge graph\"*\n\nOr use shorthand triggers:\n- `ingest <file>` → runs the Ingest Workflow\n- `query: <question>` → runs the Query Workflow\n- `health` → runs the Health Workflow (fast, every session)\n- `lint` → runs the Lint Workflow (expensive, periodic)\n- `build graph` → runs the Graph Workflow\n\n---\n\n## Directory Layout\n\n```\nraw/          # Immutable source documents — never modify these\nwiki/         # Agent owns this layer entirely\n  index.md    # Catalog of all pages — update on every ingest\n  log.md      # Append-only chronological record\n  overview.md # Living synthesis across all sources\n  sources/    # One summary page per source document\n  entities/   # People, companies, projects, products\n  concepts/   # Ideas, frameworks, methods, theories\n  syntheses/  # Saved query answers\ngraph/        # Auto-generated graph data\ntools/        # Standalone Python scripts\n  health.py   # Structural checks (deterministic, no LLM calls)\n  lint.py     # Content quality checks (uses LLM for semantic analysis)\n  build_graph.py  # Knowledge graph generation\n```\n\n---\n\n## Page Format\n\nEvery wiki page uses this frontmatter:\n\n```yaml\n---\ntitle: \"Page Title\"\ntype: source | entity | concept | synthesis\ntags: []\nsources: []       # list of source slugs that inform this page\nlast_updated: YYYY-MM-DD\n---\n```\n\nUse `[[PageName]]` wikilinks to link to other wiki pages.\n\n---\n\n## Ingest Workflow\n\nTriggered by: *\"ingest <file>\"*\n\n**Supported formats:** Markdown (`.md`) is ingested directly. Non-markdown files (`.pdf`, `.docx`, `.pptx`, `.xlsx`, `.html`, `.txt`, `.csv`, `.json`, `.xml`, `.rst`, `.rtf`, `.epub`, `.ipynb`, `.yaml`, `.yml`, `.tsv`, `.wav`, `.mp3`) are auto-converted to markdown via [markitdown](https://github.com/microsoft/markitdown) before ingestion. Use `--no-convert` to skip auto-conversion.\n\nSteps (in order):\n1. Read the source document fully (auto-convert if non-markdown)\n2. Read `wiki/index.md` and `wiki/overview.md` for current wiki context\n3. Write `wiki/sources/<slug>.md` — use the source page format below\n4. Update `wiki/index.md` — add entry under Sources section\n5. Update `wiki/overview.md` — revise synthesis if warranted\n6. Update/create entity pages for key people, companies, projects mentioned\n7. Update/create concept pages for key ideas and frameworks discussed\n8. Flag any contradictions with existing wiki content\n9. Append to `wiki/log.md`: `## [YYYY-MM-DD] ingest | <Title>`\n10. **Post-ingest validation** — check for broken `[[wikilinks]]`, verify all new pages are in `index.md`, print a change summary\n\n### Source Page Format\n\n```markdown\n---\ntitle: \"Source Title\"\ntype: source\ntags: []\ndate: YYYY-MM-DD\nsource_file: raw/...\n---\n\n## Summary\n2–4 sentence summary.\n\n## Key Claims\n- Claim 1\n- Claim 2\n\n## Key Quotes\n> \"Quote here\" — context\n\n## Connections\n- [[EntityName]] — how they relate\n- [[ConceptName]] — how it connects\n\n## Contradictions\n- Contradicts [[OtherPage]] on: ...\n```\n\n### Domain-Specific Templates\n\nIf the source falls into a specific domain (e.g., personal diary, meeting notes), the agent should use a specialized template instead of the default generic one above:\n\n#### Diary / Journal Template\n```markdown\n---\ntitle: \"YYYY-MM-DD Diary\"\ntype: source\ntags: [diary]\ndate: YYYY-MM-DD\n---\n## Event Summary\n...\n## Key Decisions\n...\n## Energy & Mood\n...\n## Connections\n...\n## Shifts & Contradictions\n...\n```\n\n#### Meeting Notes Template\n```markdown\n---\ntitle: \"Meeting Title\"\ntype: source\ntags: [meeting]\ndate: YYYY-MM-DD\n---\n## Goal\n...\n## Key Discussions\n...\n## Decisions Made\n...\n## Action Items\n...\n```\n\n---\n\n## Query Workflow\n\nTriggered by: *\"query: <question>\"*\n\nSteps:\n1. Read `wiki/index.md` to identify relevant pages\n2. Read those pages\n3. Synthesize an answer with inline citations as `[[PageName]]` wikilinks\n4. Ask the user if they want the answer filed as `wiki/syntheses/<slug>.md`\n\n---\n\n## Lint Workflow\n\nTriggered by: *\"lint\"*\n\nCheck for:\n- **Orphan pages** — wiki pages with no inbound `[[links]]` from other pages\n- **Broken links** — `[[WikiLinks]]` pointing to pages that don't exist\n- **Contradictions** — claims that conflict across pages\n- **Stale summaries** — pages not updated after newer sources\n- **Missing entity pages** — entities mentioned in 3+ pages but lacking their own page\n- **Sparse pages** — pages with fewer than 2 outbound `[[wikilinks]]` (link density budget)\n- **Data gaps** — questions the wiki can't answer; suggest new sources\n\nGraph-aware checks (require `graph.json` from `build graph`):\n- **Hub stubs** — god nodes (degree > μ+2σ) with thin content (< 500 chars)\n- **Fragile bridges** — community pairs connected by only 1 edge\n- **Isolated communities** — clusters with zero external connections\n\nOutput a lint report and ask if the user wants it saved to `wiki/lint-report.md`.\n\n---\n\n## Health Workflow\n\nTriggered by: *\"health\"*\n\nRun: `python tools/health.py` (or `python tools/health.py --json` for machine-readable output)\n\nFast structural integrity checks — **zero LLM calls**, safe to run every session:\n- **Empty / stub files** — pages with no content beyond frontmatter (rate-limit damage)\n- **Index sync** — `wiki/index.md` entries vs actual files on disk\n- **Log coverage** — source pages missing a corresponding `ingest` entry in `wiki/log.md`\n\nOutput a health report. Use `--save` to write to `wiki/health-report.md`.\n\n### Health vs Lint Boundary\n\n| Dimension | `health` | `lint` |\n|---|---|---|\n| **Scope** | Structural integrity | Content quality |\n| **LLM calls** | Zero | Yes (semantic analysis) |\n| **Cost** | Free | Tokens |\n| **Frequency** | Every session, before other work | Every 10-15 ingests |\n| **Checks** | Empty files, index sync, log sync | Orphans, broken links, contradictions, gaps |\n| **Tool** | `tools/health.py` | `tools/lint.py` |\n| **Run order** | First (pre-flight) | After health passes |\n\n> Run `health` first — linting an empty file wastes tokens.\n\n---\n\n## Graph Workflow\n\nTriggered by: *\"build graph\"*\n\nFirst try: `python tools/build_graph.py --open`\n\nIf Python/deps unavailable, build manually:\n1. Search for all `[[wikilinks]]` across wiki pages\n2. Build nodes (one per page) and edges (one per link)\n3. Infer implicit relationships not captured by wikilinks — tag `INFERRED` with confidence score; low confidence → `AMBIGUOUS`\n4. Write `graph/graph.json` with `{nodes, edges, built: date}`\n5. Write `graph/graph.html` as a self-contained vis.js visualization\n\n---\n\n## Naming Conventions\n\n- Source slugs: `kebab-case` matching source filename\n- Entity pages: `TitleCase.md` (e.g. `OpenAI.md`, `SamAltman.md`)\n- Concept pages: `TitleCase.md` (e.g. `ReinforcementLearning.md`, `RAG.md`)\n\n## Index Format\n\n```markdown\n# Wiki Index\n\n## Overview\n- [Overview](overview.md) — living synthesis\n\n## Sources\n- [Source Title](sources/slug.md) — one-line summary\n\n## Entities\n- [Entity Name](entities/EntityName.md) — one-line description\n\n## Concepts\n- [Concept Name](concepts/ConceptName.md) — one-line description\n\n## Syntheses\n- [Analysis Title](syntheses/slug.md) — what question it answers\n```\n\n## Log Format\n\n`## [YYYY-MM-DD] <operation> | <title>`\n\nOperations: `ingest`, `query`, `health`, `lint`, `graph`, `report`\n\n---\n\n## Graph Health Report\n\nTriggered by: *\"graph report\"* or `python tools/build_graph.py --report`\n\nThe `--report` flag generates a structured graph health report covering:\n- **Health summary** — edges/node ratio, orphan %, community count, link density\n- **Orphan nodes** — pages with zero graph connections\n- **God nodes** — hub pages with degree > μ+2σ (disproportionate connectivity)\n- **Fragile bridges** — community pairs connected by only 1 edge\n- **Phantom hubs** — `[[wikilinks]]` referenced by 2+ existing pages but pointing to non-existent pages (page creation signals)\n\nUse `--save` to write the report to `graph/graph-report.md`.\n\n---\n\n## Phase 3 Design Constraints (Auto-Linking — Open)\n\nPhase 3 proposes automatic `[[wikilink]]` insertion based on graph analysis. The following hard rules apply:\n\n### Promotion Gate: `draft → stable`\n- Auto-linked edges start as `DRAFT` (visible in graph, not written to page body)\n- A dedicated `promote` pass validates source grounding + consistency\n- Only edges that pass get materialized as `[[wikilinks]]` in the page\n- **Link density budget**: a page must have ≥2 outbound wikilinks before promotion\n\n### Hard Rules\n| ID | Rule | Rationale |\n|---|---|---|\n| HG-WA-01 | Graph layer MUST NOT auto-create pages from broken links — report only | LLM ingest produces hallucinated wikilinks; auto-creating amplifies noise |\n| HG-WA-02 | New slash commands MUST NOT duplicate existing command coverage | Prevents user confusion; merge into existing commands instead |\n\n<!-- File: CLAUDE.md (Tokens: ~2033 | Category: claude-rule) -->\n# LLM Wiki Agent — Schema & Workflow Instructions\n\nThis wiki is maintained entirely by Claude Code. No API key or Python scripts needed — just open this repo in Claude Code and talk to it.\n\n## Slash Commands (Claude Code)\n\n| Command | What to say |\n|---|---|\n| `/wiki-ingest` | `ingest raw/my-article.md` |\n| `/wiki-query` | `query: what are the main themes?` |\n| `/wiki-health` | `health` (fast, every session) |\n| `/wiki-lint` | `lint the wiki` (expensive, periodic) |\n| `/wiki-graph` | `build the knowledge graph` |\n\nOr just describe what you want in plain English:\n- *\"Ingest this file: raw/papers/attention-is-all-you-need.md\"*\n- *\"What does the wiki say about transformer models?\"*\n- *\"Check the wiki for orphan pages and contradictions\"*\n- *\"Build the graph and show me what's connected to RAG\"*\n\nClaude Code reads this file automatically and follows the workflows below.\n\n---\n\n## Directory Layout\n\n```\nraw/          # Immutable source documents — never modify these\nwiki/         # Claude owns this layer entirely\n  index.md    # Catalog of all pages — update on every ingest\n  log.md      # Append-only chronological record\n  overview.md # Living synthesis across all sources\n  sources/    # One summary page per source document\n  entities/   # People, companies, projects, products\n  concepts/   # Ideas, frameworks, methods, theories\n  syntheses/  # Saved query answers\ngraph/        # Auto-generated graph data\ntools/        # Standalone Python scripts\n  health.py   # Structural checks (deterministic, no LLM calls)\n  lint.py     # Content quality checks (uses LLM for semantic analysis)\n  build_graph.py  # Knowledge graph generation\n```\n\n---\n\n## Page Format\n\nEvery wiki page uses this frontmatter:\n\n```yaml\n---\ntitle: \"Page Title\"\ntype: source | entity | concept | synthesis\ntags: []\nsources: []       # list of source slugs that inform this page\nlast_updated: YYYY-MM-DD\n---\n```\n\nUse `[[PageName]]` wikilinks to link to other wiki pages.\n\n---\n\n## Ingest Workflow\n\nTriggered by: *\"ingest <file>\"* or `/wiki-ingest`\n\n**Supported formats:** Markdown (`.md`) ingested directly. Non-markdown files (`.pdf`, `.docx`, `.pptx`, `.xlsx`, `.html`, `.txt`, `.csv`, `.json`, `.xml`, `.rst`, `.rtf`, `.epub`, `.ipynb`, `.yaml`, `.yml`, `.tsv`, `.wav`, `.mp3`) auto-converted to markdown via [markitdown](https://github.com/microsoft/markitdown) before ingestion. Use `--no-convert` to skip auto-conversion.\n\nSteps (in order):\n1. Read the source document fully using the Read tool (auto-convert if non-markdown)\n2. Read `wiki/index.md` and `wiki/overview.md` for current wiki context\n3. Write `wiki/sources/<slug>.md` — use the source page format below\n4. Update `wiki/index.md` — add entry under Sources section\n5. Update `wiki/overview.md` — revise synthesis if warranted\n6. Update/create entity pages for key people, companies, projects mentioned\n7. Update/create concept pages for key ideas and frameworks discussed\n8. Flag any contradictions with existing wiki content\n9. Append to `wiki/log.md`: `## [YYYY-MM-DD] ingest | <Title>`\n10. **Post-ingest validation** — check for broken `[[wikilinks]]`, verify all new pages are in `index.md`, print a change summary\n\n### Source Page Format\n\n```markdown\n---\ntitle: \"Source Title\"\ntype: source\ntags: []\ndate: YYYY-MM-DD\nsource_file: raw/...\n---\n\n## Summary\n2–4 sentence summary.\n\n## Key Claims\n- Claim 1\n- Claim 2\n\n## Key Quotes\n> \"Quote here\" — context\n\n## Connections\n- [[EntityName]] — how they relate\n- [[ConceptName]] — how it connects\n\n## Contradictions\n- Contradicts [[OtherPage]] on: ...\n```\n\n### Domain-Specific Templates\n\nIf the source falls into a specific domain (e.g., personal diary, meeting notes), the agent should use a specialized template instead of the default generic one above:\n\n#### Diary / Journal Template\n```markdown\n---\ntitle: \"YYYY-MM-DD Diary\"\ntype: source\ntags: [diary]\ndate: YYYY-MM-DD\n---\n## Event Summary\n...\n## Key Decisions\n...\n## Energy & Mood\n...\n## Connections\n...\n## Shifts & Contradictions\n...\n```\n\n#### Meeting Notes Template\n```markdown\n---\ntitle: \"Meeting Title\"\ntype: source\ntags: [meeting]\ndate: YYYY-MM-DD\n---\n## Goal\n...\n## Key Discussions\n...\n## Decisions Made\n...\n## Action Items\n...\n```\n\n---\n\n## Query Workflow\n\nTriggered by: *\"query: <question>\"* or `/wiki-query`\n\nSteps:\n1. Read `wiki/index.md` to identify relevant pages\n2. Read those pages with the Read tool\n3. Synthesize an answer with inline citations as `[[PageName]]` wikilinks\n4. Ask the user if they want the answer filed as `wiki/syntheses/<slug>.md`\n\n---\n\n## Lint Workflow\n\nTriggered by: *\"lint the wiki\"* or `/wiki-lint`\n\nUse Grep and Read tools to check for:\n- **Orphan pages** — wiki pages with no inbound `[[links]]` from other pages\n- **Broken links** — `[[WikiLinks]]` pointing to pages that don't exist\n- **Contradictions** — claims that conflict across pages\n- **Stale summaries** — pages not updated after newer sources\n- **Missing entity pages** — entities mentioned in 3+ pages but lacking their own page\n- **Data gaps** — questions the wiki can't answer; suggest new sources\n\nOutput a lint report and ask if the user wants it saved to `wiki/lint-report.md`.\n\n---\n\n## Health Workflow\n\nTriggered by: *\"health\"* or `/wiki-health`\n\nRun: `python tools/health.py` (or `python tools/health.py --json` for machine-readable output)\n\nFast structural integrity checks — **zero LLM calls**, safe to run every session:\n- **Empty / stub files** — pages with no content beyond frontmatter (rate-limit damage)\n- **Index sync** — `wiki/index.md` entries vs actual files on disk\n- **Log coverage** — source pages missing a corresponding `ingest` entry in `wiki/log.md`\n\nOutput a health report. Use `--save` to write to `wiki/health-report.md`.\n\n### Health vs Lint Boundary\n\n| Dimension | `health` | `lint` |\n|---|---|---|\n| **Scope** | Structural integrity | Content quality |\n| **LLM calls** | Zero | Yes (semantic analysis) |\n| **Cost** | Free | Tokens |\n| **Frequency** | Every session, before other work | Every 10-15 ingests |\n| **Checks** | Empty files, index sync, log sync | Orphans, broken links, contradictions, gaps |\n| **Tool** | `tools/health.py` | `tools/lint.py` |\n| **Run order** | First (pre-flight) | After health passes |\n\n> Run `health` first — linting an empty file wastes tokens.\n\n---\n\n## Graph Workflow\n\nTriggered by: *\"build the knowledge graph\"* or `/wiki-graph`\n\nWhen the user asks to build the graph, run `tools/build_graph.py` which:\n- Pass 1: Parses all `[[wikilinks]]` → deterministic `EXTRACTED` edges\n- Pass 2: Infers implicit relationships → `INFERRED` edges with confidence scores\n- Runs Louvain community detection\n- Outputs `graph/graph.json` + `graph/graph.html`\n\nIf the user doesn't have Python/dependencies set up, instead generate the graph data manually:\n1. Use Grep to find all `[[wikilinks]]` across wiki pages\n2. Build a node/edge list\n3. Write `graph/graph.json` directly\n4. Write `graph/graph.html` using the vis.js template\n\n---\n\n## Naming Conventions\n\n- Source slugs: `kebab-case` matching source filename\n- Entity pages: `TitleCase.md` (e.g. `OpenAI.md`, `SamAltman.md`)\n- Concept pages: `TitleCase.md` (e.g. `ReinforcementLearning.md`, `RAG.md`)\n- Source pages: `kebab-case.md`\n\n## Index Format\n\n```markdown\n# Wiki Index\n\n## Overview\n- [Overview](overview.md) — living synthesis\n\n## Sources\n- [Source Title](sources/slug.md) — one-line summary\n\n## Entities\n- [Entity Name](entities/EntityName.md) — one-line description\n\n## Concepts\n- [Concept Name](concepts/ConceptName.md) — one-line description\n\n## Syntheses\n- [Analysis Title](syntheses/slug.md) — what question it answers\n```\n\n## Log Format\n\nEach entry starts with `## [YYYY-MM-DD] <operation> | <title>` so it's grep-parseable:\n\n```\ngrep \"^## \\[\" wiki/log.md | tail -10\n```\n\nOperations: `ingest`, `query`, `health`, `lint`, `graph`\n\n<!-- File: GEMINI.md (Tokens: ~1588 | Category: gemini-rule) -->\n# LLM Wiki Agent — Schema & Workflow Instructions\n\nThis wiki is maintained entirely by Gemini CLI. No API key or Python scripts needed — just open this repo with `gemini` and talk to it.\n\n## How to Use\n\nDescribe what you want in plain English:\n- *\"Ingest this file: raw/papers/my-paper.md\"*\n- *\"What does the wiki say about transformer models?\"*\n- *\"Check the wiki for orphan pages and contradictions\"*\n- *\"Build the knowledge graph\"*\n\nOr use shorthand triggers:\n- `ingest <file>` → runs the Ingest Workflow\n- `query: <question>` → runs the Query Workflow\n- `health` → runs the Health Workflow (fast, every session)\n- `lint` → runs the Lint Workflow (expensive, periodic)\n- `build graph` → runs the Graph Workflow\n\n---\n\n## Directory Layout\n\n```\nraw/          # Immutable source documents — never modify these\nwiki/         # Agent owns this layer entirely\n  index.md    # Catalog of all pages — update on every ingest\n  log.md      # Append-only chronological record\n  overview.md # Living synthesis across all sources\n  sources/    # One summary page per source document\n  entities/   # People, companies, projects, products\n  concepts/   # Ideas, frameworks, methods, theories\n  syntheses/  # Saved query answers\ngraph/        # Auto-generated graph data\ntools/        # Standalone Python scripts\n  health.py   # Structural checks (deterministic, no LLM calls)\n  lint.py     # Content quality checks (uses LLM for semantic analysis)\n  build_graph.py  # Knowledge graph generation\n```\n\n---\n\n## Page Format\n\nEvery wiki page uses this frontmatter:\n\n```yaml\n---\ntitle: \"Page Title\"\ntype: source | entity | concept | synthesis\ntags: []\nsources: []\nlast_updated: YYYY-MM-DD\n---\n```\n\nUse `[[PageName]]` wikilinks to link to other wiki pages.\n\n---\n\n## Ingest Workflow\n\nTriggered by: *\"ingest <file>\"*\n\n**Supported formats:** `.md` ingested directly. Non-markdown files (`.pdf`, `.docx`, `.pptx`, `.xlsx`, `.html`, `.txt`, `.csv`, `.json`, `.xml`, `.rst`, `.rtf`, `.epub`, `.ipynb`, `.yaml`, `.yml`, `.tsv`, `.wav`, `.mp3`) auto-converted via markitdown. Use `--no-convert` to skip.\n\n1. Read the source document fully (auto-convert if non-markdown)\n2. Read `wiki/index.md` and `wiki/overview.md` for current wiki context\n3. Write `wiki/sources/<slug>.md` (source page format below)\n4. Update `wiki/index.md` — add entry under Sources\n5. Update `wiki/overview.md` — revise synthesis if warranted\n6. Update/create entity and concept pages\n7. Flag contradictions with existing wiki content\n8. Append to `wiki/log.md`: `## [YYYY-MM-DD] ingest | <Title>`\n9. **Post-ingest validation** — check for broken `[[wikilinks]]`, verify all new pages are in `index.md`, print a change summary\n\n### Source Page Format\n\n```markdown\n---\ntitle: \"Source Title\"\ntype: source\ntags: []\ndate: YYYY-MM-DD\nsource_file: raw/...\n---\n\n## Summary\n2–4 sentence summary.\n\n## Key Claims\n- Claim 1\n\n## Key Quotes\n> \"Quote here\"\n\n## Connections\n- [[EntityName]] — how they relate\n\n## Contradictions\n- Contradicts [[OtherPage]] on: ...\n```\n\n### Domain-Specific Templates\n\nIf the source falls into a specific domain (e.g., personal diary, meeting notes), the agent should use a specialized template instead of the default generic one above:\n\n#### Diary / Journal Template\n```markdown\n---\ntitle: \"YYYY-MM-DD Diary\"\ntype: source\ntags: [diary]\ndate: YYYY-MM-DD\n---\n## Event Summary\n...\n## Key Decisions\n...\n## Energy & Mood\n...\n## Connections\n...\n## Shifts & Contradictions\n...\n```\n\n#### Meeting Notes Template\n```markdown\n---\ntitle: \"Meeting Title\"\ntype: source\ntags: [meeting]\ndate: YYYY-MM-DD\n---\n## Goal\n...\n## Key Discussions\n...\n## Decisions Made\n...\n## Action Items\n...\n```\n\n---\n\n## Query Workflow\n\nTriggered by: *\"query: <question>\"*\n\n1. Read `wiki/index.md` — identify relevant pages\n2. Read those pages\n3. Synthesize answer with `[[PageName]]` citations\n4. Offer to save as `wiki/syntheses/<slug>.md`\n\n---\n\n## Lint Workflow\n\nTriggered by: *\"lint\"*\n\nCheck for: orphan pages, broken links, contradictions, stale content, missing entity pages, sparse pages (< 2 outbound links), data gaps.\n\nGraph-aware checks (require `graph.json`): hub stubs, fragile bridges, isolated communities.\n\n---\n\n## Health Workflow\n\nTriggered by: *\"health\"*\n\nRun: `python tools/health.py` (or `python tools/health.py --json` for machine-readable output)\n\nFast structural integrity checks — **zero LLM calls**, safe to run every session:\n- **Empty / stub files** — pages with no content beyond frontmatter (rate-limit damage)\n- **Index sync** — `wiki/index.md` entries vs actual files on disk\n- **Log coverage** — source pages missing a corresponding `ingest` entry in `wiki/log.md`\n\nOutput a health report. Use `--save` to write to `wiki/health-report.md`.\n\n### Health vs Lint Boundary\n\n| Dimension | `health` | `lint` |\n|---|---|---|\n| **Scope** | Structural integrity | Content quality |\n| **LLM calls** | Zero | Yes (semantic analysis) |\n| **Cost** | Free | Tokens |\n| **Frequency** | Every session, before other work | Every 10-15 ingests |\n| **Checks** | Empty files, index sync, log sync | Orphans, broken links, contradictions, gaps |\n| **Tool** | `tools/health.py` | `tools/lint.py` |\n| **Run order** | First (pre-flight) | After health passes |\n\n> Run `health` first — linting an empty file wastes tokens.\n\n---\n\n## Graph Workflow\n\nTriggered by: *\"build graph\"*\n\nTry `python tools/build_graph.py --open` first. If unavailable, build graph.json and graph.html manually from wikilinks.\n\n---\n\n## Naming Conventions\n\n- Source slugs: `kebab-case`\n- Entity/Concept pages: `TitleCase.md`\n\n## Log Format\n\n`## [YYYY-MM-DD] <operation> | <title>`\n\nOperations: `ingest`, `query`, `lint`, `graph`, `report`\n\n---\n\n## Graph Health Report\n\nTriggered by: *\"graph report\"* or `python tools/build_graph.py --report`\n\nCovers: health summary, orphan nodes, god nodes, fragile bridges, phantom hubs. Use `--save` to persist.\n\n---\n\n## Phase 3 Design Constraints (Auto-Linking — Open)\n\n- Auto-linked edges start as `DRAFT`, require promotion gate validation\n- Link density budget: ≥2 outbound wikilinks before promotion\n- HG-WA-01: Graph layer MUST NOT auto-create pages from broken links\n- HG-WA-02: New commands MUST NOT duplicate existing command coverage\n\n<!-- File: .claude/commands/wiki-graph.md (Tokens: ~232 | Category: command-prompt) -->\nBuild the LLM Wiki knowledge graph.\n\nUsage: /wiki-graph\n\nFirst try running: python tools/build_graph.py --open\n\nIf that fails (missing dependencies), build the graph manually:\n\n1. Use Grep to find all [[wikilinks]] across every file in wiki/\n2. Build a nodes list: one node per wiki page, with id=relative-path, label=title, type from frontmatter\n3. Build an edges list: one edge per [[wikilink]], tagged EXTRACTED\n4. Infer additional implicit relationships between pages not captured by wikilinks — tag these INFERRED with a confidence score (0.0–1.0); tag low-confidence ones AMBIGUOUS\n5. Write graph/graph.json with {nodes, edges, built: today}\n6. Write graph/graph.html as a self-contained vis.js page (nodes colored by type, edges colored by type, interactive, searchable)\n\nAfter building, summarize: node count, edge count, breakdown by type, and the most connected nodes (hubs).\n\nAppend to wiki/log.md: ## [today's date] graph | Knowledge graph rebuilt\n\n<!-- File: .claude/commands/wiki-ingest.md (Tokens: ~218 | Category: command-prompt) -->\nIngest a source document into the LLM Wiki.\n\nUsage: /wiki-ingest $ARGUMENTS\n\n$ARGUMENTS should be the path to a file in raw/, e.g. `raw/articles/my-article.md`\n\nFollow the Ingest Workflow defined in CLAUDE.md exactly:\n1. Read the source file at the given path\n2. Read wiki/index.md and wiki/overview.md for current context\n3. Write wiki/sources/<slug>.md (source page format per CLAUDE.md)\n4. Update wiki/index.md — add the new entry under Sources\n5. Update wiki/overview.md — revise synthesis if warranted\n6. Create/update entity pages (wiki/entities/) for key people, companies, projects\n7. Create/update concept pages (wiki/concepts/) for key ideas and frameworks\n8. Flag any contradictions with existing wiki content\n9. Append to wiki/log.md: ## [today's date] ingest | <Title>\n\nAfter completing all writes, summarize: what was added, which pages were created or updated, and any contradictions found.\n\n<!-- File: .claude/commands/wiki-lint.md (Tokens: ~195 | Category: command-prompt) -->\nHealth-check the LLM Wiki for issues.\n\nUsage: /wiki-lint\n\nFollow the Lint Workflow defined in CLAUDE.md:\n\nStructural checks (use Grep and Glob tools):\n1. Orphan pages — wiki pages with no inbound [[wikilinks]] from other pages\n2. Broken links — [[WikiLinks]] pointing to pages that don't exist\n3. Missing entity pages — names referenced in 3+ pages but lacking their own page\n\nSemantic checks (read and reason over page content):\n4. Contradictions — claims that conflict between pages\n5. Stale summaries — pages not updated after newer sources changed the picture\n6. Data gaps — important questions the wiki can't answer; suggest specific sources to find\n\nOutput a structured markdown lint report. At the end, ask if the user wants it saved to wiki/lint-report.md.\n\nAppend to wiki/log.md: ## [today's date] lint | Wiki health check\n\n<!-- File: .claude/commands/wiki-query.md (Tokens: ~154 | Category: command-prompt) -->\nQuery the LLM Wiki and synthesize an answer.\n\nUsage: /wiki-query $ARGUMENTS\n\n$ARGUMENTS is the question to answer, e.g. `What are the main themes across all sources?`\n\nFollow the Query Workflow defined in CLAUDE.md:\n1. Read wiki/index.md to identify the most relevant pages\n2. Read those pages (up to ~10 most relevant)\n3. Synthesize a thorough markdown answer with [[PageName]] wikilink citations\n4. Include a ## Sources section at the end listing pages you drew from\n5. Ask the user if they want the answer saved as wiki/syntheses/<slug>.md\n\nIf the wiki is empty, say so and suggest running /wiki-ingest first.\n</yakaai_skills>"}