RDF/XML serialization is deferred.
{
"@context": {
"schema": "https://schema.org/",
"wiki": "https://wazootech.github.io/wiki/",
"foaf": "http://xmlns.com/foaf/0.1/",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"owl": "http://www.w3.org/2002/07/owl#",
"dc": "http://purl.org/dc/elements/1.1/",
"dcterms": "http://purl.org/dc/terms/",
"sh": "http://www.w3.org/ns/shacl#",
"wazoo": "https://schema.wazoo.dev/"
},
"@id": "wiki:wiki",
"@type": "schema:SoftwareApplication",
"schema:articleBody": "# `wiki`\n\nThis page is the **documentation home** for **Wiki CLI** (`wiki`, distributed on npm as [**`wazootech-wiki`**](https://www.npmjs.com/package/wazootech-wiki)): the semantic knowledge **toolchain** for Markdown wikis — validate with [SHACL](SHACL.md) and JSON Schema, infer and query with [SPARQL](SPARQL.md), and publish static HTML. It compiles wikis into RDF and sits **beneath** note apps and LLM-assisted workflows — progressive enhancement, not a migration.\n\nWiki CLI is published on npm, PyPI, JSR, and GitHub Releases (standalone binaries). See [Getting Started](Getting_Started.md#install) for every channel. Install with npm or use a standalone executable:\n\n```bash\nnpm install -g wazootech-wiki\nwiki --help\n```\n\n## Quickstart\n\nInstall Wiki CLI and scaffold a wiki:\n\n```bash\nnpm install -g wazootech-wiki\nmkdir my-wiki && cd my-wiki\nwiki init\nwiki check\nwiki lint\nwiki serve\n```\n\nSee [Getting Started](Getting_Started.md) for a full walkthrough.\n\n## What wiki is\n\n- The **compiler / validator / query engine** for Markdown knowledge bases with semantic frontmatter\n- An **OOTB wiki builder** — links, navigation, SHACL and JSON Schema checks, SPARQL, and static HTML from a folder of `.md` files\n- A **memory layer** — ingest or watch an existing wiki without owning the editor\n- **Interop-first** — works alongside [Obsidian](Obsidian_Integration.md), [LLM Wiki](LLM_Wiki.md) setups, and any Markdown editor\n\nAdoption path: `wiki init` → `wiki check` → `wiki serve`, then add `lint`, `query`, `render`, and `build` as the wiki matures.\n\nWiki CLI is intentionally batteries-included for semantic Markdown wikis: validation, formatting, querying, rendering, exporting, building, and local preview belong together. The boundary is not \"minimal CLI only\"; the boundary is \"semantic wiki toolchain, not editor/app automation.\"\n\n## What wiki is not\n\n- The **primary editor** or daily note-taking surface\n- A **replacement** for Obsidian, Logseq, or another wiki UI\n- A **note app clone**, CMS, or authenticated multi-user web product\n- An **auth layer** — local-first CLI and static publish; see deferred scope in [Wiki CLI templates](#ecosystem-templates) below\n- A vault automation CLI for daily notes, note append/read workflows, task lists, tags, plugin development, or Obsidian app control\n- A replacement for shell tools, Git, Pandoc, or editor-native commands\n\nHumans and agents keep writing where they already write. `wiki` makes that content **trustworthy** (SHACL, JSON Schema, and conventions), **searchable** (SPARQL + OWL-RL), and **publishable** (static HTML, JSON-LD, Turtle, optional read-only SPARQL over `wiki serve`).\n\n## Memory layer and ingestion\n\nRather than owning your editor or data store, **Wiki** functions as a **read-only memory layer** over your wiki. It parses, indexes, and queries the Markdown documents on your filesystem without mutating them or locking you into a proprietary format.\n\n- **Ingestion:** The CLI reads YAML/JSON frontmatter and HTML microdata from your files, compiling them into an in-memory RDF graph that can be queried with SPARQL or verified against SHACL shapes and JSON Schema bindings.\n- **Watching:** Running `wiki serve --watch` instructs the CLI to watch the wiki directory. Any edits you make in your preferred editor are immediately processed, updating the graph in the background and keeping your preview server synchronized.\n\n## Toolchain vs authoring surface\n\n| Layer | Role | Examples |\n| ----------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------- |\n| Authoring surface | Create, edit, search, and organize notes | Obsidian CLI, Obsidian, VS Code, shell |\n| Wiki CLI semantic layer | Compile wiki → RDF graph; check, lint, fmt; query; render; build/serve | `wiki check`, `wiki query`, `wiki build` |\n| Existing primitives | History, sync, print/PDF, and generic text processing | Git, shell tools, Pandoc |\n| Outputs | Deployable semantic artifacts | GitHub Pages HTML, export files, `/api/sparql` when enabled |\n\nThis separation is intentional: the strongest differentiator is the **machine layer** (SHACL, OWL-RL, SPARQL, typed HTML) that most note apps do not provide. **Wiki** avoids competing with editor-centric tools while making incremental adoption obvious.\n\nWhen an existing primitive already owns a workflow, Wiki CLI integrates rather than replaces it. Obsidian CLI owns Obsidian app/vault automation; Git owns history and collaboration; shell tools own generic file/process composition; Pandoc and document tools own non-semantic document conversion.\n\n`wiki link --fix-broken` supports link hygiene for publishable wikis. `wiki link --apply` is optional wiki-gardening: useful when desired, but not required for validation, publishing, or Obsidian compatibility.\n\n## Interop-first workflows\n\n### Obsidian\n\nRun `wiki` against the folder that contains `wiki.yml` or `wiki.yaml`. Use Shell Commands for on-save `wiki check`, hotkey `wiki render`, or `wiki serve --watch` for preview. Details: [Obsidian integration](Obsidian_Integration.md) and [Dataview integration](Dataview_Integration.md).\n\n### LLM wikis\n\nTreat the wiki as a compounding codebase agents maintain over time. Structured frontmatter and link conventions make SPARQL and SHACL meaningful on agent output. Pattern overview: [LLM Wiki](LLM_Wiki.md).\n\n### Plain Markdown\n\nNo Obsidian or agent stack required. `wiki init` scaffolds a wiki; conventions are documented in [Style Guide](Style_Guide.md).\n\n## Three capabilities of the CLI\n\n| Capability | Commands | Value |\n| ------------ | ---------------------------------- | ------------------------------------------------------------------ |\n| Trust | `check`, `lint`, `fmt` | Integrity contracts and authoring conventions |\n| Intelligence | `query`, `mcp`, `render`, `export` | SPARQL, MCP graph access, inline result blocks, RDF serializations |\n| Publish | `build`, `serve`, `link` | Static site, local preview, wikilink hygiene |\n| Sources | `install`, `update`, `remove` | Fetch, lock, update, and manage external sources |\n| Provenance | `graph list` | Inspect read-only named graph boundaries |\n\nDesign rationale for silence, pipes, and flat subcommands: [Design philosophies](Design_Philosophies.md).\n\n## Ecosystem templates\n\nWiki CLI ships one starter template, [wikipedia](https://github.com/wazootech/wiki-templates/tree/main/templates/wikipedia) — a Wikipedia-themed static site built from Wiki CLI outputs. It sits at the edge of the toolchain (the publish surface) while Wiki CLI owns the semantic layer ([Design philosophies](Design_Philosophies.md)). It is one subdirectory of the [wiki-templates](https://github.com/wazootech/wiki-templates) repository, and this section is the canonical registry. Install it into an empty directory with [`wiki init --template <name>`](wiki_init.md):\n\n```sh\nwiki init --template wikipedia\n```\n\n| Template | Description |\n| -------------------------------------------------------------------------------------- | ---------------------------------------------------- |\n| [wikipedia](https://github.com/wazootech/wiki-templates/tree/main/templates/wikipedia) | Wikipedia-themed layout for Wiki CLI-generated sites |\n\nNew templates are not added to [wiki-templates](https://github.com/wazootech/wiki-templates): the other eleven were retired on 2026-10-14 ([#64](https://github.com/wazootech/wiki-templates/issues/64)). To propose an integration, [open an issue](https://github.com/wazootech/wiki/issues/new) here describing the tool it connects and the Wiki CLI outputs it consumes, following the boundary rule in the wiki-templates [contributing guide](https://github.com/wazootech/wiki-templates/blob/main/CONTRIBUTING.md).\n\n### Artifact contract\n\nExternal templates consume Wiki CLI outputs — they do not replace the compiler:\n\n- **`wiki.yml`** / **`wiki.yaml`** — config root; `wiki.input`, `graph.*`, `site.*`\n- **`wiki export`** — JSON-LD, Turtle, TriG, and other RDF serializations\n- **`wiki build`** — static HTML under `site.base_url`\n\n### Retired slugs\n\nDo not use these in new prose: `sparql-service-template` (→ the retired `yasgui` template); `wiki-virtuoso-template` (→ folded into `yasgui`); `wiki-obsidian-quartz-template`, `obsidian-quartz-template` (→ the retired `quartz` template); bare `nextjs-template`, `mintlify-template`, `astro-template`; and `wiki-template`, `llm-wiki-template`, `wiki-yasgui-template`, `wiki-nextjs-template`, `wiki-quartz-template`, `wiki-cocoindex-template`, `wiki-mintlify-template`, `wiki-astro-template`.\n\nThe `wiki-templates/templates/` subdirectories those names pointed at — `generic`, `llm-wiki`, `mintlify`, `holocron`, `astro`, `nextjs`, `quartz`, `cocoindex`, `yasgui`, `camunda`, and `workspace-cli` — were retired on 2026-10-14 with the reduction to one template ([#64](https://github.com/wazootech/wiki-templates/issues/64)). Those paths 404 now, so do not link them; `wikipedia` is the only template that exists.\n\n## Features\n\n- **Check** — SHACL and JSON Schema integrity, route safety, layout frontmatter ([wiki check](wiki_check.md))\n- **Lint** — broken links, filename pattern, and heading conventions ([wiki lint](wiki_lint.md))\n- **Link** — repair broken internal links and optionally insert suggested links as wiki-gardening ([wiki link](wiki_link.md))\n- **Fmt** — Deno Markdown formatter for markdown ([wiki fmt](wiki_fmt.md))\n- **Fix** — remove frontmatter that repeats the headline or Git dates the graph derives ([wiki fix](wiki_fix.md))\n- **Query** — SPARQL with OWL-RL and optional `--pretty` Rich tables ([wiki query](wiki_query.md), [Graph Cache](Graph_Cache.md))\n- **Graph list** — inspect root and source named graphs for SPARQL `GRAPH` provenance ([wiki graph](wiki_graph.md))\n- **MCP** — read-only query-first MCP server for local agents ([wiki mcp](wiki_mcp.md))\n- **Render** — live tables from inline SPARQL ([wiki render](wiki_render.md))\n- **Build / serve** — static site, local preview, and optional read-only SPARQL endpoint ([wiki build](wiki_build.md), [wiki serve](wiki_serve.md#sparql-endpoint))\n- **Export** — JSON-LD and RDF serializations ([wiki export](wiki_export.md))\n- **Install** — fetch and lock external data sources ([wiki install](wiki_install.md))\n- **Update** — check locked sources for newer commits ([wiki update](wiki_update.md))\n- **Remove** — delete a source from wiki.yml, cache, and lockfile ([wiki remove](wiki_remove.md))\n- **Init** — scaffold `wiki.yml` ([wiki init](wiki_init.md))\n- **Upgrade** — check for Wiki CLI releases ([wiki upgrade](wiki_upgrade.md)); steps aside with exit 0 when JSR cannot answer\n\n## Supported file formats\n\n### Input pipelines\n\nWiki CLI processes files through two distinct pipelines. Files in `wiki.input` are classified as either **documents** (frontmatter parsed, IRI derived from file path, link-checked) or **raw RDF sources** (parsed directly into the RDF graph, without document processing):\n\n| Category | Extensions | Pipeline | Key behavior |\n| ------------------- | -------------------------------------------------------- | ---------------------- | --------------------------------------------------------------------------------------------- |\n| Wiki documents | `.md`, `.yaml`, `.yml`, `.json`, `.toml` | Frontmatter → graph | Parsed for frontmatter/data; document IRI derived from file path; link-checked and exportable |\n| Data-only documents | `.yaml`, `.yml`, `.json`, `.toml` | Frontmatter → graph | Subset of wiki documents without a markdown body — entire file is the data dict |\n| Raw RDF sources | `.ttl`, `.trig`, `.nt`, `.nq`, `.rdf`, `.xml`, `.jsonld` | RDF/JS parsers → graph | Loaded as raw triples; no route, no link checking, no frontmatter pipeline |\n| Inline Turtle | Turtle-tagged code fence inside `.md` | RDF/JS parser → graph | Parsed and merged into the graph alongside document frontmatter |\n\n### Document pipeline\n\nMarkdown files are parsed via the [Linked Markdown](Linked_Markdown.md) protocol: the YAML/JSON frontmatter between `---` delimiters is extracted as the data dict, and the body text is optionally added to the graph via `content_predicate`. Data-only documents (`.yaml`, `.yml`, `.json`, `.toml`) skip the body split — the entire file is the data.\n\nEach typed document also gets `schema:headline` from its first `# H1` and `schema:dateCreated` / `schema:dateModified` from its Git history (or its modification time), unless its frontmatter sets them. These are derived in memory and never written back; see [wiki fix](wiki_fix.md#derived-metadata).\n\nAll document formats have their `@context` auto-populated with `wiki:` and `foaf:` default prefixes if none is present. An explicit `@id` or `id` key in frontmatter overrides the file-path-based IRI ([Linked Markdown](Linked_Markdown.md#subject-uri-resolution)).\n\n### Raw RDF pipeline\n\nFiles with raw RDF extensions are parsed by the Deno RDF/JS stack using the format mapped from their extension. They bypass document processing — no route registration, link validation, or frontmatter coercion. They contribute triples to the same graph but are invisible to `wiki export` (which operates on documents) and `wiki link`.\n\n**Important nuance:** `.jsonld` is raw RDF, not a wiki document. It does not get a document IRI or document-level context injection, and it is not subject to link checking. A `.json` file with the same content is a wiki document and follows the frontmatter pipeline. These are disjoint processing paths.\n\n### Output formats\n\n| Context | Formats |\n| ------------------------------------ | ------------------------------------------------------------------------------------- |\n| `wiki export` | `dict` (default), `json-ld`, `turtle`, `xml` (deferred), `n3`, `nt`, `trig`, `nquads` |\n| `wiki query` | `table` (default), `json`, `csv`, `tsv`, `turtle`, `n3`, `markdown` |\n| Repository docs-theme metadata panel | `json-ld`, `turtle`, `n3`, `nt`, `trig`, `nquads` |\n\n### Key nuances\n\n- **`.jsonld` vs `.json`** — Different pipelines for the same data shape. See raw RDF pipeline note above.\n- **N3 is output-only** — Notation3 (`.n3`) is available for `wiki export` and `wiki query` CONSTRUCT results but is not recognized as an input graph source extension.\n- **`@context` auto-injection** — Document files that lack an `@context` key get default `wiki:` and `foaf:` prefixes injected. If `@context` is present as a dict, those defaults are merged in.\n- **Only `.md` carries body text** — Data-only formats cannot carry a body literal in the graph; the entire file content is the data dict.\n- **Turtle-tagged code fences** — Markdown code fences tagged `turtle` are parsed as RDF and merged into the wiki graph. This is separate from SPARQL result blocks.\n- **`.toml` is a document format** — TOML files under `wiki.input` are treated as data-only wiki documents, subject to `@context` injection and route generation.\n\n### Related\n\n- [Linked Markdown](Linked_Markdown.md) — document-to-RDF protocol and IRI resolution\n- [RDF](RDF.md) — RDF data model and serialization references\n- Individual format pages: [Turtle](Turtle.md), [TriG](TriG.md), [N-Triples](N_Triples.md), [N-Quads](N_Quads.md), [RDF/XML](RDF_XML.md), [Notation3](Notation3.md), [JSON-LD](JSON_LD.md)\n\n## Agent skills\n\nProcedural knowledge for coding agents: [Wiki Skills](Wiki_Skills.md) (`skills/wiki/` in the repository).\n\n## Start here\n\n- [Getting Started](Getting_Started.md) — install, `wiki init`, first `check` and `serve`\n- [Wiki Configuration](Wiki_Configuration.md) — `wiki.yml` / `wiki.yaml` options\n- [Style Guide](Style_Guide.md) — frontmatter, shapes, internal links, SPARQL blocks\n- [Graph Cache](Graph_Cache.md) — in-process RDF graph reuse\n- [Design Philosophies](Design_Philosophies.md) — silence is golden, pipes, flat commands\n\n## Global Options\n\nThese options apply to all subcommands. Config-driven commands include `check`, `lint`, `link`, `query`, `mcp`, `render`, `build`, `export`, `serve`, `fmt`, `install`, `remove`, `update`, and `graph`; `init` and `upgrade` run with defaults when no config file exists.\n\n### `-c, --config PATH`\n\nPath to `wiki.yml`, `wiki.yaml`, `wiki.json`, or a directory containing one of those files. Defaults to the current directory (`.`).\n\nExample:\n\n```bash\nwiki -c docs/wiki.yml check\n```\n\n### `--input PATH` (repeatable)\n\nOverride or extend `wiki.input` from config for a single invocation. Relative paths resolve against the config file directory. Useful for one-off queries against a subdirectory.\n\nExample:\n\n```bash\nwiki --input ./wiki --input ./imported query \"SELECT * WHERE { ?s ?p ?o } LIMIT 5\"\n```\n\n## Command families\n\nThe commands fall into families by what they act on:\n\n| Family | Commands | What they share |\n| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |\n| Setup and tooling | [init](wiki_init.md), [upgrade](wiki_upgrade.md) | Start a project, or update the CLI itself. |\n| Sources | [install](wiki_install.md), [update](wiki_update.md), [remove](wiki_remove.md) | Manage external data sources and `wiki.lock`. |\n| Audits | [check](wiki_check.md), [lint](wiki_lint.md) | Read-only verification of integrity and conventions. |\n| Bulk fixers | [fmt](wiki_fmt.md), [fix](wiki_fix.md), [link](wiki_link.md), [render](wiki_render.md) | Rewrite files across the whole wiki. |\n| File edits | [file new](wiki_file_new.md), [file set](wiki_file_set.md), [file patch](wiki_file_patch.md), [file mv](wiki_file_mv.md), [file rm](wiki_file_rm.md), with [edit](wiki_edit.md) for batches | Validated, link-aware edits to wiki documents; dry run by default. |\n| File reads | [file show](wiki_file_show.md), [file refs](wiki_file_refs.md) | Inspect one wiki document file. |\n| Graph | [query](wiki_query.md), [graph](wiki_graph.md), [export](wiki_export.md) | The wiki as RDF: SPARQL, named graphs, and export. |\n| Publishing | [build](wiki_build.md), [serve](wiki_serve.md), [mcp](wiki_mcp.md) | Output surfaces: static site, local server, MCP server. |\n\nThe per-file verbs are grouped under [wiki file](wiki_file.md).\n\n## Command reference\n\nEach subcommand has a dedicated page:\n\n<!-- sparql:start\n```sparql\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX schema: <https://schema.org/>\n\nSELECT ?command ?description WHERE {\n ?command rdf:type schema:TechArticle .\n FILTER(STRSTARTS(STR(?command), \"https://wazootech.github.io/wiki/wiki_\"))\n OPTIONAL { ?command schema:description ?description }\n}\nORDER BY ?command\n```\n-->\n\n| command | description |\n| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |\n| [wiki_build](wiki_build.md) | Generate a static HTML site from the wiki. |\n| [wiki_check](wiki_check.md) | Integrity checks — SHACL validation, JSON Schema frontmatter, route safety, and layout frontmatter. |\n| [wiki_edit](wiki_edit.md) | Change a wiki through validated, atomic edits instead of hand-written Markdown. |\n| [wiki_export](wiki_export.md) | Export document frontmatter as RDF or JSON-LD. |\n| [wiki_file](wiki_file.md) | Create, change, move, delete, or inspect one wiki document file through validated, link-aware edits. |\n| [wiki_file_mv](wiki_file_mv.md) | Move or rename a page and repoint every link and metadata reference to it, as a validated edit. |\n| [wiki_file_new](wiki_file_new.md) | Create a page of a known type, with its required fields first, as a validated edit. |\n| [wiki_file_patch](wiki_file_patch.md) | Append to, prepend to, or replace a heading's section, the body, or the frontmatter, as a validated edit. |\n| [wiki_file_refs](wiki_file_refs.md) | List the pages that link to a page and the pages it links to. |\n| [wiki_file_rm](wiki_file_rm.md) | Delete a page, refusing while other pages link to it unless their links are pruned to plain text, as a validated edit. |\n| [wiki_file_set](wiki_file_set.md) | Set or remove one frontmatter field, keeping comments, key order, and value spelling, as a validated edit. |\n| [wiki_file_show](wiki_file_show.md) | Describe one page as the engine sees it, with the content hash an edit expects. |\n| [wiki_fix](wiki_fix.md) | Remove frontmatter that repeats a value the graph derives from the page's H1 or Git history. |\n| [wiki_fmt](wiki_fmt.md) | Format Markdown wiki pages with native Deno/dprint formatter options. |\n| [wiki_graph](wiki_graph.md) | List read-only RDF named graphs for root and installed source provenance. |\n| [wiki_init](wiki_init.md) | Scaffold wiki.yml and an empty wiki/ folder for markdown pages. |\n| [wiki_install](wiki_install.md) | Fetch and lock external data sources declared in wiki.yml. |\n| [wiki_link](wiki_link.md) | Suggest missing wikilinks and repair unambiguous broken internal links. |\n| [wiki_lint](wiki_lint.md) | Convention audits for broken links, filename patterns, heading style, and internal link style. |\n| [wiki_mcp](wiki_mcp.md) | Run an MCP server for querying the wiki graph, with opt-in page-edit tools. |\n| [wiki_query](wiki_query.md) | Run SPARQL SELECT or CONSTRUCT against the wiki graph. |\n| [wiki_remove](wiki_remove.md) | Remove a data source from wiki.yml, its cache, and wiki.lock. |\n| [wiki_render](wiki_render.md) | Update inline SPARQL result tables in markdown files. |\n| [wiki_serve](wiki_serve.md) | Local HTTP server for live HTML preview and optional read-only SPARQL endpoint. |\n| [wiki_update](wiki_update.md) | Check locked sources for newer commits and update wiki.lock. |\n| [wiki_upgrade](wiki_upgrade.md) | Check for Wiki CLI updates and upgrade supported installations. |\n\n<!-- sparql:end -->\n\nGlobal flags: `-c`, `--input`.\n\n## Publishing\n\n- [Deploying to GitHub Pages](Deploying_to_GitHub_Pages.md) — CI workflow for this site\n- [Obsidian Integration](Obsidian_Integration.md) — Shell Commands plugin workflows\n\n## Managing drift and schema evolution\n\nA common challenge in text-based memory bases is metadata drift—especially when files are updated programmatically by external LLM agents. The Wiki CLI provides two strategies to keep a compounding codebase clean over long periods:\n\n### Automated cleaning harness\n\nTo prevent drift mechanically, you can wire a local Git hook or CI workflow that executes the following checks in order:\n\n1. **[wiki fmt](wiki_fmt.md)**: Auto-formats Markdown structures and standardizes YAML frontmatter layout.\n1. **[wiki lint](wiki_lint.md) `--strict`**: Flags broken links, non-conforming filename patterns, and heading casing warnings as hard errors.\n1. **[wiki check](wiki_check.md) `--strict`**: Ensures frontmatter conforms to [SHACL](SHACL.md) shapes and bound JSON Schema documents (`wazoo:jsonSchema`).\n\n### Resilient schema evolution\n\nEnforcing schemas on text databases can become problematic as structures evolve. The Wiki CLI avoids schema rigidity using semantic web principles:\n\n- **Additive RDF properties**: Since frontmatter is compiled into a graph, new or unconstrained keys do not cause parsing failures. They are ingested as open-world triples that can be queried or ignored.\n- **Decoupled validation**: SHACL and JSON Schema validation are diagnostic steps, not execution blockers. Files with invalid schemas can still be compiled, parsed, and queried.\n- **Class-scoped shapes**: Shapes target specific classes (e.g., `sh:targetClass schema:TechArticle`). Introducing a new document type only requires writing a new shape constraint, leaving legacy documents untouched.\n- **Namespace contexts**: Properties map to URIs via `graph.context` in [Wiki Configuration](Wiki_Configuration.md). You can rename or alias fields at the config layer without physically editing every source document.\n\n## Design\n\nThe CLI follows a flat, scriptable surface and [Design Philosophies](Design_Philosophies.md) (silent success, composable stdout). For programmatic use from Node.js/TypeScript or directly from Deno, see [Wiki Programmatic API](Wiki_Programmatic_API.md).\n\n## Pattern context\n\nThis repository implements the [LLM Wiki](LLM_Wiki.md) pattern for [Personal Knowledge](Personal_Knowledge.md) wikis. Examples in the wild include [Farzapedia](Farzapedia.md) and coverage from Andrej Karpathy.\n\nSimilar **agent memory filesystem** approaches include [Supermemory SMFS](Supermemory_SMFS.md), [Letta MemFS](Letta_MemFS.md), and [Agent Memory Filesystems](Agent_Memory_Filesystems.md).\n\nFor a **standardized agent workspace** (thin governed contract, typed graph, verification gates), see [Vivary](Vivary.md).\n\n## Repository\n\n- Source and issues: [github.com/wazootech/wiki](https://github.com/wazootech/wiki)\n- [Wiki CLI templates](#ecosystem-templates) — all templates live in the [wiki-templates](https://github.com/wazootech/wiki-templates) monorepo\n\n## Background\n\n- [Semantic Web](Semantic_Web.md) — RDF, Turtle, OWL, and related formats\n- [Software Application Shape](Software_Application_Shape.md) — SHACL shape for `SoftwareApplication` pages (including this page)",
"schema:codeRepository": {
"@id": "https://github.com/wazootech/wiki"
},
"schema:dateCreated": {
"@type": "xsd:dateTime",
"@value": "2026-10-31T23:19:03Z"
},
"schema:dateModified": {
"@type": "xsd:dateTime",
"@value": "2026-10-31T23:19:03Z"
},
"schema:description": "Command-line interface for querying, validating, and publishing semantic markdown wikis.",
"schema:headline": "wiki",
"schema:name": "wiki",
"schema:softwareVersion": "0.7.0"
}
@prefix schema: <https://schema.org/>.
@prefix wiki: <https://wazootech.github.io/wiki/>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@prefix dcterms: <http://purl.org/dc/terms/>.
@prefix sh: <http://www.w3.org/ns/shacl#>.
@prefix wazoo: <https://schema.wazoo.dev/>.
wiki:wiki a schema:SoftwareApplication;
schema:name "wiki";
schema:softwareVersion "0.7.0";
schema:description "Command-line interface for querying, validating, and publishing semantic markdown wikis.";
schema:codeRepository <https://github.com/wazootech/wiki>;
schema:articleBody "# `wiki`\n\nThis page is the **documentation home** for **Wiki CLI** (`wiki`, distributed on npm as [**`wazootech-wiki`**](https://www.npmjs.com/package/wazootech-wiki)): the semantic knowledge **toolchain** for Markdown wikis — validate with [SHACL](SHACL.md) and JSON Schema, infer and query with [SPARQL](SPARQL.md), and publish static HTML. It compiles wikis into RDF and sits **beneath** note apps and LLM-assisted workflows — progressive enhancement, not a migration.\n\nWiki CLI is published on npm, PyPI, JSR, and GitHub Releases (standalone binaries). See [Getting Started](Getting_Started.md#install) for every channel. Install with npm or use a standalone executable:\n\n```bash\nnpm install -g wazootech-wiki\nwiki --help\n```\n\n## Quickstart\n\nInstall Wiki CLI and scaffold a wiki:\n\n```bash\nnpm install -g wazootech-wiki\nmkdir my-wiki && cd my-wiki\nwiki init\nwiki check\nwiki lint\nwiki serve\n```\n\nSee [Getting Started](Getting_Started.md) for a full walkthrough.\n\n## What wiki is\n\n- The **compiler / validator / query engine** for Markdown knowledge bases with semantic frontmatter\n- An **OOTB wiki builder** — links, navigation, SHACL and JSON Schema checks, SPARQL, and static HTML from a folder of `.md` files\n- A **memory layer** — ingest or watch an existing wiki without owning the editor\n- **Interop-first** — works alongside [Obsidian](Obsidian_Integration.md), [LLM Wiki](LLM_Wiki.md) setups, and any Markdown editor\n\nAdoption path: `wiki init` → `wiki check` → `wiki serve`, then add `lint`, `query`, `render`, and `build` as the wiki matures.\n\nWiki CLI is intentionally batteries-included for semantic Markdown wikis: validation, formatting, querying, rendering, exporting, building, and local preview belong together. The boundary is not \"minimal CLI only\"; the boundary is \"semantic wiki toolchain, not editor/app automation.\"\n\n## What wiki is not\n\n- The **primary editor** or daily note-taking surface\n- A **replacement** for Obsidian, Logseq, or another wiki UI\n- A **note app clone**, CMS, or authenticated multi-user web product\n- An **auth layer** — local-first CLI and static publish; see deferred scope in [Wiki CLI templates](#ecosystem-templates) below\n- A vault automation CLI for daily notes, note append/read workflows, task lists, tags, plugin development, or Obsidian app control\n- A replacement for shell tools, Git, Pandoc, or editor-native commands\n\nHumans and agents keep writing where they already write. `wiki` makes that content **trustworthy** (SHACL, JSON Schema, and conventions), **searchable** (SPARQL + OWL-RL), and **publishable** (static HTML, JSON-LD, Turtle, optional read-only SPARQL over `wiki serve`).\n\n## Memory layer and ingestion\n\nRather than owning your editor or data store, **Wiki** functions as a **read-only memory layer** over your wiki. It parses, indexes, and queries the Markdown documents on your filesystem without mutating them or locking you into a proprietary format.\n\n- **Ingestion:** The CLI reads YAML/JSON frontmatter and HTML microdata from your files, compiling them into an in-memory RDF graph that can be queried with SPARQL or verified against SHACL shapes and JSON Schema bindings.\n- **Watching:** Running `wiki serve --watch` instructs the CLI to watch the wiki directory. Any edits you make in your preferred editor are immediately processed, updating the graph in the background and keeping your preview server synchronized.\n\n## Toolchain vs authoring surface\n\n| Layer | Role | Examples |\n| ----------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------- |\n| Authoring surface | Create, edit, search, and organize notes | Obsidian CLI, Obsidian, VS Code, shell |\n| Wiki CLI semantic layer | Compile wiki → RDF graph; check, lint, fmt; query; render; build/serve | `wiki check`, `wiki query`, `wiki build` |\n| Existing primitives | History, sync, print/PDF, and generic text processing | Git, shell tools, Pandoc |\n| Outputs | Deployable semantic artifacts | GitHub Pages HTML, export files, `/api/sparql` when enabled |\n\nThis separation is intentional: the strongest differentiator is the **machine layer** (SHACL, OWL-RL, SPARQL, typed HTML) that most note apps do not provide. **Wiki** avoids competing with editor-centric tools while making incremental adoption obvious.\n\nWhen an existing primitive already owns a workflow, Wiki CLI integrates rather than replaces it. Obsidian CLI owns Obsidian app/vault automation; Git owns history and collaboration; shell tools own generic file/process composition; Pandoc and document tools own non-semantic document conversion.\n\n`wiki link --fix-broken` supports link hygiene for publishable wikis. `wiki link --apply` is optional wiki-gardening: useful when desired, but not required for validation, publishing, or Obsidian compatibility.\n\n## Interop-first workflows\n\n### Obsidian\n\nRun `wiki` against the folder that contains `wiki.yml` or `wiki.yaml`. Use Shell Commands for on-save `wiki check`, hotkey `wiki render`, or `wiki serve --watch` for preview. Details: [Obsidian integration](Obsidian_Integration.md) and [Dataview integration](Dataview_Integration.md).\n\n### LLM wikis\n\nTreat the wiki as a compounding codebase agents maintain over time. Structured frontmatter and link conventions make SPARQL and SHACL meaningful on agent output. Pattern overview: [LLM Wiki](LLM_Wiki.md).\n\n### Plain Markdown\n\nNo Obsidian or agent stack required. `wiki init` scaffolds a wiki; conventions are documented in [Style Guide](Style_Guide.md).\n\n## Three capabilities of the CLI\n\n| Capability | Commands | Value |\n| ------------ | ---------------------------------- | ------------------------------------------------------------------ |\n| Trust | `check`, `lint`, `fmt` | Integrity contracts and authoring conventions |\n| Intelligence | `query`, `mcp`, `render`, `export` | SPARQL, MCP graph access, inline result blocks, RDF serializations |\n| Publish | `build`, `serve`, `link` | Static site, local preview, wikilink hygiene |\n| Sources | `install`, `update`, `remove` | Fetch, lock, update, and manage external sources |\n| Provenance | `graph list` | Inspect read-only named graph boundaries |\n\nDesign rationale for silence, pipes, and flat subcommands: [Design philosophies](Design_Philosophies.md).\n\n## Ecosystem templates\n\nWiki CLI ships one starter template, [wikipedia](https://github.com/wazootech/wiki-templates/tree/main/templates/wikipedia) — a Wikipedia-themed static site built from Wiki CLI outputs. It sits at the edge of the toolchain (the publish surface) while Wiki CLI owns the semantic layer ([Design philosophies](Design_Philosophies.md)). It is one subdirectory of the [wiki-templates](https://github.com/wazootech/wiki-templates) repository, and this section is the canonical registry. Install it into an empty directory with [`wiki init --template <name>`](wiki_init.md):\n\n```sh\nwiki init --template wikipedia\n```\n\n| Template | Description |\n| -------------------------------------------------------------------------------------- | ---------------------------------------------------- |\n| [wikipedia](https://github.com/wazootech/wiki-templates/tree/main/templates/wikipedia) | Wikipedia-themed layout for Wiki CLI-generated sites |\n\nNew templates are not added to [wiki-templates](https://github.com/wazootech/wiki-templates): the other eleven were retired on 2026-10-14 ([#64](https://github.com/wazootech/wiki-templates/issues/64)). To propose an integration, [open an issue](https://github.com/wazootech/wiki/issues/new) here describing the tool it connects and the Wiki CLI outputs it consumes, following the boundary rule in the wiki-templates [contributing guide](https://github.com/wazootech/wiki-templates/blob/main/CONTRIBUTING.md).\n\n### Artifact contract\n\nExternal templates consume Wiki CLI outputs — they do not replace the compiler:\n\n- **`wiki.yml`** / **`wiki.yaml`** — config root; `wiki.input`, `graph.*`, `site.*`\n- **`wiki export`** — JSON-LD, Turtle, TriG, and other RDF serializations\n- **`wiki build`** — static HTML under `site.base_url`\n\n### Retired slugs\n\nDo not use these in new prose: `sparql-service-template` (→ the retired `yasgui` template); `wiki-virtuoso-template` (→ folded into `yasgui`); `wiki-obsidian-quartz-template`, `obsidian-quartz-template` (→ the retired `quartz` template); bare `nextjs-template`, `mintlify-template`, `astro-template`; and `wiki-template`, `llm-wiki-template`, `wiki-yasgui-template`, `wiki-nextjs-template`, `wiki-quartz-template`, `wiki-cocoindex-template`, `wiki-mintlify-template`, `wiki-astro-template`.\n\nThe `wiki-templates/templates/` subdirectories those names pointed at — `generic`, `llm-wiki`, `mintlify`, `holocron`, `astro`, `nextjs`, `quartz`, `cocoindex`, `yasgui`, `camunda`, and `workspace-cli` — were retired on 2026-10-14 with the reduction to one template ([#64](https://github.com/wazootech/wiki-templates/issues/64)). Those paths 404 now, so do not link them; `wikipedia` is the only template that exists.\n\n## Features\n\n- **Check** — SHACL and JSON Schema integrity, route safety, layout frontmatter ([wiki check](wiki_check.md))\n- **Lint** — broken links, filename pattern, and heading conventions ([wiki lint](wiki_lint.md))\n- **Link** — repair broken internal links and optionally insert suggested links as wiki-gardening ([wiki link](wiki_link.md))\n- **Fmt** — Deno Markdown formatter for markdown ([wiki fmt](wiki_fmt.md))\n- **Fix** — remove frontmatter that repeats the headline or Git dates the graph derives ([wiki fix](wiki_fix.md))\n- **Query** — SPARQL with OWL-RL and optional `--pretty` Rich tables ([wiki query](wiki_query.md), [Graph Cache](Graph_Cache.md))\n- **Graph list** — inspect root and source named graphs for SPARQL `GRAPH` provenance ([wiki graph](wiki_graph.md))\n- **MCP** — read-only query-first MCP server for local agents ([wiki mcp](wiki_mcp.md))\n- **Render** — live tables from inline SPARQL ([wiki render](wiki_render.md))\n- **Build / serve** — static site, local preview, and optional read-only SPARQL endpoint ([wiki build](wiki_build.md), [wiki serve](wiki_serve.md#sparql-endpoint))\n- **Export** — JSON-LD and RDF serializations ([wiki export](wiki_export.md))\n- **Install** — fetch and lock external data sources ([wiki install](wiki_install.md))\n- **Update** — check locked sources for newer commits ([wiki update](wiki_update.md))\n- **Remove** — delete a source from wiki.yml, cache, and lockfile ([wiki remove](wiki_remove.md))\n- **Init** — scaffold `wiki.yml` ([wiki init](wiki_init.md))\n- **Upgrade** — check for Wiki CLI releases ([wiki upgrade](wiki_upgrade.md)); steps aside with exit 0 when JSR cannot answer\n\n## Supported file formats\n\n### Input pipelines\n\nWiki CLI processes files through two distinct pipelines. Files in `wiki.input` are classified as either **documents** (frontmatter parsed, IRI derived from file path, link-checked) or **raw RDF sources** (parsed directly into the RDF graph, without document processing):\n\n| Category | Extensions | Pipeline | Key behavior |\n| ------------------- | -------------------------------------------------------- | ---------------------- | --------------------------------------------------------------------------------------------- |\n| Wiki documents | `.md`, `.yaml`, `.yml`, `.json`, `.toml` | Frontmatter → graph | Parsed for frontmatter/data; document IRI derived from file path; link-checked and exportable |\n| Data-only documents | `.yaml`, `.yml`, `.json`, `.toml` | Frontmatter → graph | Subset of wiki documents without a markdown body — entire file is the data dict |\n| Raw RDF sources | `.ttl`, `.trig`, `.nt`, `.nq`, `.rdf`, `.xml`, `.jsonld` | RDF/JS parsers → graph | Loaded as raw triples; no route, no link checking, no frontmatter pipeline |\n| Inline Turtle | Turtle-tagged code fence inside `.md` | RDF/JS parser → graph | Parsed and merged into the graph alongside document frontmatter |\n\n### Document pipeline\n\nMarkdown files are parsed via the [Linked Markdown](Linked_Markdown.md) protocol: the YAML/JSON frontmatter between `---` delimiters is extracted as the data dict, and the body text is optionally added to the graph via `content_predicate`. Data-only documents (`.yaml`, `.yml`, `.json`, `.toml`) skip the body split — the entire file is the data.\n\nEach typed document also gets `schema:headline` from its first `# H1` and `schema:dateCreated` / `schema:dateModified` from its Git history (or its modification time), unless its frontmatter sets them. These are derived in memory and never written back; see [wiki fix](wiki_fix.md#derived-metadata).\n\nAll document formats have their `@context` auto-populated with `wiki:` and `foaf:` default prefixes if none is present. An explicit `@id` or `id` key in frontmatter overrides the file-path-based IRI ([Linked Markdown](Linked_Markdown.md#subject-uri-resolution)).\n\n### Raw RDF pipeline\n\nFiles with raw RDF extensions are parsed by the Deno RDF/JS stack using the format mapped from their extension. They bypass document processing — no route registration, link validation, or frontmatter coercion. They contribute triples to the same graph but are invisible to `wiki export` (which operates on documents) and `wiki link`.\n\n**Important nuance:** `.jsonld` is raw RDF, not a wiki document. It does not get a document IRI or document-level context injection, and it is not subject to link checking. A `.json` file with the same content is a wiki document and follows the frontmatter pipeline. These are disjoint processing paths.\n\n### Output formats\n\n| Context | Formats |\n| ------------------------------------ | ------------------------------------------------------------------------------------- |\n| `wiki export` | `dict` (default), `json-ld`, `turtle`, `xml` (deferred), `n3`, `nt`, `trig`, `nquads` |\n| `wiki query` | `table` (default), `json`, `csv`, `tsv`, `turtle`, `n3`, `markdown` |\n| Repository docs-theme metadata panel | `json-ld`, `turtle`, `n3`, `nt`, `trig`, `nquads` |\n\n### Key nuances\n\n- **`.jsonld` vs `.json`** — Different pipelines for the same data shape. See raw RDF pipeline note above.\n- **N3 is output-only** — Notation3 (`.n3`) is available for `wiki export` and `wiki query` CONSTRUCT results but is not recognized as an input graph source extension.\n- **`@context` auto-injection** — Document files that lack an `@context` key get default `wiki:` and `foaf:` prefixes injected. If `@context` is present as a dict, those defaults are merged in.\n- **Only `.md` carries body text** — Data-only formats cannot carry a body literal in the graph; the entire file content is the data dict.\n- **Turtle-tagged code fences** — Markdown code fences tagged `turtle` are parsed as RDF and merged into the wiki graph. This is separate from SPARQL result blocks.\n- **`.toml` is a document format** — TOML files under `wiki.input` are treated as data-only wiki documents, subject to `@context` injection and route generation.\n\n### Related\n\n- [Linked Markdown](Linked_Markdown.md) — document-to-RDF protocol and IRI resolution\n- [RDF](RDF.md) — RDF data model and serialization references\n- Individual format pages: [Turtle](Turtle.md), [TriG](TriG.md), [N-Triples](N_Triples.md), [N-Quads](N_Quads.md), [RDF/XML](RDF_XML.md), [Notation3](Notation3.md), [JSON-LD](JSON_LD.md)\n\n## Agent skills\n\nProcedural knowledge for coding agents: [Wiki Skills](Wiki_Skills.md) (`skills/wiki/` in the repository).\n\n## Start here\n\n- [Getting Started](Getting_Started.md) — install, `wiki init`, first `check` and `serve`\n- [Wiki Configuration](Wiki_Configuration.md) — `wiki.yml` / `wiki.yaml` options\n- [Style Guide](Style_Guide.md) — frontmatter, shapes, internal links, SPARQL blocks\n- [Graph Cache](Graph_Cache.md) — in-process RDF graph reuse\n- [Design Philosophies](Design_Philosophies.md) — silence is golden, pipes, flat commands\n\n## Global Options\n\nThese options apply to all subcommands. Config-driven commands include `check`, `lint`, `link`, `query`, `mcp`, `render`, `build`, `export`, `serve`, `fmt`, `install`, `remove`, `update`, and `graph`; `init` and `upgrade` run with defaults when no config file exists.\n\n### `-c, --config PATH`\n\nPath to `wiki.yml`, `wiki.yaml`, `wiki.json`, or a directory containing one of those files. Defaults to the current directory (`.`).\n\nExample:\n\n```bash\nwiki -c docs/wiki.yml check\n```\n\n### `--input PATH` (repeatable)\n\nOverride or extend `wiki.input` from config for a single invocation. Relative paths resolve against the config file directory. Useful for one-off queries against a subdirectory.\n\nExample:\n\n```bash\nwiki --input ./wiki --input ./imported query \"SELECT * WHERE { ?s ?p ?o } LIMIT 5\"\n```\n\n## Command families\n\nThe commands fall into families by what they act on:\n\n| Family | Commands | What they share |\n| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |\n| Setup and tooling | [init](wiki_init.md), [upgrade](wiki_upgrade.md) | Start a project, or update the CLI itself. |\n| Sources | [install](wiki_install.md), [update](wiki_update.md), [remove](wiki_remove.md) | Manage external data sources and `wiki.lock`. |\n| Audits | [check](wiki_check.md), [lint](wiki_lint.md) | Read-only verification of integrity and conventions. |\n| Bulk fixers | [fmt](wiki_fmt.md), [fix](wiki_fix.md), [link](wiki_link.md), [render](wiki_render.md) | Rewrite files across the whole wiki. |\n| File edits | [file new](wiki_file_new.md), [file set](wiki_file_set.md), [file patch](wiki_file_patch.md), [file mv](wiki_file_mv.md), [file rm](wiki_file_rm.md), with [edit](wiki_edit.md) for batches | Validated, link-aware edits to wiki documents; dry run by default. |\n| File reads | [file show](wiki_file_show.md), [file refs](wiki_file_refs.md) | Inspect one wiki document file. |\n| Graph | [query](wiki_query.md), [graph](wiki_graph.md), [export](wiki_export.md) | The wiki as RDF: SPARQL, named graphs, and export. |\n| Publishing | [build](wiki_build.md), [serve](wiki_serve.md), [mcp](wiki_mcp.md) | Output surfaces: static site, local server, MCP server. |\n\nThe per-file verbs are grouped under [wiki file](wiki_file.md).\n\n## Command reference\n\nEach subcommand has a dedicated page:\n\n<!-- sparql:start\n```sparql\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX schema: <https://schema.org/>\n\nSELECT ?command ?description WHERE {\n ?command rdf:type schema:TechArticle .\n FILTER(STRSTARTS(STR(?command), \"https://wazootech.github.io/wiki/wiki_\"))\n OPTIONAL { ?command schema:description ?description }\n}\nORDER BY ?command\n```\n-->\n\n| command | description |\n| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |\n| [wiki_build](wiki_build.md) | Generate a static HTML site from the wiki. |\n| [wiki_check](wiki_check.md) | Integrity checks — SHACL validation, JSON Schema frontmatter, route safety, and layout frontmatter. |\n| [wiki_edit](wiki_edit.md) | Change a wiki through validated, atomic edits instead of hand-written Markdown. |\n| [wiki_export](wiki_export.md) | Export document frontmatter as RDF or JSON-LD. |\n| [wiki_file](wiki_file.md) | Create, change, move, delete, or inspect one wiki document file through validated, link-aware edits. |\n| [wiki_file_mv](wiki_file_mv.md) | Move or rename a page and repoint every link and metadata reference to it, as a validated edit. |\n| [wiki_file_new](wiki_file_new.md) | Create a page of a known type, with its required fields first, as a validated edit. |\n| [wiki_file_patch](wiki_file_patch.md) | Append to, prepend to, or replace a heading's section, the body, or the frontmatter, as a validated edit. |\n| [wiki_file_refs](wiki_file_refs.md) | List the pages that link to a page and the pages it links to. |\n| [wiki_file_rm](wiki_file_rm.md) | Delete a page, refusing while other pages link to it unless their links are pruned to plain text, as a validated edit. |\n| [wiki_file_set](wiki_file_set.md) | Set or remove one frontmatter field, keeping comments, key order, and value spelling, as a validated edit. |\n| [wiki_file_show](wiki_file_show.md) | Describe one page as the engine sees it, with the content hash an edit expects. |\n| [wiki_fix](wiki_fix.md) | Remove frontmatter that repeats a value the graph derives from the page's H1 or Git history. |\n| [wiki_fmt](wiki_fmt.md) | Format Markdown wiki pages with native Deno/dprint formatter options. |\n| [wiki_graph](wiki_graph.md) | List read-only RDF named graphs for root and installed source provenance. |\n| [wiki_init](wiki_init.md) | Scaffold wiki.yml and an empty wiki/ folder for markdown pages. |\n| [wiki_install](wiki_install.md) | Fetch and lock external data sources declared in wiki.yml. |\n| [wiki_link](wiki_link.md) | Suggest missing wikilinks and repair unambiguous broken internal links. |\n| [wiki_lint](wiki_lint.md) | Convention audits for broken links, filename patterns, heading style, and internal link style. |\n| [wiki_mcp](wiki_mcp.md) | Run an MCP server for querying the wiki graph, with opt-in page-edit tools. |\n| [wiki_query](wiki_query.md) | Run SPARQL SELECT or CONSTRUCT against the wiki graph. |\n| [wiki_remove](wiki_remove.md) | Remove a data source from wiki.yml, its cache, and wiki.lock. |\n| [wiki_render](wiki_render.md) | Update inline SPARQL result tables in markdown files. |\n| [wiki_serve](wiki_serve.md) | Local HTTP server for live HTML preview and optional read-only SPARQL endpoint. |\n| [wiki_update](wiki_update.md) | Check locked sources for newer commits and update wiki.lock. |\n| [wiki_upgrade](wiki_upgrade.md) | Check for Wiki CLI updates and upgrade supported installations. |\n\n<!-- sparql:end -->\n\nGlobal flags: `-c`, `--input`.\n\n## Publishing\n\n- [Deploying to GitHub Pages](Deploying_to_GitHub_Pages.md) — CI workflow for this site\n- [Obsidian Integration](Obsidian_Integration.md) — Shell Commands plugin workflows\n\n## Managing drift and schema evolution\n\nA common challenge in text-based memory bases is metadata drift—especially when files are updated programmatically by external LLM agents. The Wiki CLI provides two strategies to keep a compounding codebase clean over long periods:\n\n### Automated cleaning harness\n\nTo prevent drift mechanically, you can wire a local Git hook or CI workflow that executes the following checks in order:\n\n1. **[wiki fmt](wiki_fmt.md)**: Auto-formats Markdown structures and standardizes YAML frontmatter layout.\n1. **[wiki lint](wiki_lint.md) `--strict`**: Flags broken links, non-conforming filename patterns, and heading casing warnings as hard errors.\n1. **[wiki check](wiki_check.md) `--strict`**: Ensures frontmatter conforms to [SHACL](SHACL.md) shapes and bound JSON Schema documents (`wazoo:jsonSchema`).\n\n### Resilient schema evolution\n\nEnforcing schemas on text databases can become problematic as structures evolve. The Wiki CLI avoids schema rigidity using semantic web principles:\n\n- **Additive RDF properties**: Since frontmatter is compiled into a graph, new or unconstrained keys do not cause parsing failures. They are ingested as open-world triples that can be queried or ignored.\n- **Decoupled validation**: SHACL and JSON Schema validation are diagnostic steps, not execution blockers. Files with invalid schemas can still be compiled, parsed, and queried.\n- **Class-scoped shapes**: Shapes target specific classes (e.g., `sh:targetClass schema:TechArticle`). Introducing a new document type only requires writing a new shape constraint, leaving legacy documents untouched.\n- **Namespace contexts**: Properties map to URIs via `graph.context` in [Wiki Configuration](Wiki_Configuration.md). You can rename or alias fields at the config layer without physically editing every source document.\n\n## Design\n\nThe CLI follows a flat, scriptable surface and [Design Philosophies](Design_Philosophies.md) (silent success, composable stdout). For programmatic use from Node.js/TypeScript or directly from Deno, see [Wiki Programmatic API](Wiki_Programmatic_API.md).\n\n## Pattern context\n\nThis repository implements the [LLM Wiki](LLM_Wiki.md) pattern for [Personal Knowledge](Personal_Knowledge.md) wikis. Examples in the wild include [Farzapedia](Farzapedia.md) and coverage from Andrej Karpathy.\n\nSimilar **agent memory filesystem** approaches include [Supermemory SMFS](Supermemory_SMFS.md), [Letta MemFS](Letta_MemFS.md), and [Agent Memory Filesystems](Agent_Memory_Filesystems.md).\n\nFor a **standardized agent workspace** (thin governed contract, typed graph, verification gates), see [Vivary](Vivary.md).\n\n## Repository\n\n- Source and issues: [github.com/wazootech/wiki](https://github.com/wazootech/wiki)\n- [Wiki CLI templates](#ecosystem-templates) — all templates live in the [wiki-templates](https://github.com/wazootech/wiki-templates) monorepo\n\n## Background\n\n- [Semantic Web](Semantic_Web.md) — RDF, Turtle, OWL, and related formats\n- [Software Application Shape](Software_Application_Shape.md) — SHACL shape for `SoftwareApplication` pages (including this page)";
schema:headline "wiki";
schema:dateCreated "2026-10-31T23:19:03Z"^^xsd:dateTime;
schema:dateModified "2026-10-31T23:19:03Z"^^xsd:dateTime.
@prefix schema: <https://schema.org/>.
@prefix wiki: <https://wazootech.github.io/wiki/>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@prefix dcterms: <http://purl.org/dc/terms/>.
@prefix sh: <http://www.w3.org/ns/shacl#>.
@prefix wazoo: <https://schema.wazoo.dev/>.
wiki:wiki a schema:SoftwareApplication;
schema:name "wiki";
schema:softwareVersion "0.7.0";
schema:description "Command-line interface for querying, validating, and publishing semantic markdown wikis.";
schema:codeRepository <https://github.com/wazootech/wiki>;
schema:articleBody "# `wiki`\n\nThis page is the **documentation home** for **Wiki CLI** (`wiki`, distributed on npm as [**`wazootech-wiki`**](https://www.npmjs.com/package/wazootech-wiki)): the semantic knowledge **toolchain** for Markdown wikis — validate with [SHACL](SHACL.md) and JSON Schema, infer and query with [SPARQL](SPARQL.md), and publish static HTML. It compiles wikis into RDF and sits **beneath** note apps and LLM-assisted workflows — progressive enhancement, not a migration.\n\nWiki CLI is published on npm, PyPI, JSR, and GitHub Releases (standalone binaries). See [Getting Started](Getting_Started.md#install) for every channel. Install with npm or use a standalone executable:\n\n```bash\nnpm install -g wazootech-wiki\nwiki --help\n```\n\n## Quickstart\n\nInstall Wiki CLI and scaffold a wiki:\n\n```bash\nnpm install -g wazootech-wiki\nmkdir my-wiki && cd my-wiki\nwiki init\nwiki check\nwiki lint\nwiki serve\n```\n\nSee [Getting Started](Getting_Started.md) for a full walkthrough.\n\n## What wiki is\n\n- The **compiler / validator / query engine** for Markdown knowledge bases with semantic frontmatter\n- An **OOTB wiki builder** — links, navigation, SHACL and JSON Schema checks, SPARQL, and static HTML from a folder of `.md` files\n- A **memory layer** — ingest or watch an existing wiki without owning the editor\n- **Interop-first** — works alongside [Obsidian](Obsidian_Integration.md), [LLM Wiki](LLM_Wiki.md) setups, and any Markdown editor\n\nAdoption path: `wiki init` → `wiki check` → `wiki serve`, then add `lint`, `query`, `render`, and `build` as the wiki matures.\n\nWiki CLI is intentionally batteries-included for semantic Markdown wikis: validation, formatting, querying, rendering, exporting, building, and local preview belong together. The boundary is not \"minimal CLI only\"; the boundary is \"semantic wiki toolchain, not editor/app automation.\"\n\n## What wiki is not\n\n- The **primary editor** or daily note-taking surface\n- A **replacement** for Obsidian, Logseq, or another wiki UI\n- A **note app clone**, CMS, or authenticated multi-user web product\n- An **auth layer** — local-first CLI and static publish; see deferred scope in [Wiki CLI templates](#ecosystem-templates) below\n- A vault automation CLI for daily notes, note append/read workflows, task lists, tags, plugin development, or Obsidian app control\n- A replacement for shell tools, Git, Pandoc, or editor-native commands\n\nHumans and agents keep writing where they already write. `wiki` makes that content **trustworthy** (SHACL, JSON Schema, and conventions), **searchable** (SPARQL + OWL-RL), and **publishable** (static HTML, JSON-LD, Turtle, optional read-only SPARQL over `wiki serve`).\n\n## Memory layer and ingestion\n\nRather than owning your editor or data store, **Wiki** functions as a **read-only memory layer** over your wiki. It parses, indexes, and queries the Markdown documents on your filesystem without mutating them or locking you into a proprietary format.\n\n- **Ingestion:** The CLI reads YAML/JSON frontmatter and HTML microdata from your files, compiling them into an in-memory RDF graph that can be queried with SPARQL or verified against SHACL shapes and JSON Schema bindings.\n- **Watching:** Running `wiki serve --watch` instructs the CLI to watch the wiki directory. Any edits you make in your preferred editor are immediately processed, updating the graph in the background and keeping your preview server synchronized.\n\n## Toolchain vs authoring surface\n\n| Layer | Role | Examples |\n| ----------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------- |\n| Authoring surface | Create, edit, search, and organize notes | Obsidian CLI, Obsidian, VS Code, shell |\n| Wiki CLI semantic layer | Compile wiki → RDF graph; check, lint, fmt; query; render; build/serve | `wiki check`, `wiki query`, `wiki build` |\n| Existing primitives | History, sync, print/PDF, and generic text processing | Git, shell tools, Pandoc |\n| Outputs | Deployable semantic artifacts | GitHub Pages HTML, export files, `/api/sparql` when enabled |\n\nThis separation is intentional: the strongest differentiator is the **machine layer** (SHACL, OWL-RL, SPARQL, typed HTML) that most note apps do not provide. **Wiki** avoids competing with editor-centric tools while making incremental adoption obvious.\n\nWhen an existing primitive already owns a workflow, Wiki CLI integrates rather than replaces it. Obsidian CLI owns Obsidian app/vault automation; Git owns history and collaboration; shell tools own generic file/process composition; Pandoc and document tools own non-semantic document conversion.\n\n`wiki link --fix-broken` supports link hygiene for publishable wikis. `wiki link --apply` is optional wiki-gardening: useful when desired, but not required for validation, publishing, or Obsidian compatibility.\n\n## Interop-first workflows\n\n### Obsidian\n\nRun `wiki` against the folder that contains `wiki.yml` or `wiki.yaml`. Use Shell Commands for on-save `wiki check`, hotkey `wiki render`, or `wiki serve --watch` for preview. Details: [Obsidian integration](Obsidian_Integration.md) and [Dataview integration](Dataview_Integration.md).\n\n### LLM wikis\n\nTreat the wiki as a compounding codebase agents maintain over time. Structured frontmatter and link conventions make SPARQL and SHACL meaningful on agent output. Pattern overview: [LLM Wiki](LLM_Wiki.md).\n\n### Plain Markdown\n\nNo Obsidian or agent stack required. `wiki init` scaffolds a wiki; conventions are documented in [Style Guide](Style_Guide.md).\n\n## Three capabilities of the CLI\n\n| Capability | Commands | Value |\n| ------------ | ---------------------------------- | ------------------------------------------------------------------ |\n| Trust | `check`, `lint`, `fmt` | Integrity contracts and authoring conventions |\n| Intelligence | `query`, `mcp`, `render`, `export` | SPARQL, MCP graph access, inline result blocks, RDF serializations |\n| Publish | `build`, `serve`, `link` | Static site, local preview, wikilink hygiene |\n| Sources | `install`, `update`, `remove` | Fetch, lock, update, and manage external sources |\n| Provenance | `graph list` | Inspect read-only named graph boundaries |\n\nDesign rationale for silence, pipes, and flat subcommands: [Design philosophies](Design_Philosophies.md).\n\n## Ecosystem templates\n\nWiki CLI ships one starter template, [wikipedia](https://github.com/wazootech/wiki-templates/tree/main/templates/wikipedia) — a Wikipedia-themed static site built from Wiki CLI outputs. It sits at the edge of the toolchain (the publish surface) while Wiki CLI owns the semantic layer ([Design philosophies](Design_Philosophies.md)). It is one subdirectory of the [wiki-templates](https://github.com/wazootech/wiki-templates) repository, and this section is the canonical registry. Install it into an empty directory with [`wiki init --template <name>`](wiki_init.md):\n\n```sh\nwiki init --template wikipedia\n```\n\n| Template | Description |\n| -------------------------------------------------------------------------------------- | ---------------------------------------------------- |\n| [wikipedia](https://github.com/wazootech/wiki-templates/tree/main/templates/wikipedia) | Wikipedia-themed layout for Wiki CLI-generated sites |\n\nNew templates are not added to [wiki-templates](https://github.com/wazootech/wiki-templates): the other eleven were retired on 2026-10-14 ([#64](https://github.com/wazootech/wiki-templates/issues/64)). To propose an integration, [open an issue](https://github.com/wazootech/wiki/issues/new) here describing the tool it connects and the Wiki CLI outputs it consumes, following the boundary rule in the wiki-templates [contributing guide](https://github.com/wazootech/wiki-templates/blob/main/CONTRIBUTING.md).\n\n### Artifact contract\n\nExternal templates consume Wiki CLI outputs — they do not replace the compiler:\n\n- **`wiki.yml`** / **`wiki.yaml`** — config root; `wiki.input`, `graph.*`, `site.*`\n- **`wiki export`** — JSON-LD, Turtle, TriG, and other RDF serializations\n- **`wiki build`** — static HTML under `site.base_url`\n\n### Retired slugs\n\nDo not use these in new prose: `sparql-service-template` (→ the retired `yasgui` template); `wiki-virtuoso-template` (→ folded into `yasgui`); `wiki-obsidian-quartz-template`, `obsidian-quartz-template` (→ the retired `quartz` template); bare `nextjs-template`, `mintlify-template`, `astro-template`; and `wiki-template`, `llm-wiki-template`, `wiki-yasgui-template`, `wiki-nextjs-template`, `wiki-quartz-template`, `wiki-cocoindex-template`, `wiki-mintlify-template`, `wiki-astro-template`.\n\nThe `wiki-templates/templates/` subdirectories those names pointed at — `generic`, `llm-wiki`, `mintlify`, `holocron`, `astro`, `nextjs`, `quartz`, `cocoindex`, `yasgui`, `camunda`, and `workspace-cli` — were retired on 2026-10-14 with the reduction to one template ([#64](https://github.com/wazootech/wiki-templates/issues/64)). Those paths 404 now, so do not link them; `wikipedia` is the only template that exists.\n\n## Features\n\n- **Check** — SHACL and JSON Schema integrity, route safety, layout frontmatter ([wiki check](wiki_check.md))\n- **Lint** — broken links, filename pattern, and heading conventions ([wiki lint](wiki_lint.md))\n- **Link** — repair broken internal links and optionally insert suggested links as wiki-gardening ([wiki link](wiki_link.md))\n- **Fmt** — Deno Markdown formatter for markdown ([wiki fmt](wiki_fmt.md))\n- **Fix** — remove frontmatter that repeats the headline or Git dates the graph derives ([wiki fix](wiki_fix.md))\n- **Query** — SPARQL with OWL-RL and optional `--pretty` Rich tables ([wiki query](wiki_query.md), [Graph Cache](Graph_Cache.md))\n- **Graph list** — inspect root and source named graphs for SPARQL `GRAPH` provenance ([wiki graph](wiki_graph.md))\n- **MCP** — read-only query-first MCP server for local agents ([wiki mcp](wiki_mcp.md))\n- **Render** — live tables from inline SPARQL ([wiki render](wiki_render.md))\n- **Build / serve** — static site, local preview, and optional read-only SPARQL endpoint ([wiki build](wiki_build.md), [wiki serve](wiki_serve.md#sparql-endpoint))\n- **Export** — JSON-LD and RDF serializations ([wiki export](wiki_export.md))\n- **Install** — fetch and lock external data sources ([wiki install](wiki_install.md))\n- **Update** — check locked sources for newer commits ([wiki update](wiki_update.md))\n- **Remove** — delete a source from wiki.yml, cache, and lockfile ([wiki remove](wiki_remove.md))\n- **Init** — scaffold `wiki.yml` ([wiki init](wiki_init.md))\n- **Upgrade** — check for Wiki CLI releases ([wiki upgrade](wiki_upgrade.md)); steps aside with exit 0 when JSR cannot answer\n\n## Supported file formats\n\n### Input pipelines\n\nWiki CLI processes files through two distinct pipelines. Files in `wiki.input` are classified as either **documents** (frontmatter parsed, IRI derived from file path, link-checked) or **raw RDF sources** (parsed directly into the RDF graph, without document processing):\n\n| Category | Extensions | Pipeline | Key behavior |\n| ------------------- | -------------------------------------------------------- | ---------------------- | --------------------------------------------------------------------------------------------- |\n| Wiki documents | `.md`, `.yaml`, `.yml`, `.json`, `.toml` | Frontmatter → graph | Parsed for frontmatter/data; document IRI derived from file path; link-checked and exportable |\n| Data-only documents | `.yaml`, `.yml`, `.json`, `.toml` | Frontmatter → graph | Subset of wiki documents without a markdown body — entire file is the data dict |\n| Raw RDF sources | `.ttl`, `.trig`, `.nt`, `.nq`, `.rdf`, `.xml`, `.jsonld` | RDF/JS parsers → graph | Loaded as raw triples; no route, no link checking, no frontmatter pipeline |\n| Inline Turtle | Turtle-tagged code fence inside `.md` | RDF/JS parser → graph | Parsed and merged into the graph alongside document frontmatter |\n\n### Document pipeline\n\nMarkdown files are parsed via the [Linked Markdown](Linked_Markdown.md) protocol: the YAML/JSON frontmatter between `---` delimiters is extracted as the data dict, and the body text is optionally added to the graph via `content_predicate`. Data-only documents (`.yaml`, `.yml`, `.json`, `.toml`) skip the body split — the entire file is the data.\n\nEach typed document also gets `schema:headline` from its first `# H1` and `schema:dateCreated` / `schema:dateModified` from its Git history (or its modification time), unless its frontmatter sets them. These are derived in memory and never written back; see [wiki fix](wiki_fix.md#derived-metadata).\n\nAll document formats have their `@context` auto-populated with `wiki:` and `foaf:` default prefixes if none is present. An explicit `@id` or `id` key in frontmatter overrides the file-path-based IRI ([Linked Markdown](Linked_Markdown.md#subject-uri-resolution)).\n\n### Raw RDF pipeline\n\nFiles with raw RDF extensions are parsed by the Deno RDF/JS stack using the format mapped from their extension. They bypass document processing — no route registration, link validation, or frontmatter coercion. They contribute triples to the same graph but are invisible to `wiki export` (which operates on documents) and `wiki link`.\n\n**Important nuance:** `.jsonld` is raw RDF, not a wiki document. It does not get a document IRI or document-level context injection, and it is not subject to link checking. A `.json` file with the same content is a wiki document and follows the frontmatter pipeline. These are disjoint processing paths.\n\n### Output formats\n\n| Context | Formats |\n| ------------------------------------ | ------------------------------------------------------------------------------------- |\n| `wiki export` | `dict` (default), `json-ld`, `turtle`, `xml` (deferred), `n3`, `nt`, `trig`, `nquads` |\n| `wiki query` | `table` (default), `json`, `csv`, `tsv`, `turtle`, `n3`, `markdown` |\n| Repository docs-theme metadata panel | `json-ld`, `turtle`, `n3`, `nt`, `trig`, `nquads` |\n\n### Key nuances\n\n- **`.jsonld` vs `.json`** — Different pipelines for the same data shape. See raw RDF pipeline note above.\n- **N3 is output-only** — Notation3 (`.n3`) is available for `wiki export` and `wiki query` CONSTRUCT results but is not recognized as an input graph source extension.\n- **`@context` auto-injection** — Document files that lack an `@context` key get default `wiki:` and `foaf:` prefixes injected. If `@context` is present as a dict, those defaults are merged in.\n- **Only `.md` carries body text** — Data-only formats cannot carry a body literal in the graph; the entire file content is the data dict.\n- **Turtle-tagged code fences** — Markdown code fences tagged `turtle` are parsed as RDF and merged into the wiki graph. This is separate from SPARQL result blocks.\n- **`.toml` is a document format** — TOML files under `wiki.input` are treated as data-only wiki documents, subject to `@context` injection and route generation.\n\n### Related\n\n- [Linked Markdown](Linked_Markdown.md) — document-to-RDF protocol and IRI resolution\n- [RDF](RDF.md) — RDF data model and serialization references\n- Individual format pages: [Turtle](Turtle.md), [TriG](TriG.md), [N-Triples](N_Triples.md), [N-Quads](N_Quads.md), [RDF/XML](RDF_XML.md), [Notation3](Notation3.md), [JSON-LD](JSON_LD.md)\n\n## Agent skills\n\nProcedural knowledge for coding agents: [Wiki Skills](Wiki_Skills.md) (`skills/wiki/` in the repository).\n\n## Start here\n\n- [Getting Started](Getting_Started.md) — install, `wiki init`, first `check` and `serve`\n- [Wiki Configuration](Wiki_Configuration.md) — `wiki.yml` / `wiki.yaml` options\n- [Style Guide](Style_Guide.md) — frontmatter, shapes, internal links, SPARQL blocks\n- [Graph Cache](Graph_Cache.md) — in-process RDF graph reuse\n- [Design Philosophies](Design_Philosophies.md) — silence is golden, pipes, flat commands\n\n## Global Options\n\nThese options apply to all subcommands. Config-driven commands include `check`, `lint`, `link`, `query`, `mcp`, `render`, `build`, `export`, `serve`, `fmt`, `install`, `remove`, `update`, and `graph`; `init` and `upgrade` run with defaults when no config file exists.\n\n### `-c, --config PATH`\n\nPath to `wiki.yml`, `wiki.yaml`, `wiki.json`, or a directory containing one of those files. Defaults to the current directory (`.`).\n\nExample:\n\n```bash\nwiki -c docs/wiki.yml check\n```\n\n### `--input PATH` (repeatable)\n\nOverride or extend `wiki.input` from config for a single invocation. Relative paths resolve against the config file directory. Useful for one-off queries against a subdirectory.\n\nExample:\n\n```bash\nwiki --input ./wiki --input ./imported query \"SELECT * WHERE { ?s ?p ?o } LIMIT 5\"\n```\n\n## Command families\n\nThe commands fall into families by what they act on:\n\n| Family | Commands | What they share |\n| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |\n| Setup and tooling | [init](wiki_init.md), [upgrade](wiki_upgrade.md) | Start a project, or update the CLI itself. |\n| Sources | [install](wiki_install.md), [update](wiki_update.md), [remove](wiki_remove.md) | Manage external data sources and `wiki.lock`. |\n| Audits | [check](wiki_check.md), [lint](wiki_lint.md) | Read-only verification of integrity and conventions. |\n| Bulk fixers | [fmt](wiki_fmt.md), [fix](wiki_fix.md), [link](wiki_link.md), [render](wiki_render.md) | Rewrite files across the whole wiki. |\n| File edits | [file new](wiki_file_new.md), [file set](wiki_file_set.md), [file patch](wiki_file_patch.md), [file mv](wiki_file_mv.md), [file rm](wiki_file_rm.md), with [edit](wiki_edit.md) for batches | Validated, link-aware edits to wiki documents; dry run by default. |\n| File reads | [file show](wiki_file_show.md), [file refs](wiki_file_refs.md) | Inspect one wiki document file. |\n| Graph | [query](wiki_query.md), [graph](wiki_graph.md), [export](wiki_export.md) | The wiki as RDF: SPARQL, named graphs, and export. |\n| Publishing | [build](wiki_build.md), [serve](wiki_serve.md), [mcp](wiki_mcp.md) | Output surfaces: static site, local server, MCP server. |\n\nThe per-file verbs are grouped under [wiki file](wiki_file.md).\n\n## Command reference\n\nEach subcommand has a dedicated page:\n\n<!-- sparql:start\n```sparql\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX schema: <https://schema.org/>\n\nSELECT ?command ?description WHERE {\n ?command rdf:type schema:TechArticle .\n FILTER(STRSTARTS(STR(?command), \"https://wazootech.github.io/wiki/wiki_\"))\n OPTIONAL { ?command schema:description ?description }\n}\nORDER BY ?command\n```\n-->\n\n| command | description |\n| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |\n| [wiki_build](wiki_build.md) | Generate a static HTML site from the wiki. |\n| [wiki_check](wiki_check.md) | Integrity checks — SHACL validation, JSON Schema frontmatter, route safety, and layout frontmatter. |\n| [wiki_edit](wiki_edit.md) | Change a wiki through validated, atomic edits instead of hand-written Markdown. |\n| [wiki_export](wiki_export.md) | Export document frontmatter as RDF or JSON-LD. |\n| [wiki_file](wiki_file.md) | Create, change, move, delete, or inspect one wiki document file through validated, link-aware edits. |\n| [wiki_file_mv](wiki_file_mv.md) | Move or rename a page and repoint every link and metadata reference to it, as a validated edit. |\n| [wiki_file_new](wiki_file_new.md) | Create a page of a known type, with its required fields first, as a validated edit. |\n| [wiki_file_patch](wiki_file_patch.md) | Append to, prepend to, or replace a heading's section, the body, or the frontmatter, as a validated edit. |\n| [wiki_file_refs](wiki_file_refs.md) | List the pages that link to a page and the pages it links to. |\n| [wiki_file_rm](wiki_file_rm.md) | Delete a page, refusing while other pages link to it unless their links are pruned to plain text, as a validated edit. |\n| [wiki_file_set](wiki_file_set.md) | Set or remove one frontmatter field, keeping comments, key order, and value spelling, as a validated edit. |\n| [wiki_file_show](wiki_file_show.md) | Describe one page as the engine sees it, with the content hash an edit expects. |\n| [wiki_fix](wiki_fix.md) | Remove frontmatter that repeats a value the graph derives from the page's H1 or Git history. |\n| [wiki_fmt](wiki_fmt.md) | Format Markdown wiki pages with native Deno/dprint formatter options. |\n| [wiki_graph](wiki_graph.md) | List read-only RDF named graphs for root and installed source provenance. |\n| [wiki_init](wiki_init.md) | Scaffold wiki.yml and an empty wiki/ folder for markdown pages. |\n| [wiki_install](wiki_install.md) | Fetch and lock external data sources declared in wiki.yml. |\n| [wiki_link](wiki_link.md) | Suggest missing wikilinks and repair unambiguous broken internal links. |\n| [wiki_lint](wiki_lint.md) | Convention audits for broken links, filename patterns, heading style, and internal link style. |\n| [wiki_mcp](wiki_mcp.md) | Run an MCP server for querying the wiki graph, with opt-in page-edit tools. |\n| [wiki_query](wiki_query.md) | Run SPARQL SELECT or CONSTRUCT against the wiki graph. |\n| [wiki_remove](wiki_remove.md) | Remove a data source from wiki.yml, its cache, and wiki.lock. |\n| [wiki_render](wiki_render.md) | Update inline SPARQL result tables in markdown files. |\n| [wiki_serve](wiki_serve.md) | Local HTTP server for live HTML preview and optional read-only SPARQL endpoint. |\n| [wiki_update](wiki_update.md) | Check locked sources for newer commits and update wiki.lock. |\n| [wiki_upgrade](wiki_upgrade.md) | Check for Wiki CLI updates and upgrade supported installations. |\n\n<!-- sparql:end -->\n\nGlobal flags: `-c`, `--input`.\n\n## Publishing\n\n- [Deploying to GitHub Pages](Deploying_to_GitHub_Pages.md) — CI workflow for this site\n- [Obsidian Integration](Obsidian_Integration.md) — Shell Commands plugin workflows\n\n## Managing drift and schema evolution\n\nA common challenge in text-based memory bases is metadata drift—especially when files are updated programmatically by external LLM agents. The Wiki CLI provides two strategies to keep a compounding codebase clean over long periods:\n\n### Automated cleaning harness\n\nTo prevent drift mechanically, you can wire a local Git hook or CI workflow that executes the following checks in order:\n\n1. **[wiki fmt](wiki_fmt.md)**: Auto-formats Markdown structures and standardizes YAML frontmatter layout.\n1. **[wiki lint](wiki_lint.md) `--strict`**: Flags broken links, non-conforming filename patterns, and heading casing warnings as hard errors.\n1. **[wiki check](wiki_check.md) `--strict`**: Ensures frontmatter conforms to [SHACL](SHACL.md) shapes and bound JSON Schema documents (`wazoo:jsonSchema`).\n\n### Resilient schema evolution\n\nEnforcing schemas on text databases can become problematic as structures evolve. The Wiki CLI avoids schema rigidity using semantic web principles:\n\n- **Additive RDF properties**: Since frontmatter is compiled into a graph, new or unconstrained keys do not cause parsing failures. They are ingested as open-world triples that can be queried or ignored.\n- **Decoupled validation**: SHACL and JSON Schema validation are diagnostic steps, not execution blockers. Files with invalid schemas can still be compiled, parsed, and queried.\n- **Class-scoped shapes**: Shapes target specific classes (e.g., `sh:targetClass schema:TechArticle`). Introducing a new document type only requires writing a new shape constraint, leaving legacy documents untouched.\n- **Namespace contexts**: Properties map to URIs via `graph.context` in [Wiki Configuration](Wiki_Configuration.md). You can rename or alias fields at the config layer without physically editing every source document.\n\n## Design\n\nThe CLI follows a flat, scriptable surface and [Design Philosophies](Design_Philosophies.md) (silent success, composable stdout). For programmatic use from Node.js/TypeScript or directly from Deno, see [Wiki Programmatic API](Wiki_Programmatic_API.md).\n\n## Pattern context\n\nThis repository implements the [LLM Wiki](LLM_Wiki.md) pattern for [Personal Knowledge](Personal_Knowledge.md) wikis. Examples in the wild include [Farzapedia](Farzapedia.md) and coverage from Andrej Karpathy.\n\nSimilar **agent memory filesystem** approaches include [Supermemory SMFS](Supermemory_SMFS.md), [Letta MemFS](Letta_MemFS.md), and [Agent Memory Filesystems](Agent_Memory_Filesystems.md).\n\nFor a **standardized agent workspace** (thin governed contract, typed graph, verification gates), see [Vivary](Vivary.md).\n\n## Repository\n\n- Source and issues: [github.com/wazootech/wiki](https://github.com/wazootech/wiki)\n- [Wiki CLI templates](#ecosystem-templates) — all templates live in the [wiki-templates](https://github.com/wazootech/wiki-templates) monorepo\n\n## Background\n\n- [Semantic Web](Semantic_Web.md) — RDF, Turtle, OWL, and related formats\n- [Software Application Shape](Software_Application_Shape.md) — SHACL shape for `SoftwareApplication` pages (including this page)";
schema:headline "wiki";
schema:dateCreated "2026-10-31T23:19:03Z"^^xsd:dateTime;
schema:dateModified "2026-10-31T23:19:03Z"^^xsd:dateTime.
<https://wazootech.github.io/wiki/wiki> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://schema.org/SoftwareApplication> .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/name> "wiki" .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/softwareVersion> "0.7.0" .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/description> "Command-line interface for querying, validating, and publishing semantic markdown wikis." .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/codeRepository> <https://github.com/wazootech/wiki> .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/articleBody> "# `wiki`\n\nThis page is the **documentation home** for **Wiki CLI** (`wiki`, distributed on npm as [**`wazootech-wiki`**](https://www.npmjs.com/package/wazootech-wiki)): the semantic knowledge **toolchain** for Markdown wikis — validate with [SHACL](SHACL.md) and JSON Schema, infer and query with [SPARQL](SPARQL.md), and publish static HTML. It compiles wikis into RDF and sits **beneath** note apps and LLM-assisted workflows — progressive enhancement, not a migration.\n\nWiki CLI is published on npm, PyPI, JSR, and GitHub Releases (standalone binaries). See [Getting Started](Getting_Started.md#install) for every channel. Install with npm or use a standalone executable:\n\n```bash\nnpm install -g wazootech-wiki\nwiki --help\n```\n\n## Quickstart\n\nInstall Wiki CLI and scaffold a wiki:\n\n```bash\nnpm install -g wazootech-wiki\nmkdir my-wiki && cd my-wiki\nwiki init\nwiki check\nwiki lint\nwiki serve\n```\n\nSee [Getting Started](Getting_Started.md) for a full walkthrough.\n\n## What wiki is\n\n- The **compiler / validator / query engine** for Markdown knowledge bases with semantic frontmatter\n- An **OOTB wiki builder** — links, navigation, SHACL and JSON Schema checks, SPARQL, and static HTML from a folder of `.md` files\n- A **memory layer** — ingest or watch an existing wiki without owning the editor\n- **Interop-first** — works alongside [Obsidian](Obsidian_Integration.md), [LLM Wiki](LLM_Wiki.md) setups, and any Markdown editor\n\nAdoption path: `wiki init` → `wiki check` → `wiki serve`, then add `lint`, `query`, `render`, and `build` as the wiki matures.\n\nWiki CLI is intentionally batteries-included for semantic Markdown wikis: validation, formatting, querying, rendering, exporting, building, and local preview belong together. The boundary is not \"minimal CLI only\"; the boundary is \"semantic wiki toolchain, not editor/app automation.\"\n\n## What wiki is not\n\n- The **primary editor** or daily note-taking surface\n- A **replacement** for Obsidian, Logseq, or another wiki UI\n- A **note app clone**, CMS, or authenticated multi-user web product\n- An **auth layer** — local-first CLI and static publish; see deferred scope in [Wiki CLI templates](#ecosystem-templates) below\n- A vault automation CLI for daily notes, note append/read workflows, task lists, tags, plugin development, or Obsidian app control\n- A replacement for shell tools, Git, Pandoc, or editor-native commands\n\nHumans and agents keep writing where they already write. `wiki` makes that content **trustworthy** (SHACL, JSON Schema, and conventions), **searchable** (SPARQL + OWL-RL), and **publishable** (static HTML, JSON-LD, Turtle, optional read-only SPARQL over `wiki serve`).\n\n## Memory layer and ingestion\n\nRather than owning your editor or data store, **Wiki** functions as a **read-only memory layer** over your wiki. It parses, indexes, and queries the Markdown documents on your filesystem without mutating them or locking you into a proprietary format.\n\n- **Ingestion:** The CLI reads YAML/JSON frontmatter and HTML microdata from your files, compiling them into an in-memory RDF graph that can be queried with SPARQL or verified against SHACL shapes and JSON Schema bindings.\n- **Watching:** Running `wiki serve --watch` instructs the CLI to watch the wiki directory. Any edits you make in your preferred editor are immediately processed, updating the graph in the background and keeping your preview server synchronized.\n\n## Toolchain vs authoring surface\n\n| Layer | Role | Examples |\n| ----------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------- |\n| Authoring surface | Create, edit, search, and organize notes | Obsidian CLI, Obsidian, VS Code, shell |\n| Wiki CLI semantic layer | Compile wiki → RDF graph; check, lint, fmt; query; render; build/serve | `wiki check`, `wiki query`, `wiki build` |\n| Existing primitives | History, sync, print/PDF, and generic text processing | Git, shell tools, Pandoc |\n| Outputs | Deployable semantic artifacts | GitHub Pages HTML, export files, `/api/sparql` when enabled |\n\nThis separation is intentional: the strongest differentiator is the **machine layer** (SHACL, OWL-RL, SPARQL, typed HTML) that most note apps do not provide. **Wiki** avoids competing with editor-centric tools while making incremental adoption obvious.\n\nWhen an existing primitive already owns a workflow, Wiki CLI integrates rather than replaces it. Obsidian CLI owns Obsidian app/vault automation; Git owns history and collaboration; shell tools own generic file/process composition; Pandoc and document tools own non-semantic document conversion.\n\n`wiki link --fix-broken` supports link hygiene for publishable wikis. `wiki link --apply` is optional wiki-gardening: useful when desired, but not required for validation, publishing, or Obsidian compatibility.\n\n## Interop-first workflows\n\n### Obsidian\n\nRun `wiki` against the folder that contains `wiki.yml` or `wiki.yaml`. Use Shell Commands for on-save `wiki check`, hotkey `wiki render`, or `wiki serve --watch` for preview. Details: [Obsidian integration](Obsidian_Integration.md) and [Dataview integration](Dataview_Integration.md).\n\n### LLM wikis\n\nTreat the wiki as a compounding codebase agents maintain over time. Structured frontmatter and link conventions make SPARQL and SHACL meaningful on agent output. Pattern overview: [LLM Wiki](LLM_Wiki.md).\n\n### Plain Markdown\n\nNo Obsidian or agent stack required. `wiki init` scaffolds a wiki; conventions are documented in [Style Guide](Style_Guide.md).\n\n## Three capabilities of the CLI\n\n| Capability | Commands | Value |\n| ------------ | ---------------------------------- | ------------------------------------------------------------------ |\n| Trust | `check`, `lint`, `fmt` | Integrity contracts and authoring conventions |\n| Intelligence | `query`, `mcp`, `render`, `export` | SPARQL, MCP graph access, inline result blocks, RDF serializations |\n| Publish | `build`, `serve`, `link` | Static site, local preview, wikilink hygiene |\n| Sources | `install`, `update`, `remove` | Fetch, lock, update, and manage external sources |\n| Provenance | `graph list` | Inspect read-only named graph boundaries |\n\nDesign rationale for silence, pipes, and flat subcommands: [Design philosophies](Design_Philosophies.md).\n\n## Ecosystem templates\n\nWiki CLI ships one starter template, [wikipedia](https://github.com/wazootech/wiki-templates/tree/main/templates/wikipedia) — a Wikipedia-themed static site built from Wiki CLI outputs. It sits at the edge of the toolchain (the publish surface) while Wiki CLI owns the semantic layer ([Design philosophies](Design_Philosophies.md)). It is one subdirectory of the [wiki-templates](https://github.com/wazootech/wiki-templates) repository, and this section is the canonical registry. Install it into an empty directory with [`wiki init --template <name>`](wiki_init.md):\n\n```sh\nwiki init --template wikipedia\n```\n\n| Template | Description |\n| -------------------------------------------------------------------------------------- | ---------------------------------------------------- |\n| [wikipedia](https://github.com/wazootech/wiki-templates/tree/main/templates/wikipedia) | Wikipedia-themed layout for Wiki CLI-generated sites |\n\nNew templates are not added to [wiki-templates](https://github.com/wazootech/wiki-templates): the other eleven were retired on 2026-10-14 ([#64](https://github.com/wazootech/wiki-templates/issues/64)). To propose an integration, [open an issue](https://github.com/wazootech/wiki/issues/new) here describing the tool it connects and the Wiki CLI outputs it consumes, following the boundary rule in the wiki-templates [contributing guide](https://github.com/wazootech/wiki-templates/blob/main/CONTRIBUTING.md).\n\n### Artifact contract\n\nExternal templates consume Wiki CLI outputs — they do not replace the compiler:\n\n- **`wiki.yml`** / **`wiki.yaml`** — config root; `wiki.input`, `graph.*`, `site.*`\n- **`wiki export`** — JSON-LD, Turtle, TriG, and other RDF serializations\n- **`wiki build`** — static HTML under `site.base_url`\n\n### Retired slugs\n\nDo not use these in new prose: `sparql-service-template` (→ the retired `yasgui` template); `wiki-virtuoso-template` (→ folded into `yasgui`); `wiki-obsidian-quartz-template`, `obsidian-quartz-template` (→ the retired `quartz` template); bare `nextjs-template`, `mintlify-template`, `astro-template`; and `wiki-template`, `llm-wiki-template`, `wiki-yasgui-template`, `wiki-nextjs-template`, `wiki-quartz-template`, `wiki-cocoindex-template`, `wiki-mintlify-template`, `wiki-astro-template`.\n\nThe `wiki-templates/templates/` subdirectories those names pointed at — `generic`, `llm-wiki`, `mintlify`, `holocron`, `astro`, `nextjs`, `quartz`, `cocoindex`, `yasgui`, `camunda`, and `workspace-cli` — were retired on 2026-10-14 with the reduction to one template ([#64](https://github.com/wazootech/wiki-templates/issues/64)). Those paths 404 now, so do not link them; `wikipedia` is the only template that exists.\n\n## Features\n\n- **Check** — SHACL and JSON Schema integrity, route safety, layout frontmatter ([wiki check](wiki_check.md))\n- **Lint** — broken links, filename pattern, and heading conventions ([wiki lint](wiki_lint.md))\n- **Link** — repair broken internal links and optionally insert suggested links as wiki-gardening ([wiki link](wiki_link.md))\n- **Fmt** — Deno Markdown formatter for markdown ([wiki fmt](wiki_fmt.md))\n- **Fix** — remove frontmatter that repeats the headline or Git dates the graph derives ([wiki fix](wiki_fix.md))\n- **Query** — SPARQL with OWL-RL and optional `--pretty` Rich tables ([wiki query](wiki_query.md), [Graph Cache](Graph_Cache.md))\n- **Graph list** — inspect root and source named graphs for SPARQL `GRAPH` provenance ([wiki graph](wiki_graph.md))\n- **MCP** — read-only query-first MCP server for local agents ([wiki mcp](wiki_mcp.md))\n- **Render** — live tables from inline SPARQL ([wiki render](wiki_render.md))\n- **Build / serve** — static site, local preview, and optional read-only SPARQL endpoint ([wiki build](wiki_build.md), [wiki serve](wiki_serve.md#sparql-endpoint))\n- **Export** — JSON-LD and RDF serializations ([wiki export](wiki_export.md))\n- **Install** — fetch and lock external data sources ([wiki install](wiki_install.md))\n- **Update** — check locked sources for newer commits ([wiki update](wiki_update.md))\n- **Remove** — delete a source from wiki.yml, cache, and lockfile ([wiki remove](wiki_remove.md))\n- **Init** — scaffold `wiki.yml` ([wiki init](wiki_init.md))\n- **Upgrade** — check for Wiki CLI releases ([wiki upgrade](wiki_upgrade.md)); steps aside with exit 0 when JSR cannot answer\n\n## Supported file formats\n\n### Input pipelines\n\nWiki CLI processes files through two distinct pipelines. Files in `wiki.input` are classified as either **documents** (frontmatter parsed, IRI derived from file path, link-checked) or **raw RDF sources** (parsed directly into the RDF graph, without document processing):\n\n| Category | Extensions | Pipeline | Key behavior |\n| ------------------- | -------------------------------------------------------- | ---------------------- | --------------------------------------------------------------------------------------------- |\n| Wiki documents | `.md`, `.yaml`, `.yml`, `.json`, `.toml` | Frontmatter → graph | Parsed for frontmatter/data; document IRI derived from file path; link-checked and exportable |\n| Data-only documents | `.yaml`, `.yml`, `.json`, `.toml` | Frontmatter → graph | Subset of wiki documents without a markdown body — entire file is the data dict |\n| Raw RDF sources | `.ttl`, `.trig`, `.nt`, `.nq`, `.rdf`, `.xml`, `.jsonld` | RDF/JS parsers → graph | Loaded as raw triples; no route, no link checking, no frontmatter pipeline |\n| Inline Turtle | Turtle-tagged code fence inside `.md` | RDF/JS parser → graph | Parsed and merged into the graph alongside document frontmatter |\n\n### Document pipeline\n\nMarkdown files are parsed via the [Linked Markdown](Linked_Markdown.md) protocol: the YAML/JSON frontmatter between `---` delimiters is extracted as the data dict, and the body text is optionally added to the graph via `content_predicate`. Data-only documents (`.yaml`, `.yml`, `.json`, `.toml`) skip the body split — the entire file is the data.\n\nEach typed document also gets `schema:headline` from its first `# H1` and `schema:dateCreated` / `schema:dateModified` from its Git history (or its modification time), unless its frontmatter sets them. These are derived in memory and never written back; see [wiki fix](wiki_fix.md#derived-metadata).\n\nAll document formats have their `@context` auto-populated with `wiki:` and `foaf:` default prefixes if none is present. An explicit `@id` or `id` key in frontmatter overrides the file-path-based IRI ([Linked Markdown](Linked_Markdown.md#subject-uri-resolution)).\n\n### Raw RDF pipeline\n\nFiles with raw RDF extensions are parsed by the Deno RDF/JS stack using the format mapped from their extension. They bypass document processing — no route registration, link validation, or frontmatter coercion. They contribute triples to the same graph but are invisible to `wiki export` (which operates on documents) and `wiki link`.\n\n**Important nuance:** `.jsonld` is raw RDF, not a wiki document. It does not get a document IRI or document-level context injection, and it is not subject to link checking. A `.json` file with the same content is a wiki document and follows the frontmatter pipeline. These are disjoint processing paths.\n\n### Output formats\n\n| Context | Formats |\n| ------------------------------------ | ------------------------------------------------------------------------------------- |\n| `wiki export` | `dict` (default), `json-ld`, `turtle`, `xml` (deferred), `n3`, `nt`, `trig`, `nquads` |\n| `wiki query` | `table` (default), `json`, `csv`, `tsv`, `turtle`, `n3`, `markdown` |\n| Repository docs-theme metadata panel | `json-ld`, `turtle`, `n3`, `nt`, `trig`, `nquads` |\n\n### Key nuances\n\n- **`.jsonld` vs `.json`** — Different pipelines for the same data shape. See raw RDF pipeline note above.\n- **N3 is output-only** — Notation3 (`.n3`) is available for `wiki export` and `wiki query` CONSTRUCT results but is not recognized as an input graph source extension.\n- **`@context` auto-injection** — Document files that lack an `@context` key get default `wiki:` and `foaf:` prefixes injected. If `@context` is present as a dict, those defaults are merged in.\n- **Only `.md` carries body text** — Data-only formats cannot carry a body literal in the graph; the entire file content is the data dict.\n- **Turtle-tagged code fences** — Markdown code fences tagged `turtle` are parsed as RDF and merged into the wiki graph. This is separate from SPARQL result blocks.\n- **`.toml` is a document format** — TOML files under `wiki.input` are treated as data-only wiki documents, subject to `@context` injection and route generation.\n\n### Related\n\n- [Linked Markdown](Linked_Markdown.md) — document-to-RDF protocol and IRI resolution\n- [RDF](RDF.md) — RDF data model and serialization references\n- Individual format pages: [Turtle](Turtle.md), [TriG](TriG.md), [N-Triples](N_Triples.md), [N-Quads](N_Quads.md), [RDF/XML](RDF_XML.md), [Notation3](Notation3.md), [JSON-LD](JSON_LD.md)\n\n## Agent skills\n\nProcedural knowledge for coding agents: [Wiki Skills](Wiki_Skills.md) (`skills/wiki/` in the repository).\n\n## Start here\n\n- [Getting Started](Getting_Started.md) — install, `wiki init`, first `check` and `serve`\n- [Wiki Configuration](Wiki_Configuration.md) — `wiki.yml` / `wiki.yaml` options\n- [Style Guide](Style_Guide.md) — frontmatter, shapes, internal links, SPARQL blocks\n- [Graph Cache](Graph_Cache.md) — in-process RDF graph reuse\n- [Design Philosophies](Design_Philosophies.md) — silence is golden, pipes, flat commands\n\n## Global Options\n\nThese options apply to all subcommands. Config-driven commands include `check`, `lint`, `link`, `query`, `mcp`, `render`, `build`, `export`, `serve`, `fmt`, `install`, `remove`, `update`, and `graph`; `init` and `upgrade` run with defaults when no config file exists.\n\n### `-c, --config PATH`\n\nPath to `wiki.yml`, `wiki.yaml`, `wiki.json`, or a directory containing one of those files. Defaults to the current directory (`.`).\n\nExample:\n\n```bash\nwiki -c docs/wiki.yml check\n```\n\n### `--input PATH` (repeatable)\n\nOverride or extend `wiki.input` from config for a single invocation. Relative paths resolve against the config file directory. Useful for one-off queries against a subdirectory.\n\nExample:\n\n```bash\nwiki --input ./wiki --input ./imported query \"SELECT * WHERE { ?s ?p ?o } LIMIT 5\"\n```\n\n## Command families\n\nThe commands fall into families by what they act on:\n\n| Family | Commands | What they share |\n| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |\n| Setup and tooling | [init](wiki_init.md), [upgrade](wiki_upgrade.md) | Start a project, or update the CLI itself. |\n| Sources | [install](wiki_install.md), [update](wiki_update.md), [remove](wiki_remove.md) | Manage external data sources and `wiki.lock`. |\n| Audits | [check](wiki_check.md), [lint](wiki_lint.md) | Read-only verification of integrity and conventions. |\n| Bulk fixers | [fmt](wiki_fmt.md), [fix](wiki_fix.md), [link](wiki_link.md), [render](wiki_render.md) | Rewrite files across the whole wiki. |\n| File edits | [file new](wiki_file_new.md), [file set](wiki_file_set.md), [file patch](wiki_file_patch.md), [file mv](wiki_file_mv.md), [file rm](wiki_file_rm.md), with [edit](wiki_edit.md) for batches | Validated, link-aware edits to wiki documents; dry run by default. |\n| File reads | [file show](wiki_file_show.md), [file refs](wiki_file_refs.md) | Inspect one wiki document file. |\n| Graph | [query](wiki_query.md), [graph](wiki_graph.md), [export](wiki_export.md) | The wiki as RDF: SPARQL, named graphs, and export. |\n| Publishing | [build](wiki_build.md), [serve](wiki_serve.md), [mcp](wiki_mcp.md) | Output surfaces: static site, local server, MCP server. |\n\nThe per-file verbs are grouped under [wiki file](wiki_file.md).\n\n## Command reference\n\nEach subcommand has a dedicated page:\n\n<!-- sparql:start\n```sparql\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX schema: <https://schema.org/>\n\nSELECT ?command ?description WHERE {\n ?command rdf:type schema:TechArticle .\n FILTER(STRSTARTS(STR(?command), \"https://wazootech.github.io/wiki/wiki_\"))\n OPTIONAL { ?command schema:description ?description }\n}\nORDER BY ?command\n```\n-->\n\n| command | description |\n| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |\n| [wiki_build](wiki_build.md) | Generate a static HTML site from the wiki. |\n| [wiki_check](wiki_check.md) | Integrity checks — SHACL validation, JSON Schema frontmatter, route safety, and layout frontmatter. |\n| [wiki_edit](wiki_edit.md) | Change a wiki through validated, atomic edits instead of hand-written Markdown. |\n| [wiki_export](wiki_export.md) | Export document frontmatter as RDF or JSON-LD. |\n| [wiki_file](wiki_file.md) | Create, change, move, delete, or inspect one wiki document file through validated, link-aware edits. |\n| [wiki_file_mv](wiki_file_mv.md) | Move or rename a page and repoint every link and metadata reference to it, as a validated edit. |\n| [wiki_file_new](wiki_file_new.md) | Create a page of a known type, with its required fields first, as a validated edit. |\n| [wiki_file_patch](wiki_file_patch.md) | Append to, prepend to, or replace a heading's section, the body, or the frontmatter, as a validated edit. |\n| [wiki_file_refs](wiki_file_refs.md) | List the pages that link to a page and the pages it links to. |\n| [wiki_file_rm](wiki_file_rm.md) | Delete a page, refusing while other pages link to it unless their links are pruned to plain text, as a validated edit. |\n| [wiki_file_set](wiki_file_set.md) | Set or remove one frontmatter field, keeping comments, key order, and value spelling, as a validated edit. |\n| [wiki_file_show](wiki_file_show.md) | Describe one page as the engine sees it, with the content hash an edit expects. |\n| [wiki_fix](wiki_fix.md) | Remove frontmatter that repeats a value the graph derives from the page's H1 or Git history. |\n| [wiki_fmt](wiki_fmt.md) | Format Markdown wiki pages with native Deno/dprint formatter options. |\n| [wiki_graph](wiki_graph.md) | List read-only RDF named graphs for root and installed source provenance. |\n| [wiki_init](wiki_init.md) | Scaffold wiki.yml and an empty wiki/ folder for markdown pages. |\n| [wiki_install](wiki_install.md) | Fetch and lock external data sources declared in wiki.yml. |\n| [wiki_link](wiki_link.md) | Suggest missing wikilinks and repair unambiguous broken internal links. |\n| [wiki_lint](wiki_lint.md) | Convention audits for broken links, filename patterns, heading style, and internal link style. |\n| [wiki_mcp](wiki_mcp.md) | Run an MCP server for querying the wiki graph, with opt-in page-edit tools. |\n| [wiki_query](wiki_query.md) | Run SPARQL SELECT or CONSTRUCT against the wiki graph. |\n| [wiki_remove](wiki_remove.md) | Remove a data source from wiki.yml, its cache, and wiki.lock. |\n| [wiki_render](wiki_render.md) | Update inline SPARQL result tables in markdown files. |\n| [wiki_serve](wiki_serve.md) | Local HTTP server for live HTML preview and optional read-only SPARQL endpoint. |\n| [wiki_update](wiki_update.md) | Check locked sources for newer commits and update wiki.lock. |\n| [wiki_upgrade](wiki_upgrade.md) | Check for Wiki CLI updates and upgrade supported installations. |\n\n<!-- sparql:end -->\n\nGlobal flags: `-c`, `--input`.\n\n## Publishing\n\n- [Deploying to GitHub Pages](Deploying_to_GitHub_Pages.md) — CI workflow for this site\n- [Obsidian Integration](Obsidian_Integration.md) — Shell Commands plugin workflows\n\n## Managing drift and schema evolution\n\nA common challenge in text-based memory bases is metadata drift—especially when files are updated programmatically by external LLM agents. The Wiki CLI provides two strategies to keep a compounding codebase clean over long periods:\n\n### Automated cleaning harness\n\nTo prevent drift mechanically, you can wire a local Git hook or CI workflow that executes the following checks in order:\n\n1. **[wiki fmt](wiki_fmt.md)**: Auto-formats Markdown structures and standardizes YAML frontmatter layout.\n1. **[wiki lint](wiki_lint.md) `--strict`**: Flags broken links, non-conforming filename patterns, and heading casing warnings as hard errors.\n1. **[wiki check](wiki_check.md) `--strict`**: Ensures frontmatter conforms to [SHACL](SHACL.md) shapes and bound JSON Schema documents (`wazoo:jsonSchema`).\n\n### Resilient schema evolution\n\nEnforcing schemas on text databases can become problematic as structures evolve. The Wiki CLI avoids schema rigidity using semantic web principles:\n\n- **Additive RDF properties**: Since frontmatter is compiled into a graph, new or unconstrained keys do not cause parsing failures. They are ingested as open-world triples that can be queried or ignored.\n- **Decoupled validation**: SHACL and JSON Schema validation are diagnostic steps, not execution blockers. Files with invalid schemas can still be compiled, parsed, and queried.\n- **Class-scoped shapes**: Shapes target specific classes (e.g., `sh:targetClass schema:TechArticle`). Introducing a new document type only requires writing a new shape constraint, leaving legacy documents untouched.\n- **Namespace contexts**: Properties map to URIs via `graph.context` in [Wiki Configuration](Wiki_Configuration.md). You can rename or alias fields at the config layer without physically editing every source document.\n\n## Design\n\nThe CLI follows a flat, scriptable surface and [Design Philosophies](Design_Philosophies.md) (silent success, composable stdout). For programmatic use from Node.js/TypeScript or directly from Deno, see [Wiki Programmatic API](Wiki_Programmatic_API.md).\n\n## Pattern context\n\nThis repository implements the [LLM Wiki](LLM_Wiki.md) pattern for [Personal Knowledge](Personal_Knowledge.md) wikis. Examples in the wild include [Farzapedia](Farzapedia.md) and coverage from Andrej Karpathy.\n\nSimilar **agent memory filesystem** approaches include [Supermemory SMFS](Supermemory_SMFS.md), [Letta MemFS](Letta_MemFS.md), and [Agent Memory Filesystems](Agent_Memory_Filesystems.md).\n\nFor a **standardized agent workspace** (thin governed contract, typed graph, verification gates), see [Vivary](Vivary.md).\n\n## Repository\n\n- Source and issues: [github.com/wazootech/wiki](https://github.com/wazootech/wiki)\n- [Wiki CLI templates](#ecosystem-templates) — all templates live in the [wiki-templates](https://github.com/wazootech/wiki-templates) monorepo\n\n## Background\n\n- [Semantic Web](Semantic_Web.md) — RDF, Turtle, OWL, and related formats\n- [Software Application Shape](Software_Application_Shape.md) — SHACL shape for `SoftwareApplication` pages (including this page)" .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/headline> "wiki" .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/dateCreated> "2026-10-31T23:19:03Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/dateModified> "2026-10-31T23:19:03Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
@prefix schema: <https://schema.org/>.
@prefix wiki: <https://wazootech.github.io/wiki/>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@prefix dcterms: <http://purl.org/dc/terms/>.
@prefix sh: <http://www.w3.org/ns/shacl#>.
@prefix wazoo: <https://schema.wazoo.dev/>.
wiki:wiki a schema:SoftwareApplication;
schema:name "wiki";
schema:softwareVersion "0.7.0";
schema:description "Command-line interface for querying, validating, and publishing semantic markdown wikis.";
schema:codeRepository <https://github.com/wazootech/wiki>;
schema:articleBody "# `wiki`\n\nThis page is the **documentation home** for **Wiki CLI** (`wiki`, distributed on npm as [**`wazootech-wiki`**](https://www.npmjs.com/package/wazootech-wiki)): the semantic knowledge **toolchain** for Markdown wikis — validate with [SHACL](SHACL.md) and JSON Schema, infer and query with [SPARQL](SPARQL.md), and publish static HTML. It compiles wikis into RDF and sits **beneath** note apps and LLM-assisted workflows — progressive enhancement, not a migration.\n\nWiki CLI is published on npm, PyPI, JSR, and GitHub Releases (standalone binaries). See [Getting Started](Getting_Started.md#install) for every channel. Install with npm or use a standalone executable:\n\n```bash\nnpm install -g wazootech-wiki\nwiki --help\n```\n\n## Quickstart\n\nInstall Wiki CLI and scaffold a wiki:\n\n```bash\nnpm install -g wazootech-wiki\nmkdir my-wiki && cd my-wiki\nwiki init\nwiki check\nwiki lint\nwiki serve\n```\n\nSee [Getting Started](Getting_Started.md) for a full walkthrough.\n\n## What wiki is\n\n- The **compiler / validator / query engine** for Markdown knowledge bases with semantic frontmatter\n- An **OOTB wiki builder** — links, navigation, SHACL and JSON Schema checks, SPARQL, and static HTML from a folder of `.md` files\n- A **memory layer** — ingest or watch an existing wiki without owning the editor\n- **Interop-first** — works alongside [Obsidian](Obsidian_Integration.md), [LLM Wiki](LLM_Wiki.md) setups, and any Markdown editor\n\nAdoption path: `wiki init` → `wiki check` → `wiki serve`, then add `lint`, `query`, `render`, and `build` as the wiki matures.\n\nWiki CLI is intentionally batteries-included for semantic Markdown wikis: validation, formatting, querying, rendering, exporting, building, and local preview belong together. The boundary is not \"minimal CLI only\"; the boundary is \"semantic wiki toolchain, not editor/app automation.\"\n\n## What wiki is not\n\n- The **primary editor** or daily note-taking surface\n- A **replacement** for Obsidian, Logseq, or another wiki UI\n- A **note app clone**, CMS, or authenticated multi-user web product\n- An **auth layer** — local-first CLI and static publish; see deferred scope in [Wiki CLI templates](#ecosystem-templates) below\n- A vault automation CLI for daily notes, note append/read workflows, task lists, tags, plugin development, or Obsidian app control\n- A replacement for shell tools, Git, Pandoc, or editor-native commands\n\nHumans and agents keep writing where they already write. `wiki` makes that content **trustworthy** (SHACL, JSON Schema, and conventions), **searchable** (SPARQL + OWL-RL), and **publishable** (static HTML, JSON-LD, Turtle, optional read-only SPARQL over `wiki serve`).\n\n## Memory layer and ingestion\n\nRather than owning your editor or data store, **Wiki** functions as a **read-only memory layer** over your wiki. It parses, indexes, and queries the Markdown documents on your filesystem without mutating them or locking you into a proprietary format.\n\n- **Ingestion:** The CLI reads YAML/JSON frontmatter and HTML microdata from your files, compiling them into an in-memory RDF graph that can be queried with SPARQL or verified against SHACL shapes and JSON Schema bindings.\n- **Watching:** Running `wiki serve --watch` instructs the CLI to watch the wiki directory. Any edits you make in your preferred editor are immediately processed, updating the graph in the background and keeping your preview server synchronized.\n\n## Toolchain vs authoring surface\n\n| Layer | Role | Examples |\n| ----------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------- |\n| Authoring surface | Create, edit, search, and organize notes | Obsidian CLI, Obsidian, VS Code, shell |\n| Wiki CLI semantic layer | Compile wiki → RDF graph; check, lint, fmt; query; render; build/serve | `wiki check`, `wiki query`, `wiki build` |\n| Existing primitives | History, sync, print/PDF, and generic text processing | Git, shell tools, Pandoc |\n| Outputs | Deployable semantic artifacts | GitHub Pages HTML, export files, `/api/sparql` when enabled |\n\nThis separation is intentional: the strongest differentiator is the **machine layer** (SHACL, OWL-RL, SPARQL, typed HTML) that most note apps do not provide. **Wiki** avoids competing with editor-centric tools while making incremental adoption obvious.\n\nWhen an existing primitive already owns a workflow, Wiki CLI integrates rather than replaces it. Obsidian CLI owns Obsidian app/vault automation; Git owns history and collaboration; shell tools own generic file/process composition; Pandoc and document tools own non-semantic document conversion.\n\n`wiki link --fix-broken` supports link hygiene for publishable wikis. `wiki link --apply` is optional wiki-gardening: useful when desired, but not required for validation, publishing, or Obsidian compatibility.\n\n## Interop-first workflows\n\n### Obsidian\n\nRun `wiki` against the folder that contains `wiki.yml` or `wiki.yaml`. Use Shell Commands for on-save `wiki check`, hotkey `wiki render`, or `wiki serve --watch` for preview. Details: [Obsidian integration](Obsidian_Integration.md) and [Dataview integration](Dataview_Integration.md).\n\n### LLM wikis\n\nTreat the wiki as a compounding codebase agents maintain over time. Structured frontmatter and link conventions make SPARQL and SHACL meaningful on agent output. Pattern overview: [LLM Wiki](LLM_Wiki.md).\n\n### Plain Markdown\n\nNo Obsidian or agent stack required. `wiki init` scaffolds a wiki; conventions are documented in [Style Guide](Style_Guide.md).\n\n## Three capabilities of the CLI\n\n| Capability | Commands | Value |\n| ------------ | ---------------------------------- | ------------------------------------------------------------------ |\n| Trust | `check`, `lint`, `fmt` | Integrity contracts and authoring conventions |\n| Intelligence | `query`, `mcp`, `render`, `export` | SPARQL, MCP graph access, inline result blocks, RDF serializations |\n| Publish | `build`, `serve`, `link` | Static site, local preview, wikilink hygiene |\n| Sources | `install`, `update`, `remove` | Fetch, lock, update, and manage external sources |\n| Provenance | `graph list` | Inspect read-only named graph boundaries |\n\nDesign rationale for silence, pipes, and flat subcommands: [Design philosophies](Design_Philosophies.md).\n\n## Ecosystem templates\n\nWiki CLI ships one starter template, [wikipedia](https://github.com/wazootech/wiki-templates/tree/main/templates/wikipedia) — a Wikipedia-themed static site built from Wiki CLI outputs. It sits at the edge of the toolchain (the publish surface) while Wiki CLI owns the semantic layer ([Design philosophies](Design_Philosophies.md)). It is one subdirectory of the [wiki-templates](https://github.com/wazootech/wiki-templates) repository, and this section is the canonical registry. Install it into an empty directory with [`wiki init --template <name>`](wiki_init.md):\n\n```sh\nwiki init --template wikipedia\n```\n\n| Template | Description |\n| -------------------------------------------------------------------------------------- | ---------------------------------------------------- |\n| [wikipedia](https://github.com/wazootech/wiki-templates/tree/main/templates/wikipedia) | Wikipedia-themed layout for Wiki CLI-generated sites |\n\nNew templates are not added to [wiki-templates](https://github.com/wazootech/wiki-templates): the other eleven were retired on 2026-10-14 ([#64](https://github.com/wazootech/wiki-templates/issues/64)). To propose an integration, [open an issue](https://github.com/wazootech/wiki/issues/new) here describing the tool it connects and the Wiki CLI outputs it consumes, following the boundary rule in the wiki-templates [contributing guide](https://github.com/wazootech/wiki-templates/blob/main/CONTRIBUTING.md).\n\n### Artifact contract\n\nExternal templates consume Wiki CLI outputs — they do not replace the compiler:\n\n- **`wiki.yml`** / **`wiki.yaml`** — config root; `wiki.input`, `graph.*`, `site.*`\n- **`wiki export`** — JSON-LD, Turtle, TriG, and other RDF serializations\n- **`wiki build`** — static HTML under `site.base_url`\n\n### Retired slugs\n\nDo not use these in new prose: `sparql-service-template` (→ the retired `yasgui` template); `wiki-virtuoso-template` (→ folded into `yasgui`); `wiki-obsidian-quartz-template`, `obsidian-quartz-template` (→ the retired `quartz` template); bare `nextjs-template`, `mintlify-template`, `astro-template`; and `wiki-template`, `llm-wiki-template`, `wiki-yasgui-template`, `wiki-nextjs-template`, `wiki-quartz-template`, `wiki-cocoindex-template`, `wiki-mintlify-template`, `wiki-astro-template`.\n\nThe `wiki-templates/templates/` subdirectories those names pointed at — `generic`, `llm-wiki`, `mintlify`, `holocron`, `astro`, `nextjs`, `quartz`, `cocoindex`, `yasgui`, `camunda`, and `workspace-cli` — were retired on 2026-10-14 with the reduction to one template ([#64](https://github.com/wazootech/wiki-templates/issues/64)). Those paths 404 now, so do not link them; `wikipedia` is the only template that exists.\n\n## Features\n\n- **Check** — SHACL and JSON Schema integrity, route safety, layout frontmatter ([wiki check](wiki_check.md))\n- **Lint** — broken links, filename pattern, and heading conventions ([wiki lint](wiki_lint.md))\n- **Link** — repair broken internal links and optionally insert suggested links as wiki-gardening ([wiki link](wiki_link.md))\n- **Fmt** — Deno Markdown formatter for markdown ([wiki fmt](wiki_fmt.md))\n- **Fix** — remove frontmatter that repeats the headline or Git dates the graph derives ([wiki fix](wiki_fix.md))\n- **Query** — SPARQL with OWL-RL and optional `--pretty` Rich tables ([wiki query](wiki_query.md), [Graph Cache](Graph_Cache.md))\n- **Graph list** — inspect root and source named graphs for SPARQL `GRAPH` provenance ([wiki graph](wiki_graph.md))\n- **MCP** — read-only query-first MCP server for local agents ([wiki mcp](wiki_mcp.md))\n- **Render** — live tables from inline SPARQL ([wiki render](wiki_render.md))\n- **Build / serve** — static site, local preview, and optional read-only SPARQL endpoint ([wiki build](wiki_build.md), [wiki serve](wiki_serve.md#sparql-endpoint))\n- **Export** — JSON-LD and RDF serializations ([wiki export](wiki_export.md))\n- **Install** — fetch and lock external data sources ([wiki install](wiki_install.md))\n- **Update** — check locked sources for newer commits ([wiki update](wiki_update.md))\n- **Remove** — delete a source from wiki.yml, cache, and lockfile ([wiki remove](wiki_remove.md))\n- **Init** — scaffold `wiki.yml` ([wiki init](wiki_init.md))\n- **Upgrade** — check for Wiki CLI releases ([wiki upgrade](wiki_upgrade.md)); steps aside with exit 0 when JSR cannot answer\n\n## Supported file formats\n\n### Input pipelines\n\nWiki CLI processes files through two distinct pipelines. Files in `wiki.input` are classified as either **documents** (frontmatter parsed, IRI derived from file path, link-checked) or **raw RDF sources** (parsed directly into the RDF graph, without document processing):\n\n| Category | Extensions | Pipeline | Key behavior |\n| ------------------- | -------------------------------------------------------- | ---------------------- | --------------------------------------------------------------------------------------------- |\n| Wiki documents | `.md`, `.yaml`, `.yml`, `.json`, `.toml` | Frontmatter → graph | Parsed for frontmatter/data; document IRI derived from file path; link-checked and exportable |\n| Data-only documents | `.yaml`, `.yml`, `.json`, `.toml` | Frontmatter → graph | Subset of wiki documents without a markdown body — entire file is the data dict |\n| Raw RDF sources | `.ttl`, `.trig`, `.nt`, `.nq`, `.rdf`, `.xml`, `.jsonld` | RDF/JS parsers → graph | Loaded as raw triples; no route, no link checking, no frontmatter pipeline |\n| Inline Turtle | Turtle-tagged code fence inside `.md` | RDF/JS parser → graph | Parsed and merged into the graph alongside document frontmatter |\n\n### Document pipeline\n\nMarkdown files are parsed via the [Linked Markdown](Linked_Markdown.md) protocol: the YAML/JSON frontmatter between `---` delimiters is extracted as the data dict, and the body text is optionally added to the graph via `content_predicate`. Data-only documents (`.yaml`, `.yml`, `.json`, `.toml`) skip the body split — the entire file is the data.\n\nEach typed document also gets `schema:headline` from its first `# H1` and `schema:dateCreated` / `schema:dateModified` from its Git history (or its modification time), unless its frontmatter sets them. These are derived in memory and never written back; see [wiki fix](wiki_fix.md#derived-metadata).\n\nAll document formats have their `@context` auto-populated with `wiki:` and `foaf:` default prefixes if none is present. An explicit `@id` or `id` key in frontmatter overrides the file-path-based IRI ([Linked Markdown](Linked_Markdown.md#subject-uri-resolution)).\n\n### Raw RDF pipeline\n\nFiles with raw RDF extensions are parsed by the Deno RDF/JS stack using the format mapped from their extension. They bypass document processing — no route registration, link validation, or frontmatter coercion. They contribute triples to the same graph but are invisible to `wiki export` (which operates on documents) and `wiki link`.\n\n**Important nuance:** `.jsonld` is raw RDF, not a wiki document. It does not get a document IRI or document-level context injection, and it is not subject to link checking. A `.json` file with the same content is a wiki document and follows the frontmatter pipeline. These are disjoint processing paths.\n\n### Output formats\n\n| Context | Formats |\n| ------------------------------------ | ------------------------------------------------------------------------------------- |\n| `wiki export` | `dict` (default), `json-ld`, `turtle`, `xml` (deferred), `n3`, `nt`, `trig`, `nquads` |\n| `wiki query` | `table` (default), `json`, `csv`, `tsv`, `turtle`, `n3`, `markdown` |\n| Repository docs-theme metadata panel | `json-ld`, `turtle`, `n3`, `nt`, `trig`, `nquads` |\n\n### Key nuances\n\n- **`.jsonld` vs `.json`** — Different pipelines for the same data shape. See raw RDF pipeline note above.\n- **N3 is output-only** — Notation3 (`.n3`) is available for `wiki export` and `wiki query` CONSTRUCT results but is not recognized as an input graph source extension.\n- **`@context` auto-injection** — Document files that lack an `@context` key get default `wiki:` and `foaf:` prefixes injected. If `@context` is present as a dict, those defaults are merged in.\n- **Only `.md` carries body text** — Data-only formats cannot carry a body literal in the graph; the entire file content is the data dict.\n- **Turtle-tagged code fences** — Markdown code fences tagged `turtle` are parsed as RDF and merged into the wiki graph. This is separate from SPARQL result blocks.\n- **`.toml` is a document format** — TOML files under `wiki.input` are treated as data-only wiki documents, subject to `@context` injection and route generation.\n\n### Related\n\n- [Linked Markdown](Linked_Markdown.md) — document-to-RDF protocol and IRI resolution\n- [RDF](RDF.md) — RDF data model and serialization references\n- Individual format pages: [Turtle](Turtle.md), [TriG](TriG.md), [N-Triples](N_Triples.md), [N-Quads](N_Quads.md), [RDF/XML](RDF_XML.md), [Notation3](Notation3.md), [JSON-LD](JSON_LD.md)\n\n## Agent skills\n\nProcedural knowledge for coding agents: [Wiki Skills](Wiki_Skills.md) (`skills/wiki/` in the repository).\n\n## Start here\n\n- [Getting Started](Getting_Started.md) — install, `wiki init`, first `check` and `serve`\n- [Wiki Configuration](Wiki_Configuration.md) — `wiki.yml` / `wiki.yaml` options\n- [Style Guide](Style_Guide.md) — frontmatter, shapes, internal links, SPARQL blocks\n- [Graph Cache](Graph_Cache.md) — in-process RDF graph reuse\n- [Design Philosophies](Design_Philosophies.md) — silence is golden, pipes, flat commands\n\n## Global Options\n\nThese options apply to all subcommands. Config-driven commands include `check`, `lint`, `link`, `query`, `mcp`, `render`, `build`, `export`, `serve`, `fmt`, `install`, `remove`, `update`, and `graph`; `init` and `upgrade` run with defaults when no config file exists.\n\n### `-c, --config PATH`\n\nPath to `wiki.yml`, `wiki.yaml`, `wiki.json`, or a directory containing one of those files. Defaults to the current directory (`.`).\n\nExample:\n\n```bash\nwiki -c docs/wiki.yml check\n```\n\n### `--input PATH` (repeatable)\n\nOverride or extend `wiki.input` from config for a single invocation. Relative paths resolve against the config file directory. Useful for one-off queries against a subdirectory.\n\nExample:\n\n```bash\nwiki --input ./wiki --input ./imported query \"SELECT * WHERE { ?s ?p ?o } LIMIT 5\"\n```\n\n## Command families\n\nThe commands fall into families by what they act on:\n\n| Family | Commands | What they share |\n| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |\n| Setup and tooling | [init](wiki_init.md), [upgrade](wiki_upgrade.md) | Start a project, or update the CLI itself. |\n| Sources | [install](wiki_install.md), [update](wiki_update.md), [remove](wiki_remove.md) | Manage external data sources and `wiki.lock`. |\n| Audits | [check](wiki_check.md), [lint](wiki_lint.md) | Read-only verification of integrity and conventions. |\n| Bulk fixers | [fmt](wiki_fmt.md), [fix](wiki_fix.md), [link](wiki_link.md), [render](wiki_render.md) | Rewrite files across the whole wiki. |\n| File edits | [file new](wiki_file_new.md), [file set](wiki_file_set.md), [file patch](wiki_file_patch.md), [file mv](wiki_file_mv.md), [file rm](wiki_file_rm.md), with [edit](wiki_edit.md) for batches | Validated, link-aware edits to wiki documents; dry run by default. |\n| File reads | [file show](wiki_file_show.md), [file refs](wiki_file_refs.md) | Inspect one wiki document file. |\n| Graph | [query](wiki_query.md), [graph](wiki_graph.md), [export](wiki_export.md) | The wiki as RDF: SPARQL, named graphs, and export. |\n| Publishing | [build](wiki_build.md), [serve](wiki_serve.md), [mcp](wiki_mcp.md) | Output surfaces: static site, local server, MCP server. |\n\nThe per-file verbs are grouped under [wiki file](wiki_file.md).\n\n## Command reference\n\nEach subcommand has a dedicated page:\n\n<!-- sparql:start\n```sparql\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX schema: <https://schema.org/>\n\nSELECT ?command ?description WHERE {\n ?command rdf:type schema:TechArticle .\n FILTER(STRSTARTS(STR(?command), \"https://wazootech.github.io/wiki/wiki_\"))\n OPTIONAL { ?command schema:description ?description }\n}\nORDER BY ?command\n```\n-->\n\n| command | description |\n| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |\n| [wiki_build](wiki_build.md) | Generate a static HTML site from the wiki. |\n| [wiki_check](wiki_check.md) | Integrity checks — SHACL validation, JSON Schema frontmatter, route safety, and layout frontmatter. |\n| [wiki_edit](wiki_edit.md) | Change a wiki through validated, atomic edits instead of hand-written Markdown. |\n| [wiki_export](wiki_export.md) | Export document frontmatter as RDF or JSON-LD. |\n| [wiki_file](wiki_file.md) | Create, change, move, delete, or inspect one wiki document file through validated, link-aware edits. |\n| [wiki_file_mv](wiki_file_mv.md) | Move or rename a page and repoint every link and metadata reference to it, as a validated edit. |\n| [wiki_file_new](wiki_file_new.md) | Create a page of a known type, with its required fields first, as a validated edit. |\n| [wiki_file_patch](wiki_file_patch.md) | Append to, prepend to, or replace a heading's section, the body, or the frontmatter, as a validated edit. |\n| [wiki_file_refs](wiki_file_refs.md) | List the pages that link to a page and the pages it links to. |\n| [wiki_file_rm](wiki_file_rm.md) | Delete a page, refusing while other pages link to it unless their links are pruned to plain text, as a validated edit. |\n| [wiki_file_set](wiki_file_set.md) | Set or remove one frontmatter field, keeping comments, key order, and value spelling, as a validated edit. |\n| [wiki_file_show](wiki_file_show.md) | Describe one page as the engine sees it, with the content hash an edit expects. |\n| [wiki_fix](wiki_fix.md) | Remove frontmatter that repeats a value the graph derives from the page's H1 or Git history. |\n| [wiki_fmt](wiki_fmt.md) | Format Markdown wiki pages with native Deno/dprint formatter options. |\n| [wiki_graph](wiki_graph.md) | List read-only RDF named graphs for root and installed source provenance. |\n| [wiki_init](wiki_init.md) | Scaffold wiki.yml and an empty wiki/ folder for markdown pages. |\n| [wiki_install](wiki_install.md) | Fetch and lock external data sources declared in wiki.yml. |\n| [wiki_link](wiki_link.md) | Suggest missing wikilinks and repair unambiguous broken internal links. |\n| [wiki_lint](wiki_lint.md) | Convention audits for broken links, filename patterns, heading style, and internal link style. |\n| [wiki_mcp](wiki_mcp.md) | Run an MCP server for querying the wiki graph, with opt-in page-edit tools. |\n| [wiki_query](wiki_query.md) | Run SPARQL SELECT or CONSTRUCT against the wiki graph. |\n| [wiki_remove](wiki_remove.md) | Remove a data source from wiki.yml, its cache, and wiki.lock. |\n| [wiki_render](wiki_render.md) | Update inline SPARQL result tables in markdown files. |\n| [wiki_serve](wiki_serve.md) | Local HTTP server for live HTML preview and optional read-only SPARQL endpoint. |\n| [wiki_update](wiki_update.md) | Check locked sources for newer commits and update wiki.lock. |\n| [wiki_upgrade](wiki_upgrade.md) | Check for Wiki CLI updates and upgrade supported installations. |\n\n<!-- sparql:end -->\n\nGlobal flags: `-c`, `--input`.\n\n## Publishing\n\n- [Deploying to GitHub Pages](Deploying_to_GitHub_Pages.md) — CI workflow for this site\n- [Obsidian Integration](Obsidian_Integration.md) — Shell Commands plugin workflows\n\n## Managing drift and schema evolution\n\nA common challenge in text-based memory bases is metadata drift—especially when files are updated programmatically by external LLM agents. The Wiki CLI provides two strategies to keep a compounding codebase clean over long periods:\n\n### Automated cleaning harness\n\nTo prevent drift mechanically, you can wire a local Git hook or CI workflow that executes the following checks in order:\n\n1. **[wiki fmt](wiki_fmt.md)**: Auto-formats Markdown structures and standardizes YAML frontmatter layout.\n1. **[wiki lint](wiki_lint.md) `--strict`**: Flags broken links, non-conforming filename patterns, and heading casing warnings as hard errors.\n1. **[wiki check](wiki_check.md) `--strict`**: Ensures frontmatter conforms to [SHACL](SHACL.md) shapes and bound JSON Schema documents (`wazoo:jsonSchema`).\n\n### Resilient schema evolution\n\nEnforcing schemas on text databases can become problematic as structures evolve. The Wiki CLI avoids schema rigidity using semantic web principles:\n\n- **Additive RDF properties**: Since frontmatter is compiled into a graph, new or unconstrained keys do not cause parsing failures. They are ingested as open-world triples that can be queried or ignored.\n- **Decoupled validation**: SHACL and JSON Schema validation are diagnostic steps, not execution blockers. Files with invalid schemas can still be compiled, parsed, and queried.\n- **Class-scoped shapes**: Shapes target specific classes (e.g., `sh:targetClass schema:TechArticle`). Introducing a new document type only requires writing a new shape constraint, leaving legacy documents untouched.\n- **Namespace contexts**: Properties map to URIs via `graph.context` in [Wiki Configuration](Wiki_Configuration.md). You can rename or alias fields at the config layer without physically editing every source document.\n\n## Design\n\nThe CLI follows a flat, scriptable surface and [Design Philosophies](Design_Philosophies.md) (silent success, composable stdout). For programmatic use from Node.js/TypeScript or directly from Deno, see [Wiki Programmatic API](Wiki_Programmatic_API.md).\n\n## Pattern context\n\nThis repository implements the [LLM Wiki](LLM_Wiki.md) pattern for [Personal Knowledge](Personal_Knowledge.md) wikis. Examples in the wild include [Farzapedia](Farzapedia.md) and coverage from Andrej Karpathy.\n\nSimilar **agent memory filesystem** approaches include [Supermemory SMFS](Supermemory_SMFS.md), [Letta MemFS](Letta_MemFS.md), and [Agent Memory Filesystems](Agent_Memory_Filesystems.md).\n\nFor a **standardized agent workspace** (thin governed contract, typed graph, verification gates), see [Vivary](Vivary.md).\n\n## Repository\n\n- Source and issues: [github.com/wazootech/wiki](https://github.com/wazootech/wiki)\n- [Wiki CLI templates](#ecosystem-templates) — all templates live in the [wiki-templates](https://github.com/wazootech/wiki-templates) monorepo\n\n## Background\n\n- [Semantic Web](Semantic_Web.md) — RDF, Turtle, OWL, and related formats\n- [Software Application Shape](Software_Application_Shape.md) — SHACL shape for `SoftwareApplication` pages (including this page)";
schema:headline "wiki";
schema:dateCreated "2026-10-31T23:19:03Z"^^xsd:dateTime;
schema:dateModified "2026-10-31T23:19:03Z"^^xsd:dateTime.
<https://wazootech.github.io/wiki/wiki> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://schema.org/SoftwareApplication> .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/name> "wiki" .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/softwareVersion> "0.7.0" .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/description> "Command-line interface for querying, validating, and publishing semantic markdown wikis." .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/codeRepository> <https://github.com/wazootech/wiki> .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/articleBody> """# `wiki`
This page is the **documentation home** for **Wiki CLI** (`wiki`, distributed on npm as [**`wazootech-wiki`**](https://www.npmjs.com/package/wazootech-wiki)): the semantic knowledge **toolchain** for Markdown wikis — validate with [SHACL](SHACL.md) and JSON Schema, infer and query with [SPARQL](SPARQL.md), and publish static HTML. It compiles wikis into RDF and sits **beneath** note apps and LLM-assisted workflows — progressive enhancement, not a migration.
Wiki CLI is published on npm, PyPI, JSR, and GitHub Releases (standalone binaries). See [Getting Started](Getting_Started.md#install) for every channel. Install with npm or use a standalone executable:
```bash
npm install -g wazootech-wiki
wiki --help
```
## Quickstart
Install Wiki CLI and scaffold a wiki:
```bash
npm install -g wazootech-wiki
mkdir my-wiki && cd my-wiki
wiki init
wiki check
wiki lint
wiki serve
```
See [Getting Started](Getting_Started.md) for a full walkthrough.
## What wiki is
- The **compiler / validator / query engine** for Markdown knowledge bases with semantic frontmatter
- An **OOTB wiki builder** — links, navigation, SHACL and JSON Schema checks, SPARQL, and static HTML from a folder of `.md` files
- A **memory layer** — ingest or watch an existing wiki without owning the editor
- **Interop-first** — works alongside [Obsidian](Obsidian_Integration.md), [LLM Wiki](LLM_Wiki.md) setups, and any Markdown editor
Adoption path: `wiki init` → `wiki check` → `wiki serve`, then add `lint`, `query`, `render`, and `build` as the wiki matures.
Wiki CLI is intentionally batteries-included for semantic Markdown wikis: validation, formatting, querying, rendering, exporting, building, and local preview belong together. The boundary is not "minimal CLI only"; the boundary is "semantic wiki toolchain, not editor/app automation."
## What wiki is not
- The **primary editor** or daily note-taking surface
- A **replacement** for Obsidian, Logseq, or another wiki UI
- A **note app clone**, CMS, or authenticated multi-user web product
- An **auth layer** — local-first CLI and static publish; see deferred scope in [Wiki CLI templates](#ecosystem-templates) below
- A vault automation CLI for daily notes, note append/read workflows, task lists, tags, plugin development, or Obsidian app control
- A replacement for shell tools, Git, Pandoc, or editor-native commands
Humans and agents keep writing where they already write. `wiki` makes that content **trustworthy** (SHACL, JSON Schema, and conventions), **searchable** (SPARQL + OWL-RL), and **publishable** (static HTML, JSON-LD, Turtle, optional read-only SPARQL over `wiki serve`).
## Memory layer and ingestion
Rather than owning your editor or data store, **Wiki** functions as a **read-only memory layer** over your wiki. It parses, indexes, and queries the Markdown documents on your filesystem without mutating them or locking you into a proprietary format.
- **Ingestion:** The CLI reads YAML/JSON frontmatter and HTML microdata from your files, compiling them into an in-memory RDF graph that can be queried with SPARQL or verified against SHACL shapes and JSON Schema bindings.
- **Watching:** Running `wiki serve --watch` instructs the CLI to watch the wiki directory. Any edits you make in your preferred editor are immediately processed, updating the graph in the background and keeping your preview server synchronized.
## Toolchain vs authoring surface
| Layer | Role | Examples |
| ----------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------- |
| Authoring surface | Create, edit, search, and organize notes | Obsidian CLI, Obsidian, VS Code, shell |
| Wiki CLI semantic layer | Compile wiki → RDF graph; check, lint, fmt; query; render; build/serve | `wiki check`, `wiki query`, `wiki build` |
| Existing primitives | History, sync, print/PDF, and generic text processing | Git, shell tools, Pandoc |
| Outputs | Deployable semantic artifacts | GitHub Pages HTML, export files, `/api/sparql` when enabled |
This separation is intentional: the strongest differentiator is the **machine layer** (SHACL, OWL-RL, SPARQL, typed HTML) that most note apps do not provide. **Wiki** avoids competing with editor-centric tools while making incremental adoption obvious.
When an existing primitive already owns a workflow, Wiki CLI integrates rather than replaces it. Obsidian CLI owns Obsidian app/vault automation; Git owns history and collaboration; shell tools own generic file/process composition; Pandoc and document tools own non-semantic document conversion.
`wiki link --fix-broken` supports link hygiene for publishable wikis. `wiki link --apply` is optional wiki-gardening: useful when desired, but not required for validation, publishing, or Obsidian compatibility.
## Interop-first workflows
### Obsidian
Run `wiki` against the folder that contains `wiki.yml` or `wiki.yaml`. Use Shell Commands for on-save `wiki check`, hotkey `wiki render`, or `wiki serve --watch` for preview. Details: [Obsidian integration](Obsidian_Integration.md) and [Dataview integration](Dataview_Integration.md).
### LLM wikis
Treat the wiki as a compounding codebase agents maintain over time. Structured frontmatter and link conventions make SPARQL and SHACL meaningful on agent output. Pattern overview: [LLM Wiki](LLM_Wiki.md).
### Plain Markdown
No Obsidian or agent stack required. `wiki init` scaffolds a wiki; conventions are documented in [Style Guide](Style_Guide.md).
## Three capabilities of the CLI
| Capability | Commands | Value |
| ------------ | ---------------------------------- | ------------------------------------------------------------------ |
| Trust | `check`, `lint`, `fmt` | Integrity contracts and authoring conventions |
| Intelligence | `query`, `mcp`, `render`, `export` | SPARQL, MCP graph access, inline result blocks, RDF serializations |
| Publish | `build`, `serve`, `link` | Static site, local preview, wikilink hygiene |
| Sources | `install`, `update`, `remove` | Fetch, lock, update, and manage external sources |
| Provenance | `graph list` | Inspect read-only named graph boundaries |
Design rationale for silence, pipes, and flat subcommands: [Design philosophies](Design_Philosophies.md).
## Ecosystem templates
Wiki CLI ships one starter template, [wikipedia](https://github.com/wazootech/wiki-templates/tree/main/templates/wikipedia) — a Wikipedia-themed static site built from Wiki CLI outputs. It sits at the edge of the toolchain (the publish surface) while Wiki CLI owns the semantic layer ([Design philosophies](Design_Philosophies.md)). It is one subdirectory of the [wiki-templates](https://github.com/wazootech/wiki-templates) repository, and this section is the canonical registry. Install it into an empty directory with [`wiki init --template <name>`](wiki_init.md):
```sh
wiki init --template wikipedia
```
| Template | Description |
| -------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| [wikipedia](https://github.com/wazootech/wiki-templates/tree/main/templates/wikipedia) | Wikipedia-themed layout for Wiki CLI-generated sites |
New templates are not added to [wiki-templates](https://github.com/wazootech/wiki-templates): the other eleven were retired on 2026-10-14 ([#64](https://github.com/wazootech/wiki-templates/issues/64)). To propose an integration, [open an issue](https://github.com/wazootech/wiki/issues/new) here describing the tool it connects and the Wiki CLI outputs it consumes, following the boundary rule in the wiki-templates [contributing guide](https://github.com/wazootech/wiki-templates/blob/main/CONTRIBUTING.md).
### Artifact contract
External templates consume Wiki CLI outputs — they do not replace the compiler:
- **`wiki.yml`** / **`wiki.yaml`** — config root; `wiki.input`, `graph.*`, `site.*`
- **`wiki export`** — JSON-LD, Turtle, TriG, and other RDF serializations
- **`wiki build`** — static HTML under `site.base_url`
### Retired slugs
Do not use these in new prose: `sparql-service-template` (→ the retired `yasgui` template); `wiki-virtuoso-template` (→ folded into `yasgui`); `wiki-obsidian-quartz-template`, `obsidian-quartz-template` (→ the retired `quartz` template); bare `nextjs-template`, `mintlify-template`, `astro-template`; and `wiki-template`, `llm-wiki-template`, `wiki-yasgui-template`, `wiki-nextjs-template`, `wiki-quartz-template`, `wiki-cocoindex-template`, `wiki-mintlify-template`, `wiki-astro-template`.
The `wiki-templates/templates/` subdirectories those names pointed at — `generic`, `llm-wiki`, `mintlify`, `holocron`, `astro`, `nextjs`, `quartz`, `cocoindex`, `yasgui`, `camunda`, and `workspace-cli` — were retired on 2026-10-14 with the reduction to one template ([#64](https://github.com/wazootech/wiki-templates/issues/64)). Those paths 404 now, so do not link them; `wikipedia` is the only template that exists.
## Features
- **Check** — SHACL and JSON Schema integrity, route safety, layout frontmatter ([wiki check](wiki_check.md))
- **Lint** — broken links, filename pattern, and heading conventions ([wiki lint](wiki_lint.md))
- **Link** — repair broken internal links and optionally insert suggested links as wiki-gardening ([wiki link](wiki_link.md))
- **Fmt** — Deno Markdown formatter for markdown ([wiki fmt](wiki_fmt.md))
- **Fix** — remove frontmatter that repeats the headline or Git dates the graph derives ([wiki fix](wiki_fix.md))
- **Query** — SPARQL with OWL-RL and optional `--pretty` Rich tables ([wiki query](wiki_query.md), [Graph Cache](Graph_Cache.md))
- **Graph list** — inspect root and source named graphs for SPARQL `GRAPH` provenance ([wiki graph](wiki_graph.md))
- **MCP** — read-only query-first MCP server for local agents ([wiki mcp](wiki_mcp.md))
- **Render** — live tables from inline SPARQL ([wiki render](wiki_render.md))
- **Build / serve** — static site, local preview, and optional read-only SPARQL endpoint ([wiki build](wiki_build.md), [wiki serve](wiki_serve.md#sparql-endpoint))
- **Export** — JSON-LD and RDF serializations ([wiki export](wiki_export.md))
- **Install** — fetch and lock external data sources ([wiki install](wiki_install.md))
- **Update** — check locked sources for newer commits ([wiki update](wiki_update.md))
- **Remove** — delete a source from wiki.yml, cache, and lockfile ([wiki remove](wiki_remove.md))
- **Init** — scaffold `wiki.yml` ([wiki init](wiki_init.md))
- **Upgrade** — check for Wiki CLI releases ([wiki upgrade](wiki_upgrade.md)); steps aside with exit 0 when JSR cannot answer
## Supported file formats
### Input pipelines
Wiki CLI processes files through two distinct pipelines. Files in `wiki.input` are classified as either **documents** (frontmatter parsed, IRI derived from file path, link-checked) or **raw RDF sources** (parsed directly into the RDF graph, without document processing):
| Category | Extensions | Pipeline | Key behavior |
| ------------------- | -------------------------------------------------------- | ---------------------- | --------------------------------------------------------------------------------------------- |
| Wiki documents | `.md`, `.yaml`, `.yml`, `.json`, `.toml` | Frontmatter → graph | Parsed for frontmatter/data; document IRI derived from file path; link-checked and exportable |
| Data-only documents | `.yaml`, `.yml`, `.json`, `.toml` | Frontmatter → graph | Subset of wiki documents without a markdown body — entire file is the data dict |
| Raw RDF sources | `.ttl`, `.trig`, `.nt`, `.nq`, `.rdf`, `.xml`, `.jsonld` | RDF/JS parsers → graph | Loaded as raw triples; no route, no link checking, no frontmatter pipeline |
| Inline Turtle | Turtle-tagged code fence inside `.md` | RDF/JS parser → graph | Parsed and merged into the graph alongside document frontmatter |
### Document pipeline
Markdown files are parsed via the [Linked Markdown](Linked_Markdown.md) protocol: the YAML/JSON frontmatter between `---` delimiters is extracted as the data dict, and the body text is optionally added to the graph via `content_predicate`. Data-only documents (`.yaml`, `.yml`, `.json`, `.toml`) skip the body split — the entire file is the data.
Each typed document also gets `schema:headline` from its first `# H1` and `schema:dateCreated` / `schema:dateModified` from its Git history (or its modification time), unless its frontmatter sets them. These are derived in memory and never written back; see [wiki fix](wiki_fix.md#derived-metadata).
All document formats have their `@context` auto-populated with `wiki:` and `foaf:` default prefixes if none is present. An explicit `@id` or `id` key in frontmatter overrides the file-path-based IRI ([Linked Markdown](Linked_Markdown.md#subject-uri-resolution)).
### Raw RDF pipeline
Files with raw RDF extensions are parsed by the Deno RDF/JS stack using the format mapped from their extension. They bypass document processing — no route registration, link validation, or frontmatter coercion. They contribute triples to the same graph but are invisible to `wiki export` (which operates on documents) and `wiki link`.
**Important nuance:** `.jsonld` is raw RDF, not a wiki document. It does not get a document IRI or document-level context injection, and it is not subject to link checking. A `.json` file with the same content is a wiki document and follows the frontmatter pipeline. These are disjoint processing paths.
### Output formats
| Context | Formats |
| ------------------------------------ | ------------------------------------------------------------------------------------- |
| `wiki export` | `dict` (default), `json-ld`, `turtle`, `xml` (deferred), `n3`, `nt`, `trig`, `nquads` |
| `wiki query` | `table` (default), `json`, `csv`, `tsv`, `turtle`, `n3`, `markdown` |
| Repository docs-theme metadata panel | `json-ld`, `turtle`, `n3`, `nt`, `trig`, `nquads` |
### Key nuances
- **`.jsonld` vs `.json`** — Different pipelines for the same data shape. See raw RDF pipeline note above.
- **N3 is output-only** — Notation3 (`.n3`) is available for `wiki export` and `wiki query` CONSTRUCT results but is not recognized as an input graph source extension.
- **`@context` auto-injection** — Document files that lack an `@context` key get default `wiki:` and `foaf:` prefixes injected. If `@context` is present as a dict, those defaults are merged in.
- **Only `.md` carries body text** — Data-only formats cannot carry a body literal in the graph; the entire file content is the data dict.
- **Turtle-tagged code fences** — Markdown code fences tagged `turtle` are parsed as RDF and merged into the wiki graph. This is separate from SPARQL result blocks.
- **`.toml` is a document format** — TOML files under `wiki.input` are treated as data-only wiki documents, subject to `@context` injection and route generation.
### Related
- [Linked Markdown](Linked_Markdown.md) — document-to-RDF protocol and IRI resolution
- [RDF](RDF.md) — RDF data model and serialization references
- Individual format pages: [Turtle](Turtle.md), [TriG](TriG.md), [N-Triples](N_Triples.md), [N-Quads](N_Quads.md), [RDF/XML](RDF_XML.md), [Notation3](Notation3.md), [JSON-LD](JSON_LD.md)
## Agent skills
Procedural knowledge for coding agents: [Wiki Skills](Wiki_Skills.md) (`skills/wiki/` in the repository).
## Start here
- [Getting Started](Getting_Started.md) — install, `wiki init`, first `check` and `serve`
- [Wiki Configuration](Wiki_Configuration.md) — `wiki.yml` / `wiki.yaml` options
- [Style Guide](Style_Guide.md) — frontmatter, shapes, internal links, SPARQL blocks
- [Graph Cache](Graph_Cache.md) — in-process RDF graph reuse
- [Design Philosophies](Design_Philosophies.md) — silence is golden, pipes, flat commands
## Global Options
These options apply to all subcommands. Config-driven commands include `check`, `lint`, `link`, `query`, `mcp`, `render`, `build`, `export`, `serve`, `fmt`, `install`, `remove`, `update`, and `graph`; `init` and `upgrade` run with defaults when no config file exists.
### `-c, --config PATH`
Path to `wiki.yml`, `wiki.yaml`, `wiki.json`, or a directory containing one of those files. Defaults to the current directory (`.`).
Example:
```bash
wiki -c docs/wiki.yml check
```
### `--input PATH` (repeatable)
Override or extend `wiki.input` from config for a single invocation. Relative paths resolve against the config file directory. Useful for one-off queries against a subdirectory.
Example:
```bash
wiki --input ./wiki --input ./imported query "SELECT * WHERE { ?s ?p ?o } LIMIT 5"
```
## Command families
The commands fall into families by what they act on:
| Family | Commands | What they share |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| Setup and tooling | [init](wiki_init.md), [upgrade](wiki_upgrade.md) | Start a project, or update the CLI itself. |
| Sources | [install](wiki_install.md), [update](wiki_update.md), [remove](wiki_remove.md) | Manage external data sources and `wiki.lock`. |
| Audits | [check](wiki_check.md), [lint](wiki_lint.md) | Read-only verification of integrity and conventions. |
| Bulk fixers | [fmt](wiki_fmt.md), [fix](wiki_fix.md), [link](wiki_link.md), [render](wiki_render.md) | Rewrite files across the whole wiki. |
| File edits | [file new](wiki_file_new.md), [file set](wiki_file_set.md), [file patch](wiki_file_patch.md), [file mv](wiki_file_mv.md), [file rm](wiki_file_rm.md), with [edit](wiki_edit.md) for batches | Validated, link-aware edits to wiki documents; dry run by default. |
| File reads | [file show](wiki_file_show.md), [file refs](wiki_file_refs.md) | Inspect one wiki document file. |
| Graph | [query](wiki_query.md), [graph](wiki_graph.md), [export](wiki_export.md) | The wiki as RDF: SPARQL, named graphs, and export. |
| Publishing | [build](wiki_build.md), [serve](wiki_serve.md), [mcp](wiki_mcp.md) | Output surfaces: static site, local server, MCP server. |
The per-file verbs are grouped under [wiki file](wiki_file.md).
## Command reference
Each subcommand has a dedicated page:
<!-- sparql:start
```sparql
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX schema: <https://schema.org/>
SELECT ?command ?description WHERE {
?command rdf:type schema:TechArticle .
FILTER(STRSTARTS(STR(?command), "https://wazootech.github.io/wiki/wiki_"))
OPTIONAL { ?command schema:description ?description }
}
ORDER BY ?command
```
-->
| command | description |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| [wiki_build](wiki_build.md) | Generate a static HTML site from the wiki. |
| [wiki_check](wiki_check.md) | Integrity checks — SHACL validation, JSON Schema frontmatter, route safety, and layout frontmatter. |
| [wiki_edit](wiki_edit.md) | Change a wiki through validated, atomic edits instead of hand-written Markdown. |
| [wiki_export](wiki_export.md) | Export document frontmatter as RDF or JSON-LD. |
| [wiki_file](wiki_file.md) | Create, change, move, delete, or inspect one wiki document file through validated, link-aware edits. |
| [wiki_file_mv](wiki_file_mv.md) | Move or rename a page and repoint every link and metadata reference to it, as a validated edit. |
| [wiki_file_new](wiki_file_new.md) | Create a page of a known type, with its required fields first, as a validated edit. |
| [wiki_file_patch](wiki_file_patch.md) | Append to, prepend to, or replace a heading's section, the body, or the frontmatter, as a validated edit. |
| [wiki_file_refs](wiki_file_refs.md) | List the pages that link to a page and the pages it links to. |
| [wiki_file_rm](wiki_file_rm.md) | Delete a page, refusing while other pages link to it unless their links are pruned to plain text, as a validated edit. |
| [wiki_file_set](wiki_file_set.md) | Set or remove one frontmatter field, keeping comments, key order, and value spelling, as a validated edit. |
| [wiki_file_show](wiki_file_show.md) | Describe one page as the engine sees it, with the content hash an edit expects. |
| [wiki_fix](wiki_fix.md) | Remove frontmatter that repeats a value the graph derives from the page's H1 or Git history. |
| [wiki_fmt](wiki_fmt.md) | Format Markdown wiki pages with native Deno/dprint formatter options. |
| [wiki_graph](wiki_graph.md) | List read-only RDF named graphs for root and installed source provenance. |
| [wiki_init](wiki_init.md) | Scaffold wiki.yml and an empty wiki/ folder for markdown pages. |
| [wiki_install](wiki_install.md) | Fetch and lock external data sources declared in wiki.yml. |
| [wiki_link](wiki_link.md) | Suggest missing wikilinks and repair unambiguous broken internal links. |
| [wiki_lint](wiki_lint.md) | Convention audits for broken links, filename patterns, heading style, and internal link style. |
| [wiki_mcp](wiki_mcp.md) | Run an MCP server for querying the wiki graph, with opt-in page-edit tools. |
| [wiki_query](wiki_query.md) | Run SPARQL SELECT or CONSTRUCT against the wiki graph. |
| [wiki_remove](wiki_remove.md) | Remove a data source from wiki.yml, its cache, and wiki.lock. |
| [wiki_render](wiki_render.md) | Update inline SPARQL result tables in markdown files. |
| [wiki_serve](wiki_serve.md) | Local HTTP server for live HTML preview and optional read-only SPARQL endpoint. |
| [wiki_update](wiki_update.md) | Check locked sources for newer commits and update wiki.lock. |
| [wiki_upgrade](wiki_upgrade.md) | Check for Wiki CLI updates and upgrade supported installations. |
<!-- sparql:end -->
Global flags: `-c`, `--input`.
## Publishing
- [Deploying to GitHub Pages](Deploying_to_GitHub_Pages.md) — CI workflow for this site
- [Obsidian Integration](Obsidian_Integration.md) — Shell Commands plugin workflows
## Managing drift and schema evolution
A common challenge in text-based memory bases is metadata drift—especially when files are updated programmatically by external LLM agents. The Wiki CLI provides two strategies to keep a compounding codebase clean over long periods:
### Automated cleaning harness
To prevent drift mechanically, you can wire a local Git hook or CI workflow that executes the following checks in order:
1. **[wiki fmt](wiki_fmt.md)**: Auto-formats Markdown structures and standardizes YAML frontmatter layout.
1. **[wiki lint](wiki_lint.md) `--strict`**: Flags broken links, non-conforming filename patterns, and heading casing warnings as hard errors.
1. **[wiki check](wiki_check.md) `--strict`**: Ensures frontmatter conforms to [SHACL](SHACL.md) shapes and bound JSON Schema documents (`wazoo:jsonSchema`).
### Resilient schema evolution
Enforcing schemas on text databases can become problematic as structures evolve. The Wiki CLI avoids schema rigidity using semantic web principles:
- **Additive RDF properties**: Since frontmatter is compiled into a graph, new or unconstrained keys do not cause parsing failures. They are ingested as open-world triples that can be queried or ignored.
- **Decoupled validation**: SHACL and JSON Schema validation are diagnostic steps, not execution blockers. Files with invalid schemas can still be compiled, parsed, and queried.
- **Class-scoped shapes**: Shapes target specific classes (e.g., `sh:targetClass schema:TechArticle`). Introducing a new document type only requires writing a new shape constraint, leaving legacy documents untouched.
- **Namespace contexts**: Properties map to URIs via `graph.context` in [Wiki Configuration](Wiki_Configuration.md). You can rename or alias fields at the config layer without physically editing every source document.
## Design
The CLI follows a flat, scriptable surface and [Design Philosophies](Design_Philosophies.md) (silent success, composable stdout). For programmatic use from Node.js/TypeScript or directly from Deno, see [Wiki Programmatic API](Wiki_Programmatic_API.md).
## Pattern context
This repository implements the [LLM Wiki](LLM_Wiki.md) pattern for [Personal Knowledge](Personal_Knowledge.md) wikis. Examples in the wild include [Farzapedia](Farzapedia.md) and coverage from Andrej Karpathy.
Similar **agent memory filesystem** approaches include [Supermemory SMFS](Supermemory_SMFS.md), [Letta MemFS](Letta_MemFS.md), and [Agent Memory Filesystems](Agent_Memory_Filesystems.md).
For a **standardized agent workspace** (thin governed contract, typed graph, verification gates), see [Vivary](Vivary.md).
## Repository
- Source and issues: [github.com/wazootech/wiki](https://github.com/wazootech/wiki)
- [Wiki CLI templates](#ecosystem-templates) — all templates live in the [wiki-templates](https://github.com/wazootech/wiki-templates) monorepo
## Background
- [Semantic Web](Semantic_Web.md) — RDF, Turtle, OWL, and related formats
- [Software Application Shape](Software_Application_Shape.md) — SHACL shape for `SoftwareApplication` pages (including this page)""" .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/headline> "wiki" .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/dateCreated> "2026-10-31T23:19:03Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<https://wazootech.github.io/wiki/wiki> <https://schema.org/dateModified> "2026-10-31T23:19:03Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .