@alekra1/llm-wiki 1.0.0

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/.cursorrules ADDED
@@ -0,0 +1,12 @@
1
+ # Agent instructions
2
+
3
+ This project uses an LLM wiki at `./wiki/` as its living context layer.
4
+
5
+ **On session start:** read `wiki/HOWTO.md`, `wiki/index.md`, `wiki/_active/now.md`,
6
+ and recent entries from `wiki/log.md`.
7
+
8
+ **While working:** update the wiki per `wiki/HOWTO.md`. Use supersession, not deletion,
9
+ for contradictions. Add a `log.md` entry for each wiki change.
10
+
11
+ **On session end:** run the lint checklist from `wiki/HOWTO.md §Lint`, propose prunes
12
+ to the user, apply on approval, and append a session summary to `wiki/log.md`.
package/AGENTS.md ADDED
@@ -0,0 +1,16 @@
1
+ # Agent instructions
2
+
3
+ This project uses an LLM wiki at `./wiki/` as its living context layer.
4
+
5
+ **On session start:** read `wiki/_snapshot.md` first (fast bootstrap), then `wiki/HOWTO.md`,
6
+ `wiki/index.md`, `wiki/_active/now.md`, and recent entries from `wiki/log.md`.
7
+
8
+ **While working:** update the wiki per `wiki/HOWTO.md`. Use supersession, not deletion,
9
+ for contradictions. Add a `log.md` entry for each wiki change.
10
+
11
+ **On session end:** rewrite `wiki/_snapshot.md` to reflect current state, offer to run
12
+ the lint checklist (`/wiki-lint`), apply approved changes, and append a session summary
13
+ to `wiki/log.md`.
14
+
15
+ **Slash commands** (Claude Code): `/wiki-update` — write a wiki entry; `/wiki-lint` — run
16
+ the lint checklist; `/wiki-snapshot` — refresh the snapshot mid-session.
package/CLAUDE.md ADDED
@@ -0,0 +1,21 @@
1
+ # Agent instructions
2
+
3
+ This project uses an LLM wiki at `./wiki/` as its living context layer.
4
+
5
+ **On session start:** read `wiki/_snapshot.md` first (fast bootstrap), then
6
+ `wiki/_active/now.md` and recent entries from `wiki/log.md`. If unfamiliar with the
7
+ wiki conventions, also read `wiki/HOWTO.md`. Drill into other pages only as needed.
8
+
9
+ **While working:** update the wiki per `wiki/HOWTO.md`. Use supersession, not deletion,
10
+ for contradictions. Add a `log.md` entry for each wiki change.
11
+
12
+ **On session end:** rewrite `wiki/_snapshot.md` to reflect current state if anything changed this session. Run `/wiki-lint` only when the user asks for it.
13
+
14
+ **Slash commands**: `/wiki-update` — write a wiki entry; `/wiki-lint` — run the lint
15
+ checklist; `/wiki-snapshot` — refresh the snapshot mid-session. Hooks in
16
+ `.claude/settings.json` automate the session-start reads and session-end prompt.
17
+
18
+ **If you are a subagent** (spawned via API, orchestration tool, or CI — not an
19
+ interactive CC session): hooks will not fire. Treat these instructions as your hooks.
20
+ Read `wiki/_snapshot.md` at the start of your first response. Write updates to the wiki
21
+ before your final response. Append a `log.md` entry for any wiki change made.
package/GEMINI.md ADDED
@@ -0,0 +1,12 @@
1
+ # Agent instructions
2
+
3
+ This project uses an LLM wiki at `./wiki/` as its living context layer.
4
+
5
+ **On session start:** read `wiki/HOWTO.md`, `wiki/index.md`, `wiki/_active/now.md`,
6
+ and recent entries from `wiki/log.md`.
7
+
8
+ **While working:** update the wiki per `wiki/HOWTO.md`. Use supersession, not deletion,
9
+ for contradictions. Add a `log.md` entry for each wiki change.
10
+
11
+ **On session end:** run the lint checklist from `wiki/HOWTO.md §Lint`, propose prunes
12
+ to the user, apply on approval, and append a session summary to `wiki/log.md`.
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # llm-wiki
2
+
3
+ A markdown wiki template that gives LLM agents persistent, cross-session memory. Copy it into any project — agents read and write `wiki/` as a living brain that survives context resets and provider switches.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npx @alekra1/llm-wiki
9
+ ```
10
+
11
+ This copies `wiki/` into your project, creates or appends to `CLAUDE.md`, and adds provider files (`AGENTS.md`, `GEMINI.md`, `.cursorrules`) if they don't exist.
12
+
13
+ Then install the Claude Code plugin for slash commands:
14
+ ```
15
+ /plugin marketplace add Alekra1/llm-wiki
16
+ /plugin install wiki@llm-wiki
17
+ ```
18
+
19
+ ## What's included
20
+
21
+ | File/Dir | Purpose |
22
+ |---|---|
23
+ | `wiki/` | The wiki: snapshot, active tasks, decisions, preferences, pitfalls, workflows |
24
+ | `CLAUDE.md` | Agent instructions for Claude Code |
25
+ | `AGENTS.md` | Same for OpenAI Agents / Codex |
26
+ | `GEMINI.md` | Same for Gemini |
27
+ | `.cursorrules` | Same for Cursor |
28
+ | `.claude/` | CC plugin: SessionStart hook + `/wiki-lint`, `/wiki-update`, `/wiki-snapshot` |
29
+
30
+ ## How it works
31
+
32
+ On session start, the agent reads `wiki/_snapshot.md` (~300 tokens, ~30 seconds) and picks up exactly where the last session ended. No summaries to maintain — the wiki is the memory.
33
+
34
+ Agents write to the wiki as they work: decisions in `wiki/decisions/`, preferences in `wiki/preferences/`, active tasks in `wiki/_active/`. Every change gets a line in `wiki/log.md`.
35
+
36
+ Read `wiki/HOWTO.md` for conventions.
37
+
38
+ ## Slash commands (Claude Code plugin)
39
+
40
+ | Command | What it does |
41
+ |---|---|
42
+ | `/wiki-update` | Write a new wiki entry |
43
+ | `/wiki-lint` | Run the wiki health checklist |
44
+ | `/wiki-snapshot` | Refresh the snapshot mid-session |
45
+
46
+ ## Provider support
47
+
48
+ Works with any LLM that can read files. Entry-point files (`CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, `.cursorrules`) contain identical instructions in each provider's expected format.
package/bin/setup.js ADDED
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ const PKG_ROOT = path.join(__dirname, '..');
7
+ const DEST = process.cwd();
8
+
9
+ const G = '\x1b[32m';
10
+ const Y = '\x1b[33m';
11
+ const R = '\x1b[0m';
12
+
13
+ function copyRecursive(src, dest) {
14
+ fs.mkdirSync(dest, { recursive: true });
15
+ for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
16
+ const s = path.join(src, entry.name);
17
+ const d = path.join(dest, entry.name);
18
+ entry.isDirectory() ? copyRecursive(s, d) : fs.copyFileSync(s, d);
19
+ }
20
+ }
21
+
22
+ // 1. Copy wiki/
23
+ const wikiDest = path.join(DEST, 'wiki');
24
+ if (fs.existsSync(wikiDest)) {
25
+ console.log(`· wiki/ already exists — skipping (delete to reinstall)`);
26
+ } else {
27
+ copyRecursive(path.join(PKG_ROOT, 'wiki'), wikiDest);
28
+ console.log(`${G}✓${R} Created wiki/`);
29
+ }
30
+
31
+ // 2. Handle CLAUDE.md — append if exists, create if not
32
+ const WIKI_BLOCK = `
33
+ # Wiki
34
+
35
+ This project uses an LLM wiki at \`./wiki/\` as its living context layer.
36
+
37
+ **On session start:** read \`wiki/_snapshot.md\` first (fast bootstrap), then
38
+ \`wiki/_active/now.md\` and recent entries from \`wiki/log.md\`. If unfamiliar
39
+ with the wiki conventions, also read \`wiki/HOWTO.md\`. Drill into other pages
40
+ only as needed.
41
+
42
+ **While working:** update the wiki per \`wiki/HOWTO.md\`. Use supersession, not
43
+ deletion, for contradictions. Add a \`log.md\` entry for each wiki change.
44
+
45
+ **On session end:** rewrite \`wiki/_snapshot.md\` to reflect current state if
46
+ anything changed this session.
47
+
48
+ **If you are a subagent** (spawned via API, orchestration tool, or CI — not an
49
+ interactive CC session): hooks will not fire. Treat these instructions as your
50
+ hooks. Read \`wiki/_snapshot.md\` at the start of your first response. Write
51
+ updates to the wiki before your final response. Append a \`log.md\` entry for
52
+ any wiki change made.
53
+ `;
54
+
55
+ const claudePath = path.join(DEST, 'CLAUDE.md');
56
+ if (fs.existsSync(claudePath)) {
57
+ const existing = fs.readFileSync(claudePath, 'utf8');
58
+ if (existing.includes('wiki/_snapshot.md')) {
59
+ console.log(`· CLAUDE.md already has wiki instructions — skipping`);
60
+ } else {
61
+ fs.appendFileSync(claudePath, '\n---\n' + WIKI_BLOCK);
62
+ console.log(`${G}✓${R} Appended wiki instructions to CLAUDE.md`);
63
+ }
64
+ } else {
65
+ fs.writeFileSync(claudePath, WIKI_BLOCK.trimStart());
66
+ console.log(`${G}✓${R} Created CLAUDE.md`);
67
+ }
68
+
69
+ // 3. Optional provider files — copy only if absent
70
+ for (const file of ['AGENTS.md', 'GEMINI.md', '.cursorrules']) {
71
+ const dest = path.join(DEST, file);
72
+ const src = path.join(PKG_ROOT, file);
73
+ if (fs.existsSync(src) && !fs.existsSync(dest)) {
74
+ fs.copyFileSync(src, dest);
75
+ console.log(`${G}✓${R} Created ${file}`);
76
+ } else if (fs.existsSync(dest)) {
77
+ console.log(`· ${file} already exists — skipping`);
78
+ }
79
+ }
80
+
81
+ console.log('');
82
+ console.log('Done. Next steps:');
83
+ console.log(' 1. Fill in wiki/_snapshot.md with your project state');
84
+ console.log(' 2. Start a Claude Code session — wiki bootstraps automatically');
85
+ console.log('');
86
+ console.log(`${Y}Tip:${R} install the CC plugin for slash commands (/wiki-lint, /wiki-update, /wiki-snapshot):`);
87
+ console.log(' /plugin marketplace add Alekra1/llm-wiki');
88
+ console.log(' /plugin install wiki@llm-wiki');
89
+ console.log('');
90
+ console.log(`Re-run anytime: npx @alekra1/llm-wiki`);
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@alekra1/llm-wiki",
3
+ "version": "1.0.0",
4
+ "description": "Markdown wiki template for LLM agent persistent memory. Gives agents cross-session, cross-provider memory.",
5
+ "bin": {
6
+ "llm-wiki": "bin/setup.js"
7
+ },
8
+ "files": [
9
+ "bin/",
10
+ "wiki/",
11
+ "CLAUDE.md",
12
+ "AGENTS.md",
13
+ "GEMINI.md",
14
+ ".cursorrules"
15
+ ],
16
+ "keywords": [
17
+ "llm",
18
+ "claude",
19
+ "agents",
20
+ "wiki",
21
+ "memory",
22
+ "context",
23
+ "claude-code"
24
+ ],
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/Alekra1/llm-wiki.git"
29
+ },
30
+ "engines": {
31
+ "node": ">=14"
32
+ }
33
+ }
@@ -0,0 +1,133 @@
1
+ # Examples
2
+
3
+ Canonical format examples for each wiki page type.
4
+ Copy these as starting points; replace the placeholder content.
5
+
6
+ ---
7
+
8
+ ## Decision page
9
+
10
+ File: `decisions/auth-strategy.md`
11
+
12
+ ---
13
+ type: decision
14
+ last_confirmed: 2026-05-11
15
+ ---
16
+
17
+ # Auth strategy
18
+
19
+ - 2026-04-15 — chose JWT (anticipated microservices split; stateless tokens fit that model)
20
+ - 2026-05-11 [SUPERSEDES above] — reverted to sessions + Redis. Reason: microservices split
21
+ was deprioritised; monolith for the foreseeable future. JWT added complexity (key rotation,
22
+ revocation) without benefit. Cookies + Redis are simpler and fully sufficient.
23
+
24
+ ---
25
+
26
+ ## Preference page
27
+
28
+ File: `preferences/tools.md`
29
+
30
+ ---
31
+ type: preference
32
+ last_confirmed: 2026-05-11
33
+ ---
34
+
35
+ # Tools preferences
36
+
37
+ - 2026-05-11 — use pnpm as package manager (faster installs, consistent lockfiles)
38
+ - 2026-05-20 [SUPERSEDES above] — switched to bun. Reason: bun's runtime speed matters
39
+ for this project's test suite; pnpm lockfile had repeated sync issues across machines.
40
+
41
+ ---
42
+
43
+ ## Workflow page
44
+
45
+ File: `workflows/deploy.md`
46
+
47
+ ---
48
+ type: workflow
49
+ last_confirmed: 2026-05-11
50
+ ---
51
+
52
+ # Deploy workflow
53
+
54
+ 1. Run `pnpm test` — confirm all passing.
55
+ 2. If schema changed: run `pnpm db:migrate` (check `git diff HEAD~1 -- migrations/`).
56
+ 3. Push to `main` — CI deploys to staging automatically.
57
+ 4. Verify staging at staging.example.com.
58
+ 5. Tag release: `git tag v<semver> && git push --tags`.
59
+ 6. CI promotes to production on tags automatically.
60
+
61
+ Pitfall: step 2 is easy to skip when no migration file is obviously new. Always check.
62
+
63
+ ---
64
+
65
+ ## Pitfall page
66
+
67
+ File: `pitfalls/build.md`
68
+
69
+ ---
70
+ type: pitfall
71
+ last_confirmed: 2026-05-11
72
+ ---
73
+
74
+ # Build failures
75
+
76
+ ## Schema not migrated before build
77
+
78
+ Symptom: build fails with "column X does not exist"
79
+ Fix: `pnpm db:migrate` then retry build
80
+ Root cause: type-check step queries the live schema; stale schema causes type errors.
81
+
82
+ ## Port conflict on dev start
83
+
84
+ Symptom: `EADDRINUSE :::3000`
85
+ Fix: `lsof -ti:3000 | xargs kill` then restart
86
+ Root cause: prior dev server not cleanly stopped.
87
+
88
+ ---
89
+
90
+ ## Log entries
91
+
92
+ File: `log.md` (append-only)
93
+
94
+ ## [2026-05-11 10:30] init | wiki initialized
95
+
96
+ Starting wiki. Populated starter pages. Active task: set up authentication flow.
97
+
98
+ ## [2026-05-11 14:22] decision | reverted JWT to sessions
99
+
100
+ See decisions/auth-strategy.md for full reasoning trace.
101
+
102
+ ## [2026-05-11 17:45] pitfall | build fails when migrations not applied
103
+
104
+ Added entry to pitfalls/build.md.
105
+
106
+ ## [2026-05-11 18:00] session-end | lint clean, 0 issues
107
+
108
+ No changes applied. Wiki state confirmed current.
109
+
110
+ ---
111
+
112
+ ## Active task page
113
+
114
+ File: `_active/now.md`
115
+
116
+ ---
117
+ type: active
118
+ last_confirmed: 2026-05-11
119
+ ---
120
+
121
+ # Current work
122
+
123
+ ## Active task
124
+
125
+ Implementing the password reset flow. Email sending works; token validation endpoint
126
+ in progress. Blocked on: deciding token expiry (1h vs 24h — see open-questions.md).
127
+
128
+ ## Context for next session
129
+
130
+ - File: `src/auth/reset.ts` — main implementation
131
+ - File: `src/email/templates/reset.html` — email template, done
132
+ - Decision needed: token expiry duration (open question)
133
+ - Do not restart the work on JWT — that decision is settled (see decisions/auth-strategy.md)
package/wiki/HOWTO.md ADDED
@@ -0,0 +1,194 @@
1
+ ---
2
+ purpose: agent-facing schema — read this before any other wiki file
3
+ version: 1.0
4
+ ---
5
+
6
+ # Wiki HOWTO
7
+
8
+ This wiki is the project's living context layer — preferences, decisions, workflows,
9
+ pitfalls, and active state accumulated across sessions and providers.
10
+
11
+ You maintain it. The human reads it. Read this file first; follow its rules exactly.
12
+
13
+ ---
14
+
15
+ ## Session start
16
+
17
+ Read in this order on every new session:
18
+
19
+ 1. `wiki/_snapshot.md` — compressed current-state summary; read this first for fast bootstrap
20
+ 2. `wiki/index.md` — catalog of all pages; find what is relevant to the current work
21
+ 3. `wiki/_active/now.md` — current task, blockers, in-flight state
22
+ 4. Last 10 entries of `wiki/log.md` — what happened recently
23
+
24
+ Drill into other pages only when relevant to the task at hand. The index is your map.
25
+
26
+ ---
27
+
28
+ ## During the session: when to write
29
+
30
+ Write to the wiki for **rules** — facts expected to hold across future sessions.
31
+ Do NOT write **observations** (one-off events, current conversation state) unless they
32
+ recur or the user explicitly elevates them.
33
+
34
+ | Signal | Where to write |
35
+ |--------|----------------|
36
+ | User states a preference ("I prefer X") | `preferences/` |
37
+ | A technical or design decision is made | `decisions/<topic>.md` |
38
+ | A workflow repeats more than once | `workflows/<topic>.md` |
39
+ | Something breaks and the fix is understood | `pitfalls/<area>.md` |
40
+ | Architecture insight that took effort to derive | `architecture/` |
41
+ | Current task / in-flight state changes | `_active/now.md` |
42
+ | Any of the above | also append to `log.md`; update `index.md` if new page |
43
+
44
+ **preferences/ vs decisions/**: use `preferences/` for *how the agent should behave* (tone, verbosity, tool choices). Use `decisions/` for *what the project should do* (architecture, library choices, data model). When a toolchain choice affects both (e.g. "use pnpm"), write a `decisions/` entry as the primary source; only add a `preferences/` entry if it also changes agent behavior (e.g. always use pnpm in commands).
45
+
46
+ **Closely related stack choices**: when a user states multiple related tech choices in one conversation (e.g. React + Vite + pnpm + Express), you may group them in a single `decisions/stack.md` rather than creating four thin files. The anti-bloat rule against `stack.md` applies to catch-all files that grow without discipline — a focused initial stack declaration is fine.
47
+
48
+ ---
49
+
50
+ ## The supersession rule (most important)
51
+
52
+ When new knowledge **contradicts** existing knowledge, **never delete the old entry**.
53
+ Append a dated revision block below it.
54
+
55
+ The reasoning trace — why we changed our mind — is the most valuable part of this wiki.
56
+
57
+ **Format:**
58
+
59
+ ```
60
+ - YYYY-MM-DD — [original claim] ([original reasoning])
61
+ - YYYY-MM-DD [SUPERSEDES above] — [new claim]. Reason: [why we changed].
62
+ ```
63
+
64
+ Multiple supersessions stack chronologically. The most recent entry reflects current truth.
65
+ Reading all entries shows how the project's thinking evolved.
66
+
67
+ **Same-session supersession**: if the user changes their mind within the same session, write only the final decision. Do not write the initial choice and immediately supersede it — that produces noise. The log entry can note the change: "user revised during session from X to Y."
68
+
69
+ **Read-before-write rule**: always read the current on-disk version of a file immediately before writing it — even if you read it earlier in the session. Another agent may have written it since. If the file now contains content you did not see, apply supersession rather than overwriting.
70
+
71
+ ---
72
+
73
+ ## Page format
74
+
75
+ Every wiki page uses lightweight YAML frontmatter:
76
+
77
+ ```yaml
78
+ ---
79
+ type: preference | decision | workflow | pitfall | architecture | active | snapshot
80
+ supersedes: <optional: path to prior page if this replaces another entirely>
81
+ ---
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Index discipline
87
+
88
+ `index.md` is the canonical catalog. Every page must appear there.
89
+
90
+ - When you **create** a page: add it to `index.md` immediately.
91
+ - When you **rename or delete** a page: update `index.md` immediately.
92
+
93
+ Format: `- [Page Title](relative/path.md) — one-line summary`
94
+
95
+ **Excluded from index tracking** (do not list, do not flag as orphans during lint):
96
+ - `wiki/README.md` — human-facing intro, not a content page
97
+ - `wiki/HOWTO.md` and `wiki/EXAMPLES.md` — schema files, listed separately under §Schema
98
+ - Any file named `EXAMPLE.md` — these are format templates, not content
99
+
100
+ ---
101
+
102
+ ## Log discipline
103
+
104
+ `log.md` is append-only. Never edit or delete existing entries.
105
+ Every wiki write gets a log entry.
106
+
107
+ **Format:**
108
+
109
+ ```
110
+ ## [YYYY-MM-DD HH:MM] <type> | <short description>
111
+
112
+ Optional 1-2 sentence detail if the change was complex.
113
+ ```
114
+
115
+ `HH:MM` is approximate — use your best estimate of the current time, or omit and use `00:00` if unknown.
116
+
117
+ Types: `init`, `preference`, `decision`, `workflow`, `pitfall`, `architecture`, `active`, `lint`, `session-end`
118
+
119
+ The prefix `## [YYYY-MM-DD` makes entries grep-able:
120
+ ```
121
+ grep "^## \[" wiki/log.md | tail -10
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Snapshot discipline
127
+
128
+ `_snapshot.md` is the L1 fast-bootstrap. Rewrite it at the end of every session.
129
+
130
+ **What belongs in the snapshot** (keep it to one screen):
131
+ - What the project is (one sentence)
132
+ - Current phase and active task
133
+ - Immediate next steps (3–5 ordered items)
134
+ - Critical constraints a fresh agent must not forget (3–5 bullets)
135
+ - Key open questions (link to `_active/open-questions.md` for detail)
136
+
137
+ **Rules**:
138
+ - Rewrite from scratch each time — do not append. It reflects current truth only.
139
+ - No log-style history; that belongs in `log.md`.
140
+ - If nothing changed this session, leave content as-is — git tracks when the file last changed.
141
+
142
+ ---
143
+
144
+ ## Lint (session end / on request)
145
+
146
+ When asked to lint the wiki, run this checklist in order:
147
+
148
+ 1. **Orphans** — pages not listed in `index.md`. Propose: add to index or delete.
149
+ 2. **Stale pages** — pages whose content appears outdated relative to current project state. Propose: update or archive.
150
+ 3. **Contradictions** — pages in the same category making opposing claims without supersession. Propose: merge with supersession block.
151
+ 4. **Duplicates** — overlapping content across separate pages. Propose: merge into one.
152
+ 5. **Empty templates** — placeholder pages never filled in. Propose: fill or delete.
153
+ 6. **Stale active items** — items in `_active/` that appear resolved. Propose: remove or graduate to `decisions/` or `workflows/`.
154
+
155
+ **Propose all changes. Apply only on user approval.**
156
+ After lint: rewrite `_snapshot.md` to reflect current state, then append a `session-end` entry to `log.md`.
157
+
158
+ ---
159
+
160
+ ## Non-CC environments
161
+
162
+ If slash commands (`/wiki-lint`, `/wiki-update`, `/wiki-snapshot`) are unavailable (Cursor, Gemini, Copilot, raw API), use these manual equivalents:
163
+
164
+ - Instead of `/wiki-update`: "Update the wiki with this decision per wiki/HOWTO.md routing table."
165
+ - Instead of `/wiki-lint`: "Run the 6-step lint checklist from wiki/HOWTO.md §Lint and report findings."
166
+ - Instead of `/wiki-snapshot`: "Rewrite wiki/_snapshot.md to reflect current project state."
167
+
168
+ Session-start and session-end hooks will not fire. The agent must follow the startup read sequence and end-of-session writes manually, guided by CLAUDE.md or AGENTS.md.
169
+
170
+ ---
171
+
172
+ ## Multi-agent safety
173
+
174
+ The wiki is designed for **one agent with exclusive access**. Concurrent agents are unsafe because:
175
+ - `decisions/` files: last writer silently overwrites; supersession rule requires reading before writing
176
+ - `index.md`: stale-read/write-back race can silently delete other agents' entries
177
+ - `log.md`: append-only; the only file safe for concurrent writes
178
+
179
+ If multiple agents write to the wiki:
180
+ 1. Apply the **read-before-write rule** strictly — read the file immediately before writing it.
181
+ 2. Include an agent identifier in log entries: `[agent-A] decision | ...`
182
+ 3. If you detect a conflict in a decisions/ file, apply supersession rather than overwriting.
183
+
184
+ ---
185
+
186
+ ## Anti-bloat principles
187
+
188
+ - Prefer editing existing pages over creating new ones.
189
+ - One page per concept — never two pages on the same topic.
190
+ - For `decisions/`: one file per discrete decision, named by noun (`decisions/orm.md`, `decisions/auth-strategy.md`). Do not create a catch-all `decisions/stack.md`.
191
+ - `_active/` is volatile: prune aggressively; nothing stays there more than a few sessions.
192
+ - When a blocker in `_active/now.md` resolves into a settled decision, remove it from the blockers list and create the corresponding `decisions/` page.
193
+ - When unsure whether to write: if it won't matter in a month, skip it.
194
+ - A page with many stacked supersessions is a candidate for a clean rewrite — propose it during lint.
package/wiki/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Project Wiki
2
+
3
+ This directory is the project's living knowledge base — its brain alongside the code body.
4
+
5
+ It is maintained entirely by the LLM agent. **You do not need to edit it yourself.**
6
+ Read it freely; let the agent write it.
7
+
8
+ ---
9
+
10
+ ## What's in here
11
+
12
+ | Path | Purpose |
13
+ |------|---------|
14
+ | `HOWTO.md` | Agent schema — how the wiki is read, written, and linted |
15
+ | `EXAMPLES.md` | Canonical format examples for each page type |
16
+ | `index.md` | Catalog of all pages (agent-maintained) |
17
+ | `log.md` | Chronological session log — append-only |
18
+ | `preferences/` | Your preferences for communication, tools, and code style |
19
+ | `workflows/` | How recurring tasks are done in this project |
20
+ | `decisions/` | Technical and design decisions with full reasoning traces |
21
+ | `pitfalls/` | Known failure modes and their fixes |
22
+ | `architecture/` | Structural knowledge that takes effort to re-derive |
23
+ | `_active/` | Current task and open questions — volatile, pruned often |
24
+
25
+ ---
26
+
27
+ ## How to adopt this in another project
28
+
29
+ 1. Copy this entire `wiki/` directory into your project's root.
30
+ 2. Copy the provider entry files from the repo root (`AGENTS.md`, `CLAUDE.md`, `.cursorrules`, `GEMINI.md`) to your project's root.
31
+ 3. Clear the placeholder example content, keeping directory structure and frontmatter templates.
32
+ 4. Start a new session. The agent will read the entry file automatically and bootstrap from the wiki.
33
+
34
+ ---
35
+
36
+ ## What NOT to do
37
+
38
+ - Don't manually edit `log.md` — it is append-only and the agent owns it.
39
+ - Don't delete pages to "fix" outdated information — tell the agent; it uses supersession.
40
+ - Don't store raw source documents here — the wiki holds synthesized knowledge only.
41
+ - Don't write pages yourself — tell the agent what was decided and let it write the page.
@@ -0,0 +1,19 @@
1
+ ---
2
+ type: active
3
+ ---
4
+
5
+ # Current work
6
+
7
+ ## Active task
8
+
9
+ <!-- What are we working on right now? Be specific enough that a fresh agent
10
+ can pick up without re-explanation. Include file paths if relevant. -->
11
+
12
+ ## Blockers
13
+
14
+ <!-- What is blocking progress? What decision is pending? -->
15
+
16
+ ## Context for next session
17
+
18
+ <!-- Critical: what must a fresh agent know immediately to avoid going in the wrong direction?
19
+ Keep this to 3-5 bullet points. Details live in decisions/ and architecture/. -->
@@ -0,0 +1,12 @@
1
+ ---
2
+ type: active
3
+ ---
4
+
5
+ # Open questions
6
+
7
+ Questions without answers yet. Graduate to `decisions/` once resolved.
8
+
9
+ <!-- Format:
10
+ - YYYY-MM-DD — [question] → status: open | investigating | resolved
11
+ [optional: relevant context or constraints]
12
+ -->
@@ -0,0 +1,28 @@
1
+ ---
2
+ type: snapshot
3
+ ---
4
+
5
+ # Project snapshot
6
+
7
+ <!-- Rewrite this entire file at the end of every session.
8
+ Keep it to one screen. This is the L1 fast-bootstrap: a fresh agent should read
9
+ this one file and have enough context to continue without reading anything else.
10
+ Fill in the real values below; delete these comments when done. -->
11
+
12
+ **What**: <!-- one sentence: what is this project and what does it do? -->
13
+
14
+ **Current phase**: <!-- e.g. "MVP in progress", "Phase 2 complete", "maintenance" -->
15
+
16
+ **Active task**: <!-- the single thing being worked on right now -->
17
+
18
+ **Immediate next steps** (in order):
19
+ 1. <!-- step 1 -->
20
+ 2. <!-- step 2 -->
21
+ 3. <!-- step 3 -->
22
+
23
+ **Critical context**:
24
+ - <!-- a key constraint, decision, or fact a fresh agent must not forget -->
25
+ - <!-- another critical fact — keep to 3–5 bullets -->
26
+
27
+ **Open questions** (see [_active/open-questions.md](_active/open-questions.md)):
28
+ - <!-- unresolved question, or "None currently." -->
@@ -0,0 +1,16 @@
1
+ ---
2
+ type: architecture
3
+ ---
4
+
5
+ # Architecture overview
6
+
7
+ <!-- High-level description of the project's architecture.
8
+ Updated as understanding deepens. Use supersession for significant changes.
9
+
10
+ Suggested sections:
11
+ - Tech stack (languages, frameworks, databases, infrastructure)
12
+ - Main modules / services and their responsibilities
13
+ - Key data flows
14
+ - External dependencies and why they were chosen
15
+ - What is intentionally NOT here (and why)
16
+ -->
@@ -0,0 +1,13 @@
1
+ ---
2
+ type: decision
3
+ ---
4
+
5
+ # [Decision topic]
6
+
7
+ <!-- One decision per file. Use the supersession format — never delete old entries.
8
+ See wiki/EXAMPLES.md for a full worked example.
9
+
10
+ Format:
11
+ - YYYY-MM-DD — [decision made] ([reasoning])
12
+ - YYYY-MM-DD [SUPERSEDES above] — [new decision]. Reason: [why changed].
13
+ -->
package/wiki/index.md ADDED
@@ -0,0 +1,45 @@
1
+ # Wiki index
2
+
3
+ Catalog of all wiki pages. Agent-maintained — updated on every page create or rename.
4
+
5
+ ---
6
+
7
+ ## Schema
8
+
9
+ - [HOWTO.md](HOWTO.md) — agent schema: how to read, write, and lint the wiki
10
+ - [EXAMPLES.md](EXAMPLES.md) — canonical format examples for each page type
11
+
12
+ ## Snapshot
13
+
14
+ - [_snapshot.md](_snapshot.md) — compressed current-state summary for fast session bootstrap
15
+
16
+ ## Preferences
17
+
18
+ - [preferences/communication.md](preferences/communication.md) — tone, verbosity, and formatting preferences
19
+ - [preferences/tools.md](preferences/tools.md) — package managers, shells, CLIs, and toolchain choices
20
+ - [preferences/style.md](preferences/style.md) — code style and naming conventions
21
+
22
+ ## Workflows
23
+
24
+ - [workflows/commit.md](workflows/commit.md) — commit message conventions
25
+
26
+ ## Decisions
27
+
28
+ *(none yet — entries added as decisions are made)*
29
+
30
+ ## Pitfalls
31
+
32
+ *(none yet — entries added as pitfalls are encountered and understood)*
33
+
34
+ ## Architecture
35
+
36
+ - [architecture/overview.md](architecture/overview.md) — high-level architecture overview
37
+
38
+ ## Active
39
+
40
+ - [_active/now.md](_active/now.md) — current task and blockers
41
+ - [_active/open-questions.md](_active/open-questions.md) — open questions pending resolution
42
+
43
+ ## Log
44
+
45
+ - [log.md](log.md) — chronological session log (append-only)
package/wiki/log.md ADDED
@@ -0,0 +1,14 @@
1
+ # Session log
2
+
3
+ Append-only. Never edit or delete existing entries.
4
+
5
+ Format: `## [YYYY-MM-DD HH:MM] <type> | <description>`
6
+ Types: `init`, `preference`, `decision`, `workflow`, `pitfall`, `architecture`, `active`, `lint`, `session-end`
7
+
8
+ Grep recent: `grep "^## \[" wiki/log.md | tail -10`
9
+
10
+ ---
11
+
12
+ ## [YYYY-MM-DD HH:MM] init | wiki initialized
13
+
14
+ Wiki structure created from llm-wiki template. Ready for project-specific content to be added as the project develops. Next session: read HOWTO.md and index.md to bootstrap.
@@ -0,0 +1,14 @@
1
+ ---
2
+ type: pitfall
3
+ ---
4
+
5
+ # [Area: build | tests | deploy | auth | ...]
6
+
7
+ <!-- Group related pitfalls in one file by area. Format per pitfall:
8
+
9
+ ## [Short name for the failure mode]
10
+
11
+ Symptom: [what you observe when it happens]
12
+ Fix: [the command or action that resolves it]
13
+ Root cause: [why it happens — helps recognize future variants]
14
+ -->
@@ -0,0 +1,12 @@
1
+ ---
2
+ type: preference
3
+ ---
4
+
5
+ # Communication preferences
6
+
7
+ How the agent should communicate: tone, response length, formatting, etc.
8
+
9
+ <!-- Add entries using the supersession format from wiki/EXAMPLES.md.
10
+ Example:
11
+ - 2026-05-11 — prefer terse responses; skip end-of-turn summaries; no emoji unless requested
12
+ -->
@@ -0,0 +1,13 @@
1
+ ---
2
+ type: preference
3
+ ---
4
+
5
+ # Code style preferences
6
+
7
+ Naming conventions, formatting rules, patterns to use or avoid.
8
+
9
+ <!-- Add entries using the supersession format from wiki/EXAMPLES.md.
10
+ Example:
11
+ - 2026-05-11 — TypeScript strict mode; no `any`; explicit return types on public functions
12
+ - 2026-05-11 — snake_case for database columns, camelCase for TypeScript identifiers
13
+ -->
@@ -0,0 +1,13 @@
1
+ ---
2
+ type: preference
3
+ ---
4
+
5
+ # Tools preferences
6
+
7
+ Package managers, shells, CLIs, editors, and other toolchain choices.
8
+
9
+ <!-- Add entries using the supersession format from wiki/EXAMPLES.md.
10
+ Example:
11
+ - 2026-05-11 — use bun as package manager and runtime (speed, built-in test runner)
12
+ - 2026-05-11 — use fish shell in terminal sessions
13
+ -->
@@ -0,0 +1,16 @@
1
+ ---
2
+ type: workflow
3
+ ---
4
+
5
+ # Commit workflow
6
+
7
+ How commits are structured and written in this project.
8
+
9
+ <!-- Populate this with your project's conventions. Example below.
10
+
11
+ - 2026-05-11 — conventional commits format: `<type>(<scope>): <description>`
12
+ Types: feat, fix, chore, refactor, docs, test
13
+ Example: `fix(auth): handle expired session tokens`
14
+ No emoji. Imperative present tense. Scope optional.
15
+ Each commit is a logical unit — squash fixups before merging.
16
+ -->