Skip to content

Latest commit

 

History

48 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

APM LLM Wiki

Turn any existing repository into a persistent, agent-maintained knowledge wiki.

Drop raw resources into docs/input/, then ask the agent to ingest the new inputs. The agent maintains docs/wiki/ for you. It synthesizes useful knowledge, preserves provenance, updates the wiki index, and records the ingestion. QMD indexing is automatic when the runtime supports the packaged Stop hook; otherwise it can be refreshed explicitly.

Drop or create resources in docs/input/
                ↓
         Ask agent to INGEST
                ↓
         Agent maintains wiki
                ↓
           QMD indexing
           ├─ Stop hook → automatic
           └─ No hook   → manual index refresh

This project has two goals:

  1. Implement Andrej Karpathy's LLM Wiki pattern as a ready-to-use set of agent instructions, skills and workflows.
  2. Make it straightforward to install in an existing repository as a package using Microsoft's APM (Agent Package Manager).

This project is an implementation and extension of the LLM Wiki pattern proposed by Andrej Karpathy. It is not affiliated with, endorsed by, or maintained by Andrej Karpathy.

Install

Prerequisites:

  • Microsoft APM;
  • Node.js 22 or newer with npm/npx.

From the repository you want to equip with an LLM Wiki:

# 1. Install the APM package for your agent
apm install dsissoko/apm-llm-wiki --target <your-agent>
apm compile --target <your-agent>

# 2. Create the canonical wiki structure
mkdir -p docs/{input,ontology,wiki/runbooks} && touch docs/wiki/{index.md,log.md}

# 3. Initialize the project-local QMD index
npx -y @tobilu/qmd init
npx -y @tobilu/qmd collection add docs/wiki --name wiki
npx -y @tobilu/qmd update
npx -y @tobilu/qmd embed

# 4. Launch your agent

The bootstrap is intentionally CLI-driven and deterministic. The agent is not responsible for creating the repository structure or initializing QMD.

Use your agent

Normal usage is simple:

Create or drop resources in docs/input/
Ask your agent to ingest them
Query or lint the wiki in natural language

The package provides:

  • a reusable llm-wiki skill for INGEST / QUERY / LINT workflows;
  • project-wide wiki governance instructions;
  • QMD exposed through MCP as the retrieval/indexing layer;
  • an APM-native Stop hook that automatically synchronizes QMD after agent activity when docs/wiki/ actually changed;
  • a single optional /llm-wiki-index prompt for runtimes that support packaged slash prompts and do not run the Stop hook;
  • a project-local QMD index in .qmd/, with the wiki collection restricted to docs/wiki/. .qmd/ is machine-local state and should not be committed.

Manual indexing

If you use OpenCode or any other agent/runtime that does not support the packaged Stop hook, refresh QMD after wiki changes:

npx -y @tobilu/qmd update
npx -y @tobilu/qmd embed

If the runtime supports packaged slash prompts, /llm-wiki-index provides the same explicit refresh as a convenience.

What gets initialized

The deterministic bootstrap creates this structure:

docs/
├── input/
├── ontology/
└── wiki/
    ├── index.md
    ├── log.md
    └── runbooks/

docs/input/ is the normal intake area for raw resources. docs/wiki/ is the persistent synthesized knowledge base maintained by the agent. docs/ontology/ontology.md is optional; when absent, the bundled default ontology is used.

Command surface

Normal wiki operations use natural language through the llm-wiki skill:

  • INGEST: ask the agent to ingest one or more resources from docs/input/;
  • QUERY: ask a question that should use the wiki knowledge base;
  • LINT: ask the agent to check wiki consistency.

/llm-wiki-index is the only optional slash prompt. It refreshes QMD explicitly on runtimes that support packaged prompts but do not execute the Stop hook.

Design principles

  • Markdown remains canonical and versionable in Git.
  • The current filesystem is authoritative during normal wiki operations; Git history is not used to restore deleted or replaced wiki content unless explicitly requested.
  • Input evidence is preserved.
  • Durable knowledge is synthesized instead of duplicated.
  • Provenance and uncertainty are explicit.
  • docs/wiki/index.md remains the canonical navigation map.
  • QMD is a derived, rebuildable search layer; its .qmd/ state is local and disposable.
  • QMD synchronization is deterministic: automatic through the APM Stop hook when supported, otherwise explicit through /llm-wiki-index or the equivalent QMD CLI refresh.
  • Repository and QMD initialization are deterministic CLI bootstrap operations, not agent workflows.

Status

Early public V1. The initial scope is intentionally small: deterministic bootstrap, wiki governance, lifecycle skill, QMD retrieval, and deterministic QMD synchronization.

About

Turn any existing repository into a persistent, agent-maintained knowledge wiki

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages