{"slug": "llm-wiki-on-iwe-karpathy-s-pattern-with-deterministic-lint-link-safe-refactoring", "title": "LLM Wiki on IWE: Karpathy's pattern with deterministic lint, link-safe refactoring and an IDE that edits in place", "summary": "A developer released IWE, an open-source (Apache-2.0) CLI, MCP server and LSP for markdown folders, as a concrete implementation of Andrej Karpathy's LLM Wiki pattern. The fork replaces LLM-remembered bookkeeping with deterministic commands: `iwe schema validate` checks pages against frontmatter schemas, `iwe stats` lists orphan pages, `iwe rename` rewrites references to keep links intact, and `iwe find` supports BM25 lexical search and frontmatter/graph queries. The author notes the original pattern's index, orphan checks and cross-references \"depend on the LLM remembering to do them\" and start to slip past a few hundred pages.", "body_md": "A fork of Karpathy's LLM Wiki idea file. The original describes the pattern; this is one concrete way to run it, on [IWE](https://github.com/iwe-org/iwe) (open source, Apache-2.0: a CLI, an MCP server and an LSP for markdown folders). Disclosure: I wrote IWE.\n\nSame idea as the original: paste it into your agent (Claude Code, Codex, OpenCode, etc.) and build the specifics together.\n\nThe original sets it up as \"Obsidian is the IDE; the LLM is the programmer; the wiki is the codebase.\" All of that stays: raw sources, an LLM-owned wiki, a schema file, ingest / query / lint.\n\nWhat changes is the bookkeeping. In the original, the index, the orphan checks and the cross-references all depend on the LLM remembering to do them. That works for a while. Somewhere past a few hundred pages it starts to slip quietly: a renamed page leaves dead links, a new page never makes it into the index, a summary drops a field the others have. IWE turns those into commands the agent runs and checks the result of.\n\n- **index.md becomes inclusion links.** A link alone on its own line is a parent → child edge. An index or section page is just a list of those, and a page can have more than one parent.`iwe tree` prints the hierarchy;`iwe find --included-by wiki/concepts` lists one section.\n- **Lint becomes partly deterministic.**`iwe stats` lists orphan pages.`iwe schema validate` checks every page against a schema (required frontmatter fields, enum values, dates, which sections and in what order). The LLM still has to spot contradictions and stale claims; it no longer has to remember the structural checks.\n- **Refactoring keeps links intact.**`iwe rename old-key new-key` rewrites every reference to the page.`iwe extract` lifts a section into its own page and leaves a link behind.\n- **Dataview becomes a query.**`iwe find --filter '{type: entity}'` over frontmatter, plus graph relations (`--included-by` ,`--referenced-by` ). Same language from the CLI and from the MCP server.\n- **Search.**`iwe find --lexical \"query\"` is BM25 over titles and bodies. It is not semantic search; if you need vectors, qmd from the original still fits alongside.\n\n```\nbrew install iwe-org/iwe/iwe      # or: npm install -g @iwe-org/iwe, or cargo install iwe iwes iwec\nmkdir my-wiki && cd my-wiki && iwe init\n```\n\nGive the agent IWE's tools. For Claude Code:\n\n```\n/plugin marketplace add iwe-org/skills\n/plugin install iwe@iwe-org\n```\n\nFor Codex or any other MCP client, add the `iwec` MCP server with the wiki folder as its working directory ([agent connection guide](https://iwe.md/docs/agentic/)).\n\nLayout, same three layers as the original:\n\n```\nraw/                 immutable sources (the LLM reads, never writes)\nwiki/\n  index.md           inclusion links to the section pages\n  log.md             append-only, \"## [2026-10-04] ingest | Title\"\n  sources/  entities/  concepts/\nAGENTS.md            the schema (CLAUDE.md for Claude Code)\n.iwe/schemas/        page-type schemas, bound by glob in .iwe/config.toml\n```\n\nA page-type schema, for example for source summaries:\n\n```\n$schema: https://document-schema.org/draft/2026-06/schema\ndescription: a summary of one raw source\nfrontmatter:\n  type: object\n  required: [type, source, ingested]\n  properties:\n    type: { const: source }\n    source: { type: string }\n    ingested: { type: string, format: date }\n```\n\n**Ingest.** Same flow as the original. Two additions for the schema file: after writing pages, run `iwe schema validate` and fix what it reports; every new page gets an inclusion link from its section page, so nothing is created as an orphan.\n\n**Query.** Start from the index or `iwe find --lexical`, then pull a page with its children (` iwe retrieve -k <page> -d 1`). Good answers still get filed back as pages, linked from where they belong.\n\n**Lint.** `iwe stats` for orphans, `iwe schema validate` for shape, then the LLM pass for contradictions, stale claims and missing pages.\n\n**Log.** Unchanged. The grep trick from the original still works.\n\nThe original runs the agent in one window and Obsidian in the other. [iWe for Mac](https://github.com/iwe-org/iwe-mac/releases) puts them in one: it connects the Claude Code or Codex you already use, the agent sees the page you have open, its edits land in the document while you watch, and one ⌘Z undoes a whole run. Obsidian and your editor keep working on the same folder; there is nothing to import. The app is free, macOS 15+, and not open source (the CLI and MCP server are).\n\n- Contradictions and stale claims are judgment calls; the LLM still makes them.\n- A schema checks shape, not truth. A page can validate and still be wrong.\n- The index-in-context approach still has the same ceiling as in the original; past it, lean on queries instead of reading the index.\n\n```\nSet up an LLM Wiki in this folder using IWE: install it (brew install iwe-org/iwe/iwe),\nrun `iwe init`, create raw/ and wiki/ with index.md and log.md, and write an AGENTS.md\nthat describes ingest, query and lint using `iwe find`, `iwe retrieve`, `iwe stats` and\n`iwe schema validate`. Docs: https://iwe.md/docs/agentic/\n```\n\n", "url": "https://wpnews.pro/news/llm-wiki-on-iwe-karpathy-s-pattern-with-deterministic-lint-link-safe-refactoring", "canonical_source": "https://gist.github.com/gimalay/6415b269dd9188060c4ea60ede5eb7bb", "published_at": "2026-10-04 17:12:00+00:00", "updated_at": "2026-10-05 23:47:51.942005+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-tools", "developer-tools", "large-language-models"], "entities": ["IWE", "Andrej Karpathy", "Claude Code", "Codex", "OpenCode", "Obsidian", "qmd"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/llm-wiki-on-iwe-karpathy-s-pattern-with-deterministic-lint-link-safe-refactoring", "markdown": "https://wpnews.pro/news/llm-wiki-on-iwe-karpathy-s-pattern-with-deterministic-lint-link-safe-refactoring.md", "text": "https://wpnews.pro/news/llm-wiki-on-iwe-karpathy-s-pattern-with-deterministic-lint-link-safe-refactoring.txt", "jsonld": "https://wpnews.pro/news/llm-wiki-on-iwe-karpathy-s-pattern-with-deterministic-lint-link-safe-refactoring.jsonld"}}