repo-nexus 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -4
- package/package.json +1 -1
- package/rnex +11 -0
- package/toolkit/plugins/karpathy-llm/README.md +118 -13
- package/toolkit/plugins/karpathy-llm/plugin.yaml +10 -2
- package/toolkit/plugins/karpathy-llm/rules/KARPATHY_RULES.md +33 -6
- package/toolkit/plugins/karpathy-llm/scripts/wiki-lint-trigger.sh +29 -0
- package/toolkit/plugins/karpathy-llm/templates/_log.md +9 -0
- package/toolkit/plugins/karpathy-llm/templates/hot.md +11 -0
- package/toolkit/plugins/karpathy-llm/templates/index.md +28 -0
- package/toolkit/plugins/karpathy-llm/templates/raw.gitkeep +1 -0
- package/toolkit/plugins/karpathy-llm/templates/wiki-page.sample.md +24 -0
- package/toolkit/plugins/karpathy-llm/workflows/wiki-ingest.md +60 -0
- package/toolkit/plugins/karpathy-llm/workflows/wiki-lint.md +47 -0
- package/toolkit/prompts/setup-karpathy-wiki.md +178 -0
package/README.md
CHANGED
|
@@ -19,6 +19,26 @@ A **simple, lightweight companion tool** for multi-repo workflows. It links mult
|
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
+
## Table of Contents
|
|
23
|
+
|
|
24
|
+
- [What Repo Nexus Is (and What It Isn't)](#what-repo-nexus-is-and-what-it-isnt)
|
|
25
|
+
- [How It Works: The Two Symlink Flows](#how-it-works-the-two-symlink-flows)
|
|
26
|
+
- [Key Principles](#key-principles)
|
|
27
|
+
- [Installation](#installation)
|
|
28
|
+
- [Quick Start](#quick-start)
|
|
29
|
+
- [Everyday Usage](#everyday-usage)
|
|
30
|
+
- [Plugins & AI Context Packs](#plugins--ai-context-packs)
|
|
31
|
+
- [Workspace Configuration (`rnex.yaml`)](#workspace-configuration-rnexyaml)
|
|
32
|
+
- [CLI Command Reference](#cli-command-reference)
|
|
33
|
+
- [Operating on External Workspaces via `--config`](#operating-on-external-workspaces-via---config)
|
|
34
|
+
- [Supported AI Configuration Files](#supported-ai-configuration-files)
|
|
35
|
+
- [Project Structure](#project-structure)
|
|
36
|
+
- [Running Tests](#running-tests)
|
|
37
|
+
- [Frequently Asked Questions (FAQ)](docs/FAQ.md)
|
|
38
|
+
- [License](#license)
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
22
42
|
## What Repo Nexus Is (and What It Isn't)
|
|
23
43
|
|
|
24
44
|
| What It Is | What It Isn't |
|
|
@@ -180,14 +200,24 @@ rnex plugin disable karpathy-llm
|
|
|
180
200
|
```
|
|
181
201
|
|
|
182
202
|
### Built-in Plugin: `karpathy-llm`
|
|
183
|
-
The `karpathy-llm` plugin packages Andrej Karpathy's verified LLM agent design patterns
|
|
203
|
+
The `karpathy-llm` plugin packages Andrej Karpathy's verified LLM agent design patterns, context engineering principles, and the autonomous **Karpathy LLM Wiki** architecture (based on [`setup-karpathy-wiki.md`](https://github.com/nu-nenoi/ai-toolkit/blob/main/prompts/setup-karpathy-wiki.md), available locally in `toolkit/prompts/setup-karpathy-wiki.md`):
|
|
204
|
+
* **Step 0 — Configuration Interview:** Guides setup decisions including target agent instruction file (`AGENTS.md`, `CLAUDE.md`, `.cursor/rules/wiki.mdc`, etc.), wiki purpose (codebase, second brain, research, content archive), organization layout (flat vs structured), and automation enablement.
|
|
184
205
|
* **The 4 Cardinal Agent Rules** (`.agents/rules/KARPATHY_RULES.md`):
|
|
185
206
|
1. *Think Before Coding:* Formulate explicit assumptions, boundary checks, and trade-offs before writing code.
|
|
186
207
|
2. *Simplicity First:* Minimal abstractions, readable implementations, zero speculative boilerplate.
|
|
187
208
|
3. *Surgical Changes:* Minimal blast radius, preserved comments/docstrings, and tight diffs.
|
|
188
209
|
4. *Goal-Driven Execution:* Upfront verification criteria, automated tests, and diff inspection.
|
|
189
|
-
* **
|
|
190
|
-
* **
|
|
210
|
+
* **Autonomous Karpathy LLM Wiki Knowledge Architecture:**
|
|
211
|
+
* **Intake (`/raw/`):** Append-only intake for unmodified source documents.
|
|
212
|
+
* **Curated Knowledge Base (`/wiki/`):** Interlinked atomic markdown pages with typed YAML frontmatter relations (`sources`, `related`, `extends`, `contradicts`, `mentioned_in`).
|
|
213
|
+
* **Control Index (`/wiki/index.md`):** Master navigation index with `lint_trigger: enabled|disabled` toggle.
|
|
214
|
+
* **Rolling Context (`/wiki/hot.md`):** ~500-word quick-orient context cache for AI agents.
|
|
215
|
+
* **Operation Log (`/wiki/_log.md`):** Append-only audit trail of ingest and lint operations.
|
|
216
|
+
* **Session Counter (`/wiki/.lint_trigger_counter`):** Machine-local state tracking session activity (gitignored).
|
|
217
|
+
* **Autonomous Lint Trigger (`scripts/wiki-lint-trigger.sh`):** Session counter and maintenance alerts on session 1 and every 15 sessions.
|
|
218
|
+
* **Standardized Workflows (`.agent/workflows/`):**
|
|
219
|
+
* `wiki-ingest.md`: 8-step protocol decomposing raw source documents into 5–25 atomic wiki pages.
|
|
220
|
+
* `wiki-lint.md`: 10-step protocol validating paths, recomputing `mentioned_in`, removing orphans, resolving contradictions, identifying gaps, suggesting source candidates, and rebuilding indexes.
|
|
191
221
|
|
|
192
222
|
---
|
|
193
223
|
|
|
@@ -307,7 +337,7 @@ repo-nexus/
|
|
|
307
337
|
│ ├── workflows/ci.yml # GitHub Actions CI workflow
|
|
308
338
|
│ └── ISSUE_TEMPLATE/ # Bug report and feature request templates
|
|
309
339
|
├── tests/
|
|
310
|
-
│ └── test_cli.sh # Automated CLI test suite (
|
|
340
|
+
│ └── test_cli.sh # Automated CLI test suite (21 tests)
|
|
311
341
|
├── toolkit/ # Shared prompts, scripts, templates
|
|
312
342
|
├── package.json # npm package manifest
|
|
313
343
|
├── LICENSE # MIT License
|
package/package.json
CHANGED
package/rnex
CHANGED
|
@@ -595,6 +595,7 @@ sync_plugins() {
|
|
|
595
595
|
if [ -f "$_src_path" ] && [ ! -f "$_dest_path" ]; then
|
|
596
596
|
mkdir -p "$(dirname "$_dest_path")"
|
|
597
597
|
cp "$_src_path" "$_dest_path"
|
|
598
|
+
[ -x "$_src_path" ] && chmod +x "$_dest_path" 2>/dev/null || true
|
|
598
599
|
log_ok "Initialized template: $_d"
|
|
599
600
|
fi
|
|
600
601
|
done
|
|
@@ -1096,10 +1097,20 @@ cmd_plugin_enable() {
|
|
|
1096
1097
|
if [ -f "$_src_path" ] && [ ! -f "$_dest_path" ]; then
|
|
1097
1098
|
mkdir -p "$(dirname "$_dest_path")"
|
|
1098
1099
|
cp "$_src_path" "$_dest_path"
|
|
1100
|
+
[ -x "$_src_path" ] && chmod +x "$_dest_path" 2>/dev/null || true
|
|
1099
1101
|
log_ok "Initialized template: $_d"
|
|
1100
1102
|
fi
|
|
1101
1103
|
done
|
|
1102
1104
|
|
|
1105
|
+
# Ensure machine-local state files (like wiki/.lint_trigger_counter) are gitignored
|
|
1106
|
+
_gi="$NEXUS_DIR/.gitignore"
|
|
1107
|
+
if [ -f "$NEXUS_DIR/scripts/wiki-lint-trigger.sh" ]; then
|
|
1108
|
+
if [ ! -f "$_gi" ] || ! grep -qF "wiki/.lint_trigger_counter" "$_gi" 2>/dev/null; then
|
|
1109
|
+
printf '\n# Karpathy LLM Wiki session counter\nwiki/.lint_trigger_counter\n.lint_trigger_counter\n' >> "$_gi"
|
|
1110
|
+
log_dim "Added 'wiki/.lint_trigger_counter' to .gitignore"
|
|
1111
|
+
fi
|
|
1112
|
+
fi
|
|
1113
|
+
|
|
1103
1114
|
cmd_sync
|
|
1104
1115
|
log_ok "Plugin '$_name' active across all member repositories"
|
|
1105
1116
|
}
|
|
@@ -1,47 +1,152 @@
|
|
|
1
1
|
# Karpathy LLM Plugin for Repo Nexus
|
|
2
2
|
|
|
3
|
-
The **`karpathy-llm`** plugin packages Andrej Karpathy's
|
|
3
|
+
The **`karpathy-llm`** plugin packages Andrej Karpathy's agent behavioral principles, multi-repo context engineering standards, and the autonomous **Karpathy LLM Wiki** knowledge architecture for AI coding assistants (Cursor, Claude Code, GitHub Copilot, Antigravity, Windsurf).
|
|
4
|
+
|
|
5
|
+
No external vector databases, embedding pipelines, or MCP servers required — just interlinked markdown files with structured YAML frontmatter traversed natively by AI agents.
|
|
6
|
+
|
|
7
|
+
Reference specification: [setup-karpathy-wiki.md](https://github.com/nu-nenoi/ai-toolkit/blob/main/prompts/setup-karpathy-wiki.md) (also available locally in [`toolkit/prompts/setup-karpathy-wiki.md`](../../prompts/setup-karpathy-wiki.md)).
|
|
4
8
|
|
|
5
9
|
---
|
|
6
10
|
|
|
7
11
|
## What It Provides
|
|
8
12
|
|
|
9
|
-
1.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
### 1. The 4 Cardinal Principles for Coding Agents (`rules/KARPATHY_RULES.md`)
|
|
14
|
+
* **Think Before Coding:** Explicit assumptions, problem formulation, and trade-off evaluation before writing code.
|
|
15
|
+
* **Simplicity First:** Minimal abstractions, readable implementations, and zero boilerplate bloat.
|
|
16
|
+
* **Surgical Changes:** Minimal blast radius, preserved comments/docstrings, and tightly focused diffs.
|
|
17
|
+
* **Goal-Driven Execution:** Upfront verification criteria, automated tests, and rigorous diff review.
|
|
18
|
+
|
|
19
|
+
### 2. Multi-Repo Context Engineering & Autonomy
|
|
20
|
+
* Guidelines tailored for Repo Nexus workspaces respecting member repository autonomy and symlink write-through semantics.
|
|
21
|
+
|
|
22
|
+
### 3. Complete Karpathy LLM Wiki Architecture
|
|
23
|
+
* **`/raw/` Intake Directory:** Append-only directory where unmodified source material (articles, transcripts, docs, meeting notes) is deposited. Includes `.gitkeep`.
|
|
24
|
+
* **`/wiki/` Curated Knowledge Base:** Interlinked atomic markdown pages, each with typed frontmatter relations (`sources`, `related`, `extends`, `contradicts`, `mentioned_in`).
|
|
25
|
+
* **`/wiki/index.md` Control & Navigation Index:** Master categorized catalog containing `lint_trigger: enabled|disabled` to control autonomous maintenance.
|
|
26
|
+
* **`/wiki/hot.md` Rolling Context Cache:** High-density ~500-word orientation summary for rapid agent onboarding without full wiki scans (especially for codebase knowledge and second-brain wikis).
|
|
27
|
+
* **`/wiki/_log.md` Audit Trail:** Append-only log recording every ingest and lint operation with timestamped details.
|
|
28
|
+
* **`/wiki/.lint_trigger_counter` Session Counter:** Machine-local state tracking session activity (ignored in `.gitignore`).
|
|
29
|
+
|
|
30
|
+
### 4. Autonomous Lint Trigger Script (`scripts/wiki-lint-trigger.sh`)
|
|
31
|
+
* Lightweight POSIX script checking `lint_trigger: enabled` and incrementing `wiki/.lint_trigger_counter`.
|
|
32
|
+
* Alerts agents with `[WIKI MAINTENANCE DUE]: Pending /raw/ files or wiki health checks detected. Run wiki-lint.` on session 1 and every 15 sessions.
|
|
33
|
+
|
|
34
|
+
### 5. Standardized Agent Workflows (`workflows/`)
|
|
35
|
+
* **`wiki-ingest.md` (8 Steps):** Decomposes raw source documents into 5–25 atomic wiki pages with frontmatter relations.
|
|
36
|
+
* **`wiki-lint.md` (10 Steps):** Integrity audit protocol to validate paths, recompute `mentioned_in`, eliminate orphans, merge duplicates, audit inconsistencies, identify gaps, suggest source candidates, and rebuild indexes.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Step 0 — Configuration Interview
|
|
41
|
+
|
|
42
|
+
When an AI agent or developer sets up the Karpathy LLM Wiki in a repository or workspace, consult the Step 0 configuration questions:
|
|
43
|
+
|
|
44
|
+
1. **[Q1] Which AI agent instruction file should the wiki rules be written to?**
|
|
45
|
+
- `AGENTS.md` (universal, works across most harnesses)
|
|
46
|
+
- `CLAUDE.md` (Claude Code / Anthropic)
|
|
47
|
+
- `.cursor/rules/wiki.mdc` (Cursor)
|
|
48
|
+
- `.github/copilot-instructions.md` (GitHub Copilot)
|
|
49
|
+
- `GEMINI.md` (Google Gemini / Antigravity)
|
|
50
|
+
- `.windsurfrules` (Windsurf)
|
|
51
|
+
- Other — specify path
|
|
52
|
+
|
|
53
|
+
*Append the `## Karpathy Wiki Rules` section to that file while preserving all existing content.*
|
|
14
54
|
|
|
15
|
-
2. **
|
|
16
|
-
|
|
55
|
+
2. **[Q2] What is this wiki for?**
|
|
56
|
+
- Research / reading list — articles, papers, PDFs on a topic
|
|
57
|
+
- Personal second brain — meetings, notes, business context, personal projects
|
|
58
|
+
- Content archive — transcripts, podcast notes, newsletters
|
|
59
|
+
- Codebase knowledge — architecture decisions, runbooks, team conventions
|
|
60
|
+
- Other (describe briefly)
|
|
17
61
|
|
|
18
|
-
3. **
|
|
19
|
-
|
|
62
|
+
3. **[Q3] How should the wiki be organized?**
|
|
63
|
+
- **Flat** — all pages at the top level of `/wiki/` (simpler, good default)
|
|
64
|
+
- **Structured** — subfolders by category, chosen based on Q2:
|
|
65
|
+
- Research → `concepts/`, `people/`, `organizations/`, `sources/`, `analysis/`
|
|
66
|
+
- Second brain → `projects/`, `people/`, `decisions/`, `logs/`
|
|
67
|
+
- Content archive → `sources/`, `people/`, `tools/`, `concepts/`
|
|
68
|
+
- Codebase → `architecture/`, `decisions/`, `runbooks/`, `people/`
|
|
69
|
+
- **Agent decides** — infer structure from the first batch of ingested content
|
|
70
|
+
|
|
71
|
+
4. **[Q4] Enable wiki automation now?**
|
|
72
|
+
- **Yes** — set `lint_trigger: enabled` in `/wiki/index.md` frontmatter
|
|
73
|
+
- **No** — set `lint_trigger: disabled` (can be changed anytime)
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Directory Layout Scaffolding
|
|
78
|
+
|
|
79
|
+
When enabled, the plugin scaffolds:
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
my-workspace/
|
|
83
|
+
├── raw/
|
|
84
|
+
│ └── .gitkeep # Intake for unmodified source documents
|
|
85
|
+
├── wiki/
|
|
86
|
+
│ ├── index.md # Master catalog + lint_trigger toggle
|
|
87
|
+
│ ├── hot.md # Rolling ~500-word quick-orient context
|
|
88
|
+
│ ├── _log.md # Ingestion & lint audit history
|
|
89
|
+
│ └── .lint_trigger_counter # Session counter (gitignored)
|
|
90
|
+
├── scripts/
|
|
91
|
+
│ └── wiki-lint-trigger.sh # Executable session counter & lint alert
|
|
92
|
+
├── .agents/rules/
|
|
93
|
+
│ └── KARPATHY_RULES.md # Cardinal principles & wiki rules (auto-symlinked)
|
|
94
|
+
├── .agent/workflows/
|
|
95
|
+
│ ├── wiki-ingest.md # 8-step decomposition & ingestion workflow
|
|
96
|
+
│ └── wiki-lint.md # 10-step graph validation & maintenance workflow
|
|
97
|
+
└── docs/
|
|
98
|
+
├── wiki-page.template.md # Atomic page template with typed relations
|
|
99
|
+
└── LLM_WIKI.sample.md # Sample wiki walkthrough
|
|
100
|
+
```
|
|
20
101
|
|
|
21
102
|
---
|
|
22
103
|
|
|
23
104
|
## Enabling in Repo Nexus
|
|
24
105
|
|
|
25
106
|
### Option 1: Via CLI (Recommended)
|
|
107
|
+
|
|
26
108
|
```bash
|
|
27
109
|
rnex plugin enable karpathy-llm
|
|
28
110
|
```
|
|
29
111
|
|
|
112
|
+
This command:
|
|
113
|
+
1. Adds `karpathy-llm` to `plugins:` in `rnex.yaml`.
|
|
114
|
+
2. Copies initial templates (`wiki/index.md`, `wiki/_log.md`, `wiki/hot.md`, `raw/.gitkeep`, `docs/wiki-page.template.md`, `docs/LLM_WIKI.sample.md`, `scripts/wiki-lint-trigger.sh`).
|
|
115
|
+
3. Links `KARPATHY_RULES.md` and workflows into workspace root (`.agents/rules/`, `.agent/workflows/`).
|
|
116
|
+
4. Ensures `wiki/.lint_trigger_counter` is added to `.gitignore`.
|
|
117
|
+
5. Syncs scope links and AI context files across all registered member repositories via `rnex sync`.
|
|
118
|
+
|
|
30
119
|
### Option 2: Declarative in `rnex.yaml`
|
|
31
|
-
|
|
120
|
+
|
|
121
|
+
Add `karpathy-llm` to `plugins:` in `rnex.yaml`:
|
|
122
|
+
|
|
32
123
|
```yaml
|
|
33
124
|
plugins:
|
|
34
125
|
- karpathy-llm
|
|
35
126
|
```
|
|
36
|
-
|
|
127
|
+
|
|
128
|
+
Then synchronize:
|
|
129
|
+
|
|
37
130
|
```bash
|
|
38
131
|
rnex sync
|
|
39
132
|
```
|
|
40
133
|
|
|
41
134
|
---
|
|
42
135
|
|
|
136
|
+
## Everyday Operation & Cadence
|
|
137
|
+
|
|
138
|
+
1. **Intake:** Drop raw research papers, meeting notes, PRDs, or architecture specs into `/raw/` unmodified.
|
|
139
|
+
2. **Ingest:** Instruct your AI assistant: *"Run wiki-ingest on raw/source-document.md"*.
|
|
140
|
+
3. **Session Cadence:** After sessions where repository files were edited, run `scripts/wiki-lint-trigger.sh`.
|
|
141
|
+
4. **Maintenance:** If prompted by `[WIKI MAINTENANCE DUE]`, instruct the assistant: *"Run wiki-lint"*.
|
|
142
|
+
5. **Toggle Automation:** Edit `lint_trigger: enabled` or `lint_trigger: disabled` in `/wiki/index.md` anytime.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
43
146
|
## Disabling
|
|
147
|
+
|
|
44
148
|
```bash
|
|
45
149
|
rnex plugin disable karpathy-llm
|
|
46
150
|
```
|
|
47
|
-
|
|
151
|
+
|
|
152
|
+
Safely unlinks plugin assets from member repositories and removes the entry from `rnex.yaml`. Your curated `/wiki/` and `/raw/` data remain completely untouched on disk.
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
name: karpathy-llm
|
|
2
|
-
version: 0.
|
|
3
|
-
description: Andrej Karpathy's agent behavioral principles, context engineering guidelines, and LLM Wiki
|
|
2
|
+
version: 0.3.0
|
|
3
|
+
description: Andrej Karpathy's agent behavioral principles, context engineering guidelines, and autonomous LLM Wiki knowledge architecture
|
|
4
4
|
author: nu-nenoi
|
|
5
5
|
homepage: https://github.com/nu-nenoi/repo-nexus
|
|
6
6
|
ai_files:
|
|
7
7
|
- rules/KARPATHY_RULES.md: .agents/rules/KARPATHY_RULES.md
|
|
8
|
+
- workflows/wiki-ingest.md: .agent/workflows/wiki-ingest.md
|
|
9
|
+
- workflows/wiki-lint.md: .agent/workflows/wiki-lint.md
|
|
8
10
|
templates:
|
|
11
|
+
- templates/index.md: wiki/index.md
|
|
12
|
+
- templates/_log.md: wiki/_log.md
|
|
13
|
+
- templates/hot.md: wiki/hot.md
|
|
14
|
+
- templates/raw.gitkeep: raw/.gitkeep
|
|
15
|
+
- templates/wiki-page.sample.md: docs/wiki-page.template.md
|
|
9
16
|
- templates/LLM_WIKI.sample.md: docs/LLM_WIKI.sample.md
|
|
17
|
+
- scripts/wiki-lint-trigger.sh: scripts/wiki-lint-trigger.sh
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> "The delicate art and science of context engineering: filling the context window with just the right information for the next step." — Andrej Karpathy
|
|
4
4
|
|
|
5
|
-
These guidelines provide standing operational instructions for AI coding assistants (Cursor, Claude Code, GitHub Copilot, Antigravity, Windsurf) working within multi-repository environments.
|
|
5
|
+
These guidelines provide standing operational instructions for AI coding assistants (Cursor, Claude Code, GitHub Copilot, Antigravity, Windsurf) working within multi-repository environments and managing Karpathy LLM Wiki knowledge bases.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -48,10 +48,37 @@ In a Repo Nexus workspace, independent repositories are unified into a single ac
|
|
|
48
48
|
|
|
49
49
|
---
|
|
50
50
|
|
|
51
|
-
## 3.
|
|
51
|
+
## 3. Karpathy Wiki Rules
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
When working in a repository with an active Karpathy LLM Wiki (`/wiki/` and `/raw/` directories):
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
- **Intake**: All source material (articles, transcripts, docs, notes) goes to `/raw/` unmodified. Never write directly to `/wiki/` without ingesting.
|
|
56
|
+
- **Orientation**: Before answering domain questions, read `/wiki/index.md` to find relevant pages, then read only those pages. If `hot.md` exists, read it first as a quick-orient step.
|
|
57
|
+
- **Ingestion**: When files appear in `/raw/`, run the `wiki-ingest` workflow (`.agent/workflows/wiki-ingest.md`). One source document typically produces many atomic pages (commonly 5–25 pages) — do not collapse a source into a single file.
|
|
58
|
+
- **Cadence**: After any session where repository files were created, edited, or deleted, run `scripts/wiki-lint-trigger.sh`. If it outputs `[WIKI MAINTENANCE DUE]`, run the `wiki-lint` workflow (`.agent/workflows/wiki-lint.md`) before stopping.
|
|
59
|
+
- **No-op sessions**: Do not run the trigger after read-only or purely conversational sessions where no files changed.
|
|
60
|
+
- **Enable/disable**: Wiki automation is controlled by `lint_trigger: enabled|disabled` in `/wiki/index.md` frontmatter. Edit that field to toggle — the change is committed and visible to the whole team.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 4. Typed Frontmatter Relation Schema
|
|
65
|
+
|
|
66
|
+
Every page in `/wiki/` must maintain typed frontmatter relations:
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
---
|
|
70
|
+
title: ""
|
|
71
|
+
tags: []
|
|
72
|
+
last_updated: YYYY-MM-DD
|
|
73
|
+
# Typed relation fields — paths relative to /wiki/
|
|
74
|
+
sources: [] # /raw/ files this page was derived from
|
|
75
|
+
related: [] # thematically related wiki pages
|
|
76
|
+
extends: [] # pages this one builds upon or specialises
|
|
77
|
+
contradicts: [] # pages with conflicting information
|
|
78
|
+
mentioned_in: [] # pages that link to this one (maintained by lint)
|
|
79
|
+
---
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Body:** concise summary, key facts or insights, and inline standard Markdown links (`[Label](./path.md)`) where contextually useful in prose.
|
|
83
|
+
|
|
84
|
+
The relation graph lives in frontmatter, not in prose links. Agents traverse the graph by reading frontmatter fields, not by scanning body text.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# scripts/wiki-lint-trigger.sh — Autonomous Karpathy Wiki Lint Trigger
|
|
4
|
+
# ============================================================================
|
|
5
|
+
# Check if wiki/index.md exists and contains lint_trigger: enabled.
|
|
6
|
+
# If not, exit silently with code 0.
|
|
7
|
+
grep -q "lint_trigger: enabled" wiki/index.md 2>/dev/null || exit 0
|
|
8
|
+
|
|
9
|
+
WIKI_DIR="wiki"
|
|
10
|
+
COUNTER_FILE="$WIKI_DIR/.lint_trigger_counter"
|
|
11
|
+
|
|
12
|
+
# Read and increment session counter
|
|
13
|
+
count=0
|
|
14
|
+
if [ -f "$COUNTER_FILE" ]; then
|
|
15
|
+
count=$(cat "$COUNTER_FILE" 2>/dev/null || echo 0)
|
|
16
|
+
fi
|
|
17
|
+
case "$count" in
|
|
18
|
+
''|*[!0-9]*) count=0 ;;
|
|
19
|
+
esac
|
|
20
|
+
|
|
21
|
+
count=$((count + 1))
|
|
22
|
+
printf '%s\n' "$count" > "$COUNTER_FILE" 2>/dev/null || true
|
|
23
|
+
|
|
24
|
+
# If counter is 1 or a multiple of 15, print maintenance due notice
|
|
25
|
+
if [ "$count" -eq 1 ] || [ $((count % 15)) -eq 0 ]; then
|
|
26
|
+
printf '[WIKI MAINTENANCE DUE]: Pending /raw/ files or wiki health checks detected. Run wiki-lint.\n'
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
exit 0
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Karpathy Wiki Operation Log
|
|
2
|
+
|
|
3
|
+
Append-only audit trail recording all ingest (`wiki-ingest`) and maintenance (`wiki-lint`) runs.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
### Initial Setup — YYYY-MM-DD
|
|
8
|
+
* **Action:** Initialized Karpathy LLM Wiki architecture via `karpathy-llm` plugin.
|
|
9
|
+
* **Control State:** `lint_trigger: enabled`. Intake directory `/raw/` created.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Hot Context (Rolling ~500-Word Cache)
|
|
2
|
+
|
|
3
|
+
> A compact overview of the most active and immediately relevant domain context. Agents read this file first for quick orientation without needing to parse the full wiki.
|
|
4
|
+
|
|
5
|
+
## Active Focus & System State
|
|
6
|
+
* **Current State:** Karpathy LLM Wiki initialized.
|
|
7
|
+
* **Recent Ingests:** None yet. Place raw sources into `/raw/` and trigger `wiki-ingest`.
|
|
8
|
+
* **Key Directives:**
|
|
9
|
+
1. Maintain atomic pages with typed frontmatter relations.
|
|
10
|
+
2. Update `/wiki/index.md` and this hot cache upon new ingests.
|
|
11
|
+
3. Run `scripts/wiki-lint-trigger.sh` after sessions modifying project files.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Wiki Index
|
|
3
|
+
last_updated: YYYY-MM-DD
|
|
4
|
+
lint_trigger: enabled # set to "disabled" to pause all wiki automation
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Wiki Index
|
|
8
|
+
|
|
9
|
+
Master navigation index and control file for the Karpathy LLM Wiki. Use this index to navigate atomic domain pages, architecture decisions, and cross-project knowledge.
|
|
10
|
+
|
|
11
|
+
## Overview & Status
|
|
12
|
+
* **Rolling Cache:** [`hot.md`](./hot.md) — Fast ~500-word orientation cache (for second brain or codebase wikis).
|
|
13
|
+
* **Operation Log:** [`_log.md`](./_log.md) — Timestamped ingest & maintenance history.
|
|
14
|
+
|
|
15
|
+
## Architecture & Concepts
|
|
16
|
+
* *(Atomic concept and system architecture pages will be indexed here during ingestion)*
|
|
17
|
+
|
|
18
|
+
## Decisions & ADRs
|
|
19
|
+
* *(Architecture decision records, interface contracts, and technical trade-offs)*
|
|
20
|
+
|
|
21
|
+
## Runbooks & Operations
|
|
22
|
+
* *(Operational procedures, workflows, and team conventions)*
|
|
23
|
+
|
|
24
|
+
## People & Organizations
|
|
25
|
+
* *(Key contributors, teams, organizations, and stakeholders)*
|
|
26
|
+
|
|
27
|
+
## Sources & Raw References
|
|
28
|
+
* *(Catalog of ingested source materials from `/raw/`)*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Raw intake folder for Karpathy LLM Wiki. Source documents are deposited here unmodified.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Concept or Entity Name"
|
|
3
|
+
tags: []
|
|
4
|
+
last_updated: YYYY-MM-DD
|
|
5
|
+
# Typed relation fields — paths relative to /wiki/
|
|
6
|
+
sources: [] # /raw/ files this page was derived from
|
|
7
|
+
related: [] # thematically related wiki pages
|
|
8
|
+
extends: [] # pages this one builds upon or specialises
|
|
9
|
+
contradicts: [] # pages with conflicting information
|
|
10
|
+
mentioned_in: [] # pages that link to this one (maintained by lint)
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Concept or Entity Name
|
|
14
|
+
|
|
15
|
+
## Summary
|
|
16
|
+
A concise, 1-2 paragraph summary of the concept, entity, architecture decision, or contract.
|
|
17
|
+
|
|
18
|
+
## Key Facts & Insights
|
|
19
|
+
* **Core Insight:** Grounded directly in source material from `/raw/`.
|
|
20
|
+
* **Scope & Boundaries:** Context of applicability and interfaces with other components.
|
|
21
|
+
|
|
22
|
+
## Contextual Links
|
|
23
|
+
* Reference [Related Concept](./another-concept.md) where contextually useful in prose.
|
|
24
|
+
*(Note: The relation graph lives in frontmatter, not in prose links. Agents traverse the graph by reading frontmatter fields, not by scanning body text.)*
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Wiki Ingestion Workflow (`wiki-ingest`)
|
|
2
|
+
|
|
3
|
+
Universal workflow for decomposing and ingesting raw source materials into atomic Karpathy LLM Wiki pages.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Ingestion Protocol
|
|
8
|
+
|
|
9
|
+
1. **Scan Intake:**
|
|
10
|
+
- Scan `/raw/` for source materials (articles, transcripts, documents, research notes, meeting logs) not yet recorded in `/wiki/_log.md`.
|
|
11
|
+
- All source material must reside in `/raw/` unmodified. Never write directly to `/wiki/` without ingesting.
|
|
12
|
+
|
|
13
|
+
2. **Read & Clarify:**
|
|
14
|
+
- Read each source fully.
|
|
15
|
+
- If scope, domain boundaries, target audience, or level of detail is unclear, ask one round of clarifying questions before proceeding.
|
|
16
|
+
|
|
17
|
+
3. **Atomic Decomposition:**
|
|
18
|
+
- Decompose each source into atomic wiki pages — **one per distinct concept, person, organization, event, or theme** (or architecture decision/contract).
|
|
19
|
+
- A single source document commonly produces **5–25 pages**. Never collapse an entire source into a single file.
|
|
20
|
+
- Place pages according to workspace wiki organization:
|
|
21
|
+
- **Flat:** directly under `/wiki/` (e.g., `/wiki/<topic>.md`)
|
|
22
|
+
- **Structured:** in categorical subfolders:
|
|
23
|
+
- Research → `concepts/`, `people/`, `organizations/`, `sources/`, `analysis/`
|
|
24
|
+
- Second brain → `projects/`, `people/`, `decisions/`, `logs/`
|
|
25
|
+
- Content archive → `sources/`, `people/`, `tools/`, `concepts/`
|
|
26
|
+
- Codebase → `architecture/`, `decisions/`, `runbooks/`, `people/`
|
|
27
|
+
|
|
28
|
+
4. **Frontmatter Relations:**
|
|
29
|
+
- For each page, write the required YAML frontmatter with typed relations:
|
|
30
|
+
```yaml
|
|
31
|
+
---
|
|
32
|
+
title: ""
|
|
33
|
+
tags: []
|
|
34
|
+
last_updated: YYYY-MM-DD
|
|
35
|
+
# Typed relation fields — paths relative to /wiki/
|
|
36
|
+
sources: [] # /raw/ files this page was derived from
|
|
37
|
+
related: [] # thematically related wiki pages
|
|
38
|
+
extends: [] # pages this one builds upon or specialises
|
|
39
|
+
contradicts: [] # pages with conflicting information
|
|
40
|
+
mentioned_in: [] # pages that link to this one (leave empty; maintained by lint)
|
|
41
|
+
---
|
|
42
|
+
```
|
|
43
|
+
- **Crucial:** The relation graph lives in frontmatter, not in prose links. Agents traverse the graph by reading frontmatter fields, not by scanning body text.
|
|
44
|
+
|
|
45
|
+
5. **Author Concise Body:**
|
|
46
|
+
- Write a concise body with summary, key facts, and insights.
|
|
47
|
+
- Add inline standard Markdown links (`[Label](./path.md)`) where contextually useful in prose.
|
|
48
|
+
|
|
49
|
+
6. **Update Navigation Index:**
|
|
50
|
+
- Update `/wiki/index.md` with links to all new pages in their corresponding categorized sections.
|
|
51
|
+
|
|
52
|
+
7. **Update Hot Cache:**
|
|
53
|
+
- Update `/wiki/hot.md` if it exists with the rolling ~500-word orientation summary of active context.
|
|
54
|
+
|
|
55
|
+
8. **Append Operation Log:**
|
|
56
|
+
- Append a timestamped entry to `/wiki/_log.md` detailing:
|
|
57
|
+
- Date & time
|
|
58
|
+
- Raw file processed
|
|
59
|
+
- List of atomic pages generated
|
|
60
|
+
- Any flagged follow-ups or knowledge gaps
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Wiki Lint & Maintenance Workflow (`wiki-lint`)
|
|
2
|
+
|
|
3
|
+
Periodic health check and maintenance workflow to preserve wiki graph integrity, validate typed relations, recompute bidirectional links, resolve knowledge gaps, and rebuild indexes.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Lint & Maintenance Protocol
|
|
8
|
+
|
|
9
|
+
1. **Verify Relation Paths:**
|
|
10
|
+
- For every page, verify that all paths in frontmatter relation fields (`related`, `extends`, `contradicts`, `sources`) resolve to existing files.
|
|
11
|
+
- Fix or flag broken paths.
|
|
12
|
+
|
|
13
|
+
2. **Recompute `mentioned_in`:**
|
|
14
|
+
- Recompute `mentioned_in` for every page by scanning all other pages' relation fields and inline links.
|
|
15
|
+
- Update the field in frontmatter.
|
|
16
|
+
|
|
17
|
+
3. **Find Orphaned Pages:**
|
|
18
|
+
- Detect pages not reachable from `index.md` or any `mentioned_in` field.
|
|
19
|
+
- Add them to the index in their appropriate category.
|
|
20
|
+
|
|
21
|
+
4. **Detect Duplicate or Overlapping Pages:**
|
|
22
|
+
- Detect duplicate or heavily overlapping pages.
|
|
23
|
+
- Consolidate and update relations across the wiki graph.
|
|
24
|
+
|
|
25
|
+
5. **Check Factual Inconsistencies:**
|
|
26
|
+
- Check for factual inconsistencies between pages in `contradicts` relations or covering the same topic.
|
|
27
|
+
- Clarify or resolve contradictions.
|
|
28
|
+
|
|
29
|
+
6. **Identify Knowledge Gaps:**
|
|
30
|
+
- Identify knowledge gaps: concepts referenced in relation fields or prose but lacking their own atomic page.
|
|
31
|
+
- Create stub pages or flag for future ingest.
|
|
32
|
+
|
|
33
|
+
7. **Suggest Source Candidates:**
|
|
34
|
+
- Suggest source candidates from `/raw/` or external searches to fill identified knowledge gaps.
|
|
35
|
+
|
|
36
|
+
8. **Rebuild Navigation Index:**
|
|
37
|
+
- Rebuild `/wiki/index.md` to reflect the current set of pages and categories accurately.
|
|
38
|
+
|
|
39
|
+
9. **Update Hot Cache:**
|
|
40
|
+
- Update `/wiki/hot.md` if it exists, refreshing the rolling ~500-word orientation context.
|
|
41
|
+
|
|
42
|
+
10. **Append Operation Log:**
|
|
43
|
+
- Append a lint summary to `/wiki/_log.md` detailing:
|
|
44
|
+
- Broken links fixed or flagged
|
|
45
|
+
- `mentioned_in` updates
|
|
46
|
+
- Orphans and duplicates resolved
|
|
47
|
+
- Gaps identified or stubbed
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Karpathy LLM Wiki Scaffolding Prompt
|
|
2
|
+
|
|
3
|
+
Universal meta-prompt for setting up a Karpathy LLM Wiki knowledge architecture. Works with any AI agent harness. No external MCP servers, vector databases, or embedding pipelines required — just markdown files with structured frontmatter.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
Set up a Karpathy LLM Wiki in this repository: a self-maintaining knowledge base where raw source material is ingested into interlinked atomic markdown files that any AI agent can navigate by reading indexes and following typed frontmatter relations.
|
|
9
|
+
|
|
10
|
+
Do not use external MCP servers, vector databases, or embedding pipelines.
|
|
11
|
+
Do not hard-code any specific AI tool or harness into the wiki structure itself.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
### Step 0 — Configuration (ask before creating any files)
|
|
16
|
+
|
|
17
|
+
Ask ALL of the following questions and wait for answers:
|
|
18
|
+
|
|
19
|
+
[Q1] Which AI agent instruction file should the wiki rules be written to?
|
|
20
|
+
- `AGENTS.md` (universal, works across most harnesses)
|
|
21
|
+
- `CLAUDE.md` (Claude Code / Anthropic)
|
|
22
|
+
- `.cursor/rules/wiki.mdc` (Cursor)
|
|
23
|
+
- `.github/copilot-instructions.md` (GitHub Copilot)
|
|
24
|
+
- `GEMINI.md` (Google Gemini / Antigravity)
|
|
25
|
+
- `.windsurfrules` (Windsurf)
|
|
26
|
+
- Other — specify path
|
|
27
|
+
|
|
28
|
+
Append a `## Karpathy Wiki Rules` section to that file. Preserve all existing content.
|
|
29
|
+
|
|
30
|
+
[Q2] What is this wiki for?
|
|
31
|
+
- Research / reading list — articles, papers, PDFs on a topic
|
|
32
|
+
- Personal second brain — meetings, notes, business context, personal projects
|
|
33
|
+
- Content archive — transcripts, podcast notes, newsletters
|
|
34
|
+
- Codebase knowledge — architecture decisions, runbooks, team conventions
|
|
35
|
+
- Other (describe briefly)
|
|
36
|
+
|
|
37
|
+
[Q3] How should the wiki be organized?
|
|
38
|
+
- Flat — all pages at the top level of `/wiki/` (simpler, good default)
|
|
39
|
+
- Structured — subfolders by category, chosen based on Q2 answer
|
|
40
|
+
- Agent decides — infer structure from the first batch of ingested content
|
|
41
|
+
|
|
42
|
+
[Q4] Enable wiki automation now?
|
|
43
|
+
- Yes — set `lint_trigger: enabled` in `/wiki/index.md` frontmatter
|
|
44
|
+
- No — set `lint_trigger: disabled` (can be changed at any time by editing that field)
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### 1. Directories and Files
|
|
49
|
+
|
|
50
|
+
**`/raw/`** — Append-only intake directory. All original source material goes here unmodified. Add `.gitkeep`.
|
|
51
|
+
|
|
52
|
+
**`/wiki/`** — Curated knowledge base of atomic markdown pages. Structure per Q3:
|
|
53
|
+
- Flat: all pages directly in `/wiki/`
|
|
54
|
+
- Structured: subfolders matching the project type from Q2:
|
|
55
|
+
- Research → `concepts/`, `people/`, `organizations/`, `sources/`, `analysis/`
|
|
56
|
+
- Second brain → `projects/`, `people/`, `decisions/`, `logs/`
|
|
57
|
+
- Content archive → `sources/`, `people/`, `tools/`, `concepts/`
|
|
58
|
+
- Codebase → `architecture/`, `decisions/`, `runbooks/`, `people/`
|
|
59
|
+
|
|
60
|
+
**`/wiki/index.md`** — Master navigation index and wiki control file. Contains:
|
|
61
|
+
- YAML frontmatter with `lint_trigger: enabled|disabled` — controls whether the autonomous trigger runs. Committed to version control; toggling is a team-visible decision.
|
|
62
|
+
- Categorized links to every wiki page. Auto-maintained after every ingest and lint run.
|
|
63
|
+
|
|
64
|
+
**`/wiki/_log.md`** — Append-only operation log. Every ingest and lint run appends a timestamped entry.
|
|
65
|
+
|
|
66
|
+
**`/wiki/hot.md`** *(create only for second brain or codebase wiki)* — Rolling ~500-word cache of the most recently relevant context. Lets an agent orient without reading the full wiki.
|
|
67
|
+
|
|
68
|
+
**`/wiki/.lint_trigger_counter`** — Session counter used by the lint trigger script. Machine-local state. Add to `.gitignore`.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### 2. Index File Format
|
|
73
|
+
|
|
74
|
+
`/wiki/index.md` uses its own frontmatter schema (it is the wiki control file, not a regular page):
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
---
|
|
78
|
+
title: Wiki Index
|
|
79
|
+
last_updated: YYYY-MM-DD
|
|
80
|
+
lint_trigger: enabled # set to "disabled" to pause all wiki automation
|
|
81
|
+
---
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Followed by categorized Markdown link sections matching the project type from Q2.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
### 3. Wiki Page Format
|
|
89
|
+
|
|
90
|
+
Every wiki page is a single atomic markdown file covering one concept, entity, source, or decision.
|
|
91
|
+
|
|
92
|
+
**Required YAML frontmatter:**
|
|
93
|
+
|
|
94
|
+
```yaml
|
|
95
|
+
---
|
|
96
|
+
title: ""
|
|
97
|
+
tags: []
|
|
98
|
+
last_updated: YYYY-MM-DD
|
|
99
|
+
# Typed relation fields — paths relative to /wiki/
|
|
100
|
+
sources: [] # /raw/ files this page was derived from
|
|
101
|
+
related: [] # thematically related wiki pages
|
|
102
|
+
extends: [] # pages this one builds upon or specialises
|
|
103
|
+
contradicts: [] # pages with conflicting information
|
|
104
|
+
mentioned_in: [] # pages that link to this one (maintained by lint)
|
|
105
|
+
---
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Body:** concise summary, key facts or insights, and inline standard Markdown links (`[Label](./path.md)`) where contextually useful in prose.
|
|
109
|
+
|
|
110
|
+
The relation graph lives in frontmatter, not in prose links. Agents traverse the graph by reading frontmatter fields, not by scanning body text.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### 4. Agent Instructions
|
|
115
|
+
|
|
116
|
+
In the file chosen in Q1, append:
|
|
117
|
+
|
|
118
|
+
```markdown
|
|
119
|
+
## Karpathy Wiki Rules
|
|
120
|
+
|
|
121
|
+
- **Intake**: All source material (articles, transcripts, docs, notes) goes to `/raw/` unmodified. Never write directly to `/wiki/` without ingesting.
|
|
122
|
+
- **Orientation**: Before answering domain questions, read `/wiki/index.md` to find relevant pages, then read only those pages. If `hot.md` exists, read it first as a quick-orient step.
|
|
123
|
+
- **Ingestion**: When files appear in `/raw/`, run the `wiki-ingest` workflow. One source document typically produces many atomic pages — do not collapse a source into a single file.
|
|
124
|
+
- **Cadence**: After any session where repository files were created, edited, or deleted, run `scripts/wiki-lint-trigger.sh`. If it outputs `[WIKI MAINTENANCE DUE]`, run the `wiki-lint` workflow before stopping.
|
|
125
|
+
- **No-op sessions**: Do not run the trigger after read-only or purely conversational sessions where no files changed.
|
|
126
|
+
- **Enable/disable**: Wiki automation is controlled by `lint_trigger: enabled|disabled` in `/wiki/index.md` frontmatter. Edit that field to toggle — the change is committed and visible to the whole team.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### 5. Workflows
|
|
132
|
+
|
|
133
|
+
Create workflow instruction files at `.agent/workflows/` (or `.agent/skills/` depending on the harness):
|
|
134
|
+
|
|
135
|
+
**`wiki-ingest.md`**:
|
|
136
|
+
1. Scan `/raw/` for files not yet recorded in `/wiki/_log.md`.
|
|
137
|
+
2. For each source, read it fully. If scope or depth is unclear, ask one round of clarifying questions before proceeding.
|
|
138
|
+
3. Decompose into atomic wiki pages — one per distinct concept, person, organization, event, or theme. A single article commonly produces 5–25 pages.
|
|
139
|
+
4. For each page, write the required frontmatter (including `sources`, `related`, `extends`, `contradicts`). Leave `mentioned_in` empty — lint maintains it.
|
|
140
|
+
5. Write a concise body with inline links where contextually helpful.
|
|
141
|
+
6. Update `/wiki/index.md` with links to all new pages.
|
|
142
|
+
7. Update `/wiki/hot.md` if it exists.
|
|
143
|
+
8. Append a timestamped entry to `/wiki/_log.md`.
|
|
144
|
+
|
|
145
|
+
**`wiki-lint.md`**:
|
|
146
|
+
1. For every page, verify that all paths in frontmatter relation fields (`related`, `extends`, `contradicts`, `sources`) resolve to existing files. Fix or flag broken paths.
|
|
147
|
+
2. Recompute `mentioned_in` for every page by scanning all other pages' relation fields and inline links. Update the field.
|
|
148
|
+
3. Find orphaned pages (not reachable from `index.md` or any `mentioned_in` field). Add them to the index.
|
|
149
|
+
4. Detect duplicate or heavily overlapping pages. Consolidate and update relations.
|
|
150
|
+
5. Check for factual inconsistencies between pages in `contradicts` relations or covering the same topic.
|
|
151
|
+
6. Identify knowledge gaps: concepts referenced in relation fields but lacking their own page. Create stub pages or flag for future ingest.
|
|
152
|
+
7. Suggest source candidates from `/raw/` or external searches to fill gaps.
|
|
153
|
+
8. Rebuild `/wiki/index.md` to reflect the current set of pages.
|
|
154
|
+
9. Update `/wiki/hot.md` if it exists.
|
|
155
|
+
10. Append a lint summary to `/wiki/_log.md`.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### 6. Autonomous Lint Trigger
|
|
160
|
+
|
|
161
|
+
Create `scripts/wiki-lint-trigger.sh` (POSIX shell):
|
|
162
|
+
- Check if `wiki/index.md` exists and contains `lint_trigger: enabled`. If not, exit silently with code `0`.
|
|
163
|
+
```sh
|
|
164
|
+
grep -q "lint_trigger: enabled" wiki/index.md 2>/dev/null || exit 0
|
|
165
|
+
```
|
|
166
|
+
- Read and increment a counter stored in `wiki/.lint_trigger_counter`.
|
|
167
|
+
- If counter is `1` or a multiple of `15`, print:
|
|
168
|
+
`[WIKI MAINTENANCE DUE]: Pending /raw/ files or wiki health checks detected. Run wiki-lint.`
|
|
169
|
+
- Otherwise exit silently with code `0`.
|
|
170
|
+
- Make executable: `chmod +x scripts/wiki-lint-trigger.sh`.
|
|
171
|
+
|
|
172
|
+
To disable: set `lint_trigger: disabled` in `/wiki/index.md` frontmatter.
|
|
173
|
+
To re-enable: set `lint_trigger: enabled`.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
All files must be self-contained with no external dependencies.
|
|
178
|
+
```
|