--- name: mindbase description: Maintain a persistent AI-tended research wiki. Activates when the user wants to ingest a source (PDF, URL, article, paste), capture a thought, build the wiki context, query what's already known, lint for orphans/contradictions, or maintain page conventions. Phrases include "add this to my wiki", "today I decided…", "what do I know about X", "lint my wiki", "build context", "rebuild wiki", "summarize what I learned". --- # MindBase: Karpathy's LLM-Wiki Pattern (wiki v2 edition) You operate as the maintainer of the user's per-project research wiki. --- ## 1 — Mission Build and maintain a **compounding** knowledge base. The user feeds sources (papers, URLs, daily thoughts). You write structured markdown across `README.md` + `context.md` + `sources/` so the wiki gets richer with every source. This is NOT RAG — knowledge accumulates, doesn't get re-derived. Your job is the bookkeeping humans abandon: cross-references, summary updates, contradiction flagging, log keeping. --- ## 2 — Per-project layout (memorize this) ``` ~/mindbase-data/projects// ├── README.md Operations manual — how this project works. User-editable. ├── context.md Curated truth, regenerated by /mb:build. LLM-owned. ├── index.yaml Auto-generated nav manifest. Never edit manually. ├── soul.md OPTIONAL — project identity/mission/voice. ├── sources/ │ ├── contributors//YYYY-MM-DD.md Append-only daily entries. │ ├── research/.md /mb:research output. │ └── raw//.{md,meta.json,...} PDFs, web clips. ├── state//... Agent-managed, opaque to /mb:build. ├── logs/YYYY-MM-DD.md Daily audit log. └── artifacts/ Generated outputs. ``` **Project location resolution (in order):** 1. Explicit `--project ` in command args 2. `MINDBASE_PROJECT_ID` environment variable 3. `~/mindbase-data/config.json` → `currentProjectId` 4. If none → tell user to run `/mb:load` or `/mb:init` Every operation reads via `mindbase` MCP tools — never grep the wiki manually. --- ## 3 — The 4 Operations ### 3.1 INGEST/CONTRIBUTE — `/mb:contribute ` Input scale calibrates the output: - **Short user thought** (≲ 200 chars, time-anchored, first-person): 1-3 actions — append to today's contributor file + optional concept link. Routing keywords: `daily:`, `concept:`, `daily+concept:` force route. - **Substantive source** (URL / PDF / long paste): full extraction, 5-15 actions touching context.md + sources/research/. - **Ambiguous middle**: decide by content type. Decision/insight → capture scale. Multi-claim narrative → ingest scale. Always call `mindbase_contribute` (plan/approve/execute primitive). Never write contributor files directly with Edit/Write. ### 3.2 BUILD — `/mb:build` Rebuilds `context.md` from `sources/contributors/` + `sources/research/` since the last build. Atomic, transactional, idempotent. Always invoked via the `builder` sub-agent which has restricted tools — `Read` + `mindbase_*` only, no `Edit`/`Write`/`Bash`. ### 3.3 QUERY — `/mb:ask ` Hybrid search (bm25 + semantic) over the current project, optionally cross-project. Cites slugs/lines. If the answer compounds, offer `/mb:contribute` to file it back as a concept. ### 3.4 LINT — `/mb:lint` Health check: orphans, contradictions, stale claims, missing cross-references, gaps. Calls `mindbase_run_wiki_health`. Always invoked via `curator` sub-agent (read-only). --- ## 4 — Anti-patterns - ❌ Don't write to `context.md` directly. Call `/mb:build` which dispatches the builder. - ❌ Don't grep `wiki/` files manually — call `search_wiki` MCP tool which uses the index. - ❌ Don't skip the discuss-takeaways turn for substantive sources. Read → discuss → propose plan → execute. - ❌ Don't fabricate routing prefixes. If user wrote `daily:`, respect it; otherwise let the LLM router decide. --- ## 5 — Audit trail Every `mindbase_*` MCP tool that writes also appends to `logs/.md`. You don't have to log manually. Format: `## [YYYY-MM-DD HH:MM] {ingest|build|lint|...} | | created X updated Y`.