From e85963af55e1bef2191aeba1a31f6da582752d9d Mon Sep 17 00:00:00 2001 From: portersky <24420859+portersky@users.noreply.github.com> Date: Sun, 24 May 2026 22:24:12 +0200 Subject: [PATCH] Initial commit Wiki template inspired by Andrej Karpathy's llmwiki gist. Includes agent instructions (AGENTS.md), empty wiki scaffold (wiki/index.md, wiki/log.md), editor config, gitignore, and README documenting the ingest/query/lint workflow. --- .editorconfig | 6 +++ .gitignore | 20 +++++++ AGENTS.md | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++ CLAUDE.md | 1 + README.md | 49 +++++++++++++++++ wiki/index.md | 23 ++++++++ wiki/log.md | 5 ++ 7 files changed, 246 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 AGENTS.md create mode 100644 CLAUDE.md create mode 100644 README.md create mode 100644 wiki/index.md create mode 100644 wiki/log.md diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..5f5d25b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +[*] +end_of_line = lf +charset = utf-8 +indent_style = space +indent_size = 2 +insert_final_newline = true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..96616dc --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# OS +.DS_Store +.AppleDouble +.LSOverride + +# Editors +.vscode/ +.idea/ +.zed/ + +# AI agent harnesses +.claude/ + +# Raw assets (large binaries — keep locally, not in git) +raw/assets/*.pdf +raw/assets/*.png +raw/assets/*.jpg +raw/assets/*.jpeg +raw/assets/*.gif +raw/assets/*.webp diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..2caec16 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,142 @@ +# LLM Wiki — Agent Instructions + +You are a wiki maintainer. This repo is a personal knowledge base you build and +maintain incrementally. You never modify files in `raw/`. You own everything in +`wiki/`. + +## Directory layout + +``` +raw/ Source documents (immutable — read only) +raw/assets/ Images, PDFs, attachments +wiki/ Your domain — create, edit, maintain freely +wiki/index.md Catalog of all wiki pages (you maintain this) +wiki/log.md Append-only operation log (you maintain this) +``` + +## Page schema + +Every wiki page must have YAML frontmatter: + +```yaml +--- +type: concept | entity | source | synthesis | comparison +title: "" +tags: [] +sources: [] # filenames from raw/ that support this page +related: [] # wiki page filenames this page links to +updated: YYYY-MM-DD +confidence: high | medium | low +--- +``` + +For `updated`, always use a tool to get the current date - never hardcode or +guess it. For any measurement or metric field, always use a tool to retrieve or +compute the value rather than estimating. + +Follow the frontmatter with a one-paragraph summary, then the body. + +## Operations + +### ingest \ + +1. Read the source file in `raw/`. +2. Discuss key takeaways with the user. +3. Write `wiki/src-.md` (type: source) summarizing the source. +4. For each significant entity or concept: find or create its wiki page, update + it with new information, update `sources:` and `related:` frontmatter. +5. Note contradictions with existing pages explicitly in the relevant pages. +6. Update `wiki/index.md` — add new pages, update summaries of changed pages. +7. Append to `wiki/log.md`: + ``` + ## [YYYY-MM-DD] ingest | + Pages created: ... + Pages updated: ... + ``` + +### query \ + +1. Read `wiki/index.md` to identify relevant pages. +2. Read those pages. +3. Synthesize an answer with citations linking to wiki pages. +4. Ask the user: "File this as a new wiki page?" If yes, write it as type: + synthesis and update the index. +5. Append to `wiki/log.md`: + ``` + ## [YYYY-MM-DD] query | + Pages read: ... + Filed: yes/no + ``` + +### lint + +1. Read all pages in `wiki/`. +2. Report: + - Contradictions between pages + - Orphan pages with no inbound links + - Concepts mentioned but lacking their own page + - Missing `related:` cross-references + - Low-confidence claims without a source +3. For each issue, propose a fix. Apply fixes the user approves. +4. Append to `wiki/log.md`: + ``` + ## [YYYY-MM-DD] lint + Issues found: ... + Fixed: ... + ``` + +## Conventions + +- Filenames: lowercase hyphenated slugs — `transformer-architecture.md` +- Source summaries: prefix `src-` — `src-attention-is-all-you-need.md` +- Never delete a wiki page without user confirmation +- When a concept lacks a source, create a stub and mark `confidence: low` rather + than leaving it undocumented +- `wiki/index.md` is sorted by type, then alphabetically within each type +- `wiki/log.md` entries start with `## [YYYY-MM-DD]` so they are grep-parseable + +## Shell Scripts + +- Always use `#!/bin/sh` shebang for shell scripts +- Scripts must be POSIX compliant (no bashisms) +- When providing commands to users: + - Windows/PowerShell: use `` ` `` for line continuation + - Unix/Linux/macOS: use `\` for line continuation + +## Commit Messages + +- Follow the 50/72 rule: + - Subject line: max 50 characters + - Body lines: wrapped at 72 characters +- Use conventional commit prefixes (`feat:`, `fix:`, `docs:`, `chore:`, `ci:`, + etc.) +- Separate subject from body with a blank line +- Do **not** add yourself as a co-author (`Co-Authored-By:` trailers are + forbidden) + +Example: + +``` +feat: add stopwatch timer + +Replace Hello World with a live stopwatch that prints elapsed time +in HH:MM:SS.mmm format, updating every 10ms with color output. +``` + +## Documentation (Markdown) + +- Wrap normal text and lists at **max 80 columns** (for readability in + terminals and editors). +- **Exceptions**: Tables and code blocks can exceed 80 columns when + formatting requires it (e.g. trees, alignment). +- Use standard Markdown: `**bold**`, `` `inline code` ``, `##` headings, + `-` or numbered lists, fenced code blocks with language hints + (` ```c `, ` ```sh `). +- Keep examples concise, up-to-date, and self-documenting. +- Do not use em dashes (`--`). Use a colon or rewrite the sentence. +- Each shell command gets its own fenced code block; do **not** combine + multiple commands into one block. Precede each block with a short + plain-text label describing what the command does. +- README.md: hardware wiring, pin assignments, build instructions. + Keep it up to date when changing peripheral assignments. +- This file (`AGENTS.md`) follows its own rules. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..15e7940 --- /dev/null +++ b/README.md @@ -0,0 +1,49 @@ +# llmwiki + +> Inspired by [Andrej Karpathy's llmwiki gist](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f). + +A personal knowledge base built and maintained by an AI agent (Claude Code). +Drop source documents into `raw/`, then tell the agent to ingest, query, or +lint. The agent owns everything under `wiki/`; you own everything under `raw/`. + +## How it works + +The agent follows the operations defined in `AGENTS.md`: + +- **ingest ``**: summarize a raw document, create or update concept and + entity pages, cross-link related pages, update the index. +- **query ``**: answer a question from the wiki, optionally filing + the answer as a new synthesis page. +- **lint**: find contradictions, orphan pages, missing cross-references, and + low-confidence unsourced claims. + +## Directory layout + +``` +raw/ Source documents (immutable — drop files here) +raw/assets/ Images, PDFs, attachments +wiki/ Agent-maintained knowledge base +wiki/index.md Catalog of all wiki pages +wiki/log.md Append-only operation log +AGENTS.md Agent instructions and page schema +``` + +## Getting started + +1. Clone this repo as your wiki template. +2. Add source documents to `raw/`. +3. Open Claude Code or the pi CLI and run: + + ``` + ingest + ``` + +## Page types + +| Type | Description | +|--------------|--------------------------------------------------| +| `concept` | An idea, technique, or term | +| `entity` | A person, model, paper, project, or organization | +| `source` | Summary of a raw document (`src-` prefix) | +| `synthesis` | Answer to a query, filed for future reference | +| `comparison` | Side-by-side analysis of two or more entities | diff --git a/wiki/index.md b/wiki/index.md new file mode 100644 index 0000000..a3f2ad3 --- /dev/null +++ b/wiki/index.md @@ -0,0 +1,23 @@ +# Wiki Index + +_Maintained by agent. Updated on every ingest, query (if filed), and lint._ + +## Sources + +_(none yet)_ + +## Concepts + +_(none yet)_ + +## Entities + +_(none yet)_ + +## Syntheses + +_(none yet)_ + +## Comparisons + +_(none yet)_ diff --git a/wiki/log.md b/wiki/log.md new file mode 100644 index 0000000..3656429 --- /dev/null +++ b/wiki/log.md @@ -0,0 +1,5 @@ +# Wiki Log + +_Append-only. One entry per operation._ +_Format: `## [YYYY-MM-DD] | `_ +_Grep tip: `grep "^## \[" wiki/log.md | tail -10`_