Coregit
API Reference

LLM Wiki

API endpoints for LLM-maintained knowledge bases — the wiki pattern by Andrej Karpathy, powered by Coregit.

Build persistent, version-controlled knowledge bases that LLMs maintain for you. Based on the LLM Wiki pattern by Andrej Karpathy — where an LLM incrementally builds and maintains a structured wiki from raw sources.

A Coregit LLM Wiki is a regular repository with a specific structure:

wiki.json          # Configuration
schema.md          # LLM instructions
index.md           # Content catalog
log.md             # Activity log
raw/               # Immutable source documents
wiki/              # LLM-generated pages

Create a Wiki

Fork the llm-wiki-template and set up wiki configuration in one call.

POST /v1/repos/:slug/wiki/init

Permission: Write access required.

{
  "slug": "my-research",
  "title": "AI Research Wiki",
  "description": "Deep dive into transformer architectures",
  "namespace": "alice",
  "visibility": "private"
}
FieldRequiredDescription
slugYesRepository slug for the new wiki
titleNoWiki title (default: "My Knowledge Base")
descriptionNoWiki description
namespaceNoOptional namespace
visibilityNoprivate (default) or public

Response 201

{
  "id": "abc123",
  "slug": "my-research",
  "description": "AI Research Wiki",
  "default_branch": "main",
  "visibility": "private",
  "wiki_config": {
    "version": 1,
    "title": "AI Research Wiki",
    "description": "Deep dive into transformer architectures",
    "llms_txt": {
      "include_sources": false,
      "max_pages": 500,
      "sort": "updated"
    }
  },
  "git_url": "https://api.coregit.dev/myorg/my-research.git",
  "api_url": "https://api.coregit.dev/v1/repos/my-research",
  "created_at": "2026-04-10T12:00:00Z"
}

SDK

const { data } = await cg.wiki.init({
  slug: "my-research",
  title: "AI Research Wiki",
  description: "Deep dive into transformer architectures",
});

List Wiki Pages

List all pages under wiki/ with parsed YAML frontmatter.

GET /v1/repos/:slug/wiki/pages
ParamDescription
typeFilter by page type: entity, concept, source-summary, comparison, analysis
tagFilter by tag
sortSort field: updated (default), created, title
limitMax results (default: 50, max: 200)
offsetPagination offset
refBranch or commit SHA

Response 200

{
  "pages": [
    {
      "path": "wiki/transformers.md",
      "title": "Transformer Architecture",
      "summary": "The dominant architecture for sequence modeling since 2017",
      "tags": ["deep-learning", "architecture"],
      "type": "concept",
      "sources": ["raw/attention-is-all-you-need.md"],
      "related": ["wiki/attention.md", "wiki/bert.md"],
      "created": "2026-04-10",
      "updated": "2026-04-10",
      "word_count": 1250
    }
  ],
  "total": 42,
  "ref": "main"
}

SDK

const { data } = await cg.wiki.listPages("my-research", {
  type: "concept",
  tag: "deep-learning",
  sort: "updated",
});

Read a Wiki Page

Get a single page with parsed frontmatter and full content.

GET /v1/repos/:slug/wiki/pages/:path

Response 200

{
  "path": "wiki/transformers.md",
  "frontmatter": {
    "title": "Transformer Architecture",
    "summary": "The dominant architecture for sequence modeling since 2017",
    "tags": ["deep-learning", "architecture"],
    "sources": ["raw/attention-is-all-you-need.md"],
    "type": "concept",
    "related": ["wiki/attention.md"],
    "created": "2026-04-10",
    "updated": "2026-04-10"
  },
  "content": "The Transformer was introduced in...",
  "word_count": 1250,
  "sha": "a1b2c3d4",
  "ref": "main"
}

SDK

const { data } = await cg.wiki.getPage("my-research", "transformers.md");

List Raw Sources

List files in the raw/ directory.

GET /v1/repos/:slug/wiki/sources

SDK

const { data } = await cg.wiki.listSources("my-research");

Read a Raw Source

Get the content of a source file.

GET /v1/repos/:slug/wiki/sources/:path

SDK

const { data } = await cg.wiki.getSource("my-research", "attention-is-all-you-need.md");

Get Wiki Index

Read the index.md content catalog — the file LLM agents read first to understand wiki structure.

GET /v1/repos/:slug/wiki/index

SDK

const { data } = await cg.wiki.getIndex("my-research");

Get Activity Log

Read parsed entries from log.md — chronological record of ingests, queries, and lint passes.

GET /v1/repos/:slug/wiki/log
ParamDescription
limitMax entries (default: 20, max: 100)
offsetPagination offset

Response 200

