# MemPalace Convention — kai_coach_kb

**Wing:** `pivot_salepoint`
**Room:** `kai_coach_kb`
**Canonical source for this convention:** this repo file. The `_room_README` drawer inside MemPalace is a snapshot copy for in-palace context; if the two ever drift, the repo file wins.

## Drawer identity

MemPalace drawers are addressed by an auto-generated internal id (e.g. `drawer_pivot_salepoint_kai_coach_kb_<hash>`). MemPalace does NOT expose a stable drawer-name parameter at write time, so the artifact id (e.g. `P-01-03`) lives in two stable surfaces:

1. **Tags** — every drawer carries a required `artifact_id:<id>` tag (e.g. `artifact_id:P-01-03`). This is the primary lookup key.
2. **First line of body** — every drawer body begins with `artifact_id: <id> — <title>` for human readability and grep.

Retrieval pattern: `mempalace_search` with the tag filter `artifact_id:P-01-03` returns the unique drawer for that artifact. Exactly one drawer per artifact id.

## Drawer body

First line: `artifact_id: <id> — <title>` (per above).

Following content: full artifact — title, body, source_ref, kai_voice_draft, voice_context_tags, all linked_* arrays. Newlines and Unicode allowed (unlike KG, which is ASCII-only).

## Drawer tags

**Tool-API note (amended 2026-06-09 per ch.0 dry-run):** The `mempalace_add_drawer` MCP signature does *not* accept a `tags` parameter — only `wing`, `room`, `content`, `source_file`, `added_by`. Tags therefore live inside the drawer body, as a dedicated second line of the body content. This is sufficient for grep-style retrieval and for `mempalace_search` queries that match against body text.

Required tag line (placed as line 3 of body, immediately after the first-line artifact id and a blank line):

```
tags: [artifact_id:<id>, ch-XX, <node_type>, <status>]
```

Where:
- `artifact_id:<id>` — primary lookup key (e.g. `artifact_id:P-01-03`)
- `ch-XX` — chapter id (`ch-0`, `ch-01`, `ch-02`, ...) — use `ch-0` for the ch.00 intro
- `<node_type>` — `principle`, `loop`, `script`, `anti_pattern`, `user_state`
- `<status>` — `draft`, `reviewed`, `locked`

Example (from ch.0):

```
artifact_id: P-00-01 — A profession is built on skills, not on luck / timing / positioning

tags: [artifact_id:P-00-01, ch-0, principle, draft]

title: ...
body: ...
```

When the chapter locks (Phase 9), update the `status` part of the tag line from `draft` to `locked` — the drawer body must be re-written (no in-place tag mutation API exists). Plan to batch-rewrite all of a chapter's drawers in a single Phase 9 step.

## What does NOT go in drawers

Structural relations (edges) live in KG triples — see `protocols/kg-predicates.md` for the predicate list. Drawers hold bodies; KG holds connections.
