A sanitized, PII-free template for a file-based, agent-readable long-term memory system — a git folder of Markdown pages that AI coding agents (Claude Code, and optionally Codex CLI and Gemini CLI) read at session start and write to as canonical memory. Based on Karpathy's LLM Wiki pattern (https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f).
This repo contains only the reusable mechanisms — hooks, scripts, schema,
and protocols. It ships with no personal content: pages/ is empty,
index.md is a skeleton, and log.md has only its header.
Read SETUP.md — paste it into a fresh Claude Code session and it will diagnose your machine, interview you, and deploy the system. Or do it by hand:
git clone [TEMPLATE_REPO_URL] [WIKI_ROOT]
cd [WIKI_ROOT]
powershell -ExecutionPolicy Bypass -File .\scripts\bootstrap-windows.ps1
# or on macOS: bash scripts/bootstrap-macos.sh
The bootstrap script wires Claude session hooks into ~/.claude/settings.json,
registers scheduled compile/lint jobs, seeds ~/.claude/wiki-machine-id.txt with
this machine's hostname, seeds ~/.codex/AGENTS.md and ~/.gemini/GEMINI.md
SSOT pointers (only if absent), and creates an empty .state/compile-state.json.
wiki-template/
├── SETUP.md portable, interview-driven setup prompt (start here)
├── WIKI.md canonical schema + workflow + protocols
├── AGENTS.md canonical agent behaviour (Codex sources this directly)
├── CLAUDE.md thin @AGENTS.md wrapper for Claude
├── GEMINI.md Gemini-facing SSOT pointer
├── README.md this file
├── index.md catalog skeleton (empty section lists)
├── log.md append-only event journal (header only)
├── hooks/ Claude + Codex + Gemini session hooks (PowerShell)
├── scripts/ compile/lint/query/changes prompts; bootstrap + schedule;
│ new-project scaffolder; agent sync/precompute scripts
├── pages/ empty knowledge tree (people/projects/concepts/topics/
│ │ discussions), plus one neutral example page
│ └── concepts/_example.md
├── .state/ compile-state.json (empty watermarks) — usually gitignored
├── codex-wiki.{ps1,cmd}, gemini-wiki.{ps1,cmd} interactive launchers
├── .gitignore
└── .gitattributes
- Three layers:
raw/(immutable imports),.logs/daily/(immutable session traces),pages/(synthesized canonical knowledge). - Entry point:
index.md. Agents read it first and navigate on demand. - log.md: append-only table —
Agent | Machine | Date | Time | Op | Summary. - Compile turns daily logs + raw sources into pages on a schedule.
- Lint health-checks the wiki weekly.
- Behavioural-rule SSOT pattern: durable rules live in
pages/concepts/, with one-line pointers in user-level configs.
Full detail in WIKI.md.