{
  "entries": [
    {
      "date": "2026-04-10",
      "operation": "ingest",
      "title": "Attention Is All You Need",
      "body": "Processed paper. Created wiki/transformers.md, updated wiki/attention.md."
    }
  ],
  "total": 15,
  "ref": "main"
}

SDK

const { data } = await cg.wiki.getLog("my-research", { limit: 10 });

Generate llms.txt

Auto-generate a structured text file for external LLM consumption. Follows the emerging llms.txt convention.

GET /v1/repos/:slug/wiki/llms.txt
ParamDescription
formatcompact (default) — summaries only. full — includes page content.
refBranch or commit SHA

Returns Content-Type: text/plain. Cached by commit SHA.

Compact format

# AI Research Wiki
> Deep dive into transformer architectures

## Pages
- [Transformer Architecture](wiki/transformers.md): The dominant architecture for sequence modeling since 2017
- [Attention Mechanism](wiki/attention.md): Core mechanism enabling transformers to weigh input tokens

## Sources
- raw/attention-is-all-you-need.md (8,200 words)

Full format

Includes full page content after the summaries section.

SDK

const { data } = await cg.wiki.llmsTxt("my-research", { format: "full" });

Search across wiki pages AND raw sources using natural language. Wraps the existing semantic search pipeline with wiki-specific scoping.

POST /v1/repos/:slug/wiki/search
{
  "q": "How does multi-head attention work?",
  "scope": "all",
  "top_k": 10
}
FieldRequiredDescription
qYesNatural language query
scopeNoall (default), wiki (only wiki pages), sources (only raw sources)
top_kNoNumber of results (default: 10)
tagNoFilter wiki results by tag
typeNoFilter wiki results by page type

Wiki page results include parsed frontmatter.

SDK

const { data } = await cg.wiki.search("my-research", {
  q: "How does multi-head attention work?",
  scope: "wiki",
});

Knowledge Graph

Get the wiki's knowledge graph — built from frontmatter related links, sources references, and shared tags.

GET /v1/repos/:slug/wiki/graph

Response 200

{
  "nodes": [
    { "path": "wiki/transformers.md", "title": "Transformer Architecture", "tags": ["deep-learning"], "type": "concept", "word_count": 1250 },
    { "path": "raw/attention-paper.md", "title": "attention-paper.md", "tags": [], "type": "source", "word_count": 0 }
  ],
  "edges": [
    { "source": "wiki/transformers.md", "target": "wiki/attention.md", "type": "related" },
    { "source": "wiki/transformers.md", "target": "raw/attention-paper.md", "type": "source-ref" },
    { "source": "wiki/transformers.md", "target": "wiki/bert.md", "type": "shared-tag", "tag": "deep-learning" }
  ],
  "tag_clusters": {
    "deep-learning": ["wiki/transformers.md", "wiki/bert.md"]
  },
  "stats": { "pages": 42, "sources": 15, "links": 87, "orphans": 3 },
  "ref": "main"
}

SDK

const { data } = await cg.wiki.graph("my-research");

Wiki Stats

Health overview — pages, sources, links, orphans, type distribution, last activity.

GET /v1/repos/:slug/wiki/stats

Response 200

{
  "pages": 42,
  "sources": 15,
  "links": 87,
  "orphans": 3,
  "total_words": 52500,
  "avg_words_per_page": 1250,
  "types": { "concept": 18, "entity": 12, "source-summary": 10, "comparison": 2 },
  "tags": 24,
  "last_activity": "2026-04-10",
  "ref": "main"
}

SDK

const { data } = await cg.wiki.stats("my-research");

Writing to the Wiki

Wiki pages and sources are written using the standard Commits API. The wiki endpoints are read-only convenience layers.

To add a source:

await cg.commits.create("my-research", {
  branch: "main",
  message: "Add source: Attention Is All You Need",
  author: { name: "alice", email: "alice@example.com" },
  changes: [{ path: "raw/attention-paper.md", content: "..." }],
});

To create or update a wiki page:

await cg.commits.create("my-research", {
  branch: "main",
  message: "ingest: Attention Is All You Need",
  author: { name: "wiki-agent", email: "agent@example.com" },
  changes: [
    { path: "wiki/transformers.md", content: "---\ntitle: \"Transformer Architecture\"\nsummary: \"...\"\ntags: [deep-learning]\ntype: concept\nsources: [raw/attention-paper.md]\n---\n\nContent here..." },
    { path: "index.md", content: "...updated index..." },
    { path: "log.md", content: "...appended entry..." },
  ],
});

This is the pattern Karpathy describes — the LLM agent commits multiple files atomically (one for each updated page, plus index and log updates). Coregit's multi-file atomic commits make this a single API call.

On this page