# Setup Guide

This skill routes between QMD and MemPalace. Both must be installed and indexed for the skill to work.

## Prerequisites

- [QMD](https://github.com/tobil/qmd) — codebase indexer
- [MemPalace](https://github.com/mempalace/mempalace) — persistent AI memory

## Step 1: Index your codebase with QMD

```bash
# Add your repo as a collection
qmd collection add <your-repo-path> --name <collection-name>

# Embed (required for semantic search)
qmd embed -f

# Verify
qmd status
```

Good patterns for `--name`: your repo name, e.g. `my-project`, `backend`, `monorepo`.

## Step 2: Mine project knowledge into MemPalace

Mine directories that contain decisions, handoffs, planning, and documentation — NOT raw code files.

```bash
# Initialize each directory first (creates mempalace.yaml)
python -m mempalace init <your-docs-dir> --yes

# Mine into a named wing
python -m mempalace mine <your-docs-dir> --wing <your-project-name>

# Repeat for each knowledge directory:
# .claude/memory/, .claude/handoffs/, docs/, planning/, brain-research/
```

## Step 3: Verify both tools work

```bash
# QMD — should return results
qmd query "main entry point"

# MemPalace — should return results  
python -m mempalace search "architecture decision"
```

## Step 4: (Windows only) MemPalace CLI path

If `python -m mempalace` doesn't work, use the venv path directly:
```bash
PYTHONUTF8=1 "C:/Users/<you>/.mempalace-venv/Scripts/python.exe" -m mempalace search "..."
```

## What goes where

| Content | Tool |
|---------|------|
| Source code (`.rs`, `.ts`, `.go`, etc.) | QMD |
| Markdown docs, README, schemas | QMD |
| Session handoffs | MemPalace |
| Architecture decisions | MemPalace |
| Planning files | MemPalace |
| Bug investigation notes | MemPalace |

Do NOT dump raw source code into MemPalace — it creates thousands of useless drawers and buries the actual memories.
