memori.wiki / spec

An open spec for an AI-era wiki.

memori.wiki is a personal knowledge wiki that any AI can read. This page documents the URL contract, the retrieval API, the llms.txt manifest, and the bundle digest — the same primitives the Memory.Wiki reference implementation ships today. Other tools can implement this spec and interop with no platform lock-in.

Engine licence: MIT. Reference implementation: Memory.Wiki. Spec version: 0.1 (draft, 2026-05-15).

00

Why this spec exists

Every AI dev tool — Claude Code, Cursor, Codex, Gemini CLI, Windsurf, Aider — wants per-project context. Today users hand-curate that context in CLAUDE.md / AGENTS.md / .cursor/rules and it goes stale within a week. memori.wiki replaces the curation step with an AI-readable URL that returns a structured representation of a person's knowledge graph. Any tool that follows this spec can fetch the same payload and stay in sync.

The spec is intentionally minimal. Markdown for content, URLs for addressability, query parameters for token-economy knobs. No bespoke schema, no SDK lock-in. This is on purpose — the only way the spec earns adoption is by being cheap to implement.

01

URL contract

Three scopes, each addressable, each AI-readable.

memori.wiki/{user}/{slug}   —   a single doc. Tightest token cost; one note, one decision.

memori.wiki/{user}/b/{bundle}   —   a curated bundle of docs plus its pre-computed graph analysis (themes, insights, concept relations). Recommended scope for project-level tool config.

memori.wiki/{user}   —   the whole hub. Broad context, hub-wide concept index attached. Use sparingly.

During the rebrand transition, memory.wiki/{id}, memory.wiki/b/{id}, andmemory.wiki/hub/{slug} resolve to the same payloads. mori.wiki/... 301s to memori.wiki/....

02

Raw markdown variant

Every public URL has a clean-markdown sibling at /raw/...:

endpoints
GET /raw/{docId}
GET /raw/b/{bundleId}
GET /raw/hub/{slug}
GET /raw/hub/{slug}/c/{concept}

Response is text/markdown, charset UTF-8, with a YAML frontmatter block telling the AI which scope it just received. Browsers viewing these URLs see plain markdown.

The middleware also routes {id}.md / /b/{id}.md / /hub/{slug}.md as convenience aliases so users can paste a .md suffix and get the raw form directly.

03

Query knobs

Three knobs control token economy on raw responses:

?compact   —   strip whitespace, drop noisy quote blocks, condense long lines. Works on every raw URL. Typical 30–50% token reduction.

?full=1   —   bundle only. Inline every member doc body after the analysis section. Default returns the digest (link list).

?graph=0   —   bundle only. Drop the canvas analysis section. Use when the receiving AI only wants the doc inventory.

Knobs combine. ?compact&full=1 returns every doc inline, whitespace stripped — useful for one-shot full-bundle context. ?compact&graph=0 returns the doc inventory only, no analysis.

04

llms.txt manifest

Following the llms.txt standard: every public hub publishes a crawl manifest at:

endpoint
GET /hub/{slug}/llms.txt

The body lists every public doc and bundle with title, URL, and ≤200-char description, plus pointers to the?compact and ?digest variants. Agents that prefer a manifest crawl over a one-shot payload fetch llms.txt first, then walk to specific docs on demand.

/hub/{slug}/llms-full.txt serves a denser variant capped at 80k tokens by default (override with ?cap=) for AI tools that prefer one fetch over many.

05

Bundle digest shape

Bundle responses ship the canvas analysis inline so the receiving AI inherits the prior AI's work for free:

markdown
---
mw_bundle: 1
id: <bundleId>
title: "..."
url: https://memory.wiki/b/<id>
document_count: N
updated: <ISO>
analysis_generated_at: <ISO>
analysis_stale: true        # only when a member doc was edited after the analysis
source: "Memory.Wiki"
---

# <Bundle title>
> <description>
**Intent:** <intent>

## Summary
<canvas summary>

## Themes
- ...

## Cross-document insights
- ...

## Key takeaways
- ...

## Open questions / gaps
- ...

## Notable connections
- **doc A** ↔ **doc B** — <relationship>

## Concepts (this bundle)
- **concept** (from **doc title**)

## Concept relations
- **conceptA** ↔ **conceptB** — <edge label>

1. [Doc 1](https://memory.wiki/<docId>) — annotation
2. [Doc 2](https://memory.wiki/<docId>) — annotation
...

06

Retrieval API

One endpoint, hybrid retrieval (semantic + keyword + optional rerank). Hub-scoped, public.

request
POST /api/hub/{slug}/recall
Content-Type: application/json

{
  "question": "react hooks vs context",
  "k": 5,
  "level": "doc",         // doc | chunk | bundle
  "hybrid": true,         // chunk-level only — BM25 + vector reciprocal rank fusion
  "rerank": true          // Anthropic Haiku cross-encoder; doubles latency, raises precision
}
response
{
  "hub": { "slug": "you", "display_name": "..." },
  "results": [
    {
      "id": "abc123",
      "title": "React hooks crash course",
      "url": "https://memory.wiki/abc123",
      "snippet": "...react hooks let you...",
      "distance": 0.13,
      "updated_at": "2026-04-10T..."
    }
  ]
}

k capped at 20. distance is cosine — lower is more relevant.level=chunk returns paragraph-level matches with doc id + heading path.level=bundle matches against bundle titles + descriptions.

07

Concept index

The hub-wide concept index is the AI-era replacement for hand-typed categories and tags. Built incrementally by the bundle analysis pipeline — every Analyze run upserts concepts the LLM extracted from that bundle's docs.

Public surface:

endpoints
GET /hub/{slug}/c/{concept}           # rendered per-concept page (HTML)
GET /raw/hub/{slug}/c/{concept}        # same, raw markdown variant

Per-concept page returns: canonical label, description, source documents, neighbour concepts. The neighbours come from concept_relations typed edges (supports / elaborates / contradicts / exemplifies / contains). Same edge vocabulary the bundle canvas uses.

08

Privacy gates

Three states, applied uniformly to docs, bundles, and hubs.

Public   —   published; no allowed_emails. Anonymous AI fetches succeed.

Restricted   —   published; allowed_emails set. Fetcher must pass Authorization: Bearer <token> as the owner, or X-User-Email matching an allowed address. Otherwise 403/404.

Private   —   not published. Owner JWT only.

Every gating decision happens server-side in the raw-fetch routes — there's no path by which a URL can leak content the rendered viewer wouldn't already show. Revoking allowed_emails takes effect on the next fetch.

10

Implementing this spec

Three integration paths, all stable.

  1. URL paste. Drop a memori.wiki URL into any AI chat. The model fetches the raw variant automatically. Zero config, works today across Claude / ChatGPT / Cursor / Gemini.
  2. Context file reference. Add the URL to AGENTS.md / CLAUDE.md /.cursor/rules. The AI dev tool fetches on every session boot. See /docs/integrate for per-tool snippets.
  3. API integration. Call POST /api/hub/{slug}/recall directly for precise retrieval. No SDK required — plain HTTP. The endpoint is hub-public, no API key needed.

The reference renderer is markdown-it with footnotes + GFM, configured identically to TipTap so authoring and viewing surfaces produce the same DOM. Source: github.com/raymindai/mdcore.

Spec version 0.1 (draft) — open for feedback. PRs welcome via the repo.