Skip to content

Instantly share code, notes, and snippets.

@mameli
Last active May 19, 2026 12:18
Show Gist options
  • Select an option

  • Save mameli/0a91c888b54a9328252359f9bc57d3e1 to your computer and use it in GitHub Desktop.

Select an option

Save mameli/0a91c888b54a9328252359f9bc57d3e1 to your computer and use it in GitHub Desktop.
llm-wiki-init-prompt

LLM Wiki — Generic Init Prompt

Use this prompt when you want an AI coding assistant to create a fresh local wiki workspace that follows a durable raw/ + wiki/ + outputs/ pattern.

How To Use

  1. Replace <WIKI_ROOT> with the folder where the wiki should live.
  2. Replace <your-domain-description> with a short description of the wiki's scope.
  3. Copy everything inside the ## Prompt section.
  4. Paste it into your AI coding assistant.
  5. Run it in the local environment where the wiki should be created.

Prefer an absolute path for <WIKI_ROOT>. Example:

/Users/you/Documents/MyWiki

What This Prompt Does

It asks the assistant to:

  • create the base wiki folder structure,
  • write index.md, wiki/INDEX.md, log.md, and AGENTS.md,
  • initialize an append-only log,
  • and install operating rules that future agents can follow consistently.

Prompt

Create a wiki workspace at <WIKI_ROOT>.

Create this structure:
```text
<WIKI_ROOT>/
├── raw/               (source captures: URLs, files, transcripts, notes)
├── wiki/
│   └── INDEX.md       (topic catalog with heading "# Topic Index")
├── outputs/           (generated analyses and one-off reports)
├── index.md           (top-level navigation with heading "# Wiki Index")
├── log.md             (append-only operations log with heading "# Log")
└── AGENTS.md          (agent operating rules; use template below)
```

Then write AGENTS.md with exactly this content:

# _Wiki Agent Rules

> This file is the canonical rule set for all agents operating on this wiki.

## Defaults

- Default wiki path: `<WIKI_ROOT>`
- Optional override: `LLM_WIKI_PATH`

```bash
WIKI="${LLM_WIKI_PATH:-<WIKI_ROOT>}"
```

## Domain

<your-domain-description>

## Structure

- `raw/` = source material (do not edit existing files)
- `wiki/` = synthesized, durable topic pages
- `outputs/` = generated analyses/reports that are not durable topic pages
- `index.md` = top-level structure map
- `wiki/INDEX.md` = topic catalog
- `log.md` = append-only operation log

## Operating Rules

- Never modify files inside `raw/`.
- Every durable topic page lives in `wiki/`.
- Every wiki page starts with a short summary paragraph.
- Use `[[wikilinks]]` for internal links.
- When creating or updating topic pages, add/update corresponding entries in `wiki/INDEX.md`.
- Keep one topic per file unless a topic is too small and naturally grouped.
- Do not use `_Wiki/` as a replacement for the rest of the vault; it is a maintained side layer.
- Distill source material into clear topic pages instead of copying raw content into `wiki/`.
- Do not silently overwrite conflicting claims; preserve both with dates/sources and flag for review.

## Recommended Frontmatter

```yaml
---
title: Page Title
created: YYYY-MM-DD
updated: YYYY-MM-DD
type: topic | comparison | query | project | index
domain: ai-research | ai-coding | data-engineering | ml | hobby
hobby: ""  # optional (e.g., travel, cooking, music, videogames)
tags: []
sources: []
---
```

## Orientation (existing wikis)

Always read before creating anything:

1. Read `$WIKI/AGENTS.md`.
2. Read `$WIKI/index.md`.
3. If present, read `$WIKI/wiki/INDEX.md`.
4. Read last 20-30 entries in `$WIKI/log.md`.
5. Search topic/entity names before creating pages:

```bash
rg -n "<topic-or-entity>" "$WIKI" -g '*.md'
```

Preserve the existing `raw/`, `wiki/`, `outputs/` structure. Do not force alternate layouts unless the user explicitly requests migration.

## Initialize Wiki

When asked to create/start a wiki in an empty location:

1. Create minimal structure: `raw/`, `wiki/`, `outputs/`
2. Create: `index.md`, `wiki/INDEX.md`, `AGENTS.md`, `log.md`
3. Set domain, taxonomy, and operating rules in `AGENTS.md`.
4. Append initialization entry to `log.md`.

## Ingest Workflow

When given a URL, file, or pasted text:

1. Save source under `raw/` with metadata (URL/path, author if known, capture date).
2. Extract entities and concepts from the source.
3. Check existing coverage in `wiki/INDEX.md` and with `rg`.
4. Update existing topic pages first; create new pages only when warranted:
   - appears in 2+ sources, or
   - central to one important source.
5. For each new/updated page:
   - bump `updated` date,
   - keep tags inside the taxonomy defined in this file,
   - add/refresh `[[wikilinks]]`.
6. Update `wiki/INDEX.md` and `index.md`.
7. Put transient analyses in `outputs/`, not in durable topic pages.
8. Append `log.md` entry listing every changed file.
9. If the ingest would modify more than 10 existing pages, ask the user before proceeding.

## Query Workflow

1. Read `index.md`, `wiki/INDEX.md`, and relevant topic pages directly.
2. Synthesize from compiled wiki knowledge.
3. Cite used pages via wikilinks in the answer text.
4. If synthesis is substantial and reusable, save under `wiki/` (durable) or `outputs/` (one-off).
5. Append query entry to `log.md`.

## Lint Workflow

Run and report by severity:

1. Broken wikilinks (`[[page]]` target missing).
2. Orphan topic pages (no inbound wikilinks).
3. Index completeness (`wiki/` pages in `wiki/INDEX.md`; top-level coherence with `index.md`).
4. Frontmatter completeness (required fields from this file).
5. Taxonomy drift (tags used but absent in this file's taxonomy).
6. Oversized pages (>200 lines).
7. Stale pages (content significantly older than relevant latest sources).
8. Possible contradictions across related pages.
9. Log rotation (`log.md` > 500 entries).

After lint: group findings by severity, provide file paths, append `## [YYYY-MM-DD] lint | N issues found` to `log.md`.

## Conventions

- Filenames: stable and predictable; avoid unnecessary renames.
- Prefer concise, scannable pages.
- Split pages beyond ~200 lines into focused sub-pages.
- Move superseded pages to `_archive/` only if that directory exists or the user requests it.

## Maintenance

- Keep `index.md` and `wiki/INDEX.md` coherent and navigable.
- Keep naming stable so links stay predictable.
- Prefer minimal edits over process expansion.

## Output Contract

Always return:

1. Files created/updated/moved.
2. Key contradictions or uncertainty detected.
3. Next best action (ingest, query, or lint).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment