llm-wikis 0.2.1 → 0.2.3

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 ADDED
@@ -0,0 +1,128 @@
1
+ # llm-wikis
2
+
3
+ Multi-wiki sync observability for the [Karpathy LLM Wiki](https://karpathy.ai/zero-to-hero.html) pattern.
4
+
5
+ ![llm-wikis banner](docs/assets/github-banner.png)
6
+
7
+ ---
8
+
9
+ ## What is this?
10
+
11
+ Karpathy's LLM Wiki pattern: instead of RAG querying raw chunks at runtime, an AI agent reads your source files and incrementally compiles them into a structured, persistent, interlinked Markdown wiki. It solves RAG's statelessness and chunk-boundary noise — the AI owns the overhead, you own the sourcing and querying.
12
+
13
+ **llm-wikis** adds the sync layer that the pattern ships without:
14
+
15
+ - **Multiple independent wikis per project** — each covering a different knowledge domain, under a single `/wikis` command surface
16
+ - **Sync visibility** — see exactly what's changed, added, deleted, or renamed before any tokens are spent
17
+ - **Rename detection** — file moves resolved from hash comparison, zero LLM tokens
18
+ - **Deferred ingestion** — flag files for later with `--later`, no surprise token costs
19
+ - **Provenance tracking** — bidirectional manifest linking every `raw/` file to the `wiki/` pages it produced
20
+ - **Wiki integrity auditing** — detect and resolve manually-edited wiki files before they silently diverge
21
+
22
+ Works with **Claude Code**, **Gemini CLI**, and **Codex** via a neutral `WIKI.md` schema (not hardcoded to `CLAUDE.md`).
23
+
24
+ ---
25
+
26
+ ## Install
27
+
28
+ ```bash
29
+ npm install -g llm-wikis
30
+ ```
31
+
32
+ This installs three CLI scripts and places the skill file at `~/.claude/skills/wikis/`.
33
+
34
+ ---
35
+
36
+ ## Slash commands
37
+
38
+ Use `/wikis` directly in Claude Code (or any supported LLM CLI):
39
+
40
+ | Command | Description |
41
+ |---|---|
42
+ | `/wikis init <name>` | Create a new wiki at `wikis/<name>/` |
43
+ | `/wikis use <name>` | Set the active wiki |
44
+ | `/wikis list` | List all wikis with sync state |
45
+ | `/wikis status` | Show what's changed since last ingest |
46
+ | `/wikis ingest` | Ingest unsynced raw files into wiki pages |
47
+ | `/wikis ingest --later` | Mark files for later — zero token usage |
48
+ | `/wikis trace <file>` | Show bidirectional provenance for any file |
49
+ | `/wikis report` | Generate a filterable HTML provenance report |
50
+ | `/wikis recover manifest` | Restore manifest from backup |
51
+ | `/wikis rebuild-manifest` | Re-derive manifest from disk scan |
52
+ | `/wikis recover schema` | Reset `WIKI.md` to the default template |
53
+
54
+ ---
55
+
56
+ ## CLI scripts
57
+
58
+ Three deterministic scripts are available directly (used internally by the skill, but callable standalone):
59
+
60
+ ```bash
61
+ # List all wikis in a project
62
+ wikis scan --list <project-root>
63
+
64
+ # Show sync status for a wiki
65
+ wikis scan --status <wiki-path>
66
+
67
+ # Record a raw → wiki ingestion in the manifest
68
+ wikis record <wiki-path> <raw-file> <wiki-page>
69
+
70
+ # Generate a static HTML report
71
+ wikis report <wiki-path> <output.html>
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Project structure
77
+
78
+ Running `/wikis init` creates:
79
+
80
+ ```
81
+ project/
82
+ wikis/
83
+ <name>/
84
+ raw/ ← drop source files here (PDFs, notes, docs)
85
+ wiki/ ← compiled wiki pages live here
86
+ WIKI.md ← schema: domain conventions for the LLM
87
+ .wiki-manifest.json
88
+ .wiki-manifest.backup.json
89
+ .wiki-context ← active wiki name (set by /wikis use)
90
+ ```
91
+
92
+ Multiple wikis are fully independent — different raw sources, different wiki pages, separate manifests.
93
+
94
+ ---
95
+
96
+ ## Manifest
97
+
98
+ Each wiki has a bidirectional manifest tracking every `raw/ → wiki/` relationship:
99
+
100
+ ```json
101
+ {
102
+ "version": "1.0",
103
+ "wiki_name": "auditor",
104
+ "last_ingestion": "2026-05-30T12:00:00Z",
105
+ "raw_to_wiki": {
106
+ "raw/paper.pdf": {
107
+ "hash": "sha256...",
108
+ "ingested": 1748600000000,
109
+ "deferred": false,
110
+ "wiki_pages": ["wiki/concept-a.md"]
111
+ }
112
+ },
113
+ "wiki_to_raw": {
114
+ "wiki/concept-a.md": {
115
+ "hash": "sha256...",
116
+ "sources": ["raw/paper.pdf"]
117
+ }
118
+ }
119
+ }
120
+ ```
121
+
122
+ The LLM never writes the manifest directly — only the deterministic scripts do, atomically, with a backup before every write.
123
+
124
+ ---
125
+
126
+ ## License
127
+
128
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llm-wikis",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Multi-wiki sync observability for the Karpathy LLM Wiki pattern",
5
5
  "license": "MIT",
6
6
  "bin": {
package/postinstall.js CHANGED
@@ -3,7 +3,7 @@ const fs = require('fs');
3
3
  const path = require('path');
4
4
  const os = require('os');
5
5
 
6
- const src = path.join(__dirname, 'skill');
6
+ const src = path.join(__dirname, 'skills', 'wiki');
7
7
  const dest = path.join(os.homedir(), '.claude', 'skills', 'wiki');
8
8
 
9
9
  try {
@@ -12,5 +12,5 @@ try {
12
12
  console.log('[llm-wiki-sync] Skill installed to ~/.claude/skills/wiki/');
13
13
  } catch (err) {
14
14
  console.warn('[llm-wiki-sync] Could not install skill:', err.message);
15
- console.warn('[llm-wiki-sync] Manually copy the skill/ directory to ~/.claude/skills/wiki/');
15
+ console.warn('[llm-wiki-sync] Manually copy the skills/wiki/ directory to ~/.claude/skills/wiki/');
16
16
  }
@@ -9,7 +9,7 @@ function usage() {
9
9
  console.error('Usage:');
10
10
  console.error(' wiki-ingest-record <wiki-path> <raw-file-relpath> <wiki-page-relpath>');
11
11
  console.error(' wiki-ingest-record <wiki-path> <raw-file-relpath> --update-hash-only');
12
- console.error(' wiki-ingest-record <wiki-path> --defer <raw-file-relpath>');
12
+ console.error(' wiki-ingest-record <wiki-path> --later <raw-file-relpath>');
13
13
  process.exit(1);
14
14
  }
15
15
 
@@ -43,8 +43,8 @@ if (!wikiPath || !arg2) usage();
43
43
 
44
44
  const absWikiPath = path.resolve(wikiPath);
45
45
 
46
- // Mode: --defer <raw-file>
47
- if (arg2 === '--defer') {
46
+ // Mode: --later <raw-file>
47
+ if (arg2 === '--later') {
48
48
  const rawRel = arg3;
49
49
  if (!rawRel) usage();
50
50
 
@@ -5,7 +5,7 @@ const fs = require('fs');
5
5
  const path = require('path');
6
6
  const crypto = require('crypto');
7
7
 
8
- const VERSION = '0.2.1';
8
+ const VERSION = '0.2.2';
9
9
 
10
10
  function usage() {
11
11
  console.error('Usage:');
package/scripts/wikis.js CHANGED
@@ -4,7 +4,7 @@
4
4
  const { execFileSync } = require('child_process');
5
5
  const path = require('path');
6
6
 
7
- const VERSION = '0.2.1';
7
+ const VERSION = '0.2.2';
8
8
 
9
9
  const HELP = `
10
10
  llm-wikis v${VERSION}
@@ -22,7 +22,7 @@ Slash commands (Claude Code / Gemini CLI / Codex):
22
22
  /wikis use <name> Set the active wiki
23
23
  /wikis list List all wikis
24
24
  /wikis status Show sync status
25
- /wikis ingest [--defer] Ingest unsynced files
25
+ /wikis ingest [--later] Ingest unsynced files
26
26
  /wikis trace <file> Show file provenance
27
27
  /wikis report Generate HTML report
28
28
  /wikis recover manifest Restore manifest from backup
@@ -110,24 +110,24 @@ Count "unsynced" as entries in `raw_to_wiki` where `ingested` is null and `defer
110
110
 
111
111
  ---
112
112
 
113
- ## `/wikis ingest [--defer]`
113
+ ## `/wikis ingest [--later]`
114
114
 
115
115
  Requires active wiki. Read `.wiki-context` for `<name>`.
116
116
 
117
- ### With `--defer`
117
+ ### With `--later`
118
118
 
119
119
  1. Run: `wiki-scan --status wikis/<name>`
120
120
  2. Collect all files in `added` and `modified` from the scan output.
121
121
  3. If none: print `"Nothing to defer. Run /wikis status to check."` and stop.
122
- 4. For each file, run: `wiki-ingest-record wikis/<name> --defer <file>`
122
+ 4. For each file, run: `wiki-ingest-record wikis/<name> --later <file>`
123
123
  5. Print:
124
124
  ```
125
125
  Deferred N file(s). No tokens consumed.
126
- Run /wikis ingest (without --defer) when ready to process them.
126
+ Run /wikis ingest (without --later) when ready to process them.
127
127
  ```
128
128
  6. **Zero LLM calls** — this entire command is pure script execution. Do not read or process any raw files.
129
129
 
130
- ### Without `--defer`
130
+ ### Without `--later`
131
131
 
132
132
  1. Run: `wiki-scan --status wikis/<name>`
133
133
  2. Collect files to ingest: all in `added` + `modified` + any entries in the manifest where `deferred: true`.
@@ -309,7 +309,7 @@ Unknown subcommand. Available commands:
309
309
  /wikis use <name> Set the active wiki
310
310
  /wikis list List all wikis
311
311
  /wikis status Show sync status
312
- /wikis ingest [--defer] Ingest unsynced files
312
+ /wikis ingest [--later] Ingest unsynced files
313
313
  /wikis trace <file> Show file provenance
314
314
  /wikis report Generate HTML report
315
315
  /wikis recover manifest Restore manifest from backup
File without changes
File without changes